Learn R Programming

bootsPLS (version 1.1.2)

fit.model: Create a spls.constraint object by fitting a constraint spls on a bootsPLS object

Description

Create a spls.constraint object by fitting a constraint spls with the spls.hybrid function on a `bootsPLS' object

Usage

fit.model(object,auto.tune,X,Y,ncomp,signature,alpha,limit,showProgress=TRUE)

Arguments

object

a `bootsPLS' object', as obtained from bootsPLS.

auto.tune

Logical. If TRUE, tune the optimal number of component (ncomp) and which variables to select on each component (signature). It only works with object

X

Input matrix of dimension n * p; each row is an observation vector.

Y

Factor with at least q>2 levels.

ncomp

How many component are to be included in the sPLS-DA analysis?

signature

A list containing which variables to keep on each component.

alpha

Level of the test.

limit

Vector of maximal number of genes to include on each component.

showProgress

Logical. If TRUE, shows the progress of the algorithm.

Value

A 'spls.constraint' object is returned for which plotIndiv is available.

The outputs are the ones from spls.hybrid, plus

data

A list of the input data X, Y, Y.mat (dummy matrix) and of signature, which is a list containing the variables kept on each component. If a tuning occurs, either for the number of components or for the variables or both, outputs $component.selection and $variable.selection are available; see component.selection and variable.selection.

Details

This function fit a spls.hybrid on the variables included in signature, which can be an input or internally calculated by setting auto.tune=TRUE. If object is given as an input, (X, Y) are ignored. If auto.tune=TRUE, ncomp, signature are ignored.

See Also

prediction, CI.prediction, plotIndiv

Examples

Run this code
# NOT RUN {
data(MSC)
X=MSC$X
Y=MSC$Y


boot=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5)

# with a bootsPLS object and auto.tune=TRUE
fit=fit.model(boot,auto.tune=TRUE)
plot(fit$component.selection)
plot(fit$variable.selection)

# with a bootsPLS object and ncomp=2
fit=fit.model(boot,ncomp=2)

# with a bootsPLS object and ncomp/signature as input
signature=fit$data$signature
fit=fit.model(boot,ncomp=2,signature=signature)

# with no bootsPLS object
fit=fit.model(X=X,Y=Y,ncomp=2,signature=signature)# bootsPLS object

plotIndiv(fit,ind.names=FALSE, legend=TRUE)

# }

Run the code above in your browser using DataLab