Lindsay Banin
2009-Jun-11 12:55 UTC
[R] Error in 1:p : NA/NaN argument when running model comparisons
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
Uwe Ligges
2009-Jun-11 15:46 UTC
[R] Error in 1:p : NA/NaN argument when running model comparisons
Lindsay Banin wrote:> 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 argumentWell, without model specification and data it is impossible for us to know why exactly the AIC cannot be calculated. Uwe Ligges> 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 > > ______________________________________________ > 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.