[R] Error in 1:p : NA/NaN argument when running model comparisons

Lindsay Banin l.banin05 at leeds.ac.uk
Thu Jun 11 14:55:33 CEST 2009


Hi there,

I am trying to compare nonlinear least squares regression with AIC and anova. The simplest model is one nonlinear curve, and in the more complex model I have a categorical variable (producing parameter estimates for four curves).
Both models run fine, but when I try to produce an AIC value for the second model I get the error:

> AIC(pow.nls1)
[1] 114408.3
> AIC(pow.nls2)
Error in 1:p : NA/NaN argument

And similarly, when I try to compare the models with ANOVA, I get:

anova(pow.nls1, pow.nls2)
Error in if (df[i] > 0) { : missing value where TRUE/FALSE needed

It seemed as if this could be a problem with the dataset, but I have checked thoroughly and there are no missing values etc.
What do these error messages actually indicate?

Many thanks in advance!
Lindsay




More information about the R-help mailing list