msir: Model-based Sliced Inverse Regression (MSIR)

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

View source: R/msir.R

Description

A dimension reduction method based on Gaussian finite mixture models which provides an extension to sliced inverse regression (SIR). The basis of the subspace is estimated by modeling the inverse distribution within slice using Gaussian finite mixtures with number of components and covariance matrix parameterization selected by BIC or defined by the user.

Usage

1
2
msir(x, y, nslices = msir.nslices, slice.function = msir.slices, 
     modelNames = NULL, G = NULL, cov = c("mle", "regularized"), ...)

Arguments

x

A (n x p) design matrix containing the predictors data values.

y

A (n x 1) vector of data values for the response variable. It can be a numeric vector (regression) but also a factor (classification). In the latter case, the levels of the factor define the slices used.

nslices

The number of slices used, unless y is a factor. By default the value returned by msir.nslices.

slice.function

The slice functions to be used, by default msir.slices, but the user can provide a different slicing function.

modelNames

A vector of character strings indicating the Gaussian mixture models to be fitted as described in mclustModelNames. If a vector of strings is given they are used for all the slices. If a list of vectors is provided then each vector refers to a single slice.

G

An integer vector specifying the numbers of mixture components used in fitting Gaussian mixture models. If a list of vectors is provided then each vector refers to a single slice.

cov

The predictors marginal covariance matrix. Possible choices are:

  • "mle": for the maximum likelihood estimate

  • "regularized": for a regularized estimate of the covariance matrix (see msir.regularizedSigma)

  • R matrix: a (p x p) user defined covariance matrix

...

other arguments passed to msir.compute.

Value

Returns an object of class 'msir' with attributes:

call

the function call.

x

the design matrix.

y

the response vector.

slice.info

output from slicing function.

mixmod

a list of finite mixture model objects as described in mclustModel.

loglik

the log-likelihood for the mixture models.

f

a vector of length equal to the total number of mixture components containing the fraction of observations in each fitted component within slices.

mu

a matrix of component within slices predictors means.

sigma

the marginal predictors covariance matrix.

M

the msir kernel matrix.

evalues

the eigenvalues from the generalized eigen-decomposition of M.

evectors

the raw eigenvectors from the generalized eigen-decomposition of M ordered according to the eigenvalues.

basis

the normalized eigenvectors from the generalized eigen-decomposition of M ordered according to the eigenvalues.

std.basis

standardized basis vectors obtained by multiplying each coefficient of the eigenvectors by the standard deviation of the corresponding predictor. The resulting coefficients are scaled such that all predictors have unit standard deviation.

numdir

the maximal number of directions estimated.

dir

the estimated MSIR directions from mean-centered predictors.

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

summary.msir, plot.msir.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 1-dimensional simple regression
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)
MSIR <- msir(x, y)
summary(MSIR)
plot(MSIR, type = "2Dplot")

# 1-dimensional symmetric response curve
n <- 200
p <- 5
b <- as.matrix(c(1,-1,rep(0,p-2)))
x <- matrix(rnorm(n*p), nrow = n, ncol = p)
y <- (0.5 * x%*%b)^2 + 0.1*rnorm(n)
MSIR <- msir(x, y)
summary(MSIR)
plot(MSIR, type = "2Dplot")
plot(MSIR, type = "coefficients")

# 2-dimensional response curve
n <- 300
p <- 5
b1 <- c(1, 1, 1, rep(0, p-3))
b2 <- c(1,-1,-1, rep(0, p-3))
b <- cbind(b1,b2)
x <- matrix(rnorm(n*p), nrow = n, ncol = p)
y <- x %*% b1 + (x %*% b1)^3 + 4*(x %*% b2)^2 + rnorm(n)
MSIR <- msir(x, y)
summary(MSIR)
plot(MSIR, which = 1:2)
## Not run: plot(MSIR, type = "spinplot")
plot(MSIR, which = 1, type = "2Dplot", span = 0.7)
plot(MSIR, which = 2, type = "2Dplot", span = 0.7)

Example output

Package 'msir' version 1.3.2
Type 'citation("msir")' for citing this R package in publications.
-------------------------------------------------- 
Model-based SIR 
-------------------------------------------------- 

Slices:
          1   2   3   4   5   6  
GMM       XII XXX XXX XXX XXX XII
Num.comp. 1   1   1   1   1   1  
Num.obs.  33  33  33  33  33  35 

Estimated basis vectors:
         Dir1      Dir2      Dir3    Dir4      Dir5
x1  0.7178636 -0.025053  0.073717 0.41742 -0.523022
x2 -0.6956219  0.033681  0.066339 0.56675 -0.507702
x3  0.0086978  0.722677 -0.572969 0.19663  0.108636
x4  0.0173955 -0.635883 -0.808347 0.17325 -0.048928
x5  0.0200961 -0.267636  0.091908 0.66021  0.674159

                Dir1      Dir2      Dir3       Dir4      Dir5
Eigenvalues  0.87488  0.054655  0.029564  0.0074107 3.872e-03
Cum. %      90.15834 95.790639 98.837290 99.6009793 1.000e+02
-------------------------------------------------- 
Model-based SIR 
-------------------------------------------------- 

Slices:
          1   2       3   4     5     6    
GMM       XXX EEE     XII EEE   EEE   EII  
Num.comp. 1   3       1   2     2     2    
Num.obs.  33  12|14|7 33  16|17 18|15 24|11

Estimated basis vectors:
        Dir1     Dir2       Dir3     Dir4     Dir5
x1  0.747648 -0.43540 -0.1514276  0.41573  0.34432
x2 -0.662786 -0.42087 -0.3078675  0.33402  0.27243
x3  0.023848 -0.73124  0.0013476 -0.33904 -0.68105
x4 -0.030613 -0.26170  0.0449039 -0.74128  0.57642
x5  0.015231  0.17348 -0.9382266 -0.22618 -0.10548

                Dir1     Dir2     Dir3      Dir4       Dir5
Eigenvalues  0.90292  0.18852  0.14972  0.088869   0.043121
Cum. %      65.75519 79.48437 90.38783 96.859736 100.000000
-------------------------------------------------- 
Model-based SIR 
-------------------------------------------------- 

Slices:
          1   2   3   4        5     6        7     8  
GMM       XXI XXX XII EEV      EEV   EEV      EEV   XXI
Num.comp. 1   1   1   3        2     3        2     1  
Num.obs.  42  42  42  12|17|13 22|20 11|20|11 26|16 6  

Estimated basis vectors:
        Dir1      Dir2      Dir3      Dir4     Dir5
x1 -0.261639  0.949219  0.094196 -0.072585 -0.12808
x2  0.699415  0.223130 -0.514194 -0.233538 -0.10593
x3  0.661030  0.176540  0.710934  0.210799  0.22018
x4  0.067053 -0.108516  0.258145  0.474003 -0.91849
x5 -0.030116  0.079091 -0.393276  0.819193  0.28333

                Dir1     Dir2      Dir3      Dir4       Dir5
Eigenvalues  0.76334  0.56723  0.053349  0.033247   0.016935
Cum. %      53.22793 92.78081 96.500826 98.819150 100.000000

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