Tetris

Tetris

# library(XML) opts_knit$set(upload.fun = imgur_upload)
library(reshape2)
library(ggplot2)
setwd("/Users/ruben/Dropbox/Self-Insight/ErsteErgebnisse/EMGplots")
load(file = "tetris.rdata")
WEIT = melt(tetris3[, c("vp", "event", "rl", "bh", "muscle", "ctime10", "activity")], 
    id.vars = c("vp", "event", "rl", "bh", "muscle", "ctime10"))
WEIT2 = dcast(WEIT, vp + rl + bh + event + muscle ~ ., fun.aggregate = mean)
names(WEIT2) = c("vp", "rl", "bh", "event", "muscle", "activity")
p = ggplot(data = WEIT2) + geom_jitter(shape = 1, alpha = 0.1) + scale_shape(solid = F) + 
    stat_summary(fun.data = "mean_cl_boot", geom = "smooth") + scale_y_continuous(limits = c(-1, 
    10))
p + aes(rl, activity) + scale_x_continuous("Rows deleted")
## Warning: Removed 2 rows containing missing values (stat_summary).
## Warning: Removed 2 rows containing missing values (geom_point).

plot of chunk tetris.export

p + aes(rl, activity) + facet_wrap(~muscle) + scale_x_continuous("Rows deleted")
## Warning: Removed 2 rows containing missing values (stat_summary).
## Warning: Removed 2 rows containing missing values (geom_point).

plot of chunk tetris.export

p + aes(bh, activity) + facet_wrap(~muscle) + scale_x_continuous("Black holes")
## Warning: Removed 2 rows containing missing values (stat_summary).
## Warning: Removed 2 rows containing missing values (geom_point).

plot of chunk tetris.export

p + aes(bh, activity) + facet_wrap(~rl) + scale_x_continuous(limits = c(0, 17)) + 
    scale_x_continuous("Black holes")
## Scale for 'x' is already present. Adding another scale for 'x', which will
## replace the existing scale.
## Warning: Removed 2 rows containing missing values (stat_summary).
## Warning: Removed 2 rows containing missing values (geom_point).

plot of chunk tetris.export

p + aes(bh, activity) + facet_wrap(~event + muscle) + scale_x_continuous(limits = c(0, 
    17)) + scale_x_continuous("Black holes")
## Scale for 'x' is already present. Adding another scale for 'x', which will
## replace the existing scale.
## Warning: Removed 2 rows containing missing values (stat_summary).
## Warning: Removed 2 rows containing missing values (geom_point).
## geom_path: Each group consist of only one observation. Do you need to
## adjust the group aesthetic?
## geom_path: Each group consist of only one observation. Do you need to
## adjust the group aesthetic?
## geom_path: Each group consist of only one observation. Do you need to
## adjust the group aesthetic?
## geom_path: Each group consist of only one observation. Do you need to
## adjust the group aesthetic?

plot of chunk tetris.export


qplot(event, activity, data = WEIT2, geom = "blank") + geom_boxplot() + facet_wrap(~muscle)

plot of chunk tetris.export


WEIT$firsthalf = WEIT$ctime10 <= 258
WEIT3 = dcast(WEIT, vp ~ event + muscle, fun.aggregate = mean)

library(ellipse)
correl = round(cor(WEIT3[, -1], use = "na.or.complete", method = "spearman"), 
    2)
correl
##                    baseline_corr baseline_zygo big.failure_corr
## baseline_corr               1.00         -0.14             0.25
## baseline_zygo              -0.14          1.00            -0.03
## big.failure_corr            0.25         -0.03             1.00
## big.failure_zygo           -0.01          0.05            -0.39
## gameover_corr               0.15          0.01             0.57
## gameover_zygo              -0.14          0.02            -0.26
## small.failure_corr          0.05         -0.02             0.56
## small.failure_zygo         -0.08          0.05            -0.32
## success_corr                0.04          0.00             0.42
## success_zygo               -0.01         -0.07            -0.04
##                    big.failure_zygo gameover_corr gameover_zygo
## baseline_corr                 -0.01          0.15         -0.14
## baseline_zygo                  0.05          0.01          0.02
## big.failure_corr              -0.39          0.57         -0.26
## big.failure_zygo               1.00         -0.17          0.55
## gameover_corr                 -0.17          1.00         -0.31
## gameover_zygo                  0.55         -0.31          1.00
## small.failure_corr            -0.07          0.59         -0.07
## small.failure_zygo             0.48         -0.16          0.51
## success_corr                  -0.03          0.53         -0.04
## success_zygo                   0.04         -0.13          0.33
##                    small.failure_corr small.failure_zygo success_corr
## baseline_corr                    0.05              -0.08         0.04
## baseline_zygo                   -0.02               0.05         0.00
## big.failure_corr                 0.56              -0.32         0.42
## big.failure_zygo                -0.07               0.48        -0.03
## gameover_corr                    0.59              -0.16         0.53
## gameover_zygo                   -0.07               0.51        -0.04
## small.failure_corr               1.00              -0.22         0.89
## small.failure_zygo              -0.22               1.00        -0.18
## success_corr                     0.89              -0.18         1.00
## success_zygo                    -0.20               0.54        -0.22
##                    success_zygo
## baseline_corr             -0.01
## baseline_zygo             -0.07
## big.failure_corr          -0.04
## big.failure_zygo           0.04
## gameover_corr             -0.13
## gameover_zygo              0.33
## small.failure_corr        -0.20
## small.failure_zygo         0.54
## success_corr              -0.22
## success_zygo               1.00
colorfun <- colorRamp(c("#CC0000", "white", "#3366CC"), space = "Lab")
plotcorr(correl, type = "upper", col = rgb(colorfun((correl + 1)/2), maxColorValue = 255))

plot of chunk tetris.export



write.table(WEIT3, dec = ",", "tetrisEMGweit3.csv", sep = "\t", qmethod = "double", 
    na = "99", row.names = F)
save(WEIT3, file = "tetrisWEIT3.RData")
gc()
##           used (Mb) gc trigger  (Mb) max used  (Mb)
## Ncells  551241 29.5     899071  48.1   899071  48.1
## Vcells 4836119 36.9   13805511 105.4 13805336 105.4

Factor analyses

Oblimin rotation

library(psych)
## Attaching package: 'psych'
## The following object(s) are masked from 'package:Hmisc':
## 
## describe
## The following object(s) are masked from 'package:ggplot2':
## 
## %+%
number.of.factors = fa.parallel(correl, n.obs = nrow(WEIT3))
## Loading required package: MASS
## Parallel analysis suggests that the number of factors =  3  and the number of components =  3

plot of chunk oblimin

fa(correl, n.obs = nrow(WEIT3), number.of.factors$nfact)
## Loading required package: GPArotation
## Factor Analysis using method =  minres
## Call: fa(r = correl, nfactors = number.of.factors$nfact, n.obs = nrow(WEIT3))
## Standardized loadings (pattern matrix) based upon correlation matrix
##                      MR1   MR2   MR3    h2    u2
## baseline_corr       0.03 -0.18  0.05 0.034 0.966
## baseline_zygo      -0.02  0.08 -0.08 0.011 0.989
## big.failure_corr    0.51 -0.50  0.19 0.574 0.426
## big.failure_zygo    0.06  0.79 -0.06 0.598 0.402
## gameover_corr       0.56 -0.27  0.07 0.430 0.570
## gameover_zygo       0.08  0.65  0.26 0.548 0.452
## small.failure_corr  1.00  0.03 -0.02 0.988 0.012
## small.failure_zygo -0.05  0.50  0.51 0.640 0.360
## success_corr        0.90  0.10 -0.08 0.808 0.192
## success_zygo       -0.07 -0.02  0.84 0.713 0.287
## 
##                        MR1  MR2  MR3
## SS loadings           2.44 1.77 1.14
## Proportion Var        0.24 0.18 0.11
## Cumulative Var        0.24 0.42 0.53
## Proportion Explained  0.46 0.33 0.21
## Cumulative Proportion 0.46 0.79 1.00
## 
##  With factor correlations of 
##       MR1   MR2   MR3
## MR1  1.00 -0.19 -0.14
## MR2 -0.19  1.00  0.22
## MR3 -0.14  0.22  1.00
## 
## Test of the hypothesis that 3 factors are sufficient.
## 
## The degrees of freedom for the null model are  45  and the objective function was  4.4 with Chi Square of  917.9
## The degrees of freedom for the model are 18  and the objective function was  0.39 
## 
## The root mean square of the residuals (RMSR) is  0.03 
## The df corrected root mean square of the residuals is  0.08 
## The number of observations was  214  with Chi Square =  81.4  with prob <  4.9e-10 
## 
## Tucker Lewis Index of factoring reliability =  0.817
## RMSEA index =  0.131  and the 90 % confidence intervals are  0.101 0.157
## BIC =  -15.18
## Fit based upon off diagonal values = 0.97
## Measures of factor score adequacy             
##                                                 MR1  MR2  MR3
## Correlation of scores with factors             0.99 0.90 0.88
## Multiple R square of scores with factors       0.99 0.80 0.77
## Minimum correlation of possible factor scores  0.98 0.61 0.55

Varimax rotation

fa(correl, n.obs = nrow(WEIT3), number.of.factors$nfact, rotate = "varimax")
## Factor Analysis using method =  minres
## Call: fa(r = correl, nfactors = number.of.factors$nfact, n.obs = nrow(WEIT3), 
##     rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                      MR1   MR2   MR3    h2    u2
## baseline_corr       0.04 -0.03 -0.18 0.034 0.966
## baseline_zygo      -0.02 -0.04  0.09 0.011 0.989
## big.failure_corr    0.53 -0.06 -0.54 0.574 0.426
## big.failure_zygo   -0.01  0.27  0.73 0.598 0.402
## gameover_corr       0.57 -0.09 -0.30 0.430 0.570
## gameover_zygo       0.00  0.52  0.53 0.548 0.452
## small.failure_corr  0.99 -0.08 -0.05 0.988 0.012
## small.failure_zygo -0.14  0.71  0.34 0.640 0.360
## success_corr        0.89 -0.11  0.04 0.808 0.192
## success_zygo       -0.14  0.81 -0.19 0.713 0.287
## 
##                        MR1  MR2  MR3
## SS loadings           2.43 1.53 1.39
## Proportion Var        0.24 0.15 0.14
## Cumulative Var        0.24 0.40 0.53
## Proportion Explained  0.45 0.29 0.26
## Cumulative Proportion 0.45 0.74 1.00
## 
## Test of the hypothesis that 3 factors are sufficient.
## 
## The degrees of freedom for the null model are  45  and the objective function was  4.4 with Chi Square of  917.9
## The degrees of freedom for the model are 18  and the objective function was  0.39 
## 
## The root mean square of the residuals (RMSR) is  0.03 
## The df corrected root mean square of the residuals is  0.08 
## The number of observations was  214  with Chi Square =  81.4  with prob <  4.9e-10 
## 
## Tucker Lewis Index of factoring reliability =  0.817
## RMSEA index =  0.131  and the 90 % confidence intervals are  0.101 0.157
## BIC =  -15.18
## Fit based upon off diagonal values = 0.97
## Measures of factor score adequacy             
##                                                 MR1  MR2  MR3
## Correlation of scores with factors             0.99 0.89 0.86
## Multiple R square of scores with factors       0.99 0.80 0.75
## Minimum correlation of possible factor scores  0.97 0.59 0.49

LANG = WEIT
LANG[which(LANG$event == "big.failure" | LANG$event == "small.failure"), "event"] = "failure"
breit = dcast(LANG, vp ~ event + muscle, fun.aggregate = mean)

(efa = fa(WEIT3[, -c(1:3)], fa.parallel(breit[, -1])$nfact, rotate = "varimax", 
    missing = T, fm = "ml"))
## Parallel analysis suggests that the number of factors =  3  and the number of components =  3

plot of chunk varimax

## Factor Analysis using method =  ml
## Call: fa(r = WEIT3[, -c(1:3)], nfactors = fa.parallel(breit[, -1])$nfact, 
##     rotate = "varimax", missing = T, fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                      ML3   ML2   ML1   h2    u2
## big.failure_corr    0.18 -0.18  0.96 1.00 0.005
## big.failure_zygo    0.05  0.53 -0.14 0.30 0.701
## gameover_corr       0.16 -0.12  0.58 0.38 0.624
## gameover_zygo       0.11  0.42 -0.24 0.25 0.754
## small.failure_corr  0.94 -0.11  0.30 1.00 0.005
## small.failure_zygo -0.14  0.99 -0.04 1.00 0.005
## success_corr        0.90 -0.01  0.09 0.82 0.180
## success_zygo       -0.17  0.45 -0.03 0.24 0.763
## 
##                        ML3  ML2  ML1
## SS loadings           1.82 1.69 1.45
## Proportion Var        0.23 0.21 0.18
## Cumulative Var        0.23 0.44 0.62
## Proportion Explained  0.37 0.34 0.29
## Cumulative Proportion 0.37 0.71 1.00
## 
## Test of the hypothesis that 3 factors are sufficient.
## 
## The degrees of freedom for the null model are  28  and the objective function was  3.82 with Chi Square of  800.3
## The degrees of freedom for the model are 7  and the objective function was  0.41 
## 
## The root mean square of the residuals (RMSR) is  0.04 
## The df corrected root mean square of the residuals is  0.12 
## The number of observations was  214  with Chi Square =  85.71  with prob <  9.4e-16 
## 
## Tucker Lewis Index of factoring reliability =  0.588
## RMSEA index =  0.233  and the 90 % confidence intervals are  0.187 0.274
## BIC =  48.15
## Fit based upon off diagonal values = 0.97
## Measures of factor score adequacy             
##                                                 ML3  ML2  ML1
## Correlation of scores with factors             1.00 1.00 1.00
## Multiple R square of scores with factors       0.99 0.99 0.99
## Minimum correlation of possible factor scores  0.99 0.99 0.99
(efa = fa(breit[, -c(1:3)], number.of.factors$nfact, rotate = "varimax", missing = T, 
    fm = "ml"))
## In fa, too many factors requested for this number of variables to use SMC
## for communality estimates, 1s are used instead
## Factor Analysis using method =  ml
## Call: fa(r = breit[, -c(1:3)], nfactors = number.of.factors$nfact, 
##     rotate = "varimax", missing = T, fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
##                 ML1   ML2   ML3   h2    u2
## failure_corr   0.99 -0.08 -0.10 1.00 0.005
## failure_zygo  -0.17  0.34  0.58 0.47 0.527
## gameover_corr  0.31 -0.02 -0.28 0.18 0.822
## gameover_zygo  0.05  0.05  0.72 0.52 0.478
## success_corr   0.88 -0.14  0.04 0.79 0.211
## success_zygo  -0.12  0.97  0.19 1.00 0.005
## 
##                        ML1  ML2  ML3
## SS loadings           1.89 1.09 0.97
## Proportion Var        0.32 0.18 0.16
## Cumulative Var        0.32 0.50 0.66
## Proportion Explained  0.48 0.28 0.25
## Cumulative Proportion 0.48 0.75 1.00
## 
## Test of the hypothesis that 3 factors are sufficient.
## 
## The degrees of freedom for the null model are  15  and the objective function was  2.22 with Chi Square of  465.7
## The degrees of freedom for the model are 0  and the objective function was  0.02 
## 
## The root mean square of the residuals (RMSR) is  0.01 
## The number of observations was  214  with Chi Square =  5.05  with prob <  NA 
## 
## Tucker Lewis Index of factoring reliability =  -Inf
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                 ML1  ML2  ML3
## Correlation of scores with factors             1.00 0.99 0.80
## Multiple R square of scores with factors       0.99 0.98 0.63
## Minimum correlation of possible factor scores  0.99 0.96 0.27

efa = fa(breit[, -1], number.of.factors$nfact, rotate = "varimax")
efa$scores
##          MR1        MR2       MR3
## 1   -0.48514 -0.8141212 -0.136979
## 2    0.51489  0.7337515 -0.402441
## 3    0.88641  0.0975498  2.727202
## 4    1.09178 -0.9464929 -0.054957
## 5   -1.49530  0.6477726  0.596305
## 6   -0.12004 -0.4686060 -0.272917
## 7    0.58889  1.6287194  1.851453
## 8   -0.60664 -0.3985989  0.019033
## 9   -0.59792 -0.5386740 -1.636100
## 10   1.61993 -0.9950512  1.903714
## 11       NaN        NaN       NaN
## 12   0.02901 -1.1176846  1.357861
## 13       NaN        NaN       NaN
## 14   0.09695  1.1512387  0.692658
## 15   0.75236 -0.3598299 -0.623129
## 16  -0.27225 -0.6707211 -0.139202
## 17   1.51353  0.0965476  0.209184
## 18  -0.83120  0.0332471  0.537109
## 19  -0.34129 -0.7387664 -0.010945
## 20  -0.18791 -0.4555252  0.138496
## 21  -1.68633 -0.1945235  0.411998
## 22  -0.30897 -0.0002259 -0.118250
## 23   1.94149  0.7254919  0.806063
## 24  -0.25610 -0.0965505 -0.135638
## 25       NaN        NaN       NaN
## 26   0.92916  0.2297771  1.316258
## 27   0.47172 -0.0583471 -1.131307
## 28   0.55128 -0.1375546 -0.483411
## 29  -1.96844  1.7216414  1.343886
## 30   1.55652 -0.4060185  1.306102
## 31  -0.96811 -0.2899665 -0.395953
## 32   0.09896 -0.4774857 -0.535379
## 33       NaN        NaN       NaN
## 34  -1.42227 -0.9948465 -0.538709
## 35   0.45629 -0.6002482  0.444528
## 36   0.92407 -0.0108851 -0.840229
## 37  -1.59105  1.8914059  0.911506
## 38       NaN        NaN       NaN
## 39  -2.45662  0.6558711  0.390377
## 40  -0.25517  0.4545269 -1.121986
## 41  -1.28977 -0.7450220  0.131493
## 42   0.45890  1.1031617  0.678390
## 43   2.55586  0.2975132 -0.624604
## 44   1.09826 -0.4540412 -0.136577
## 45   1.30385  0.1377728 -1.166338
## 46  -0.49631  1.3883597  1.083390
## 47  -0.55836 -0.4731540 -0.130348
## 48  -1.48670 -0.5809274 -0.763924
## 49   0.50380 -0.8520061  0.243985
## 50   0.15924 -0.5145480 -0.544016
## 51  -1.23695 -0.7935643  0.243645
## 52  -0.19139  2.0166547  1.988318
## 53       NaN        NaN       NaN
## 54  -0.13638  0.2233415  0.742785
## 55   0.92034  2.2880022 -2.305502
## 56   0.01086 -0.4390838 -0.142304
## 57   0.61914 -0.4476803 -0.124990
## 58  -0.24882 -0.7231133 -0.339538
## 59  -0.24121 -0.9631771 -0.448566
## 60  -1.34265 -0.8759436  0.011291
## 61   0.38681 -0.6941534 -0.197208
## 62  -0.82022  0.8392369 -1.175433
## 63  -0.03692  2.0347200 -0.814682
## 64  -0.31185 -0.5531945 -0.350470
## 65   1.32443 -0.2880045  0.017906
## 66  -0.64294 -0.0413378 -0.155505
## 67  -0.07785 -0.0627645  0.771992
## 68  -0.21285 -0.5533711 -0.784454
## 69  -1.56849 -0.7988623 -0.211406
## 70       NaN        NaN       NaN
## 71  -0.59683 -0.0349752 -0.169657
## 72  -0.13432 -0.0329477 -0.938224
## 73  -0.62467 -0.9060083  0.101466
## 74   0.26998 -0.2332967 -0.894763
## 75  -0.49544 -0.5222756 -0.186107
## 76       NaN        NaN       NaN
## 77  -0.27419 -0.3673303 -0.735896
## 78       NaN        NaN       NaN
## 79  -0.69747  0.9239488 -0.669921
## 80   0.70003  0.6953384  0.400827
## 81  -0.14859  0.5415966  0.887178
## 82  -0.14361 -0.2830238 -0.005984
## 83  -0.46244 -0.0913998 -0.151241
## 84   0.90521 -0.4663279  0.037747
## 85  -0.03548  0.4426770  0.044141
## 86  -1.70451  0.9833780 -0.833995
## 87   0.40557 -0.0077008 -0.048200
## 88  -1.37115 -0.6003726 -0.299604
## 89   1.37031 -1.0150151 -0.244517
## 90   1.21353  0.6978033 -0.087715
## 91   0.36577 -0.8458237  0.049453
## 92  -0.82522 -0.5175249 -0.479357
## 93  -1.22279  0.4867173 -0.756023
## 94       NaN        NaN       NaN
## 95  -0.54922  3.1943973 -0.043212
## 96  -0.48080  0.4861953  1.285630
## 97  -0.77095 -0.5180137 -0.781917
## 98       NaN        NaN       NaN
## 99  -0.13263 -0.4033884 -0.229204
## 100  1.22847  0.1000521  0.299217
## 101  0.95397 -0.4770846 -0.228678
## 102 -1.13201  0.3610960  0.259445
## 103  0.07041 -0.6849297 -0.001797
## 104 -0.76058  2.9527968 -0.258727
## 105  2.19813  2.6061822 -0.641452
## 106 -0.12373  2.9869675  0.475728
## 107  1.47100  0.2311962 -1.486037
## 108      NaN        NaN       NaN
## 109 -0.50593  1.1737209  2.311369
## 110  1.19946 -1.4109341  1.317629
## 111 -0.12978  0.0436242  0.471915
## 112      NaN        NaN       NaN
## 113  1.24377  2.0238728 -1.756002
## 114  1.64402 -0.4208370  0.277422
## 115 -0.47266  0.8957078  0.513682
## 116  1.34283 -0.5993755  0.080409
## 117  0.28268 -0.4280437  0.302890
## 118  0.31716 -0.4145794  0.531401
## 119  1.95927 -0.8590215  1.480213
## 120 -0.23441 -0.2931578 -0.032692
## 121  0.72110  0.1462545  0.101557
## 122  0.27453  2.0335599 -0.814131
## 123 -1.70461 -0.0435545 -0.781074
## 124  0.66492 -0.2206197 -0.408356
## 125 -0.08066 -0.9841873 -0.024083
## 126  0.60984 -0.5316965  0.270318
## 127 -0.82429  1.2512140 -1.017522
## 128 -1.23299 -0.6770361 -0.014617
## 129  0.37628 -0.1062939  0.026186
## 130 -2.21530  1.8360794  1.212368
## 131 -1.15909 -0.9441270 -0.067188
## 132      NaN        NaN       NaN
## 133      NaN        NaN       NaN
## 134 -0.06349  0.5450359  1.250196
## 135  0.49417 -1.9502933  0.790221
## 136 -0.10122  1.0949605 -0.053435
## 137 -0.22171 -0.8259696 -0.884904
## 138  0.08812 -0.5013169 -0.031659
## 139 -1.14259  0.0760303  0.180839
## 140  0.32265  0.8255711 -0.954939
## 141 -0.29220  0.5689290  0.163304
## 142  0.80119  0.2327859 -0.637041
## 143 -0.23234 -0.8014117 -0.185760
## 144 -1.00702  0.6838489  0.197624
## 145  0.30699  0.3681743  0.669983
## 146 -0.85008 -0.7613478  0.327889
## 147  1.82360  0.1651609 -0.276380
## 148  0.01081 -0.5296350  0.527765
## 149      NaN        NaN       NaN
## 150  0.55323  0.9442904 -0.999393
## 151 -0.73613  0.2171196  0.177403
## 152  1.53641  0.9808048 -0.233117
## 153      NaN        NaN       NaN
## 154 -0.82711  1.1644084  1.167121
## 155  1.64931  0.6252002  0.402468
## 156 -0.36778  1.3729775  1.342395
## 157      NaN        NaN       NaN
## 158 -0.03987 -0.0963102 -0.692296
## 159 -1.26570  1.0876267  0.526447
## 160  0.85169  0.0706372 -0.590268
## 161 -1.57365  1.0228353 -0.685048
## 162 -0.65744 -0.8001068 -0.121657
## 163  0.11249 -0.3323173  0.512700
## 164  1.47962  0.2964149 -0.835490
## 165 -1.77011  0.4547862 -0.295922
## 166 -0.46943 -0.5877175 -0.082177
## 167  1.60723 -0.3129723  0.146218
## 168 -0.45147 -1.1500194 -0.272064
## 169  2.09783 -0.7533014 -0.146530
## 170      NaN        NaN       NaN
## 171  0.62900 -0.5993592  0.263793
## 172  0.24800 -0.3370904 -0.231498
## 173  0.56302 -0.7933837  0.420861
## 174  0.93227  0.7276840  0.361351
## 175 -0.68262 -0.6036964 -0.238755
## 176 -0.95162  0.9377103  1.122475
## 177  0.36978 -0.4233363  0.178553
## 178 -0.77447  0.3864033  0.381552
## 179 -0.63488 -0.6973837 -0.691383
## 180  1.17509  1.0396341 -0.095057
## 181  0.04336 -0.9883300  0.724023
## 182  0.14643 -0.3936881  0.413178
## 183 -0.98760 -0.3856323  0.089400
## 184 -1.12891 -0.5648768 -1.053435
## 185 -0.91959 -0.0244296 -1.337478
## 186  0.64598 -0.4662473  0.238344
## 187  0.09554 -0.4913583  0.573988
## 188 -0.53819 -0.3346968 -0.091174
## 189  0.77260 -0.3448231 -0.588491
## 190      NaN        NaN       NaN
## 191 -0.37600 -0.7227575 -0.209818
## 192      NaN        NaN       NaN
## 193  0.12663  0.0184960  0.187831
## 194 -0.77157 -0.8432080 -0.872974
## 195  1.56865 -0.1714596  0.430326
## 196  0.06355 -0.1423476 -0.072167
## 197 -0.55221 -0.6342822 -0.225320
## 198 -0.96667 -0.4587200 -0.173537
## 199 -0.39307  1.5244100 -0.472477
## 200      NaN        NaN       NaN
## 201 -0.90262 -0.7341547 -0.782507
## 202  0.03241 -0.4988132 -0.089957
## 203 -1.57793 -1.1353281  0.074743
## 204  0.94646 -0.2547730 -0.152031
## 205  2.40228 -1.0015664  0.479403
## 206  2.00434  0.1016919 -0.770253
## 207 -0.87912  1.9662760  1.975026
## 208 -1.52010 -0.3932592 -0.490710
## 209 -0.58470  0.5553851 -0.928376
## 210  0.07929 -0.1141344 -0.515964
## 211  2.63915  1.7505692 -2.477876
## 212 -1.33527 -0.2395151 -0.404214
## 213  0.21974 -0.2722001 -0.847377
## 214 -1.23369 -1.0474969 -0.039905
summary(fakt)
## Error: object 'fakt' not found

Odd-Even Correlations

WEIT$odd = (WEIT$ctime10%%8) %nin% c(0, 1, 2, 3)
WEIT4 = dcast(WEIT, vp ~ event + muscle + odd, fun.aggregate = mean)
correl = round(cor(WEIT4[, 2:8], use = "na.or.complete", method = "spearman"), 
    2)
correl
##                        baseline_corr_FALSE baseline_corr_TRUE
## baseline_corr_FALSE                   1.00               0.91
## baseline_corr_TRUE                    0.91               1.00
## baseline_zygo_FALSE                  -0.11              -0.14
## baseline_zygo_TRUE                   -0.14              -0.15
## big.failure_corr_FALSE                0.20               0.24
## big.failure_corr_TRUE                 0.21               0.15
## big.failure_zygo_FALSE               -0.01               0.04
##                        baseline_zygo_FALSE baseline_zygo_TRUE
## baseline_corr_FALSE                  -0.11              -0.14
## baseline_corr_TRUE                   -0.14              -0.15
## baseline_zygo_FALSE                   1.00               0.88
## baseline_zygo_TRUE                    0.88               1.00
## big.failure_corr_FALSE                0.01               0.01
## big.failure_corr_TRUE                -0.06              -0.08
## big.failure_zygo_FALSE               -0.02               0.01
##                        big.failure_corr_FALSE big.failure_corr_TRUE
## baseline_corr_FALSE                      0.20                  0.21
## baseline_corr_TRUE                       0.24                  0.15
## baseline_zygo_FALSE                      0.01                 -0.06
## baseline_zygo_TRUE                       0.01                 -0.08
## big.failure_corr_FALSE                   1.00                  0.84
## big.failure_corr_TRUE                    0.84                  1.00
## big.failure_zygo_FALSE                  -0.34                 -0.45
##                        big.failure_zygo_FALSE
## baseline_corr_FALSE                     -0.01
## baseline_corr_TRUE                       0.04
## baseline_zygo_FALSE                     -0.02
## baseline_zygo_TRUE                       0.01
## big.failure_corr_FALSE                  -0.34
## big.failure_corr_TRUE                   -0.45
## big.failure_zygo_FALSE                   1.00

Yields extremely high positive correlations, but that might just be due to closeness in time / autocorrelation?.

library(lme4)
## Loading required package: lattice
## Loading required package: Matrix
tetris3$event = as.factor(tetris3$event) 
### simple icc
lmer(activity ~  (1 |vp),data=tetris3) # not much variance explained by the person
## Linear mixed model fit by REML ['lmerMod']
## Formula: activity ~ (1 | vp) 
##    Data: tetris3 
## 
## REML criterion at convergence: 539975 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  vp       (Intercept) 0.024    0.155   
##  Residual             0.558    0.747   
## Number of obs: 239095, groups: vp, 214
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)   0.0609     0.0107    5.69

tetris4 = melt(tetris3,measure.vars="activity")
tetris4 = dcast(tetris4,... ~ muscle)
head(tetris4)
##   evnumber  vp ctime10    event rl bh variable   corr     zygo
## 1       51 101       0 baseline  0  0 activity 0.4400 -0.13426
## 2       51 101       1 baseline  0  0 activity 0.3190 -0.15062
## 3       51 101       2 baseline  0  0 activity 0.5768 -0.15681
## 4       51 101       3 baseline  0  0 activity 0.3806 -0.15254
## 5       51 101       4 baseline  0  0 activity 0.3623 -0.14697
## 6       51 101       5 baseline  0  0 activity 0.2842 -0.09246


source(file="~/R/self-insight/diary/2- jaap instruction - snippet calculate slope reliability.R")

(iislopes.z = lmer(zygo ~ rl + bh + ctime10 + (1 + rl + bh + ctime10|vp),data=tetris4))
## Linear mixed model fit by REML ['lmerMod']
## Formula: zygo ~ rl + bh + ctime10 + (1 + rl + bh + ctime10 | vp) 
##    Data: tetris4 
## 
## REML criterion at convergence: 303558 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr                
##  vp       (Intercept) 0.201596 0.4490                       
##           rl          0.294234 0.5424    0.691              
##           bh          2.267695 1.5059    0.681  0.931       
##           ctime10     0.000111 0.0105   -0.764 -0.958 -0.985
##  Residual             0.717849 0.8473                       
## Number of obs: 119552, groups: vp, 214
## 
## Fixed effects:
##              Estimate Std. Error t value
## (Intercept)  0.006259   0.031195    0.20
## rl          -0.106968   0.037420   -2.86
## bh           0.033877   0.102962    0.33
## ctime10      0.000137   0.000720    0.19
## 
## Correlation of Fixed Effects:
##         (Intr) rl     bh    
## rl       0.668              
## bh       0.670  0.923       
## ctime10 -0.755 -0.949 -0.984


summary(tetris4)
##     evnumber         vp         ctime10               event      
##  Min.   : 51   Min.   :101   Min.   :   0   baseline     :13148  
##  1st Qu.:184   1st Qu.:155   1st Qu.: 134   big.failure  : 2813  
##  Median :217   Median :208   Median : 258   gameover     : 3224  
##  Mean   :194   Mean   :208   Mean   : 262   small.failure:69222  
##  3rd Qu.:219   3rd Qu.:262   3rd Qu.: 379   success      :31156  
##  Max.   :245   Max.   :320   Max.   :1047                        
##                                                                  
##        rl             bh            variable           corr       
##  Min.   :0.00   Min.   : 0.00   activity:119563   Min.   :-1.195  
##  1st Qu.:0.00   1st Qu.: 1.00                     1st Qu.:-0.280  
##  Median :0.00   Median : 2.00                     Median :-0.023  
##  Mean   :0.33   Mean   : 3.06                     Mean   : 0.029  
##  3rd Qu.:1.00   3rd Qu.: 4.00                     3rd Qu.: 0.255  
##  Max.   :4.00   Max.   :30.00                     Max.   :23.346  
##                                                   NA's   :20      
##       zygo      
##  Min.   :-0.95  
##  1st Qu.:-0.21  
##  Median :-0.13  
##  Mean   : 0.09  
##  3rd Qu.: 0.02  
##  Max.   :33.68  
##  NA's   :11
(iislopes.z2 = lmer(zygo ~ rl + bh + ctime10 + event + (1 + rl + bh + ctime10 + event|vp),data=tetris4))
## caught warning: failure to converge in 10000 evaluations
## Linear mixed model fit by REML ['lmerMod']
## Formula: zygo ~ rl + bh + ctime10 + event + (1 + rl + bh + ctime10 + event |      vp) 
##    Data: tetris4 
## 
## REML criterion at convergence: 290325 
## 
## Random effects:
##  Groups   Name               Variance Std.Dev. Corr                       
##  vp       (Intercept)        7.48e-01 0.86475                             
##           rl                 7.41e-02 0.27224   0.806                     
##           bh                 3.27e-02 0.18086   0.529  0.534              
##           ctime10            6.65e-06 0.00258  -0.716 -0.717 -0.320       
##           eventbig.failure   2.97e+00 1.72249   0.245  0.029  0.049 -0.079
##           eventgameover      3.82e+00 1.95405   0.254  0.327 -0.115 -0.022
##           eventsmall.failure 4.43e-01 0.66561  -0.378 -0.476 -0.221 -0.072
##           eventsuccess       5.90e-01 0.76812  -0.572 -0.495 -0.376  0.250
##  Residual                    6.34e-01 0.79612                             
##                      
##                      
##                      
##                      
##                      
##                      
##   0.205              
##   0.401 -0.140       
##   0.210 -0.050  0.631
##                      
## Number of obs: 119552, groups: vp, 214
## 
## Fixed effects:
##                     Estimate Std. Error t value
## (Intercept)         0.133601   0.059530    2.24
## rl                  0.006857   0.021123    0.32
## bh                  0.089026   0.012592    7.07
## ctime10             0.000196   0.000180    1.09
## eventbig.failure   -0.058020   0.144085   -0.40
## eventgameover      -1.301460   0.142986   -9.10
## eventsmall.failure -0.285777   0.046665   -6.12
## eventsuccess       -0.352676   0.054989   -6.41
## 
## Correlation of Fixed Effects:
##             (Intr) rl     bh     ctim10 evntb. evntgm evnts.
## rl           0.706                                          
## bh           0.517  0.466                                   
## ctime10     -0.701 -0.624 -0.325                            
## eventbg.flr  0.194  0.009  0.024 -0.067                     
## eventgamevr  0.229  0.273 -0.139 -0.014  0.176              
## evntsmll.fl -0.381 -0.409 -0.219 -0.088  0.340 -0.105       
## eventsuccss -0.556 -0.521 -0.355  0.221  0.180 -0.033  0.620
relia.z = get.reliabilites(iislopes.z)
## Attaching package: 'plyr'
## The following object(s) are masked from 'package:Hmisc':
## 
## is.discrete, summarize
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

relia.z2 = get.reliabilites(iislopes.z2)
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## Error: undefined columns selected

(iislopes.c = lmer(corr ~ rl + bh + (1 + rl + bh + ctime10 |vp) + ctime10,data=tetris4))
## Linear mixed model fit by REML ['lmerMod']
## Formula: corr ~ rl + bh + (1 + rl + bh + ctime10 | vp) + ctime10 
##    Data: tetris4 
## 
## REML criterion at convergence: 145611 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr                
##  vp       (Intercept) 8.95e-02 0.29919                      
##           rl          1.50e-01 0.38767   0.244              
##           bh          2.50e-01 0.50043   0.409  0.198       
##           ctime10     2.67e-05 0.00517  -0.478 -0.052 -0.969
##  Residual             1.90e-01 0.43621                      
## Number of obs: 119543, groups: vp, 214
## 
## Fixed effects:
##              Estimate Std. Error t value
## (Intercept) -0.037270   0.020657   -1.80
## rl           0.047468   0.026673    1.78
## bh          -0.009961   0.034227   -0.29
## ctime10      0.000298   0.000353    0.84
## 
## Correlation of Fixed Effects:
##         (Intr) rl     bh    
## rl       0.237              
## bh       0.405  0.197       
## ctime10 -0.476 -0.053 -0.968
relia.c = get.reliabilites(iislopes.c)
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained



tetris5 = na.omit(tetris4)
tetris5[,c("eventbig.failure", "eventgameover", "eventsmall.failure", "eventsuccess")]= model.matrix(zygo ~ event,tetris5)[,-1]
(iislopes.z.dummy = lmer(zygo ~ rl + bh + ctime10 + eventbig.failure + eventgameover + eventsmall.failure + eventsuccess + (1 + rl + bh + ctime10 + eventbig.failure + eventgameover + eventsmall.failure + eventsuccess|vp),data=tetris5))
## caught warning: failure to converge in 10000 evaluations
## Linear mixed model fit by REML ['lmerMod']
## Formula: zygo ~ rl + bh + ctime10 + eventbig.failure + eventgameover +      eventsmall.failure + eventsuccess + (1 + rl + bh + ctime10 +      eventbig.failure + eventgameover + eventsmall.failure + eventsuccess |      vp) 
##    Data: tetris5 
## 
## REML criterion at convergence: 290406 
## 
## Random effects:
##  Groups   Name               Variance Std.Dev. Corr                       
##  vp       (Intercept)        1.36e+00 1.1649                              
##           rl                 3.95e-02 0.1988    0.711                     
##           bh                 3.73e-02 0.1931    0.497  0.562              
##           ctime10            9.62e-06 0.0031   -0.838 -0.680 -0.353       
##           eventbig.failure   3.49e+00 1.8669    0.273 -0.074  0.046 -0.128
##           eventgameover      3.76e+00 1.9398    0.269  0.270 -0.145 -0.109
##           eventsmall.failure 4.97e-01 0.7053   -0.220 -0.385 -0.357 -0.092
##           eventsuccess       4.85e-01 0.6964   -0.045  0.013 -0.178 -0.147
##  Residual                    6.33e-01 0.7957                              
##                      
##                      
##                      
##                      
##                      
##                      
##   0.184              
##   0.410 -0.150       
##   0.339  0.170  0.444
##                      
## Number of obs: 119532, groups: vp, 214
## 
## Fixed effects:
##                     Estimate Std. Error t value
## (Intercept)         0.133573   0.079942    1.67
## rl                 -0.003587   0.017052   -0.21
## bh                  0.089041   0.013424    6.63
## ctime10             0.000196   0.000215    0.91
## eventbig.failure    0.006914   0.158988    0.04
## eventgameover      -1.306790   0.142014   -9.20
## eventsmall.failure -0.285738   0.049315   -5.79
## eventsuccess       -0.341882   0.050415   -6.78
## 
## Correlation of Fixed Effects:
##             (Intr) rl     bh     ctim10 evntb. evntgm evnts.
## rl           0.564                                          
## bh           0.488  0.444                                   
## ctime10     -0.826 -0.537 -0.356                            
## eventbg.flr  0.214 -0.043  0.025 -0.103                     
## eventgamevr  0.246  0.201 -0.164 -0.096  0.157              
## evntsmll.fl -0.225 -0.300 -0.350 -0.104  0.338 -0.115       
## eventsuccss -0.054 -0.139 -0.167 -0.150  0.265  0.163  0.444
relia.z3 = get.reliabilites(iislopes.z.dummy)
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained


(iislopes.z.subset = lmer(zygo ~ rl + bh + ctime10 + eventgameover + (1 + rl + bh + ctime10 + eventgameover |vp),data=tetris5))
## Linear mixed model fit by REML ['lmerMod']
## Formula: zygo ~ rl + bh + ctime10 + eventgameover + (1 + rl + bh + ctime10 +      eventgameover | vp) 
##    Data: tetris5 
## 
## REML criterion at convergence: 295333 
## 
## Random effects:
##  Groups   Name          Variance Std.Dev. Corr                       
##  vp       (Intercept)   9.31e-02 0.30505                             
##           rl            4.14e-02 0.20337  -0.446                     
##           bh            1.42e-01 0.37618  -0.494  0.470              
##           ctime10       2.11e-06 0.00145  -0.336 -0.358 -0.214       
##           eventgameover 4.05e+00 2.01266  -0.004 -0.124 -0.059  0.407
##  Residual               6.70e-01 0.81868                             
## Number of obs: 119532, groups: vp, 214
## 
## Fixed effects:
##                Estimate Std. Error t value
## (Intercept)   -0.007346   0.021557   -0.34
## rl            -0.078917   0.014762   -5.35
## bh             0.081366   0.025822    3.15
## ctime10       -0.000193   0.000104   -1.87
## eventgameover -0.984288   0.146894   -6.70
## 
## Correlation of Fixed Effects:
##             (Intr) rl     bh     ctim10
## rl          -0.423                     
## bh          -0.476  0.447              
## ctime10     -0.354 -0.338 -0.220       
## eventgamevr -0.002 -0.116 -0.067  0.385
relia.z4 = get.reliabilites(iislopes.z.subset)
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

(iislopes.c.subset = lmer(corr ~ rl + bh + ctime10 + eventgameover + (1 + rl + bh + ctime10 + eventgameover |vp),data=tetris5))
## Linear mixed model fit by REML ['lmerMod']
## Formula: corr ~ rl + bh + ctime10 + eventgameover + (1 + rl + bh + ctime10 +      eventgameover | vp) 
##    Data: tetris5 
## 
## REML criterion at convergence: 142342 
## 
## Random effects:
##  Groups   Name          Variance Std.Dev. Corr                       
##  vp       (Intercept)   4.10e-01 0.64005                             
##           rl            6.80e-02 0.26067   0.772                     
##           bh            7.69e-03 0.08771   0.507  0.602              
##           ctime10       4.25e-06 0.00206  -0.824 -0.633 -0.709       
##           eventgameover 5.23e-01 0.72294   0.583  0.693  0.301 -0.503
##  Residual               1.86e-01 0.43095                             
## Number of obs: 119532, groups: vp, 214
## 
## Fixed effects:
##                Estimate Std. Error t value
## (Intercept)   -0.042353   0.043849   -0.97
## rl             0.041041   0.018028    2.28
## bh            -0.012039   0.006102   -1.97
## ctime10        0.000336   0.000142    2.37
## eventgameover -0.012516   0.053038   -0.24
## 
## Correlation of Fixed Effects:
##             (Intr) rl     bh     ctim10
## rl           0.760                     
## bh           0.497  0.589              
## ctime10     -0.821 -0.624 -0.705       
## eventgamevr  0.543  0.635  0.245 -0.457
relia.c4 = get.reliabilites(iislopes.c.subset)
## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained

## stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust
## this.

plot of chunk multilevel.var.explained



sapply(relia.z4,mean) # mean of reliabilities ZYGO 
##   (Intercept)            rl            bh       ctime10 eventgameover 
##      0.006771      0.021436      0.058774      0.979738      0.005926
sapply(relia.c4,mean) # mean of reliabilities CORR
##   (Intercept)            rl            bh       ctime10 eventgameover 
##      0.130364      0.041748      0.088193      0.973316      0.003303

library(QuantPsyc)
## Loading required package: boot
## Attaching package: 'boot'
## The following object(s) are masked from 'package:lattice':
## 
## melanoma
## The following object(s) are masked from 'package:psych':
## 
## logit
## The following object(s) are masked from 'package:survival':
## 
## aml
## Attaching package: 'QuantPsyc'
## The following object(s) are masked from 'package:Matrix':
## 
## norm
## The following object(s) are masked from 'package:base':
## 
## norm
slopes.z = as.data.frame(Make.Z(coef(iislopes.z.subset)$vp))
slopes.z$vp = rownames(slopes.z)
qplot(value,vp,data=melt(slopes.z,id="vp"),geom="text",label=vp) + facet_wrap(~ variable)

plot of chunk multilevel.var.explained

slopes.c = as.data.frame(Make.Z(coef(iislopes.c.subset)$vp))
slopes.c$vp = rownames(slopes.c)
qplot(value,vp,data=melt(slopes.c,id="vp"),geom="text",label=vp) + facet_wrap(~ variable)

plot of chunk multilevel.var.explained


slopes = merge(slopes.z,slopes.c,by="vp",suffixes=c("_zygo","_corr"))

write.table(slopes, dec=",", "tetris_slopes.csv", sep="\t",qmethod="double",na="99",row.names=F)
gc()
##            used  (Mb) gc trigger  (Mb) max used  (Mb)
## Ncells  1534539  82.0    2403845 128.4  2251281 120.3
## Vcells 44844325 342.2   66300163 505.9 66258782 505.6

Fan Poster

library(stringr)

ggplot(data=tetris3) +
    scale_x_continuous(limits=c(0,583)) +
    labs(title=str_c("Tetris")) + 
    stat_summary(aes(x=ctime10,y=activity,fill=muscle,alpha=0.2),geom="ribbon",fun.data="mean_sdl",mult=0.5)+
    stat_summary(aes(x=ctime10,y=activity,colour=muscle),geom="line",fun.data="mean_sdl")+
    scale_fill_manual(values=c("#DEDEDE","#31429C"))+
    scale_colour_manual(values=c('#000000','#4184BE'))
## Warning: Removed 2360 rows containing missing values (stat_summary).
## Warning: Removed 2360 rows containing missing values (stat_summary).

plot of chunk tetris.plot



ggplot(data=tetris3) +
    scale_x_continuous(limits=c(0,583)) +
    scale_y_continuous(limits=c(-1,12)) +
    labs(title=str_c("Tetris")) + 
    geom_rect(aes(fill=as.factor(event),xmin = ctime10,xmax=ctime10+1,ymax=12,ymin=12-(rl*2)-(bh/2),alpha=.5))  + 
    scale_fill_manual(values=c("#ffffff","#b34c55","#723B51","#b95B6a","#80A55F"))+
    geom_line(aes(x=ctime10,y=activity,colour=muscle))+
    scale_colour_manual(values=c('#000000','#4184BE'))+
    facet_wrap(~ vp)
## Warning: Removed 16 rows containing missing values (geom_path).
## Warning: Removed 32 rows containing missing values (geom_path).
## Warning: Removed 1122 rows containing missing values (geom_path).
## Warning: Removed 34 rows containing missing values (geom_path).
## Warning: Removed 60 rows containing missing values (geom_path).
## Warning: Removed 2 rows containing missing values (geom_path).
## Warning: Removed 40 rows containing missing values (geom_path).
## Warning: Removed 88 rows containing missing values (geom_path).
## Warning: Removed 1 rows containing missing values (geom_path).
## Warning: Removed 6 rows containing missing values (geom_path).
## Warning: Removed 1 rows containing missing values (geom_path).
## Warning: Removed 12 rows containing missing values (geom_path).
## Warning: Removed 1 rows containing missing values (geom_path).
## Warning: Removed 16 rows containing missing values (geom_path).
## Warning: Removed 60 rows containing missing values (geom_path).
## Warning: Removed 126 rows containing missing values (geom_path).
## Warning: Removed 136 rows containing missing values (geom_path).
## Warning: Removed 58 rows containing missing values (geom_path).
## Warning: Removed 56 rows containing missing values (geom_path).
## Warning: Removed 172 rows containing missing values (geom_path).
## Warning: Removed 1 rows containing missing values (geom_path).
## Warning: Removed 80 rows containing missing values (geom_path).
## Warning: Removed 140 rows containing missing values (geom_path).
## Warning: Removed 104 rows containing missing values (geom_path).

plot of chunk tetris.plot