predicts | R Documentation |
The function calculates the predicted values and the difference of a range of cases with the confidence interval. It can be used for any glm, polr or multinom model.
predicts(model, values, position = NULL, sim.count = 1000, conf.int = 0.95, sigma = NULL, set.seed = NULL, doPar = FALSE, type = c("any", "simulation", "bootstrap"))
model |
the model-Object generated with glm(), glm.nb(), polr(), multinom(), mlogit() or tobit() |
values |
The values of cases as character in the order how they appear in the summary(model) Estimate. The values must be in the following way: "value1;value2;value3;...". Each one of the values can be one of the following:
|
position |
OPTIONAL which variable should be taken for the discrete change, the variable must have at least two values. default: only predicted probabilities |
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 |
doPar |
OPTIONAL if the code should run parallel if more than 2 cores are detected |
type |
OPTIONAL choose between simulation and bootstrap, "any" chooses between those two according to the number of cases (bootstrap if n < 500) |
The function makes a simulation for the all combination of cases and compares them to each other.
The output is a data.frame with the predicted values and discrete changes.
Benjamin Schlegel, kontakt@benjaminschlegel.ch
## Not run: model1 = glm(Sex ~ Height + Smoke + Pulse, data=MASS::survey, family=binomial(link=logit)) summary(model1) # comparing person with hight 150 to 160, 160 to 170, 170 to 180, 180 to 190 # with all combination of(non-)smokers and a median of pulse predicts(model1, "150-190,10;F;median", position = 1, doPar = FALSE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.