predict.msir {msir} | R Documentation |
Model-based Sliced Inverse Regression directions
Description
MSIR estimates a set of d \le p
orthogonal direction vectors of length p
which are estimates of the basis of the dimensional reduction subspace.
Usage
## S3 method for class 'msir'
predict(object, dim = 1:object$numdir, newdata, ...)
Arguments
object |
an object of class |
dim |
the dimensions of the reduced subspace used for prediction. |
newdata |
a data frame or matrix giving the data. If missing the data obtained from the call to |
... |
further arguments passed to or from other methods. |
Value
The function returns a matrix of points projected on the subspace spanned by the estimated basis vectors.
Author(s)
Luca Scrucca luca.scrucca@unipg.it
References
Scrucca, L. (2011) Model-based SIR for dimension reduction. Computational Statistics & Data Analysis, 55(11), 3010-3026.
See Also
{msir}
Examples
n <- 200
p <- 5
b <- as.matrix(c(1,-1,rep(0,p-2)))
x <- matrix(rnorm(n*p), nrow = n, ncol = p)
y <- exp(0.5 * x%*%b) + 0.1*rnorm(n)
pairs(cbind(y,x), gap = 0)
MSIR <- msir(x, y)
summary(MSIR)
plot(MSIR, which = 1, type = "2Dplot")
all.equal(predict(MSIR), MSIR$dir)
predict(MSIR, dim = 1:2)
x0 <- matrix(rnorm(n*p), nrow = n, ncol = p)
y0 <- exp(0.5 * x0%*%b) + 0.1*rnorm(n)
plot(predict(MSIR, dim = 1, newdata = x0), y0)
[Package msir version 1.3.3 Index]