Hello,

I am two-stage structural equation modelling to confirm the factorial structure of a scale I am using. I have conducted a meta analysis and have found nine relevant studies that have used that scale. I want to confirm whether the structure of the scale fits or not using meta analytic structural equation modelling. For doing this, I am using the two-stage approach (in metaSEM) package.

This first stage is working fine but I am getting an error in the second stage (i.e. tssem2). The code is presented below:

# Stage 2

#There are two observed variables (BO and STS) and one latent variable (CF)

```
dims <- c("BO", "STS", "CF")
mat<-matrix(rep(0, 3*3), nrow=3, ncol=3)
dimnames(mat)[[1]]<-dimnames(mat)[[2]]<-dims
mat
# A matrix
A <- matrix(c(0,0,"0.3*CF_BO",0,0,"0.3*CF_STS",0,0,0),nrow=3,ncol=3,byrow=TRUE)
dimnames(A)[[1]]<-dimnames(A)[[2]]<-dims
A
A<-as.mxMatrix(A)
# S matrix
Vars <- Diag(c("0.2*var_BO", "0.2*var_STS"))
Cors <- matrix(1,nrow=1,ncol=1)
S <- bdiagMat(list(Vars, Cors))
dimnames(S)[[1]] <- dimnames(S)[[2]] <- dims
S
S <- as.mxMatrix(S)
# F matrix
F <- Diag(c(1, 1, 0))
F <- F[1:2,]
dimnames(F)[[1]] <- dims[1:2]
dimnames(F)[[2]] <- dims
F
F <- as.mxMatrix(F)
cfa2 <- tssem2(cfa1, Amatrix = A, Smatrix = S, Fmatrix = F, diag.constraints = FALSE)
summary (cfa2)
# The error message I am getting is:
Error in if (pchisq(chi.squared, df = df, ncp = 0) >= upper) { :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In pchisq(tT, df = dfT, lower.tail = FALSE) : NaNs produced
2: In sqrt(max((tT - dfT)/(n - 1), 0)/dfT) : NaNs produced
3: In pchisq(chi.squared, df = df, ncp = 0) : NaNs produced
```

I would really appreciate some help.

Thank you

Jasmeet Singh