You are here

multi-group WLS

8 posts / 0 new
Last post
pascofearon's picture
Offline
Joined: 05/07/2013 - 10:57
multi-group WLS
AttachmentSize
Binary Data Lavaan twin modelling[1].R1.51 KB

Hi Mike,
Hope this finds you well. I'm trying to run a multi-group SEM (twin data) using summary statistics rather than raw data. I have the covariance and asymptotic covariance matrices. I think I'm hitting errors in the way I'm handling the multi-group aspect - as WLS says the following:

Error in withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning")) :
(list) object cannot be coerced to type 'double'

I've supplied the two matrices as lists - one for each group. The script is attached.

I also get this message:

In addition: Warning message:
In if (is.pd(Cov)) { :
the condition has length > 1 and only the first element will be used

Any help much appreciated as always!

Best,

Pasco

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Dear Pasco,

Dear Pasco,

Attached is the code for your model.
You may note that the SEs in lavaan are different than those in OpenMx as the precision of the inputs is different in these two cases.

Best,
Mike

File attachments: 
pascofearon's picture
Offline
Joined: 05/07/2013 - 10:57
Multi-group WLS

Thanks so much Mike - that's fantastic. I was quite far off in my attempt here!

All best,

Pasco

pascofearon's picture
Offline
Joined: 05/07/2013 - 10:57
WLS follow-up

Hi Mike,
I have a follow-up query about this - the model runs perfectly with your edits, and returns sensible looking parameter estimates and standard errors. However, when I add a request for confidence intervals I get very strange estimates. I'm not sure if my code is wrong, or there is a more fundamental issue with the likelihood-based intervals. The adjusted part of the code was just:

ace <- mxModel('All', gp1, gp2,
mxFitFunctionMultigroup(c('gp1.fitfunction', 'gp2.fitfunction')), mxCI(c('gp1.Amatrix'), interval = 0.95, type=c('both')))
fit1 <- mxRun(ace, intervals = TRUE)

Thanks for any help, as always!

Best,

Pasco

Mike Cheung's picture
Offline
Joined: 10/08/2009 - 22:37
Dear Pasco,

Dear Pasco,

The parameter estimates with the LBCI are the same as those without the LBCI.

The model without the LBCI:

free parameters:
  name      matrix row col   Estimate Std.Error A
1    a gp1.Amatrix  P1  A1 0.87909044  0.110115  
2    c gp1.Amatrix  P1  C1 0.02645751  2.585079 

The model with the LBCI:

free parameters:
  name      matrix row col   Estimate Std.Error A
1    a gp1.Amatrix  P1  A1 0.87909044  0.110115  
2    c gp1.Amatrix  P1  C1 0.02645751  2.585079  
 
confidence intervals:
      lbound   estimate    ubound note
a -0.9487976 0.87909044 0.9488027     
c -0.5184616 0.02645751 0.5184611     

Could you tell us what the issues are?

Best,
Mike

pascofearon's picture
Offline
Joined: 05/07/2013 - 10:57
Hi Mike,

Hi Mike,
Yes the estimates are fine, but it's the CIs - they run almost from -1 to 1 (for a).

Best,

Pasco

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
sign indeterminacy?

I bet some of your free parameters are sign-indeterminate.

pascofearon's picture
Offline
Joined: 05/07/2013 - 10:57
Ahhh, of course - thanks,

Ahhh, of course - thanks, that's likely it!