basepredict.vglm {glm.predict} | R Documentation |
predicted value
Description
The function calculates the predicted value with the confidence interval. It can be used for any vglm model.
Usage
## S3 method for class 'vglm'
basepredict(model, values, sim.count=1000, conf.int=0.95, sigma=NULL, set.seed=NULL,
type = c("any", "simulation", "bootstrap"), summary = TRUE)
Arguments
model |
the model Object generated with vglm() |
values |
the values of the case as vector in the order how they appear in the summary(model) Estimate |
sim.count |
OPTIONAL numbers of simulations to be done by the function. default: 1000 |
conf.int |
OPTIONAL the confidence interval used by the function. default: 0.95 |
sigma |
OPTIONAL the variance-covariance matrix, can be changed when having for example robust or clustered vcov. default: vcov(model) |
set.seed |
OPTIONAL set a seed for the random number generator |
type |
OPTIONAL choose between simulation and bootstrap, "any" chooses between those two according to the number of cases (bootstrap if n < 1000). Note: bootstrap is very slow for vglm() models. |
summary |
OPTIONAL if mean/quantiles should be return or all simulated values (default: TRUE) |
Details
The function makes a simulation for the two cases and compares them to each other.
Value
The output is a matrix have in the first column the predicted value, in the second column the lower value of the confidence interval and in the third column the upper value of the confidence interval.
Author(s)
Benjamin Schlegel, kontakt@benjaminschlegel.ch
Examples
## Not run:
data = MASS::survey
data$Smoke = ordered(data$Smoke, levels = c("Never", "Occas", "Regul", "Heavy"))
model1 = VGAM::vglm(Smoke ~ Height + Pulse, data=data,
family = cumulative(parallel=FALSE ~ Pulse), maxit=1000)
summary(model1)
# predicted probability of smoking of a person with height 170 and an average pulse
basepredict(model1, c(170,mean(MASS::survey$Pulse,na.rm=TRUE)))
## End(Not run)