# Confirmatory Factor Analysis

3 posts / 0 new
Offline
Joined: 12/08/2020 - 03:09
Confirmatory Factor Analysis
AttachmentSize
26 bytes
26 bytes

Hello,

I am conducting a meta-analytic study to confirm the factorial structure of a scale using two-stage structural equation modelling.
The scale is having two subscales namely, burnout (BO) and secondary traumatic stress (STS), which load on a latent factor called "Compassion Fatigue". I want to confirm its factorial structure by meta-analysing the correlation coefficients across nine studies identified in the literature. The code I have written works fine for the first stage (TSSEM1) but it is showing an error for the second stage (TSSEM2).

I would really appreciate if you could take a look at the code and pinpoint a mistake that is causing the error. I have attached two .csv files for your reference.

Thank you

Kind regards,
Jasmeet Singh

The code I have written is stated below:

# Converting correlation tables into matrices

mat1 <- as.matrix(CF1)
mat2 <- as.matrix(CF2)

dimnames(mat1)[[1]] <- dimnames(mat1)[[2]] <- c("BO", "STS")
dimnames(mat2)[[1]] <- dimnames(mat2)[[2]] <- c("BO", "STS")

# Converting matrices into a list

matrix.list <- list(mat1, mat2)
names(matrix.list) <- c("Sodeke-Gregson et al., 2013", "Deighton et al., 2007")
n <- c(253,100)
all.data <- list(matrix.list, n)

# Stage 1

library(metaSEM)

cfa1 <- tssem1(all.data[[1]], all.data[[2]], method="REM", RE.type = "Diag")
summary(cfa1)

# 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.3CF_BO",0,0,"0.3CF_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.2var_BO", "0.2var_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
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

Offline
Joined: 10/08/2009 - 22:37
Hi Jasmeet,

Hi Jasmeet,

There were 2 errors. The first one was syntactic. An * was missing in the model specification.

A <- matrix(c(0,0,"0.3*CF",0,0,"0.3*CF",0,0,0),nrow=3,ncol=3,byrow=TRUE)
Vars <- Diag(c("0.2*var_BO", "0.2*var_STS"))

Note. I cannot say whether it is meaningful to conduct a meta-analysis with only 2 studies. I will leave it to your justifications.

Best,
Mike

File attachments:
Offline
Joined: 12/08/2020 - 03:09
Hello Mike,

Hello Mike,

Thank you very much for reviewing the code. I have actually identified nine studies but I didn't share all with you because I thought that it might be a bit extra. I got your point regarding estimating two factor loadings using a single coefficient. I think it would produce a just-identified model that's why the Chi-Square value is 0.00.

Apart from all this, I really appreciate your help.

Kind regards,
Jasmeet Singh