# Predefining input values

Hi I have a question regarding defining the values while using the mxMatrix. How are these values calculated?
For example in the script IntroToTwinAnalysisinRandOpenMx.R the starting values were defined as written below but how were these values determined?
svMe ← 50 # start value for means
svVa ← .8 # start value for variance
lbVa ← .0001 # lower bound for variance

As a second question I am trying to go over the script IntroToTwinAnalysisInRandOpenMx but for some of the lines I am getting an error as such

“Error in file(file, ifelse(append, “a”, “w”)) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, “a”, “w”)) :
cannot open file ‘corrs.csv’: Permission denied”

The specific line I got this error code was as follows:

Combining results into one object
Corr2<-cbind(rMZ, rDZ)
write.table(Corr2,file=“corrs.csv”,sep=",",row.names=FALSE,col.names=FALSE)

I got the permission denied error code for other lines too. What could be the reason for it?

Thank you!

Welcome, Didi! Good question. In principle, starting values for optimization wouldn’t matter if optimization was an exact science. Unfortunately it isn’t, so we can help the optimization along by starting somewhere where the parameters aren’t too far off the mark. How do we do that? My method follows 3 principles: 1. Get the expected means to be close to (ideally less than 2SD away on the scaling of the expected variances) the observed ones. 2. Get the expected variances close to the observed ones. Slightly larger expected than observed is a good choice. 3. Keep the correlations between variables near zero. These three steps will avoid situations where the starting values yield a likelihood of zero (log-likelihood of -infinity) which can make optimization fail.

For your second question, I think that is because you are in the wrong default directory, setwd(“directoryPath”) in R can change the current working directory (which you can inspect with getwd()).

HTH!

1 Like