# NOT RUN {
p = 30
n = 50
beta = c(1, -0.8, 0.6, 0, 0, -1.5, -0.5, 1.2)
beta = c( beta, rep(0, times = p - length(beta)) )
Comp_data = comp_Model(n = n, p = p, beta = beta, intercept = FALSE)
test_data = comp_Model(n = 30, p = p, beta = beta, intercept = FALSE)
cvm1 <- cv.compCL(y = Comp_data$y, Z = Comp_data$X.comp,
Zc = Comp_data$Zc, intercept = Comp_data$intercept)
y_hat = predict(cvm1, Znew = test_data$X.comp, Zcnew = test_data$Zc)
predmat = predict(cvm1, Znew = test_data$X.comp, Zcnew = test_data$Zc, s = NULL)
plot(test_data$y, y_hat, xlab = "Observed response", ylab = "Predicted response")
abline(a = 0, b = 1, col = "red")
# }
Run the code above in your browser using DataLab