Hi All-

I am new to OpenMx with some experience with biological path analysis using AMOS. I want to create a starting model (with all possible biological meaningful paths set as optional) and have OpenMx permute the model to test all possible combinations of optional paths. Then I will use one of the test statistics to select my final model for testing with independent data sets. I have been looking over the tutorials but have no idea where to even begin (i.e. which models,e ct.). If anyone could point me into the correct direction it would be greatly appreciated.

Best~

mrubin

Are you thinking about modification indexes/indices?

http://openmx.psyc.virginia.edu/thread/1019

Hello and welcome!

While I'm not sure what the range of biological meaningful models is, what you're discussing seems to be very possible with OpenMx and R. The documentation chapters on multiple regression using either paths (http://openmx.psyc.virginia.edu/docs/OpenMx/latest/Regression_Path.html) or matrices (http://openmx.psyc.virginia.edu/docs/OpenMx/latest/Regression_Matrix.html) should be good places to start to learn about the path modeling capabilities of OpenMx. There are companion demo scripts already built into R; just type 'demo()' to see a list of script demos in all of the libraries you have loaded (they won't all be OpenMx demos), then something like 'demo(MultipleRegression_PathRaw)' to run any particular demo. Feel free to ask the forums for help on this.

Once you have built your starting model, you'll want to systematically edit your saturated model to change various parameters. You can look to the documentation chapter on mixture models for a little help on this, as that chapter makes a bunch of copies of a template model, then edits those copies to fit different models or change starting values. The 'omxSetParameters()' function takes a model and a list of names parameters (please name your free parameters, it'll make editing the template much easier) and allows you to change and edit those parameters to make new models.

Hopefully that will get you started, and let us know how we can help!

ryne

Thanks for the suggestions Ryne, I will start with these tutorials today. The range of biologically meaningful models is likely to be very high for this project. Is is possible for R to automatically test all possible models given a starting model with all optional paths?

Best~

M

Sure. I can be more specific with how to implement if you tell me more about your data, your "all possible" model and how much sophistication you want to/can include in your R scripts.

General workflow will go like this:

-Make template/"all possible paths" model. Store this in an object.

-Decide on what other models you'd like to test.

-Build a loop, lapply or other method to copy and edit your template once for every model to be fitted.

-Run the models, preferably by including them all in one giant container/holder model and run them all in parallel on a machine with a few cores.

Write some amount of code to let us know what you're trying to do and we'll help you fix it.

Thanks Ryne- I will put together what I can, which will be rough. Can I email it to you? This is data that has not yet been published, so I would rather not post my data sets online.

Thanks for all your help!

Best~

Matthew

Hi Ryne-

Below is my code and I have attached my data file. The code is rough and I still do not really know what I am doing or what functions I should be running. I am going to outline, what I am trying to do in works since there will likely be no way you will get it from my code:

The data file contains geneotypic means for 82 genotypes and 4 traits of interest: Period, Phase, tGR1 and Rel Lifespan. The saturated model (starting model) should have arrow from Period to Rel Lifespan, Period to tGR1, Phase to Rel Lifespan, Phase to tGR1 and tGR1 to Rel Lifespan. All traits should also have an error term assoicates with then (I think this is mxPath, from=trait, arrow=2 in OpenMx). All arrows are free or optional, meaning that they can be included or dropped from the model. Starting with the saturated model, I want to test every possible combination of the optional arrows and save the Information Criteria for each model to a file that I can later sort on whichever paramater I choose for model selection. This model testing step needs to be automated and have the ability to be spread across a cluster. This current model will run quickly but the upcomming models have upwards of 20 variables which will result in a vary large number of possible models to test.

Also, here are some other questions that I have:

Period and Phase are highly correlated in this data set, so I put a doule-sided arrow connecting them (this is what I would do in AMOS but I am not sure what to do in OpenMx).

I am not sure what to do with traits that may reciprically effect each other, i.e. Period may effect tGR1 and tGR1 may effect Period. I would think that I should put a single-headed arrow in both directions and allow them to be dropped systimatically in and out of the model but again I am not sure.

Also, I am not sure as mentioned above what higher level function I shouls be using (i.e. factor Model vs others). I would love your suggestions on this given my model description above.

Thanks for all your help Ryne!

Best~

mrubin

require(OpenMx)

data<-read.csv("Fall2008.csv")

factorModel <- mxModel(name="Fall2008.Model1",

type="RAM",

## Specified Paths in the saturated model

mxPath(from=data$tGR1, to=Data$Rel Lifespan),

mxPath(from=data$Period, to=data$Rel Lifespan),

mxPath(from=data$Phase, to=data$Rel Lifespan),

mxPath(from=data$tGR1, to=data$Rel Lifespan),

mxPath(from=data$Period, to=data$tGR1),

mxPath(from=data$Phase, to=data$tGR1),

## Error Paths for each variable

mxPath(from=data$tGR1, arrows=2),

mxPath(from=data$tRel Lifespan, arrows=2),

mxPath(from=data$tPeriod, arrows=2),

mxPath(from=data$tPhase, arrows=2)

mxData(observed=cov(data), type="cov", numObs=82)

)

## Want to run all possible models and print Information Criteria to a text file

Nice work. There are a few ways to do this, and I'll present the way I would do it.

You've done a good job setting up your initial saturated model. Here are a few tips to help you along

-you forgot to include a