Learn R Programming

edrGraphicalTools (version 2.2)

sliceMat: Slicing matrix computation

Description

Returns the slicing matrix required for the "SIR-I" method.

Usage

sliceMat(Y, X, H, details=FALSE, rdSup=FALSE)

Arguments

Y

A numeric vector representing the dependent variable (a response vector).

X

A matrix representing the quantitative explanatory variables (bind by column).

H

The chosen number of slices.

details

A boolean that determines whether or not some matrices used to construct the slicing matrix should be sent back. See also 'Value'.

rdSup

When the number of slices is not a divisor of the sample size, this boolean determines whether or not the slices which contain an extra point are randomly chosen.

Value

If details=FALSE, the \(p\) x \(p\) slicing matrix \(M\), where \(p\) is the number of columns of \(X\).

If details=TRUE, a list made of \(M\), \(X_h\) and \(P_h\).

Details

This function divides the range of \(Y\) in \(H\) distinct intervals, or slices. It then puts every row of \(X\) into a slice with respect to the corresponding element of \(Y\). It finally computes a matrix \(M = X_h' P_h X_h\) where each row of \(X_h\) is the mean vector over the vectors of \(X\) that belong to a given slice. The matrix \(P_h\) is diagonal and contains the number of rows of \(X\) placed in each sliced. The matrix \(M\) is required when trying to perform a sliced inverse regression.

See Also

edr, edrUnderdet

Examples

Run this code
# NOT RUN {
#The "SIR-I" method whithout using 'edr'
n <- 500
p <- 5
H <- 10
beta <- c(1, 1, 1, 0, 0)
X <- rmvnorm(n,rep(0,p),diag(p))
eps <- rnorm(n, 0, 10)
Y <- (X %*% beta)^3 + eps
M <- sliceMat(Y,X,H)
hatBeta <- eigen(solve(var(X)) %*% M)$vectors[,1]
cor(hatBeta,beta)^2
 
# }

Run the code above in your browser using DataLab