| plot.boot.BTLLasso {BTLLasso} | R Documentation |
Plot bootstrap intervals for BTLLasso
Description
Plots bootstrap intervals for every single coefficient based on bootstrap estimates
calculated by boot.BTLLasso. Bootstrap
intervals are separated by covariates, every covariate is plotted
separately.
Usage
## S3 method for class 'boot.BTLLasso'
plot(
x,
quantiles = c(0.025, 0.975),
plots_per_page = 1,
ask_new = TRUE,
rescale = FALSE,
which = "all",
include.zero = TRUE,
rows = NULL,
subs.X = NULL,
subs.Z1 = NULL,
main.Z2 = "Obj-spec. Covariates",
...
)
Arguments
x |
boot.BTLLasso object |
quantiles |
Which empirical quantiles of the bootstrap estimates should be plotted? |
plots_per_page |
Number of plots per page, internally specified by |
ask_new |
If TRUE, the user is asked before each plot. |
rescale |
Should the parameter estimates be rescaled for plotting? Only
applies if |
which |
Integer vector to specify which parameters/variables to plot. |
include.zero |
Should all plots contain zero? |
rows |
Optional argument for the number of rows in the plot.
Only applies if |
subs.X |
Optional vector of subtitles for variables in |
subs.Z1 |
Optional vector of subtitles for variables in |
main.Z2 |
Optional character containg main for plot containing intervals for Z2 parameters. |
... |
other parameters to be passed through to plot function. |
Author(s)
Gunther Schauberger
gunther.schauberger@tum.de
References
Schauberger, Gunther and Tutz, Gerhard (2019): BTLLasso - A Common Framework and Software Package for the Inclusion and Selection of Covariates in Bradley-Terry Models, Journal of Statistical Software, 88(9), 1-29, doi:10.18637/jss.v088.i09
Schauberger, Gunther and Tutz, Gerhard (2017): Subject-specific modelling of paired comparison data: A lasso-type penalty approach, Statistical Modelling, 17(3), 223 - 243
Schauberger, Gunther, Groll Andreas and Tutz, Gerhard (2018): Analysis of the importance of on-field covariates in the German Bundesliga, Journal of Applied Statistics, 45(9), 1561 - 1578
See Also
boot.BTLLasso, BTLLasso,
cv.BTLLasso
Examples
## Not run:
op <- par(no.readonly = TRUE)
##############################
##### Example with simulated data set containing X, Z1 and Z2
##############################
data(SimData)
## Specify control argument
## -> allow for object-specific order effects and penalize intercepts
ctrl <- ctrl.BTLLasso(penalize.intercepts = TRUE, object.order.effect = TRUE,
penalize.order.effect.diffs = TRUE)
## Simple BTLLasso model for tuning parameters lambda
m.sim <- BTLLasso(Y = SimData$Y, X = SimData$X, Z1 = SimData$Z1,
Z2 = SimData$Z2, control = ctrl)
m.sim
par(xpd = TRUE)
plot(m.sim)
## Cross-validate BTLLasso model for tuning parameters lambda
set.seed(1860)
m.sim.cv <- cv.BTLLasso(Y = SimData$Y, X = SimData$X, Z1 = SimData$Z1,
Z2 = SimData$Z2, control = ctrl)
m.sim.cv
coef(m.sim.cv)
logLik(m.sim.cv)
head(predict(m.sim.cv, type="response"))
head(predict(m.sim.cv, type="trait"))
plot(m.sim.cv, plots_per_page = 4)
## Example for bootstrap intervals for illustration only
## Don't calculate bootstrap intervals with B = 20!!!!
set.seed(1860)
m.sim.boot <- boot.BTLLasso(m.sim.cv, B = 20, cores = 20)
m.sim.boot
plot(m.sim.boot, plots_per_page = 4)
##############################
##### Example with small version from GLES data set
##############################
data(GLESsmall)
## extract data and center covariates for better interpretability
Y <- GLESsmall$Y
X <- scale(GLESsmall$X, scale = FALSE)
Z1 <- scale(GLESsmall$Z1, scale = FALSE)
## vector of subtitles, containing the coding of the X covariates
subs.X <- c('', 'female (1); male (0)')
## Cross-validate BTLLasso model
m.gles.cv <- cv.BTLLasso(Y = Y, X = X, Z1 = Z1)
m.gles.cv
coef(m.gles.cv)
logLik(m.gles.cv)
head(predict(m.gles.cv, type="response"))
head(predict(m.gles.cv, type="trait"))
par(xpd = TRUE, mar = c(5,4,4,6))
plot(m.gles.cv, subs.X = subs.X, plots_per_page = 4, which = 2:5)
paths(m.gles.cv, y.axis = 'L2')
##############################
##### Example with Bundesliga data set
##############################
data(Buli1516)
Y <- Buli1516$Y5
Z1 <- scale(Buli1516$Z1, scale = FALSE)
ctrl.buli <- ctrl.BTLLasso(object.order.effect = TRUE,
name.order = "Home",
penalize.order.effect.diffs = TRUE,
penalize.order.effect.absolute = FALSE,
order.center = TRUE, lambda2 = 1e-2)
set.seed(1860)
m.buli <- cv.BTLLasso(Y = Y, Z1 = Z1, control = ctrl.buli)
m.buli
par(xpd = TRUE, mar = c(5,4,4,6))
plot(m.buli)
##############################
##### Example with Topmodel data set
##############################
data("Topmodel2007", package = "psychotree")
Y.models <- response.BTLLasso(Topmodel2007$preference)
X.models <- scale(model.matrix(preference~., data = Topmodel2007)[,-1])
rownames(X.models) <- paste0("Subject",1:nrow(X.models))
colnames(X.models) <- c("Gender","Age","KnowShow","WatchShow","WatchFinal")
set.seed(5)
m.models <- cv.BTLLasso(Y = Y.models, X = X.models)
plot(m.models, plots_per_page = 6)
par(op)
## End(Not run)