predict.sgpls: Make predictions or extract coefficients from a fitted SGPLS...

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

View source: R/predict.sgpls.R

Description

Make predictions or extract coefficients from a fitted SGPLS object.

Usage

1
2
3
4
5
## S3 method for class 'sgpls'
predict( object, newx, type = c("fit","coefficient"),
    fit.type = c("class","response"), ... )
## S3 method for class 'sgpls'
coef( object, ... )

Arguments

object

A fitted SGPLS object.

newx

If type="fit", then newx should be the predictor matrix of test dataset. If newx is omitted, then prediction of training dataset is returned. If type="coefficient", then newx can be omitted.

type

If type="fit", fitted values are returned. If type="coefficient", coefficient estimates of SGPLS fits are returned.

fit.type

If fit.type="class", fitted classes are returned. If fit.type="response", fitted probabilities are returned. Relevant only when type="fit".

...

Any arguments for predict.sgpls should work for coef.sgpls.

Details

Users can input either only selected variables or all variables for newx.

Value

Matrix of coefficient estimates if type="coefficient". Matrix of predicted responses if type="fit" (responses will be predicted classes if fit.type="class" or predicted probabilities if fit.type="response").

Author(s)

Dongjun Chung and Sunduz Keles.

References

Chung D and Keles S (2010), "Sparse partial least squares classification for high dimensional data", Statistical Applications in Genetics and Molecular Biology, Vol. 9, Article 17.

See Also

print.sgpls.

Examples

1
2
3
4
5
6
7
8
data(prostate)
# SGPLS with eta=0.55 & 3 hidden components
f <- sgpls( prostate$x, prostate$y, K=3, eta=0.55, scale.x=FALSE )
# Print out coefficients
coef.f <- coef(f)
coef.f[ coef.f!=0, ]
# Prediction on the training dataset
(pred.f <- predict( f, type="fit" ))

spls documentation built on May 6, 2019, 1:09 a.m.