predict.msir: Model-based Sliced Inverse Regression directions

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/msir.R

Description

MSIR estimates a set of d ≤ p orthogonal direction vectors of length p which are estimates of the basis of the dimensional reduction subspace.

Usage

1
2
  ## S3 method for class 'msir'
predict(object, dim = 1:object$numdir, newdata, ...)

Arguments

object

an object of class 'msir' resulting from a call to msir.

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 msir are used.

...

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)

msir documentation built on Jan. 13, 2021, 12:50 p.m.