Hello, I will use the lca method in the e1071 package. But I get the following error: Error in pas[j, ] <- drop(exp(rep(1, nvar) %*% log(mp))) : number of items to replace is not a multiple of replacement length Does anybody know this error and knows what this means? Kind regards, Tryntsje
> I will use the lca method in the e1071 package. But I get the followingerror:> Error in pas[j, ] <- drop(exp(rep(1, nvar) %*% log(mp))) : > number of items to replace is not a multiple of replacement length > > Does anybody know this error and knows what this means?The error means that you are trying to assign a variable of one size to a variable of another fixed size. An example that recreates it is: x <- matrix(1:6, nrow=3) x[1,] <- 1:10 x[1,] cannot be resized from 3 to 10 without affecting the rest of x, so an error is thrown. In your example, the jth row of the matrix pas is a different size from drop(exp(rep(1, nvar) %*% log(mp))). Since you haven't provided a reproducible example (tut tut, read the posting guide) you'll have to do the debugging yourself. To get you started, type traceback() to see where the problem occurs. Now try options(error=recover), and call the lca function again. Now you can examine the values of nvar, mp and pas to see what is going wrong. Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}}
Before using lca, try data<-as.matrix(data). For example when I tried using lca " lca(LSAT,2,niter=100)" for known LSAT data (library ltm), I took error messages. But, when I use data<-as.matrix(LSAT) lca(data,2,niter=100) I took results for lca King Regards, Evgenia Tryntsje Wesselius wrote:> > Hello, > > I will use the lca method in the e1071 package. But I get the following > error: > Error in pas[j, ] <- drop(exp(rep(1, nvar) %*% log(mp))) : > number of items to replace is not a multiple of replacement length > > Does anybody know this error and knows what this means? > > Kind regards, > > Tryntsje > > ______________________________________________ > R-help at 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. > >-- View this message in context: http://www.nabble.com/LCA-%28e1071-package%29%3A-error-tp21478519p22040077.html Sent from the R help mailing list archive at Nabble.com.