msma: Multiblock Sparse Multivariable Analysis

Description Usage Arguments Details Value Examples

View source: R/src.r

Description

This is a function for a matrix decomposition method incorporating sparse and supervised modeling for a multiblock multivariable data analysis

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
msma(X, ...)

## Default S3 method:
msma(X, Y = NULL, Z = NULL, comp = 2, lambdaX = NULL,
  lambdaY = NULL, eta = 1, type = "lasso", inX = NULL, inY = NULL,
  muX = 0, muY = 0, defmethod = "canonical", scaling = TRUE,
  verbose = FALSE, intseed = 1, ...)

## S3 method for class 'msma'
print(x, ...)

Arguments

X

a matrix or list of matrices indicating the explanatory variable(s). This parameter is required.

...

further arguments passed to or from other methods.

Y

a matrix or list of matrices indicating objective variable(s). This is optional. If there is no input for Y, then PCA is implemented.

Z

a vector, response variable(s) for implementing the supervised version of (multiblock) PCA or PLS. This is optional. The length of Z is the number of subjects. If there is no input for Z, then unsupervised PLS/PCA is implemented.

comp

numeric scalar for the number of components to be considered.

lambdaX

numeric vector of regularized parameters for X, with a length equal to the number of blocks. If lambdaX is omitted, no regularization is conducted.

lambdaY

numeric vector of regularized parameters for Y, with a length equal to the number of blocks. If lambdaY is omitted, no regularization is conducted.

eta

numeric scalar indicating the parameter indexing the penalty family. This version contains only choice 1.

type

a character, indicating the penalty family. In this version, only one choice is available: "lasso."

inX

a vector or list of numeric vectors specifying the variables in X, always included in the model

inY

a vector or list of numeric vectors specifying the variables in Y, always included in the model

muX

a numeric scalar for the weight of X for the supervised case. 0 <= muX <= 1.

muY

a numeric scalar for the weight of Y for the supervised case. 0 <= muY <= 1.

defmethod

a character representing the deflation method. This version has only the choice "canonical."

scaling

a logical, indicating whether or not data scaling is performed. The default is TRUE.

verbose

information

intseed

seed number for the random number in the parameter estimation algorithm.

x

an object of class "msma." Usually, a result of a call to msma

Details

msma requires at least one input X (a matrix or list). In this case, (multiblock) PCA is conducted. If Y is also specified, then a PLS is conducted using X as explanatory variables and Y as objective variables. This function scales each data matrix to a mean of 0 and variance of 1 in the default. The block structure can be represented as a list. If Z is also specified, a supervised version is implemented, and the degree is controlled by muX or muY, where 0 <= muX <= 1, 0 <= muY <= 1, and 0 <= muX + muY < 1. If a positive lambdaX or lambdaY is specified, then a sparse estimation based on the L1 penalty is implemented.

Value

dmode

Indicates mode "PLS" or "PCA"

X

Scaled X, which has a list form.

Y

Scaled Y, which has a list form.

Xscale

Scaling information for X. The mean and standard deviation values for each block of X are returned.

Yscale

Scaling information for Y. The mean and standard deviation values for each block of Y are returned.

comp

Number of components

wbX

Block loading for X. The list has the same length as that of the input list X (number of blocks) and consists of a matrix. The number of variables is present in the row and the number of components is present in the column.

sbX

Block score for X. The list has the same length as that of the input list X (number of blocks) and consists of a matrix, with the number of subjects in the row and the number of components in the column.

wbY

Block loading for Y. The list has same length as that of the input list Y (number of blocks) and consists of a matrix, with the number of variables in the row and the number of components in the column.

sbY

Block score for Y. The list has same length as that of the input list Y (number of blocks) and consists of a matrix, with the number of subjects in the row and the number of components in the column.

ssX

Super score for X. In the matrix, the number of subjects is in the row and the number of components is in the column.

wsX

Super loading for X. In the matrix, the number of blocks is in the row and the number of components is in the column.

ssY

Super score for Y. In the matrix, the number of subjects is in the row and the number of components is in the column.

wsY

Super loading for Y. In the matrix, the number of blocks is in the row and the number of components is in the column.

nzwbX

Number of nonzeros in block loading for X

nzwbY

Number of nonzeros in block loading for Y

selectXnames

Names of selected variables for X. This returns from the original names of X

selectYnames

Names of selected variables for Y. This returns from the original names of Y

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
##### data #####
tmpdata = simdata(n = 50, rho = 0.8, Yps = c(10, 12, 15), Xps = 20, seed=1)
X = tmpdata$X; Y = tmpdata$Y 

##### One Component #####
fit1 = msma(X, Y, comp=1, lambdaX=2, lambdaY=1:3)
fit1

##### Two Component #####
fit2 = msma(X, Y, comp=2, lambdaX=2, lambdaY=1:3)
fit2

##### Matrix data #####
sigma = matrix(0.8, 10, 10)
diag(sigma) = 1
X2 = rmvnorm(50, rep(0, 10), sigma)
Y2 = rmvnorm(50, rep(0, 10), sigma)

fit3 = msma(X2, Y2, comp=1, lambdaX=2, lambdaY=2)
fit3

##### Sparse Principal Component Analysis #####
fit5 = msma(X2, comp=5, lambdaX=2.5)
summary(fit5)

msma documentation built on May 4, 2018, 9:04 a.m.