Learn R Programming

metaSEM (version 2.0)

Roorda11: Studies on Students' School Engagement and Achievement Reported by Roorda et al. (2011)

Description

The data set includes 45 studies on the influence of affective teacher-student relationships on students' school engagement and achievement reported by Roorda et al. (2011).

Arguments

Details

The variables are:

data

A list of 45 studies of correlation matrices. The variables are pos (positive teacher-student relations), neg (negative teacher-student relations), enga (student engagement), and achiev (student achievement).

n

A vector of sample sizes

SES

A vector of average socio-economic status (SES) of the samples

References

Jak, S., & Cheung, M. W.-L. (2018). Addressing heterogeneity in meta-analytic structural equation modeling using subgroup analysis. Behavior Research Methods, 50, 1359-1373.

Examples

Run this code

# \donttest{

## These are correlation matrices; set a missing diagonal to 1 when the
## corresponding variable has a reported correlation.
roorda_cor <- lapply(Roorda11$data, function(S) {
  observed <- vapply(seq_len(nrow(S)), function(i) any(!is.na(S[i, -i])), logical(1))
  d <- diag(S)
  d[is.na(d) & observed] <- 1
  diag(S) <- d
  S
})
## Random-effects model: First stage analysis
random1 <- tssem1(Cov = roorda_cor, n = Roorda11$n, method = "REM",
                  RE.type = "Diag")
summary(random1)

## Model specification in lavaan syntax
model <- "## Regression paths
          enga ~ b31*pos + b32*neg
          achiev ~ b43*enga
          ## Variances of pos and neg are fixed at 1
          pos ~~ 1*pos
          neg ~~ 1*neg
          ## Correlation between pos and neg
          pos ~~ p21*neg
          ## Error variances
          enga ~~ p33*enga
          achiev ~~ p44*achiev"

RAM <- lavaan2RAM(model, obs.variables=c("pos", "neg", "enga", "achiev"))
RAM

## ## Equivalent RAM specification using create.mxMatrix()
## varnames <- c("pos", "neg", "enga", "achiev")
## A <- create.mxMatrix(c(0,0,0,0,
##                        0,0,0,0,
##                        "0.1*b31","0.1*b32",0,0,
##                        0,0,"0.1*b43",0),
##                      type = "Full", nrow = 4, ncol = 4, byrow = TRUE,
##                      name = "A", as.mxMatrix = FALSE)
## dimnames(A) <- list(varnames, varnames)
## A
##
## S <- create.mxMatrix(c(1,
##                        ".5*p21",1,
##                        0,0,"0.6*p33",
##                        0,0,0,"0.6*p44"),
##                      type="Symm", byrow = TRUE,
##                      name="S", as.mxMatrix = FALSE)
## dimnames(S) <- list(varnames, varnames)
## S

## Random-effects model: Second stage analysis
## Calculate dependent-variable residual variances implicitly.
random2 <- tssem2(random1, RAM=RAM, diag.constraints=FALSE,
                  intervals.type="LB")
summary(random2)

## Display the model with the parameter estimates    
plot(random2)
# }

Run the code above in your browser using DataLab