# sliceMat: Slicing matrix computation In edrGraphicalTools: Provides Tools for Dimension Reduction Methods

## Description

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

## Usage

 `1` ```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.

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

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

## Author(s)

Raphaël Coudret <rcoudret@gmail.com>, Benoît Liquet <benoit.liquet@isped.u-bordeaux2.fr> and Jérôme Saracco <jerome.saracco@math.u-bordeaux1.fr>

`edr`, `edrUnderdet`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ``` #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 ```