I have a question regarding regression analysis on a dataset were the input values generate different results over time:
e.g.
1 2
2 2
3 5
4 1
2 5
3 8
How would I go about doing the regression on such a dataset, since the values change?
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.
Sign up to join this communityI have a question regarding regression analysis on a dataset were the input values generate different results over time:
e.g.
1 2
2 2
3 5
4 1
2 5
3 8
How would I go about doing the regression on such a dataset, since the values change?
What do you mean by "the input values generate different results over time?" This happens a lot in regression analysis, and isn't typically a problem.
You could start by loading your data into R, and running a simple linear model.
x<-c(1,2,3,4,2,3)
y<-c(2,2,5,1,5,8)
model<-lm(y~x)
summary(model)
plot(x,y)
lines(x,fitted(model))
In the case of your example data, a simple linear model is terrible. Can you be more specific about what you're trying to do?
/edit: In response to suncoolso: once you've fit a simple linear model, you can use the "gls" command from the "nlme" package to fit a simple linear model with an autoregressive correlation structure.
lm
is probably not what @eWizardll is looking for. I hope the answer to your question would make things clearer.
$\endgroup$
– suncoolsu
Jan 22 '11 at 4:50