On 09-Apr-09 22:53:51, Brendan Morse wrote: > Hi everyone, I am running a monte carlo and am getting an error that I > haven't the slightest clue where to begin figuring it out. The error > is as follows: > > Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) >: > 0 (non-NA) cases > In addition: Warning message: > In ltm.fit(X, betas, constraint, formula, con) : > Hessian matrix at convergence is not positive definite; unstable > solution. > > The puzzling aspect though is that it successfully runs a number of > complete iterations before this occurs. I am not sure what or where > this is going on. > > Any suggestions? > > Thanks very much (in advance) > - Brendan
This is the sort of thing that can happen is the covariates in your linear model lead to a model matrix which singular (or nearly so). In other words, at least one of your covariate vectors is a linear combination of the others (or nearly so). The facts that (a) you are doing a Monte Carlo simulationm and (b) you get a number of satisfactory runs and then it fails, suggest that you are randomly creating covariate (independent-variable) values as well as dependent-variable values. If that is so, then the structure of your model may be such that it is relatively likely for such singularity to arise. While not particularly likely for continuous covariates, near-singularity can nevertheless happen. It can be much more likely if you are generating random levels of factors, since only a finite number of combinations are possible, and sooner or later you will definitely hit exact collinarity. And if you are using a fairly large number of covariates, and not a large number of cases, then it can become really likely! I'm only guessing, of course, and you can either agree with, or deny, the above suggestions. Either way, it would help in clarifying the problem to know the details of how your Monte Carlo simulation is supposed to work. Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 10-Apr-09 Time: 00:23:04 ------------------------------ XFMail ------------------------------ ______________________________________________ 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.