An error in stage-1 for fixed model

3 replies [Last post]
Ryan's picture
Offline
Joined: 02/08/2014

Dear Mike,

I encounter a problem when trying the fixed model for stage 1. The error info is

"Error in if (!all(isPD)) stop(paste("Group ", (1:no.groups)[!isPD], " is not positive definite.", :
missing value where TRUE/FALSE needed".

The dataset is exactly the same one I used in random model. I tried "fixed1<-tssem1(my.df, n, method="FEM", no.string="NA")", and NA is the expression in my dataset for missing values, but metaSEM seems not to accept this argument.

Would you please provide any hints?

Thanks!

Ryan

Mike Cheung's picture
Offline
Joined: 10/08/2009
Dear Ryan, The tssem1() does

Dear Ryan,

The tssem1() does not accept no.string=”NA” as an argument because there is no such argument for tssem1(). See ?tssem1() for the accepted arguments.

When a random-effects model is used, the sample correlation matrices are treated as multivariate effect sizes (Cheung, 2014). The metaSEM package does not check whether or not the correlation matrices are positive definite. Moreover, missing values on any patterns of correlations are acceptable. For example, correlation between var1 and var2 is missing in the attached example. It works fine for REM. Therefore, the REM uses all available data.

However, it fails under the fixed-effects model. It is because, a multiple-group SEM is used under the fixed-effects model (Cheung & Chan, 2005). Most, if not all, SEM packages do not accept missing values in the sample correlation/covariance matrices in multiple-group analysis. We need to define either x3[1,1] or x3[2,2] as missing variables. Therefore, some correlation coefficients will be deleted in the analysis.

You may also read some relevant discussion at http://openmx.psyc.virginia.edu/thread/2360 .

Refereces
Cheung, M.W.-L. (2014). Fixed- and random-effects meta-analytic structural equation modeling: Examples and analyses in R. Behavior Research Methods, 46, 29-40.
Cheung, M.W.-L., & Chan, W. (2005). Meta-analytic structural equation modeling: A two-stage approach. Psychological Methods, 10, 40-64.

Regards,
Mike

================================================================
library(metaSEM)
## Loading required package: OpenMx

## Sample data
n <- c(100, 200, 300)
(x1 <- vec2symMat(c(1, 0.2, 0.3, 1, 0.4, 1)))
## [,1] [,2] [,3]
## [1,] 1.0 0.2 0.3
## [2,] 0.2 1.0 0.4
## [3,] 0.3 0.4 1.0
(x2 <- vec2symMat(c(1, 0.3, 0.4, 1, 0.3, 1)))
## [,1] [,2] [,3]
## [1,] 1.0 0.3 0.4
## [2,] 0.3 1.0 0.3
## [3,] 0.4 0.3 1.0

## Missing correlation
(x3 <- vec2symMat(c(1, NA, 0.35, 1, 0.2, 1)))
## [,1] [,2] [,3]
## [1,] 1.00 NA 0.35
## [2,] NA 1.0 0.20
## [3,] 0.35 0.2 1.00
my.df1 <- list(x1, x2, x3)

## Work fine
summary(tssem1(my.df1, n, method = "REM", RE.type = "Diag"))
## Running TSSEM1 (Random Effects Model) Analysis of Correlation Matrix
##
## Call:
## meta(y = ES, v = acovR, RE.constraints = Diag(x = paste(RE.startvalues,
## "*Tau2_", 1:no.es, "_", 1:no.es, sep = "")), RE.lbound = RE.lbound,
## I2 = I2, model.name = model.name, suppressWarnings = TRUE)
##
## 95% confidence intervals: z statistic approximation
## Coefficients:
## Estimate Std.Error lbound ubound z value Pr(>|z|)
## Intercept1 2.59e-01 4.87e-02 1.63e-01 3.54e-01 5.31 1.1e-07 ***
## Intercept2 3.58e-01 3.54e-02 2.89e-01 4.28e-01 10.13 < 2e-16 ***
## Intercept3 2.79e-01 4.88e-02 1.84e-01 3.75e-01 5.73 1.0e-08 ***
## Tau2_1_1 1.00e-10 NA NA NA NA NA
## Tau2_2_2 1.00e-10 NA NA NA NA NA
## Tau2_3_3 2.00e-03 5.73e-03 -9.23e-03 1.32e-02 0.35 0.73
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Q statistic on the homogeneity of effect sizes: 6.115
## Degrees of freedom of the Q statistic: 5
## P value of the Q statistic: 0.2952
## Heterogeneity indices (based on the estimated Tau2):
## Estimate
## Intercept1: I2 (Q statistic) 0.00
## Intercept2: I2 (Q statistic) 0.00
## Intercept3: I2 (Q statistic) 0.31
##
## Number of studies (or clusters): 3
## Number of observed statistics: 8
## Number of estimated parameters: 6
## Degrees of freedom: 2
## -2 log likelihood: -22.58
## OpenMx status1: 0 ("0" or "1": The optimization is considered fine.
## Other values indicate problems.)

## Not work
tssem1(my.df1, n, method = "FEM")
## Error: missing value where TRUE/FALSE needed

## Declare either x3[1,1] or x3[2,2] as missing variable
x3[1, 1] <- NA
my.df2 <- list(x1, x2, x3)

## Work fine
summary(tssem1(my.df2, n, method = "REM", RE.type = "Diag"))
## Running TSSEM1 (Random Effects Model) Analysis of Correlation Matrix
##
## Call:
## meta(y = ES, v = acovR, RE.constraints = Diag(x = paste(RE.startvalues,
## "*Tau2_", 1:no.es, "_", 1:no.es, sep = "")), RE.lbound = RE.lbound,
## I2 = I2, model.name = model.name, suppressWarnings = TRUE)
##
## 95% confidence intervals: z statistic approximation
## Coefficients:
## Estimate Std.Error lbound ubound z value Pr(>|z|)
## Intercept1 2.61e-01 5.01e-02 1.63e-01 3.60e-01 5.21 1.9e-07 ***
## Intercept2 3.68e-01 4.75e-02 2.75e-01 4.61e-01 7.74 1.0e-14 ***
## Intercept3 2.81e-01 4.94e-02 1.84e-01 3.78e-01 5.69 1.3e-08 ***
## Tau2_1_1 1.00e-10 NA NA NA NA NA
## Tau2_2_2 1.00e-10 NA NA NA NA NA
## Tau2_3_3 2.08e-03 5.78e-03 -9.25e-03 1.34e-02 0.36 0.72
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Q statistic on the homogeneity of effect sizes: 6.058
## Degrees of freedom of the Q statistic: 4
## P value of the Q statistic: 0.1949
## Heterogeneity indices (based on the estimated Tau2):
## Estimate
## Intercept1: I2 (Q statistic) 0.00
## Intercept2: I2 (Q statistic) 0.00
## Intercept3: I2 (Q statistic) 0.32
##
## Number of studies (or clusters): 3
## Number of observed statistics: 7
## Number of estimated parameters: 6
## Degrees of freedom: 1
## -2 log likelihood: -18.53
## OpenMx status1: 0 ("0" or "1": The optimization is considered fine.
## Other values indicate problems.)

## Work fine
summary(tssem1(my.df2, n, method = "FEM"))
## Running TSSEM1 Analysis of Correlation Matrix
##
## Call:
## tssem1FEM(my.df = my.df, n = n, cor.analysis = cor.analysis,
## model.name = model.name, cluster = cluster, suppressWarnings = suppressWarnings)
##
## Coefficients:
## Estimate Std.Error z value Pr(>|z|)
## S[1,2] 0.2457 0.0529 4.64 3.4e-06 ***
## S[1,3] 0.3552 0.0500 7.10 1.2e-12 ***
## S[2,3] 0.2677 0.0381 7.02 2.2e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Goodness-of-fit indices:
## Value
## Sample size 600.00
## Chi-square of target model 6.15
## DF of target model 4.00
## p value of target model 0.19
## Chi-square of independence model 101.72
## DF of independence model 7.00
## RMSEA 0.05
## SRMR 0.07
## TLI 0.96
## CFI 0.98
## AIC -1.85
## BIC -19.43
## OpenMx status1: 0 ("0" or "1": The optimization is considered fine.
## Other values indicate problems.)

Ryan's picture
Offline
Joined: 02/08/2014
Appreciate!!!

Dear Mike,

Thanks for your nice response!

I see what you mean: I need to declare all missing variables in each matrix individually, before running "fixed" model and pooling the correlation matrices.

Thanks!

Ryan
p.s., I did try "LB" for R=5000, but didn't get "standard error", probably due to using Mac. I am trying that again with a PC.

Mike Cheung's picture
Offline
Joined: 10/08/2009
Dear Ryan, You cannot get the

Dear Ryan,

You cannot get the SEs from the PC neither.

"When diag.constraints=TRUE, nonlinear constraints are imposed to ensure that the model implied matrix is a correlation matrix. OpenMx does not report the standard errors (SEs) when there are nonlinear constraints." You may refer to the original thread at http://openmx.psyc.virginia.edu/thread/2715

You may use ?mxCI in OpenMx to get the document about the likelihood-based CI.

Regards,
Mike