bootplsglm | R Documentation |
Provides a wrapper for the bootstrap function boot
from the
boot
R package.
Implements non-parametric bootstraps for PLS
Generalized Linear Regression models by either (Y,X) or (Y,T) resampling.
bootplsglm( object, typeboot = "fmodel_np", R = 250, statistic = NULL, sim = "ordinary", stype = "i", stabvalue = 1e+06, verbose = TRUE, ... )
object |
An object of class |
typeboot |
The type of bootstrap. Either (Y,X) boostrap
( |
R |
The number of bootstrap replicates. Usually this will be a single
positive integer. For importance resampling, some resamples may use one set
of weights and others use a different set of weights. In this case |
statistic |
A function which when applied to data returns a vector
containing the statistic(s) of interest. |
sim |
A character string indicating the type of simulation required.
Possible values are |
stype |
A character string indicating what the second argument of
|
stabvalue |
A value to hard threshold bootstrap estimates computed from atypical resamplings. Especially useful for Generalized Linear Models. |
verbose |
should info messages be displayed ? |
... |
Other named arguments for |
More details on bootstrap techniques are available in the help of the
boot
function.
An object of class "boot"
. See the Value part of the help of
the function boot
.
Frédéric Bertrand
frederic.bertrand@utt.fr
https://fbertran.github.io/homepage/
A. Lazraq, R. Cleroux, and J.-P. Gauchi. (2003). Selecting both
latent and explanatory variables in the PLS1 regression model.
Chemometrics and Intelligent Laboratory Systems, 66(2):117-126.
P.
Bastien, V. Esposito-Vinzi, and M. Tenenhaus. (2005). PLS generalised linear
regression. Computational Statistics & Data Analysis, 48(1):17-46.
A. C. Davison and D. V. Hinkley. (1997). Bootstrap Methods and Their
Applications. Cambridge University Press, Cambridge.
boot
#Imputed aze dataset data(aze_compl) Xaze_compl<-aze_compl[,2:34] yaze_compl<-aze_compl$y dataset <- cbind(y=yaze_compl,Xaze_compl) modplsglm <- plsRglm(y~.,data=dataset,3,modele="pls-glm-logistic") library(boot) # Bastien (Y,T) PLS bootstrap aze_compl.bootYT <- bootplsglm(modplsglm, R=250, verbose=FALSE) boxplots.bootpls(aze_compl.bootYT) confints.bootpls(aze_compl.bootYT) plots.confints.bootpls(confints.bootpls(aze_compl.bootYT)) # (Y,X) PLS bootstrap aze_compl.bootYX <- bootplsglm(modplsglm, R=250, verbose=FALSE, typeboot = "plsmodel") boxplots.bootpls(aze_compl.bootYX) confints.bootpls(aze_compl.bootYX) plots.confints.bootpls(confints.bootpls(aze_compl.bootYX)) # (Y,X) PLS bootstrap raw coefficients aze_compl.bootYX.raw <- bootplsglm(modplsglm, R=250, verbose=FALSE, typeboot = "plsmodel", statistic=coefs.plsRglm.raw) boxplots.bootpls(aze_compl.bootYX.raw) confints.bootpls(aze_compl.bootYX.raw) plots.confints.bootpls(confints.bootpls(aze_compl.bootYX.raw)) plot(aze_compl.bootYT,index=2) jack.after.boot(aze_compl.bootYT, index=2, useJ=TRUE, nt=3) plot(aze_compl.bootYT, index=2,jack=TRUE) aze_compl.tilt.boot <- tilt.bootplsglm(modplsglm, statistic=coefs.plsRglm, R=c(499, 100, 100), alpha=c(0.025, 0.975), sim="ordinary", stype="i", index=1) # PLS bootstrap balanced aze_compl.bootYT <- bootplsglm(modplsglm, sim="balanced", R=250, verbose=FALSE) boxplots.bootpls(aze_compl.bootYT) confints.bootpls(aze_compl.bootYT) plots.confints.bootpls(confints.bootpls(aze_compl.bootYT)) plot(aze_compl.bootYT) jack.after.boot(aze_compl.bootYT, index=1, useJ=TRUE, nt=3) plot(aze_compl.bootYT,jack=TRUE) aze_compl.tilt.boot <- tilt.bootplsglm(modplsglm, statistic=coefs.plsR, R=c(499, 100, 100), alpha=c(0.025, 0.975), sim="balanced", stype="i", index=1) # PLS permutation bootstrap aze_compl.bootYT <- bootplsglm(modplsglm, sim="permutation", R=250, verbose=FALSE) boxplots.bootpls(aze_compl.bootYT) plot(aze_compl.bootYT) #Original aze dataset with missing values data(aze) Xaze<-aze[,2:34] yaze<-aze$y library(boot) modplsglm2 <- plsRglm(yaze,Xaze,3,modele="pls-glm-logistic") aze.bootYT <- bootplsglm(modplsglm2, R=250, verbose=FALSE) boxplots.bootpls(aze.bootYT) confints.bootpls(aze.bootYT) plots.confints.bootpls(confints.bootpls(aze.bootYT)) #Ordinal logistic regression data(bordeaux) Xbordeaux<-bordeaux[,1:4] ybordeaux<-factor(bordeaux$Quality,ordered=TRUE) dataset <- cbind(y=ybordeaux,Xbordeaux) options(contrasts = c("contr.treatment", "contr.poly")) modplsglm3 <- plsRglm(ybordeaux,Xbordeaux,1,modele="pls-glm-polr") bordeaux.bootYT<- bootplsglm(modplsglm3, sim="permutation", R=250, verbose=FALSE) boxplots.bootpls(bordeaux.bootYT) boxplots.bootpls(bordeaux.bootYT,ranget0=TRUE) bordeaux.bootYT2<- bootplsglm(modplsglm3, sim="permutation", R=250, strata=unclass(ybordeaux), verbose=FALSE) boxplots.bootpls(bordeaux.bootYT2,ranget0=TRUE) if(require(chemometrics)){ data(hyptis) hyptis yhyptis <- factor(hyptis$Group,ordered=TRUE) Xhyptis <- as.data.frame(hyptis[,c(1:6)]) dataset <- cbind(y=yhyptis,Xhyptis) options(contrasts = c("contr.treatment", "contr.poly")) modplsglm4 <- plsRglm(yhyptis,Xhyptis,3,modele="pls-glm-polr") hyptis.bootYT3<- bootplsglm(modplsglm4, sim="permutation", R=250, verbose=FALSE) rownames(hyptis.bootYT3$t0)<-c("Sabi\nnene","Pin\nene", "Cine\nole","Terpi\nnene","Fenc\nhone","Terpi\nnolene") boxplots.bootpls(hyptis.bootYT3) boxplots.bootpls(hyptis.bootYT3,xaxisticks=FALSE) boxplots.bootpls(hyptis.bootYT3,ranget0=TRUE) boxplots.bootpls(hyptis.bootYT3,ranget0=TRUE,xaxisticks=FALSE) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.