# Decomposed ACE variances...now trying to run regressions

Posted on

sppspp10
Joined: 02/05/2021

Forums

I am 100% new to twin data and OpenMx, and so far the tutorials and documentations have been **superbly** helpful!

I used this [genetic epi path specification annotated guide] (https://vipbg.vcu.edu/vipbg/OpenMx2/docs//OpenMx/latest/GeneticEpi_Path.html#ace-model-a-twin-analysis) to decompose the variances of ACE on a given phenotype (my DV).

I used this [genetic epi path specification annotated guide] (https://vipbg.vcu.edu/vipbg/OpenMx2/docs//OpenMx/latest/GeneticEpi_Path.html#ace-model-a-twin-analysis) to decompose the variances of ACE on a given phenotype (my DV).

Now, though, I need to run a regression and I can't figure out how to feed the ACE variances from above into the regressions. I assume I have to constrain the parameters somehow?

I have a categorical IV (an unshared environmental factor) ~ continuous Phenotype DV + covariates

And my research question is whether the E (unshared environmental factor) is significantly associated with the DV, after controlling for A and C confounders.

Is there any documentation I missed on this script?

Thank you so much for any help.

## You should post your script

I don't follow this part. In particular, I think you mean "continuous Phenotype DV ~ categorical IV (an unshared environmental factor) + covariates"? Also, what makes you so sure the IV is nonshared-environmental? How many categories does it have, and are they ordered?

Log in or register to post comments

## Script and clarification

Script is below, but so far it just includes the ACE variance breakdown. I do not understand how to write the regression script (which is where I am stuck). To clarify your

:

1. You are right, I meant that the continuous DV ~ categorical IV + covariates

2. The IV being non-shared is the crux of my research question. My research question asks if going outdoors into nature affects mental health. So, the behavior of going outside into nature (which may have some genetic influences, but is also the observed difference in unshared environmental, i.e. the behavior) is hypothesized to be associated with improved mental health (the phenotype DV).

3. The IV has 5 categories, ordered.

Any help feeding my ACE model summary into the regression model is needed.

`# Select Variables for Analysis`

selVars <- c('cohenpss_score_A','cohenpss_score_B') #Selecting these columns for analysis

aceVars <- c("A1","C1","E1","A2","C2","E2") #creating latent variables

# Select Data for Analysis: Creating two subsets for MZ and DZ to generate descriptive stats for each group type

mzData <- subset(df, zyg_A==1, selVars)

dzData <- subset(df, zyg_A==0, selVars)

# Generate Descriptive Statistics

colMeans(mzData,na.rm=TRUE) #mean ~11

colMeans(dzData,na.rm=TRUE)

cov(mzData,use="complete") #cov ~45

cov(dzData,use="complete")

# Path objects for Multiple Groups

manifestVars=selVars #Manifest = the Stress phenotype

latentVars=aceVars

# variances of latent variables

latVariances <- mxPath( from=aceVars, arrows=2,

free=FALSE, values=1 )

# means of latent variables... AND SPECIFYING SINGLE=HEADED ARROWS FROM TRIANGLE (WHICH IS FIXED AT 1) TO EACH OF THE LATENT VARIABLES, FIXED AT 0

latMeans <- mxPath( from="one", to=aceVars, arrows=1,

free=FALSE, values=0 )

# means of observed variables

obsMeans <- mxPath( from="one", to=selVars, arrows=1,

free=TRUE, values=10, labels="mean" ) #The mean cohen_pss_score is around 11

# path coefficients for twin 1

pathAceT1 <- mxPath( from=c("A1","C1","E1"), to="cohenpss_score_A", arrows=1,

free=TRUE, values=.5, label=c("a","c","e") )

# path coefficients for twin 2

pathAceT2 <- mxPath( from=c("A2","C2","E2"), to="cohenpss_score_B", arrows=1,

free=TRUE, values=.5, label=c("a","c","e") )

#The common environmental factors are the same for both twins (by definition), so setting the fixed correlation of 1 for C1 and C2

# covariance between C1 & C2

covC1C2 <- mxPath( from="C1", to="C2", arrows=2,

free=FALSE, values=1 )

# covariance between A1 & A2 in MZ twins

covA1A2_MZ <- mxPath( from="A1", to="A2", arrows=2,

free=FALSE, values=1 )

# covariance between A1 & A2 in DZ twins

covA1A2_DZ <- mxPath( from="A1", to="A2", arrows=2,

free=FALSE, values=.5 )

# Data objects for Multiple Groups

dataMZ <- mxData( observed=mzData, type="raw" )

dataDZ <- mxData( observed=dzData, type="raw" )

# Combine Groups

paths <- list( latVariances, latMeans, obsMeans,

pathAceT1, pathAceT2, covC1C2 )

modelMZ <- mxModel(model="MZ", type="RAM", manifestVars=selVars,

latentVars=aceVars, paths, covA1A2_MZ, dataMZ )

modelDZ <- mxModel(model="DZ", type="RAM", manifestVars=selVars,

latentVars=aceVars, paths, covA1A2_DZ, dataDZ )

obj <- mxFitFunctionMultigroup(c("MZ", "DZ"))

modelACE <- mxModel(model="ACE", modelMZ, modelDZ, obj )

`# Run Model`

fitACE <- mxRun(modelACE)

sumACE <- summary(fitACE)

```

Log in or register to post comments

## Let me be sure I understand.

Log in or register to post comments

In reply to Let me be sure I understand. by AdminRobK

## Correct

Log in or register to post comments

In reply to Correct by sppspp10

## OK, I have a quite clear idea

Are your covariates age and sex, perhaps?

Log in or register to post comments

## How about a simple bivariate

Subsequently you can observe the e cross path and do some testing with it. I.e. does model fit decrease significantly if you fix the path to zero?

Log in or register to post comments

In reply to How about a simple bivariate by Leo

## umxACEv instead of umxACE

Log in or register to post comments

## try this

Give the attached script a try. Obviously, I can't actually test it, since I don't have your dataset.

Note that there are alternate ways in which the location and scale of the latent liability underlying the ordinal IV could be identified.

Edit: my mistake--you'll need to use `latentVars=c(aceVars,dummyVars)` when you construct `modelMZ` and `modelDZ`.

Log in or register to post comments

In reply to try this by AdminRobK

## covariance not positive definite

Running ACE with 16 parameters

constraint-adjusted standard errors could not be calculated because the coefficient matrix of the quadratic form was uninvertibleIn model 'ACE' Optimizer returned a non-zero status code 10. Starting values are not feasible. Consider mxTryHard()Error: The job for model 'ACE' exited abnormally with the error message: fit is not finite (0: The continuous part of the model implied covariance (loc3) is not positive definite in data 'DZ.data' row 89. Detail:

covariance = matrix(c( # 6x6

0.7575, 0.37875, 0, 0, 0, 0

, 0.37875, 0.7575, 0, 0, 0, 0

, 0, 0, 0, 0, 0, 0

, 0, 0, 0, 0, 0, 0

, 0, 0, 0, 0, 0, 0

, 0, 0, 0, 0, 0, 0), byrow=TRUE, nrow=6, ncol=6)

1: The continuous part of the model implied covariance (loc3) is not positive definite in data 'DZ.data' row 82. Detail:

covariance = matrix(c( # 6x6

0.7575, 0.37875, 0, 0, 0, 0

, 0.37875, 0.7575, 0, 0, 0, 0

, 0, 0, 0, 0, 0, 0

, 0, 0, 0, 0, 0, 0

, 0, 0, 0, 0, 0, 0

, 0, 0, 0, 0, 0, 0), byrow=TRUE, nrow=6, ncol=6)

Log in or register to post comments

In reply to covariance not positive definite by sppspp10

## 6x6?

At any rate, it appears some paths that should be free are instead fixed to zero.

Log in or register to post comments

In reply to try this by AdminRobK

## Tried collapsing categories

Log in or register to post comments