1
$\begingroup$

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?

$\endgroup$
3
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ I think aeWiardll is implying that there is a correlation (or some similar structure) in the data. Therefore, the simple assumption of independence of 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

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.