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

ModTwinMaRawCon.R | 10.52 KB |

Common Pathways - with age moderator.R | 19.27 KB |

Hello

I am wondering if it is possible to apply the age moderation script from Boulder (attached) to the Common Pathways model? I have tried to do it but end up with multiple problems (one of which is how to add an age moderation to the f component - but that is almost the least of my worries) - my attempt is also attached. Any help would be greatly appreciated.

Thank you in advance

Karen

... without C:/Users/karen.oakley/Dropbox/Analyses/DASS to test. Could you send it (or some dummy version thereof?

Hello Mike

Thank you so much for looking at this. Attached is a dummy data set and a revised script with a couple of changes I realised were needed.

Thank you

Karen

I fixed a few things and have it running. The key issue was around the size of the b matrix of regression parameters, which I figure needs to be nv x 2, so that b %*% rbind(Age,Age^2) ends up with dimensions nv x 1. This in turn needs to be transposed to be added to twin 1 and twin 2 expected (grand) means. Note that I figure you want different regression parameters on the Age and Age^2 covariates for each of the different variables (but the same for both twins).

The key to figuring this out was looking at the matrices it was having trouble getting to conform:

I also commented out some bits that weren't working - they were sort of post-processing things not necessary to fit the model and which would be more efficient to do with mxEval() calls after the model has been fitted.

Thank you so much for this, Mike

I have made a couple of further changes which I realized were needed, and still have some further questions which I would appreciate any assistance with.

In the standard Common Pathways model the variance for the latent variable is constrained to be 1. Where should this constraint be applied when including the age moderation? At the moment I have it placed at the latent and moderated latent path coefficients but I am not sure if this is correct. Also then when multiplying by age or age group, this means the total variance does not =1

Currently my f values (the path coefficients from the latent to each of the specific variables ) is negative – this is causing a bit of havoc when calculating the total variance- any ideas on what I am doing wrong???

Should the f value be age moderated? If so, how would it be best to do this?

Currently I am unable to calculate the means for each age group as they are non-conformable arrays – I just can’t work out how to get them to be conformable – any ideas? (currently hashed out – MI)

My specific variance for each age group is also coming out with non-conformable arrays. I have tried changing the matrix size of “Unit” but this is not fixing the problem – again any ideas?

I would be really grateful if the equations for the following could be checked:

a. Total estimate by age (stestbyAgetotal)

b. Estimates for the latent variable by age (stestByAgeCommon)

c. Estimates for the each specific variable by age (eg I currently have AsI/VsI – is VsI the correct denominator?) (stestbyAgeSpecific)

d. Estimates from the latent variable to each of the specific variables including the calculation of f1 (stestByAgefromcommontospecific)

Thank you so much in advance

With much gratitude

Karen