Dear Alain, There were 16 variables with 10 cases with missing values. The sample covariance matrix is not positive definite. It has nothing to do with lavaan. You need more cases before you can fit a CFA with 16 variables.
Regards, Mike -- --------------------------------------------------------------------- Mike W.L. Cheung Phone: (65) 6516-3702 Department of Psychology Fax: (65) 6773-1843 National University of Singapore http://courses.nus.edu.sg/course/psycwlm/internet/ --------------------------------------------------------------------- On Wed, Jun 1, 2011 at 6:31 PM, D. Alain <dialva...@yahoo.de> wrote: > Dear R-List, > > (I am not sure whether this list is the right place for my question...) > > I have a dataframe df.cfa > > > df.cfa<-data.frame(x1=c(5,4,1,5,5,NA,4,NA,NA,5),x2=c(2,3,3,3,NA,1,2,1,2,1),x3=c(5,3,4,1,5,5,5,5,5,5),x4=c(5,3,4,5,5,5,5,5,5,5),x5=c(5,4,3,3,4,4,4,5,NA,5),x6=c(3,5,2,1,4,NA,NA,5,3,4),x7=c(5,4,3,4,4,3,4,NA,NA,4),x8=c(5,5,3,4,5,4,5,4,5,5),x9=c(5,1,1,1,NA,3,3,2,2,3),x10=c(5,5,2,3,4,3,1,3,2,5),x11=c(5,4,4,5,5,4,5,4,5,5),x12=c(5,4,5,5,5,4,5,5,5,5),x13=c(5,4,4,5,5,5,5,5,5,5),x14=c(5,3,3,NA,5,4,5,3,NA,5),x15=c(4,4,4,3,4,5,2,4,5,5),x16=c(5,4,3,3,4,4,3,3,4,5)) > > > and I want to carry out a confirmatory factor analysis using the "cfa" > function (lavaan). > > library(lavaan) > > then I specify my model > > cfa.model<-' f1=~x1+x2+x3+x4+x5 > f2=~x6+x7+x8+x9+x10+x11 > f3=~x12+x13+x14+x15+x16 ' > > and run the cfa routine > > fit<-cfa(cfa.model,data=df.cfa,missing="ml") > > The output is an error message (here partly in german) > > "Error in chol.default(S) : der führende Minor der Ordnung 4 ist nicht > positiv definit > Fehler in Sample(data = data, group = group, sample.cov = sample.cov, > sample.mean = sample.mean, : sample covariance can not be inverted" > > Then I tried to "lavaanify" my model specification first > > cfa.model<- lavaanify(cfa.model) > > id lhs op rhs user group free ustart fixed.x label eq.id free.uncon > 1 1 f1 =~ x1 1 1 1 NA 0 f1=~x1 0 1 > 2 2 f1 =~ x2 1 1 2 NA 0 f1=~x2 0 2 > 3 3 f1 =~ x3 1 1 3 NA 0 f1=~x3 0 3 > 4 4 f1 =~ x4 1 1 4 NA 0 f1=~x4 0 4 > 5 5 f1 =~ x5 1 1 5 NA 0 f1=~x5 0 5 > 6 6 f2 =~ x6 1 1 6 NA 0 f2=~x6 0 6 > 7 7 f2 =~ x7 1 1 7 NA 0 f2=~x7 0 7 > 8 8 f2 =~ x8 1 1 8 NA 0 f2=~x8 0 8 > 9 9 f2 =~ x9 1 1 9 NA 0 f2=~x9 0 9 > 10 10 f2 =~ x10 1 1 10 NA 0 f2=~x10 0 10 > 11 11 f2 =~ x11 1 1 11 NA 0 f2=~x11 0 11 > 12 12 f3 =~ x12 1 1 12 NA 0 f3=~x12 0 12 > 13 13 f3 =~ x13 1 1 13 NA 0 f3=~x13 0 13 > 14 14 f3 =~ x14 1 1 14 NA 0 f3=~x14 0 14 > 15 15 f3 =~ x15 1 1 15 NA 0 f3=~x15 0 15 > 16 16 f3 =~ x16 1 1 16 NA 0 f3=~x16 0 16 > > I run cfa again > > fit<-cfa(cfa.model,data=df.cfa,missing="ml") > > And this time I get another error information > > "Error in start.idx[i]:end.idx[i] : NA/NaN Argument" > > I must admit that I am stuck, can anyone help? > > Thanks, Alain > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.