Hi, I am trying to fit a SEM model (the ram specification of the model, along with the estimated polycoric VCmatrix (CC32), is attacched), but I get the following error message: "Error in 1:m : NA/NaN argument"I did not find any help on internet, so I tried to understend what is going wrong calling: getAnywhere(sem.default) and reproducing the sem.default function step by step.I found that the problem arises from: n.fix <- length(fixed.x)
if (!is.null(fixed.x)) { for (i in 1:n.fix) { for (j in 1:i) { ram <- rbind(ram, c(2, fixed.x[i], fixed.x[j], 0, S[fixed.x[i], fixed.x[j]])) } } } m <- max(ram[, c(2, 3)]) Indeed, if I run just: for (i in 1:n.fix) {for (j in 1:i) {G<-c(2, fixed.x[i], fixed.x[j], 0, S[fixed.x[i], fixed.x[j]]) } I get only this (G=): "2" "Autunno" "Autunno" "0" "1" But I still cannot understand what is wrong.The code I used is: library(sem)CLB<-classifyVariables(Mod.Bus) fisse<-as.character(CLB$exogenous)Business32<-sem(Mod.Bus, S= as.matrix(CC32), N<- 16029, fixed.x=fisse,objective= objectiveGLS, maxiter=100000) Can anybody help me please?Any suggestion will be truly appreciated.Annalisa Model ram specific.docx (21K) <http://r.789695.n4.nabble.com/attachment/4685052/0/Model%20ram%20specific.docx> CC32.Rdata (20K) <http://r.789695.n4.nabble.com/attachment/4685052/1/CC32.Rdata> C32.Rdata (17K) <http://r.789695.n4.nabble.com/attachment/4685052/2/C32.Rdata> -- View this message in context: http://r.789695.n4.nabble.com/Help-with-SEM-Error-in-1-m-NA-NaN-argument-tp4685052.html Sent from the R help mailing list archive at Nabble.com. [[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.