Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example I have vectX and vectY, and I want to know:

  1. Which is the better model fitting for my data -- it can be linear, exponential, or parabolic.
  2. If my result is significant.

I am doing it like this:

#response exponentiel
expFct2 = function (x, a, b,c)
  a*(1-exp(-x/b)) + c  
#response parabola
expFct3 <- function (x, a, b, c)

model1 <- lm(vectY ~ vectY, data=d)  
aic1 <- AIC(model1)

model2 <- nls(vectY ~ expFct2(vectX, a, b, c), data= d, 
aic2 <- AIC(model2)

model3 <- nls(vectY ~ expFct3(vectX, a, b, c), data= d, 
              start = list(a=-1, b=3, c=0))
aic3 <- AIC(model3)

if ((aic1 <= aic2) & (aic1 <= aic3)) print("Model1 is better") 
if ((aic2 < aic1) & (aic2 < aic3)) print("Model2 is better")
if ((aic3 < aic1) & (aic3 < aic2))print("Model3 is better")

For example if model1 is better, I am doing summary(model1) and I have p-value to know if my result is significant. And I built my equation from de coeff

But if it is model 2, non linear is better. I'am doing summary(model2) but there isn't p-value. I read that it is normal. So how can I know if my result is significant? I still can built an equation but if it isn't significant...

Is it possible to do cor.test(vectX,vectY) before knowing which is the better model? And if p-value is > 0.05 then I don't need to cheek what is the better model, because it isn't significant?

share|improve this question

You are trying to substitute rules and computations for thinking.

The cor.test approach will not work because cor.test only tests linear relationships, there are many examples of curved relationships (parabola being one) where cor.test would show no relationship when there is one.

What does the science behind your variables suggest as a reasonable relationship? Do all match with intuition?

Which AIC score is lowest is not enough, what if one is lower but by only a miniscule amount? It would probably not be hard to find/create a sample dataset where moving a single point by a small amount would change which of your AIC scores is the lowest, would you really be comfortable with a decision based on rules like that?

Also note that your parabola can be fit as a linear model using lm rather than nls. Also note that AIC is defined up to a constant, make sure that the aic methods for lm and nls use the same constant or the comparisons will be meaningless.

share|improve this answer
Thank you for your answer. My data is really big and and I have to choose one of this equations for about 100 difference vectX and vectY. So I can't check every couple of vectors. Is there another method to determine which is the better model? Can I use summary(model)$sigma For nls function, how can I know if my equation is significance? – Tali Sep 17 '11 at 20:13
@Tatiana This is not a forum; please follow the rules described in FAQ. – mbq Sep 17 '11 at 22:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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