View source: R/predict.splsda.R
predict.splsda | R Documentation |
Make predictions or extract coefficients from a fitted SPLSDA object.
## S3 method for class 'splsda'
predict( object, newx, type = c("fit","coefficient"),
fit.type = c("class","response"), ... )
## S3 method for class 'splsda'
coef( object, ... )
object |
A fitted SPLSDA object. |
newx |
If |
type |
If |
fit.type |
If |
... |
Any arguments for |
Users can input either only selected variables or all variables for newx
.
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"
).
Dongjun Chung and Sunduz Keles.
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.
print.splsda
.
data(prostate)
# SPLSDA with eta=0.8 & 3 hidden components
f <- splsda( prostate$x, prostate$y, K=3, eta=0.8, 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" ))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.