R: How to fit a time series model such as “Y(t) = αX + βY(t-1)”?
问题 How do I fit this model in R, step by step? My scope is to make a forecast for t+1. Y(t) = αX(t) + βY(t-1) Y(t) <- years from 1900 to 2000. X <- a score measure from 0 to 100. Y(t-1) <- lagged value of order 1 for Y. Thanks in advance. 回答1: Your model is an AR(1) time series for y with covariate x . We can just use arima0 (no missing value) or arima (missing value allowed) from R base: fit <- arima0(y, order = c(1, 0, 0), xreg = x) Let's consider a small example: set.seed(0) x <- runif(100) #