Loading packages
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
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.0.0 ✔ readr 1.1.1
## ✔ tibble 1.4.2 ✔ purrr 0.2.5
## ✔ tidyr 0.8.1 ✔ stringr 1.3.1
## ✔ ggplot2 3.0.0 ✔ forcats 0.3.0
## ── Conflicts ────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(lme4)
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
##
## expand
library(lmerTest)
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
library(sjstats)
library(sjPlot)
## #refugeeswelcome
library(jmRtools)
library(MuMIn)
library(konfound)
## Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
## For more information visit https://jmichaelrosenberg.shinyapps.io/shinykonfound/.
library(haven)
Loading data
Anna_Practicum <- read_sav("PRACTICUM MASTER LONG.sav")
Predicting SI
M1<-lmer(SI_comp ~ Day +
cond +
Day*cond +
T1PIcomp +
T1AUTcomp +
(1|StudyID) + (1|Day), data = Anna_Practicum)
summary(M1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: SI_comp ~ Day + cond + Day * cond + T1PIcomp + T1AUTcomp + (1 |
## StudyID) + (1 | Day)
## Data: Anna_Practicum
##
## REML criterion at convergence: 1815.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -4.4154 -0.5236 0.0614 0.5457 3.9219
##
## Random effects:
## Groups Name Variance Std.Dev.
## StudyID (Intercept) 0.362011 0.60167
## Day (Intercept) 0.004259 0.06526
## Residual 0.370687 0.60884
## Number of obs: 832, groups: StudyID, 129; Day, 8
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.733323 0.350856 139.203778 4.940 2.2e-06 ***
## Day -0.075497 0.021995 20.404340 -3.432 0.002579 **
## cond 0.001341 0.151388 275.375786 0.009 0.992941
## T1PIcomp 0.269479 0.071607 125.282999 3.763 0.000256 ***
## T1AUTcomp 0.252415 0.067992 124.838372 3.712 0.000308 ***
## Day:cond 0.066307 0.022311 705.084024 2.972 0.003060 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) Day cond T1PIcm T1AUTc
## Day -0.252
## cond -0.238 0.414
## T1PIcomp -0.543 -0.003 0.065
## T1AUTcomp -0.558 0.006 -0.129 -0.290
## Day:cond 0.179 -0.703 -0.584 0.003 -0.006
ranova(M1)
## ANOVA-like table for random-effects: Single term deletions
##
## Model:
## SI_comp ~ Day + cond + T1PIcomp + T1AUTcomp + (1 | StudyID) +
## (1 | Day) + Day:cond
## npar logLik AIC LRT Df Pr(>Chisq)
## <none> 9 -907.68 1833.4
## (1 | StudyID) 8 -1062.68 2141.4 309.996 1 <2e-16 ***
## (1 | Day) 8 -908.97 1833.9 2.572 1 0.1088
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
sjstats::icc(M1)
##
## Linear mixed model
##
## Family : gaussian (identity)
## Formula: SI_comp ~ Day + cond + Day * cond + T1PIcomp + T1AUTcomp + (1 | StudyID) + (1 | Day)
##
## ICC (StudyID): 0.4912
## ICC (Day): 0.0058
#sjPlot::sjp.int(M1, type = "eff")
#konfound::konfound(M33, interest_c)
#konfound::konfound(M33, ch_time)
#konfound::konfound(M33, female)
#M33r<-r2glmm::r2beta(M33, method = "nsj")
#M33r
#MuMIn::r.squaredGLMM(M33)
#plot(M33r)