3
$\begingroup$

I have following two models (fit1, fit2) estimated using nls approach. I want to compare their goodness using anova, and the results follows:

dd <- data.frame(t=0:10,
                 Frequency=c(195746,93938,53181,31853,19856,12182,
                             7847,5459,4325,3203,2750))
model1 <- deriv( ~ c*(1+b*(q-1)*t)^(1/(1-q)),
               c("c", "b", "q"), function (t, c, b,q){})

par1 <- list(c = 1e5, b = 1.5, q =2)
fit1 <- nls(Frequency ~ model1(t, c, b, q), data=dd,start=par1)

model3 <- deriv( ~  exp(-beta1*t)/(beta2+beta3*t),c("beta1", "beta2", "beta3"),
                function (t, beta1, beta2,beta3){})
par3 <- list(beta1 = .0100, beta2 = .0002, beta3 =0.0002)
fit3 <- nls(Frequency ~ model3(t, beta1,beta2,beta3), data=dd,start=par3)

anova(fit3,fit1,test="Chisq")


Model 1: Frequency ~ model(t, beta1, beta2, beta3)

Model 2: Frequency ~ model(t, c, b, q)
  Res.Df Res.Sum Sq Df Sum Sq F value Pr(>F)
1     78   11892917                         
2     78   14080592  0      0    

I am still not sure if I can use anova? Or if there is another approach I would appreciate it if you let me know about...

$\endgroup$
1
  • 4
    $\begingroup$ In what sense are these "nested"? They don't seem to have the same parameters. $\endgroup$ Dec 20, 2016 at 19:08

1 Answer 1

3
$\begingroup$

Chi-square test and the default F test are valid only if the the models are nested. Your models don't seem be nested, thus you can't interpret anything from it.

EDIT: Nested means the one of the model is a subset of the other model. Your model parameters suggest otherwise. None of your model is a subset of the other model. You can't apply anova() here. If you believe your models are nested, please give us a working script.

$\endgroup$
5
  • $\begingroup$ fit1 and fit2 have different parameters, and they don't look like nested to me. Also pointed out by @gung. $\endgroup$
    – SmallChess
    Dec 21, 2016 at 0:06
  • $\begingroup$ @13554N I edited... $\endgroup$
    – SmallChess
    Dec 21, 2016 at 1:17
  • $\begingroup$ I edited my question and provided the working script.. $\endgroup$
    – 13554N
    Dec 21, 2016 at 17:01
  • 1
    $\begingroup$ @13554N I checked it, but I don't think they are nested. $\endgroup$
    – SmallChess
    Dec 23, 2016 at 1:08
  • 1
    $\begingroup$ @13554N If you want to compare the models, you might want to use AIC/BIC. They are okay for non-nested models. You may also want to use R2, adjusted R2. $\endgroup$
    – SmallChess
    Dec 23, 2016 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.