Description Usage Arguments Details Value See Also Examples
prediction
1 2 | prediction (object,X,Y,signature,ncomp,X.test,CI,many,
subsampling.matrix,ratio,level.CI,save.file)
|
object |
a ‘spls.constraint’ object, as one resulting from |
X |
Only used if |
Y |
Only used if |
signature |
Only used if |
ncomp |
Only used if |
X.test |
Test matrix. |
CI |
logical. If TRUE, the confidence interval are calculated. |
many |
How many subsamplings do you want to do? Default is 100 |
subsampling.matrix |
Optional matrix of |
ratio |
Number between 0 and 1. It is the proportion of the n samples that are put aside and considered as an internal testing set. The (1-ratio)*n samples are used as a training set. |
level.CI |
A 1- |
save.file |
Save the outputs of the functions in |
This function can work with a spls.constraint
object or with the input data (X, Y, signature). See examples below to see the difference in use.
CI |
A (1- |
Y.hat.test |
A four dimensional array. The two first dimensions are an estimation of the dummy matrix obtained from Y (size n * number of sample types). The third dimension is relative to the number of components |
ClassifResult |
A 5-dimensional array. The two first dimensions consists in the confusion matrix. The third dimension is relative to the number of components |
loadings.X |
A 3-dimensional array. Loadings vector of X, for each component and each subsampling. |
prediction.X |
A 4-dimensional array of size n*many*ncomp*3. Gives the prediction for the chosen |
prediction.X.test |
A 4-dimensional array of size nrow(X.test)*many*ncomp*3. Gives the prediction for the chosen |
learning.sample |
Matrix of size n*many. Gives the samples that have been used in the internal training set over the |
coeff |
A list of means.X, sigma.X, means.Y and sigma.Y. Means and variances for the variables of X and the columns of the dummy matrix obtained from Y, each row is a subsampling. |
data |
A list of the input data X, Y and of ind.kept.X, which is a list containing the variables kept on each component. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ## Not run:
data(MSC)
X=MSC$X
Y=MSC$Y
# with a bootsPLS object
boot=bootsPLS(X=X,Y=Y,ncomp=3,many=5,kCV=5)
fit=fit.model(boot,ncomp=3)
# with a spls.constraint object and without CI
pred=prediction(fit,X.test=X)
lapply(pred$predicted.test,head)
# with a spls.constraint object and with CI
pred.CI=prediction(fit,X.test=X,CI=TRUE)
lapply(pred.CI$out.CI$CI$'comp.1',head)
lapply(pred.CI$out.CI$CI$'comp.2',head)
lapply(pred.CI$out.CI$CI$'comp.3',head)
# without a spls.constraint object. X,Y and signature are needed
# the results should be similar
#(not the same because of the random subsamplings,
# exactly the same if subsampling.matrix is an input)
signature=fit$data$signature
pred=prediction(X=X,Y=Y,signature=signature,X.test=X)
pred2=prediction(X=X,Y=Y,signature=signature,X.test=X,CI=TRUE)
lapply(pred2$out.CI$CI$'comp.1',head)
lapply(pred2$out.CI$CI$'comp.2',head)
lapply(pred2$out.CI$CI$'comp.3',head)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.