dc.polr {glm.predict} | R Documentation |
predicted values and discrete change
Description
The function calculates the predicted values and the difference of two cases with the confidence interval. It can be used for a polr model.
Usage
## S3 method for class 'polr'
dc(model, values = NULL, sim.count = 1000, conf.int = 0.95,
sigma = NULL, set.seed = NULL, values1 = NULL, values2 = NULL,
type = c("any", "simulation", "bootstrap"), summary = TRUE)
Arguments
model |
the model-Object generated with polr() |
values |
the values of case 1 and 2 as vector in the order how they appear in the summary(model) Estimate. Values is if values1 and values2 are specified after each other in the same vector. Either values or values1 and values2 have to be specified. |
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 |
values1 |
the values of case 1 as vector in the order how they appear in the summary(model) Estimate. Has to be defined if values is not defined. |
values2 |
the values of case 2 as vector in the order how they appear in the summary(model) Estimate. Has to be defined if values is not defined. |
type |
OPTIONAL choose between simulation and bootstrap, "any" chooses between those two according to the number of cases (bootstrap if n < 1000) |
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 values, 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 = polr(Smoke ~ Height + Pulse, data=data)
summary(model1)
dc(model1, values1 = c(150,mean(MASS::survey$Pulse,na.rm=TRUE)),
values2 = c(151,mean(MASS::survey$Pulse,na.rm=TRUE)))
# all differences are significant as the confidence intervals do not include 0
## End(Not run)