Published on *OpenMx* (http://openmx.psyc.virginia.edu)

By *iloo*

Created *10/04/2013 - 02:20*

Fri, 10/04/2013 - 02:20 — iloo [1]

So nothing has ahppened with the regression coefficients. This is true on my Windows machine, as well as on my Linux server. To make things even more complicated, this happen when changing the number of thresds used for fitting model:

I.e. the result seems to be correct when stating the use of an even number of threads, but not when using an odd number of threads! To make things even more confusing, this is true on the Linux server (where the number of threads actually is changed) as well as on Windows (where only one thread is used).

I've noticed this a while ago but forgot to post it to you developers.

Something goes wrong when you include definition variables in a model where both continuous and categorical variables are included, and use the definition variables for regression on the mean. For example running this code yields on my machine:

library(OpenMx) N <- 2000 u <- rbinom(N,1,.5) x <- .5*u+rnorm(N) y <- mxFactor( rbinom(N,1,pnorm(-2+u)) , levels=c(0,1) ) model <- mxModel( 'BinCont', mxMatrix('Full',nrow=1,ncol=2,free=c(T,T),name='Betas'), mxMatrix('Full',nrow=1,ncol=1,free=F,label='data.u',name='U'), mxMatrix('Full',nrow=1,ncol=2,free=c(T,F),name='Means'), mxAlgebra( Means + Betas%x%U , name='eMean'), mxMatrix('Full',nrow=1,ncol=1,free=T,name='Thresh'), mxMatrix('Symm',nrow=2,ncol=2,free=c(T,T,F),values=c(1,0,1),name='Cov'), mxData( data.frame(x,y,u) , type='raw'), mxFIMLObjective( means='eMean', covariance='Cov',thresholds='Thresh',threshnames='y',dimnames=c('x','y') ) ) mxRun( model )@output$estimate[1:2] > mxRun( model )@output$estimate[1:2] Running BinCont BinCont.Betas[1,1] BinCont.Betas[1,2] 0.1 0.1

So nothing has ahppened with the regression coefficients. This is true on my Windows machine, as well as on my Linux server. To make things even more complicated, this happen when changing the number of thresds used for fitting model:

> mxOption( NULL , 'Number of Threads' , 2) > mxRun( model )@output$estimate[1:2] Running BinCont BinCont.Betas[1,1] BinCont.Betas[1,2] 0.5015814 0.9228213 > mxOption( NULL , 'Number of Threads' , 3) > mxRun( model )@output$estimate[1:2] Running BinCont BinCont.Betas[1,1] BinCont.Betas[1,2] 1.1945377 0.5031962 > mxOption( NULL , 'Number of Threads' , 4) > mxRun( model )@output$estimate[1:2] Running BinCont BinCont.Betas[1,1] BinCont.Betas[1,2] 0.5015814 0.9228213

I.e. the result seems to be correct when stating the use of an even number of threads, but not when using an odd number of threads! To make things even more confusing, this is true on the Linux server (where the number of threads actually is changed) as well as on Windows (where only one thread is used).

Am I doing something wrong? Is the use of FIMLObjective causing something of this?

**Links:**

[1] http://openmx.psyc.virginia.edu/users/iloo

[2] http://openmx.psyc.virginia.edu/thread/2631

[3] http://openmx.psyc.virginia.edu/forums/opensem-forums/categorical-outcomes