Reputation: 11
I am a beginner in R, and I want to predict orbit times of planetary objects based on their average distance from the Sun (in AU).
I thought using R would be great, so I have set
x<-c(0.387,0.723,1.000,1.524,5.203,9.537)
y<-c(87.969,224.701,365.256,686.980,4329.630,10751.805)
I typed model=lm(y~x)
to fit a model onto it and then used predict.lm(model, newdata=new)
, where new=c(19.191,30.069,39.482).
I am returned with values but they are really off. I also tried taking the log of all the y values and tried that with the same process I just detailed. However, the values I am returned with are still off. I would appreciate any help to this problem or a resource that provides more help for R in this area. Thanks so much!
However, the given data value's plot was exponential, so if anyone could help to fit an exponential model instead of linear would be great.
Upvotes: 1
Views: 59
Reputation: 5698
Your fit is off, because you try to fit a linear model to something that is not linear. Without being an astronomer, I think Kepler's Third Law is applicable. This formula, taken from Wikipedia, depicts the relationship between orbit times (in days) and distance (AU).
This could be rewritten as:
Which can be simplified to
Taking the log and fitting a linear model would work when the underlying process is exponential.
From here it seems that your model should be something like, although probably not exact, this: model=lm(y~x + I(X^(3/2)))
.
Upvotes: 1