dta2<-read.table("C:/Users/ASUS/Desktop/data/reading_piat.txt",header=T)
head(dta2)
## ID Wave Age_G Age PIAT
## 1 1 1 6.5 6.0000 18
## 2 1 2 8.5 8.3333 35
## 3 1 3 10.5 10.3333 59
## 4 2 1 6.5 6.0000 18
## 5 2 2 8.5 8.5000 25
## 6 2 3 10.5 10.5833 28
dta2 $ ID <- factor(dta2$ID)
dta2$Wave <- factor(dta2$Wave)
dta2$Age6.5 = dta2$Age -6.5
str(dta2)
## 'data.frame': 267 obs. of 6 variables:
## $ ID : Factor w/ 89 levels "1","2","3","4",..: 1 1 1 2 2 2 3 3 3 4 ...
## $ Wave : Factor w/ 3 levels "1","2","3": 1 2 3 1 2 3 1 2 3 1 ...
## $ Age_G : num 6.5 8.5 10.5 6.5 8.5 10.5 6.5 8.5 10.5 6.5 ...
## $ Age : num 6 8.33 10.33 6 8.5 ...
## $ PIAT : int 18 35 59 18 25 28 18 23 32 18 ...
## $ Age6.5: num -0.5 1.83 3.83 -0.5 2 ...
Performing analysis for the following model:
Scoreij = b0i + b1i × (ageij - 6.5) + εij,
b0i = β0i + U0i,
b1i = β1i + U1i, i = 1, 2, …, 89; i=ID, j = 1, 2, 3 (wave)
library(lme4)
## Loading required package: Matrix
m0 <- lmer(PIAT ~ ( 1 |ID)+ (Age6.5|Wave), dta2)
## boundary (singular) fit: see ?isSingular
summary(m0)
## Linear mixed model fit by REML ['lmerMod']
## Formula: PIAT ~ (1 | ID) + (Age6.5 | Wave)
## Data: dta2
##
## REML criterion at convergence: 1870.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.04900 -0.57962 -0.05358 0.56617 2.89698
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## ID (Intercept) 26.84 5.181
## Wave (Intercept) 187.92 13.708
## Age6.5 21.22 4.607 -1.00
## Residual 44.18 6.647
## Number of obs: 267, groups: ID, 89; Wave, 3
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 35.233 1.363 25.84
## convergence code: 0
## boundary (singular) fit: see ?isSingular