Predict method for CVE Fits.
Predict response using projected data. The forward model g(B' X) is
estimated with mars
in the mda package.
## S3 method for class 'cve' predict(object, newdata, k, ...)
prediced respone(s) for newdata
.
# create B for simulation B <- rep(1, 5) / sqrt(5) set.seed(21) # creat predictor data x ~ N(0, I_p) x <- matrix(rnorm(500), 100) # simulate response variable # y = f(B'x) + err # with f(x1) = x1 and err ~ N(0, 0.25^2) y <- x %*% B + 0.25 * rnorm(100) x.train <- x[1:80, ] x.test <- x[81:100, ] y.train <- y[1:80, ] y.test <- y[81:100, ] # calculate cve with method 'simple' for k = 1 cve.obj.simple <- cve(y.train ~ x.train, k = 1) # predict y.test from x.test yhat <- predict(cve.obj.simple, x.test, 1) # plot prediction against y.test plot(yhat, y.test)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.