I am trying to run midas_r command to get the coefficients but I am getting the following error:
Error in midas_r(yy ~ mls(yy, 1, 1) + mls(xx, 3:11, 3, nbeta), start = list(xx = c(1.7, :
could not find function "midas_r"
Since the code is running fine in my colleague's Rstudio, not able to find the issue. Is there an issue with my R studio version or any additional package is required to be installed ?
I tried the following code in Rstudio 2023.03.0:
install.packages("midasr")
library(midasr)
data("USqgdp", package = "midasr")
data("USpayems", package = "midasr")
y <- window(USqgdp, end = c(2011, 2))
x <- window(USpayems, end = c(2011, 7))
yg <- diff(log(y)) * 100
xg <- diff(log(x)) * 100
nx <- ts(c(NA, xg, NA, NA), start = start(x), frequency = 12)
ny <- ts(c(rep(NA, 33), yg, NA), start = start(x), frequency = 4)
xx <- window(nx, start = c(1985, 1), end = c(2009, 3))
yy <- window(ny, start = c(1985, 1), end = c(2009, 1))
head(xx)
head(yy)
beta0 <- midas_r(yy ~ mls(yy, 1, 1) + mls(xx, 3:11, 3, nbeta), start = list(xx = c(1.7, 1, 5)))
coef(beta0)
Ideally the code should give the following result:
(Intercept) yy xx1 xx2 xx3
0.8315274 0.1058910 2.5887103 1.0201202 13.6867809