Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predict.cve

Predict method for CVE Fits.


Description

Predict response using projected data. The forward model g(B' X) is estimated with mars in the mda package.

Usage

## S3 method for class 'cve'
predict(object, newdata, k, ...)

Arguments

object

an object of class "cve", usually, a result of a call to cve or cve.call.

newdata

Matrix of new predictor values, C.

k

dimension of SDR space to be used for data projection.

...

further arguments passed to mars.

Value

prediced respone(s) for newdata.

See Also

Examples

# 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)

CVarE

Conditional Variance Estimator for Sufficient Dimension Reduction

v1.1
GPL-3
Authors
Daniel Kapla [aut, cph, cre], Lukas Fertl [aut, cph], Efstathia Bura [ctb]
Initial release
2021-03-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.