# \donttest{
# 1. Fit a model on small simulated data
train <- sff_dgp(n = 500, rf = 0.5)
lam <- list(lb = c(10^{-3}, 10^{-2}, 10^{-1}), lrho = c(10^{-3}, 10^{-2}, 10^{-1}))
fit <- sffr_pen2SLS(train$Y, train$X, train$W,
gpy = seq(0, 1, length = 101),
gpx = seq(0, 1, length = 101),
K0 = 10, Ky = 10, Kx = 10,
lam_cands = lam)
# 2. Simulate NEW covariates and a compatible weight matrix
test <- sff_dgp(n = 1000, rf = 0.5) ## we keep only X and W
pred <- predict_sffr2SLS(fit, xnew = test$X, Wnew = test$W)
# }
Run the code above in your browser using DataLab