Learn R Programming

msir (version 1.1)

msir: MSIR -- Model-based Sliced Inverse Regression

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

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

Arguments

x
a $(n \times p)$ design matrix containing the predictors data values.
y
a $(n \times 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 lis
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: lcl{ "mle" = maximum likelihood estimate "regularized" = regularized covariance matrix (see
...
other arguments passed to msir.compute.

Value

  • Returns an object of class 'msir' with attributes:
  • callthe function call.
  • xthe design matrix.
  • ythe response vector.
  • slice.infooutput from slicing function.
  • mixmoda list of finite mixture model objects as described in mclustModel.
  • loglikthe log-likelihood for the mixture models.
  • fa vector of length equal to the total number of mixture components containing the fraction of observations in each fitted component within slices.
  • mua matrix of component within slices predictors means.
  • sigmathe marginal predictors covariance matrix.
  • Mthe msir kernel matrix.
  • evaluesthe eigenvalues from the generalized eigen-decomposition of M.
  • evectorsthe raw eigenvectors from the generalized eigen-decomposition of M ordered according to the eigenvalues.
  • basisthe normalized eigenvectors from the generalized eigen-decomposition of M ordered according to the eigenvalues.
  • std.basisstandardized 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.
  • numdirthe maximal number of directions estimated.
  • dirthe estimated MSIR directions from mean-centered predictors.

References

Scrucca, L. (2011) Model-based SIR for dimension reduction. Computational Statistics and Data Analysis, 55(11), 3010-3026.

See Also

summary.msir, plot.msir, dr

Examples

Run this code
# 1-dimensional simple regression
n = 200; p = 5
b = as.matrix(c(1,-1,rep(0,p-2)))
x = mvrnorm(n, rep(0,p), diag(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 = mvrnorm(n, rep(0,p), diag(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 = mvrnorm(n, mu = rep(0,p), Sigma = diag(p))
y = x %*% b1 + (x %*% b1)^3 + 4*(x %*% b2)^2 + rnorm(n)
MSIR = msir(x, y)
summary(MSIR)
plot(MSIR, which = 1:2)
plot(MSIR, type = "spinplot")
plot(MSIR, which = 1, type = "2Dplot", span = 0.7)
plot(MSIR, which = 2, type = "2Dplot", span = 0.7)

Run the code above in your browser using DataLab