library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
require(ggplot2)
## Loading required package: ggplot2
require(lme4)
## Loading required package: lme4
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
require(lmerTest)
## Loading required package: lmerTest
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
setwd("/Volumes/somrehab-ts/Groups/BorichLab/NB_VPI_EEG")
df = read.csv("fooof_results_all_subjects.csv", header = T)

split condition into Limb, Feedback, and Posture

df_split <- df %>%
  separate(condition, into = c("Limb", "Feedback", "Posture"), sep = "_") %>%
  mutate(group = substr(subject, 1, 3))

df_split$onset <- factor(df_split$onset, levels = c("preonset", "postonset"))

Split the data by limb

df_split_L = df_split[df_split$Limb == "LEFT" & df_split$channel == "CP4",]
df_split_R = df_split[df_split$Limb == "RIGHT" & df_split$channel == "CP3",]

Plot Mu Right: Power

 ggplot(data = df_split_R, aes(x = onset, y = alpha_power)) + 
  stat_summary(fun = "mean", geom = "col", position = "dodge") +
  geom_point(position = position_dodge(0.9)) +
  geom_line(aes(group = subject))+
  facet_grid(rows = vars(group), cols = vars(Posture, Feedback))+
    theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  ylab("Mu Power")
## Warning: Removed 34 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 34 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 17 rows containing missing values or values outside the scale range
## (`geom_line()`).

#ggsave(plot,"alpha.jpg", width = 6, height = 4, unit = 'in', dpi = 300)

Plot Mu Left: Power

 ggplot(data = df_split_L, aes(x = onset, y = alpha_power)) + 
  stat_summary(fun = "mean", geom = "col", position = "dodge") +
  geom_point(position = position_dodge(0.9)) +
  geom_line(aes(group = subject))+
  facet_grid(rows = vars(group), cols = vars(Posture, Feedback))+
    theme(axis.text.x = element_text(angle = 45, hjust = 1))+
  ylab("Mu Power")
## Warning: Removed 33 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 33 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_line()`).

LMER Mu Power: Right Limb

model = lmer(alpha_power~onset*Feedback*Posture+(1|subject), data = df_split_R)
summary(model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: alpha_power ~ onset * Feedback * Posture + (1 | subject)
##    Data: df_split_R
## 
## REML criterion at convergence: -129.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2416 -0.5845  0.0100  0.4808  3.1140 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subject  (Intercept) 0.07620  0.2760  
##  Residual             0.01847  0.1359  
## Number of obs: 238, groups:  subject, 33
## 
## Fixed effects:
##                                           Estimate Std. Error         df
## (Intercept)                               0.773127   0.053762  46.451409
## onsetpostonset                           -0.206478   0.034992 198.147917
## FeedbackVIS                              -0.072471   0.034414 198.199709
## PostureSTAND                             -0.100980   0.034753 198.245758
## onsetpostonset:FeedbackVIS               -0.033408   0.050000 198.220706
## onsetpostonset:PostureSTAND               0.006462   0.050075 198.319970
## FeedbackVIS:PostureSTAND                  0.120534   0.048769 198.263442
## onsetpostonset:FeedbackVIS:PostureSTAND  -0.011215   0.071095 198.208484
##                                         t value Pr(>|t|)    
## (Intercept)                              14.381  < 2e-16 ***
## onsetpostonset                           -5.901 1.54e-08 ***
## FeedbackVIS                              -2.106  0.03648 *  
## PostureSTAND                             -2.906  0.00408 ** 
## onsetpostonset:FeedbackVIS               -0.668  0.50480    
## onsetpostonset:PostureSTAND               0.129  0.89744    
## FeedbackVIS:PostureSTAND                  2.472  0.01430 *  
## onsetpostonset:FeedbackVIS:PostureSTAND  -0.158  0.87482    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) onstps FdbVIS PSTAND on:FVIS o:PSTA FVIS:P
## onsetpstnst -0.307                                           
## FeedbackVIS -0.314  0.483                                    
## PosturSTAND -0.311  0.478  0.490                             
## onstps:FVIS  0.216 -0.700 -0.688 -0.337                      
## onst:PSTAND  0.214 -0.702 -0.340 -0.692  0.495               
## FVIS:PSTAND  0.222 -0.343 -0.708 -0.715  0.488   0.497       
## o:FVIS:PSTA -0.151  0.495  0.484  0.487 -0.704  -0.705 -0.683

LMER Mu Power: Left Limb

model = lmer(alpha_power~onset*Feedback*Posture+(1|subject), data = df_split_L)
summary(model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: alpha_power ~ onset * Feedback * Posture + (1 | subject)
##    Data: df_split_L
## 
## REML criterion at convergence: -133.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5251 -0.6212 -0.0276  0.5033  3.8793 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subject  (Intercept) 0.07703  0.2775  
##  Residual             0.01798  0.1341  
## Number of obs: 239, groups:  subject, 34
## 
## Fixed effects:
##                                           Estimate Std. Error         df
## (Intercept)                               0.723848   0.053043  46.948708
## onsetpostonset                           -0.181192   0.034491 198.329955
## FeedbackVIS                               0.008737   0.034390 198.224016
## PostureSTAND                             -0.048440   0.033417 198.038147
## onsetpostonset:FeedbackVIS               -0.104543   0.049811 198.401451
## onsetpostonset:PostureSTAND               0.023753   0.049300 198.177416
## FeedbackVIS:PostureSTAND                  0.010468   0.048398 198.181234
## onsetpostonset:FeedbackVIS:PostureSTAND   0.070274   0.070107 198.207961
##                                         t value Pr(>|t|)    
## (Intercept)                              13.646  < 2e-16 ***
## onsetpostonset                           -5.253 3.84e-07 ***
## FeedbackVIS                               0.254   0.7997    
## PostureSTAND                             -1.450   0.1488    
## onsetpostonset:FeedbackVIS               -2.099   0.0371 *  
## onsetpostonset:PostureSTAND               0.482   0.6305    
## FeedbackVIS:PostureSTAND                  0.216   0.8290    
## onsetpostonset:FeedbackVIS:PostureSTAND   1.002   0.3174    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) onstps FdbVIS PSTAND on:FVIS o:PSTA FVIS:P
## onsetpstnst -0.300                                           
## FeedbackVIS -0.299  0.466                                    
## PosturSTAND -0.309  0.478  0.476                             
## onstps:FVIS  0.208 -0.694 -0.691 -0.331                      
## onst:PSTAND  0.210 -0.695 -0.321 -0.678  0.479               
## FVIS:PSTAND  0.212 -0.327 -0.710 -0.690  0.487   0.468       
## o:FVIS:PSTA -0.147  0.491  0.491  0.477 -0.708  -0.703 -0.689

Plot Mu Right: AUC

 ggplot(data = df_split_R, aes(x = onset, y = alpha_auc)) + 
  stat_summary(fun = "mean", geom = "col", position = "dodge") +
  geom_point(position = position_dodge(0.9)) +
  geom_line(aes(group = subject))+
  facet_grid(rows = vars(group), cols = vars(Posture, Feedback))+
    theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  ylab("Mu AUC") +
  ylim(0,10)
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_line()`).

#ggsave(plot,"alpha.jpg", width = 6, height = 4, unit = 'in', dpi = 300)

Plot Mu Left: AUC

 ggplot(data = df_split_L, aes(x = onset, y = alpha_auc)) + 
  stat_summary(fun = "mean", geom = "col", position = "dodge") +
  geom_point(position = position_dodge(0.9)) +
  geom_line(aes(group = subject))+
  facet_grid(rows = vars(group), cols = vars(Posture, Feedback))+
    theme(axis.text.x = element_text(angle = 45, hjust = 1))+
  ylab("Mu AUC") +
  ylim(0,10)
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_line()`).

LMER Mu AUC: Right Limb

model = lmer(alpha_auc~onset*Feedback*Posture+(1|subject), data = df_split_R)
summary(model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: alpha_auc ~ onset * Feedback * Posture + (1 | subject)
##    Data: df_split_R
## 
## REML criterion at convergence: 1059.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -6.5202 -0.3599 -0.0110  0.3323  5.5334 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subject  (Intercept) 6.442    2.538   
##  Residual             1.923    1.387   
## Number of obs: 272, groups:  subject, 34
## 
## Fixed effects:
##                                         Estimate Std. Error       df t value
## (Intercept)                               2.8237     0.4960  51.2478   5.693
## onsetpostonset                           -1.1903     0.3363 231.0000  -3.539
## FeedbackVIS                              -0.5047     0.3363 231.0000  -1.501
## PostureSTAND                             -0.8133     0.3363 231.0000  -2.418
## onsetpostonset:FeedbackVIS                0.1290     0.4756 231.0000   0.271
## onsetpostonset:PostureSTAND               0.3394     0.4756 231.0000   0.714
## FeedbackVIS:PostureSTAND                  0.9286     0.4756 231.0000   1.952
## onsetpostonset:FeedbackVIS:PostureSTAND  -0.6118     0.6727 231.0000  -0.910
##                                         Pr(>|t|)    
## (Intercept)                              6.1e-07 ***
## onsetpostonset                          0.000485 ***
## FeedbackVIS                             0.134803    
## PostureSTAND                            0.016377 *  
## onsetpostonset:FeedbackVIS              0.786499    
## onsetpostonset:PostureSTAND             0.476165    
## FeedbackVIS:PostureSTAND                0.052107 .  
## onsetpostonset:FeedbackVIS:PostureSTAND 0.364005    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) onstps FdbVIS PSTAND on:FVIS o:PSTA FVIS:P
## onsetpstnst -0.339                                           
## FeedbackVIS -0.339  0.500                                    
## PosturSTAND -0.339  0.500  0.500                             
## onstps:FVIS  0.240 -0.707 -0.707 -0.354                      
## onst:PSTAND  0.240 -0.707 -0.354 -0.707  0.500               
## FVIS:PSTAND  0.240 -0.354 -0.707 -0.707  0.500   0.500       
## o:FVIS:PSTA -0.170  0.500  0.500  0.500 -0.707  -0.707 -0.707

LMER Mu AUC: Left Limb

model = lmer(alpha_auc~onset*Feedback*Posture+(1|subject), data = df_split_L)
summary(model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: alpha_auc ~ onset * Feedback * Posture + (1 | subject)
##    Data: df_split_L
## 
## REML criterion at convergence: 1249.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -5.5497 -0.2888 -0.0220  0.2550  8.5674 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subject  (Intercept) 8.404    2.899   
##  Residual             4.203    2.050   
## Number of obs: 272, groups:  subject, 34
## 
## Fixed effects:
##                                          Estimate Std. Error        df t value
## (Intercept)                               2.73290    0.60892  64.22211   4.488
## onsetpostonset                           -1.19722    0.49721 231.00000  -2.408
## FeedbackVIS                               0.30782    0.49721 231.00000   0.619
## PostureSTAND                             -0.30590    0.49721 231.00000  -0.615
## onsetpostonset:FeedbackVIS               -0.73054    0.70316 231.00000  -1.039
## onsetpostonset:PostureSTAND               0.01692    0.70316 231.00000   0.024
## FeedbackVIS:PostureSTAND                 -0.15176    0.70316 231.00000  -0.216
## onsetpostonset:FeedbackVIS:PostureSTAND   0.42246    0.99442 231.00000   0.425
##                                         Pr(>|t|)    
## (Intercept)                             3.05e-05 ***
## onsetpostonset                            0.0168 *  
## FeedbackVIS                               0.5365    
## PostureSTAND                              0.5390    
## onsetpostonset:FeedbackVIS                0.2999    
## onsetpostonset:PostureSTAND               0.9808    
## FeedbackVIS:PostureSTAND                  0.8293    
## onsetpostonset:FeedbackVIS:PostureSTAND   0.6714    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) onstps FdbVIS PSTAND on:FVIS o:PSTA FVIS:P
## onsetpstnst -0.408                                           
## FeedbackVIS -0.408  0.500                                    
## PosturSTAND -0.408  0.500  0.500                             
## onstps:FVIS  0.289 -0.707 -0.707 -0.354                      
## onst:PSTAND  0.289 -0.707 -0.354 -0.707  0.500               
## FVIS:PSTAND  0.289 -0.354 -0.707 -0.707  0.500   0.500       
## o:FVIS:PSTA -0.204  0.500  0.500  0.500 -0.707  -0.707 -0.707

Plot Beta Right: Power

ggplot(data = df_split_R, aes(x = onset, y = beta_power)) + 
  stat_summary(fun = "mean", geom = "col", position = "dodge") +
  geom_point(position = position_dodge(0.9)) +
  geom_line(aes(group = subject))+
  facet_grid(rows = vars(group), cols = vars(Posture, Feedback, Limb))+
    theme(axis.text.x = element_text(angle = 45, hjust = 1))+
  ylab("Beta Power")
## Warning: Removed 26 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 26 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_line()`).

Plot Beta Left: Power

ggplot(data = df_split_L, aes(x = onset, y = beta_power)) + 
  stat_summary(fun = "mean", geom = "col", position = "dodge") +
  geom_point(position = position_dodge(0.9)) +
  geom_line(aes(group = subject))+
  facet_grid(rows = vars(group), cols = vars(Posture, Feedback, Limb))+
    theme(axis.text.x = element_text(angle = 45, hjust = 1))+
  ylab("Beta Power")
## Warning: Removed 18 rows containing non-finite outside the scale range
## (`stat_summary()`).
## Warning: Removed 18 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_line()`).

LMER Beta Power: Right Limb

model = lmer(beta_power~onset*Feedback*Posture+(1|subject), data = df_split_R)
summary(model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: beta_power ~ onset * Feedback * Posture + (1 | subject)
##    Data: df_split_R
## 
## REML criterion at convergence: -309
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.6505 -0.5371 -0.0873  0.4329  4.2924 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subject  (Intercept) 0.037522 0.19371 
##  Residual             0.008856 0.09411 
## Number of obs: 246, groups:  subject, 34
## 
## Fixed effects:
##                                           Estimate Std. Error         df
## (Intercept)                               0.563914   0.037060  47.267528
## onsetpostonset                           -0.199292   0.024122 205.198189
## FeedbackVIS                               0.004336   0.023030 204.925196
## PostureSTAND                             -0.073457   0.023463 205.104939
## onsetpostonset:FeedbackVIS               -0.035971   0.034439 205.033535
## onsetpostonset:PostureSTAND               0.037004   0.034320 205.055766
## FeedbackVIS:PostureSTAND                  0.022420   0.032733 204.990880
## onsetpostonset:FeedbackVIS:PostureSTAND   0.034530   0.048428 205.038655
##                                         t value Pr(>|t|)    
## (Intercept)                              15.216  < 2e-16 ***
## onsetpostonset                           -8.262 1.76e-14 ***
## FeedbackVIS                               0.188    0.851    
## PostureSTAND                             -3.131    0.002 ** 
## onsetpostonset:FeedbackVIS               -1.044    0.298    
## onsetpostonset:PostureSTAND               1.078    0.282    
## FeedbackVIS:PostureSTAND                  0.685    0.494    
## onsetpostonset:FeedbackVIS:PostureSTAND   0.713    0.477    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) onstps FdbVIS PSTAND on:FVIS o:PSTA FVIS:P
## onsetpstnst -0.300                                           
## FeedbackVIS -0.316  0.483                                    
## PosturSTAND -0.311  0.478  0.500                             
## onstps:FVIS  0.211 -0.694 -0.669 -0.334                      
## onst:PSTAND  0.211 -0.698 -0.339 -0.681  0.488               
## FVIS:PSTAND  0.223 -0.343 -0.704 -0.717  0.471   0.488       
## o:FVIS:PSTA -0.150  0.495  0.476  0.485 -0.712  -0.708 -0.676

LMER Beta Power: Left Limb

model = lmer(beta_power~onset*Feedback*Posture+(1|subject), data = df_split_L)
summary(model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: beta_power ~ onset * Feedback * Posture + (1 | subject)
##    Data: df_split_L
## 
## REML criterion at convergence: -354.8
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.49461 -0.66460 -0.04673  0.63568  3.06037 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subject  (Intercept) 0.035222 0.18768 
##  Residual             0.007681 0.08764 
## Number of obs: 254, groups:  subject, 34
## 
## Fixed effects:
##                                          Estimate Std. Error        df t value
## (Intercept)                               0.54710    0.03552  45.90286  15.401
## onsetpostonset                           -0.18217    0.02280 213.28357  -7.989
## FeedbackVIS                              -0.00824    0.02145 213.06859  -0.384
## PostureSTAND                             -0.04662    0.02126 212.98847  -2.193
## onsetpostonset:FeedbackVIS               -0.04358    0.03192 213.15638  -1.365
## onsetpostonset:PostureSTAND               0.01077    0.03156 213.17642   0.341
## FeedbackVIS:PostureSTAND                  0.02920    0.03020 213.02891   0.967
## onsetpostonset:FeedbackVIS:PostureSTAND   0.03959    0.04438 213.18162   0.892
##                                         Pr(>|t|)    
## (Intercept)                              < 2e-16 ***
## onsetpostonset                           8.4e-14 ***
## FeedbackVIS                               0.7013    
## PostureSTAND                              0.0294 *  
## onsetpostonset:FeedbackVIS                0.1736    
## onsetpostonset:PostureSTAND               0.7331    
## FeedbackVIS:PostureSTAND                  0.3348    
## onsetpostonset:FeedbackVIS:PostureSTAND   0.3733    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) onstps FdbVIS PSTAND on:FVIS o:PSTA FVIS:P
## onsetpstnst -0.279                                           
## FeedbackVIS -0.296  0.465                                    
## PosturSTAND -0.299  0.466  0.495                             
## onstps:FVIS  0.199 -0.712 -0.672 -0.333                      
## onst:PSTAND  0.202 -0.722 -0.336 -0.674  0.514               
## FVIS:PSTAND  0.211 -0.330 -0.710 -0.704  0.478   0.476       
## o:FVIS:PSTA -0.143  0.514  0.485  0.479 -0.722  -0.712 -0.682

Plot Beta Right: AUC

ggplot(data = df_split_R, aes(x = onset, y = beta_auc)) + 
  stat_summary(fun = "mean", geom = "col", position = "dodge") +
  geom_point(position = position_dodge(0.9)) +
  geom_line(aes(group = subject))+
  facet_grid(rows = vars(group), cols = vars(Posture, Feedback, Limb))+
    theme(axis.text.x = element_text(angle = 45, hjust = 1))+
  ylab("Beta AUC")

Plot Beta Left: AUC

ggplot(data = df_split_L, aes(x = onset, y = beta_auc)) + 
  stat_summary(fun = "mean", geom = "col", position = "dodge") +
  geom_point(position = position_dodge(0.9)) +
  geom_line(aes(group = subject))+
  facet_grid(rows = vars(group), cols = vars(Posture, Feedback, Limb))+
    theme(axis.text.x = element_text(angle = 45, hjust = 1))+
  ylab("Beta AUC")

LMER Beta AUC: Right Limb

model = lmer(beta_auc~onset*Feedback*Posture+(1|subject), data = df_split_R)
summary(model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: beta_auc ~ onset * Feedback * Posture + (1 | subject)
##    Data: df_split_R
## 
## REML criterion at convergence: 577.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2150 -0.5265  0.0761  0.4302  6.2334 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subject  (Intercept) 1.6832   1.2974  
##  Residual             0.2889   0.5375  
## Number of obs: 272, groups:  subject, 34
## 
## Fixed effects:
##                                          Estimate Std. Error        df t value
## (Intercept)                               1.86336    0.24084  43.28350   7.737
## onsetpostonset                           -0.56890    0.13036 231.00000  -4.364
## FeedbackVIS                               0.20399    0.13036 231.00000   1.565
## PostureSTAND                             -0.12857    0.13036 231.00000  -0.986
## onsetpostonset:FeedbackVIS               -0.28300    0.18436 231.00000  -1.535
## onsetpostonset:PostureSTAND              -0.01075    0.18436 231.00000  -0.058
## FeedbackVIS:PostureSTAND                  0.01527    0.18436 231.00000   0.083
## onsetpostonset:FeedbackVIS:PostureSTAND   0.08402    0.26072 231.00000   0.322
##                                         Pr(>|t|)    
## (Intercept)                             1.07e-09 ***
## onsetpostonset                          1.93e-05 ***
## FeedbackVIS                                0.119    
## PostureSTAND                               0.325    
## onsetpostonset:FeedbackVIS                 0.126    
## onsetpostonset:PostureSTAND                0.954    
## FeedbackVIS:PostureSTAND                   0.934    
## onsetpostonset:FeedbackVIS:PostureSTAND    0.748    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) onstps FdbVIS PSTAND on:FVIS o:PSTA FVIS:P
## onsetpstnst -0.271                                           
## FeedbackVIS -0.271  0.500                                    
## PosturSTAND -0.271  0.500  0.500                             
## onstps:FVIS  0.191 -0.707 -0.707 -0.354                      
## onst:PSTAND  0.191 -0.707 -0.354 -0.707  0.500               
## FVIS:PSTAND  0.191 -0.354 -0.707 -0.707  0.500   0.500       
## o:FVIS:PSTA -0.135  0.500  0.500  0.500 -0.707  -0.707 -0.707

LMER Beta AUC: Left Limb

model = lmer(beta_auc~onset*Feedback*Posture+(1|subject), data = df_split_L)
summary(model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: beta_auc ~ onset * Feedback * Posture + (1 | subject)
##    Data: df_split_L
## 
## REML criterion at convergence: 617.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5856 -0.5091  0.0093  0.4895  6.7766 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subject  (Intercept) 1.6078   1.2680  
##  Residual             0.3467   0.5888  
## Number of obs: 272, groups:  subject, 34
## 
## Fixed effects:
##                                          Estimate Std. Error        df t value
## (Intercept)                               1.93927    0.23976  46.01948   8.088
## onsetpostonset                           -0.66591    0.14281 231.00000  -4.663
## FeedbackVIS                               0.12095    0.14281 231.00000   0.847
## PostureSTAND                             -0.11936    0.14281 231.00000  -0.836
## onsetpostonset:FeedbackVIS               -0.29997    0.20197 231.00000  -1.485
## onsetpostonset:PostureSTAND              -0.02608    0.20197 231.00000  -0.129
## FeedbackVIS:PostureSTAND                  0.07582    0.20197 231.00000   0.375
## onsetpostonset:FeedbackVIS:PostureSTAND   0.07338    0.28563 231.00000   0.257
##                                         Pr(>|t|)    
## (Intercept)                             2.19e-10 ***
## onsetpostonset                          5.28e-06 ***
## FeedbackVIS                                0.398    
## PostureSTAND                               0.404    
## onsetpostonset:FeedbackVIS                 0.139    
## onsetpostonset:PostureSTAND                0.897    
## FeedbackVIS:PostureSTAND                   0.708    
## onsetpostonset:FeedbackVIS:PostureSTAND    0.797    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) onstps FdbVIS PSTAND on:FVIS o:PSTA FVIS:P
## onsetpstnst -0.298                                           
## FeedbackVIS -0.298  0.500                                    
## PosturSTAND -0.298  0.500  0.500                             
## onstps:FVIS  0.211 -0.707 -0.707 -0.354                      
## onst:PSTAND  0.211 -0.707 -0.354 -0.707  0.500               
## FVIS:PSTAND  0.211 -0.354 -0.707 -0.707  0.500   0.500       
## o:FVIS:PSTA -0.149  0.500  0.500  0.500 -0.707  -0.707 -0.707

To Do: -C3/C4, P3/P4, O1/O2? -adjust fooof parameters X-Include AUC in python script -don’t include 0 in pwelch -LIMO or extract and run in R