Wed, 08/13/2014 - 05:00

Hi,

I am conducting a trivariate twin analysis and after running ACE model my estimates of C for males are significant for phenotypes 1 and 3 but not significant for phenotype 2. AE model results in significant worsening of the goodness of fit.

I have run ACE model with c21, c22 and c32 fixed to 0 using the attached script.

Is that correct way of doing it or is there another way?

Any comments will be appreciated

Many thanks!

Attachment | Size |
---|---|

Ace.R | 13.87 KB |

I assume you're trying to fit a model with the influence of C on phenotype #2 set to zero, correct? Here's what I get when I inspect your mxMatrix

`pathCm`

:From the way you have the matrix labeled, you would want to set c21 and c31 to zero, since those would be the two paths that go from a latent C variable to phenotype #2 in the Cholesky factorization. More than likely, you wanted to define your path matrices with argument

`byrow=TRUE`

, for example,Then, the labeling and start values look a lot more sensible:

With

`byrow=TRUE`

, you would instead fix c21 and c22 to zero.Yes that is correct. They look more sensible, thank you!

I've made a mistake there because I was trying to free the significant parameters but not those set to zero, therefore:

CholAceModel <- omxSetParameters(CholAceModel, labels=c("c21m","c22m","c32m"), free=F, values = c( 0, 0, 0) )

CholAceModel <- omxSetParameters(CholAceModel, labels=c("c11m","c31m","c33m"), free=T, values =c(1, .8, 1 ))

Can they stay free when you fix them to zero?

I think in this case you need to fix 3,2 to zero. If the second Cholesky factor does not affect the second phenotype (2,2 is fixed) then Cholesky factors 2 and 3 only do one thing, affect phenotype 3. So the model would be under identified unless you fix 3,2 as well. What you have:

is correct. I'm not sure if this is what you went with in the end.

Oops. You are correct that it's necessary to also fix 3,2 to zero for the sake of identification. My mistake.

I went with that first but Rob, in the comment above, pointed out that it gives me a wrong matrix.

Ended up specifying path by path:

CholAceModel <- omxSetParameters(CholAceModel, labels="c11m", free=T, values = 1)

CholAceModel <- omxSetParameters(CholAceModel, labels="c21m", free=F, values = 0)

CholAceModel <- omxSetParameters(CholAceModel, labels="c22m", free=F, values = 0)

CholAceModel <- omxSetParameters(CholAceModel, labels="c31m", free=T, values = .8)

CholAceModel <- omxSetParameters(CholAceModel, labels="c32m", free=F, values = 0)

CholAceModel <- omxSetParameters(CholAceModel, labels="c33m", free=T, values = 1)

which gives me the following:

@labels

[,1] [,2] [,3]

[1,] "c11m" NA NA

[2,] "c21m" "c22m" NA

[3,] "c31m" "c32m" "c33m"

@values

[,1] [,2] [,3]

[1,] 1.0 0 0

[2,] 0.0 0 0

[3,] 0.8 0 1

@free

[,1] [,2] [,3]

[1,] TRUE FALSE FALSE

[2,] TRUE TRUE FALSE

[3,] TRUE TRUE TRUE

@lbound: No lower bounds assigned.

@ubound: No upper bounds assigned.

The values for C estimates that I am getting now are not significant though, so not sure if that is correct?

Many thanks!

Your output is censored a little: you say

@free

T F F

T T F

T T T

but that doesn't show the matrix name. What do you see if you ask for:

yourModel$matrixName$free

???

Also ensure you are not getting errors in between the setparameter statements. really, a list of labels you want to fix should work fine, and most are in the state you want anyhow.

($ assumes you're using the 2.0 beta, if not replace $ with @ )

PS: umxLabel() is a massive help for stuff like this. It will label matrices of any type correctly (also labels all the paths of RAM models.

The labels are "rn_cn", i.e., for a matrix "A", cell [1,1] is labeled "A_r1c1"

This makes it fool-proof to get and set parameters by label, and removes dozens of error prone lines of code from scripts.

Also names RAM paths as "var_to_var" and "var_with_var", so "extraversion_to_depression" etc.

Given a matrix model, it will dig inside and label all your matrices in one hit.

grab it as

The labels & values look as I would expect. The free matrix does not. Elements 2,1 2,2 and 3,2 should be FALSE, should they not?

Yes they should be FALSE but for some reason they are still free.

Any suggestions how to change that?

What are you typing at the R prompt to see this?:

If you're inspecting

`pathCm`

, then the changes you made with`omxSetParameters()`

won't be reflected there. That's because your`omxSetParameters()`

statements act upon the parameters in`CholAceModel`

, not on those in`pathCm`

. To see the matrix of C paths for males in`CholAceModel`

, you'd type something like`CholAceModel$MZMmodel.cm`

. You can also try`omxGetParameters(CholAceModel)`

, which by default returns the values offree parameters onlyfrom the given MxModel.I was indeed inspecting the wrong matrix.

Thank you for your comments!