0

I have a question regarding a multiple linear regression model. I want to test the effect of my independent variables in year(i) on my dependent variable in the subsequent year (i+1):

**y(year i+1) = b0 + b1x1(year i) + b2x2(year i) + b3*x3(year i) + ei

How do I test this in R?**

My data is in yearly data format, covering 20 years with roughly 50,000 observations (Year - Dependent Variable - Independent variables 1-3)

Thank you so much for your help!

  • 1
    From what I understand you are looking for univariate regression: explain value Y by prior value of Y (Y-1). turning this into multivariate would make sense - from my understanding - if you use Y-2 and Y-3 as aditional explanatory variables, this you can turn this into a multivariate linear regression. in R the function you are looking for is lm(). some resources I sugest you to look into: https://www.statmethods.net/stats/regression.html or https://www.datacamp.com/community/tutorials/linear-regression-R – DPH Apr 30 '21 at 15:27
  • maybe you want to test if y-1 or y-2 or y-3 is better, in that case you can run 3 times univariate linear regression and compare the results. http://www.sthda.com/english/articles/40-regression-analysis/167-simple-linear-regression-in-r/ – DPH Apr 30 '21 at 15:28
  • Hi Sabrina, could you provide an axample data so we could provide you with better help. Please see https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Guibor Camargo Salamanca Apr 30 '21 at 15:28
  • 1
    `y ~ lag(x) + lag(z)` if `x` and `z` are time-series objects. Note that you need to use a time-series regression or your standard errors will be wrong. – dash2 Apr 30 '21 at 15:28

0 Answers0