# R forced closed due to non pd cov matrix

2 posts / 0 new
Offline
Joined: 09/07/2010 - 17:14
R forced closed due to non pd cov matrix

Code as below. I think it is due to a non positive definite covariance input. When this is fixed, all is fine.

A pop -up says R for windows GUI front end has stopped working.

require(OpenMx)

varnames<-c("BIC1","SSC1","BIC2","SSC2");

p<-2;
pstar<-p*(p+1)/2;
diagind<-(diag(p)==1);

nMZ<-84;
nDZ<-33;
varnames<-c("BIC1","SSC1","BIC2","SSC2");

LA<-mxMatrix(type="Lower",nrow=p,ncol=p,free=T,values=0,
label=paste("a",1:pstar,sep=""),name="LA");
LC<-mxMatrix(type="Lower",nrow=p,ncol=p,free=T,values=0,
label=paste("c",1:pstar,sep=""),name="LC");
LE<-mxMatrix(type="Lower",nrow=p,ncol=p,free=T,values=c(1,.5,sqrt(3)/2),
label=paste("e",1:pstar,sep=""),name="LE");

LA@lbound[diagind]<-0;
LC@lbound[diagind]<-0;
LE@lbound[diagind]<-0;

A<-mxAlgebra(expression=LA%%t(LA),name="A");
C<-mxAlgebra(expression=LC%
%t(LC),name="C");
E<-mxAlgebra(expression=LE%*%t(LE),name="E");

ACESigmaMZ<-mxAlgebra(expression=rbind(cbind(A+C+E,A+C),cbind(A+C,A+C+E)),
name="ACESigmaMZ");

ACEModelMZ<-mxModel("ACEModelMZ",
mxMLObjective(covariance="ACEModelTwin.ACESigmaMZ",dimnames=varnames),
mxData(observed=dataMZ,type="cov",numObs=nMZ));
ACEModelDZ<-mxModel("ACEModelDZ",
twin<-mxAlgebra(expression=ACEModelMZ.objective+ACEModelDZ.objective,name="twin");
ACEModelTwin<-mxModel("ACEModelTwin",LA,LC,LE,A,C,E,