predProbs: Predicted Probabilities for a Variety of Logit and Probit...

Description Usage Arguments Value References Examples

View source: R/predProbs.R

Description

This an R function for computing predicted probabilities for binary & ordinal logit and probit, (partial) generalized ordinal & multinomial logit models estimated with glm, clm (in ordinal), and vglm (in VGAM) commands. It returns a data frame with each column containing the predicted probabilities for a specific response y value given a set of chosen independent variable settings.

Usage

1
predProbs(model, specs, method="logit")

Arguments

model

An input model object estimated with glm, clm, or vglm. The order of the right-hand variables must be the same as that of the "specs" argument.

specs

A data frame with each row specifying the chosen values of all the independent variables in the model.

method

Default "logit"; altenative methods are "probit," "mlogit," and "gologit".The "logit" and "probit" method can be estimated with glm or clm of the ordinal package while "mlogit" and "gologit" can be estimated with vglm in the VGAM package. For multinomial logit models, use the last choice as the reference category.

Value

The function outputs a data frame of J number of columns, with each column containing the predicted probabilities p(y=j) with j = 1, ..., J for ordinal models, j = 1, 0 for binary models, and j = 1, ..., Ref for multinomial models. The rows are defined the same as in the input "specs" argument.

References

Tim F. Liao, 1994. Interpreting Probability Models: Logit, Probit, and Other Generalized Linear Models. Thousand Oaks, CA: Sage.

J. Scott Long, 1997. Regression Models for Categorical and Limited Dependent Variables. Thousand Oaks, CA: Sage.

Examples

1
2
3
4
5
6
7
8
data(adm)
adm$hRank[adm$rank==1 | adm$rank==2] <- 1
adm$hRank[adm$rank==3 | adm$rank==4] <- 0
logit1 <- glm(admit ~ gre + hRank + gpa, data=adm, binomial)
setval1 <- expand.grid(gre=seq(250,800,50), hRank=0:1, gpa=mean(adm$gpa))
predprobs1 <- predProbs(logit1, setval1)
probit1 <- glm(admit ~ gre + hRank + gpa, data=adm, binomial(link=probit))
predprobs2 <- predProbs(probit1, setval1, method="probit")

ProbMarg documentation built on July 1, 2020, 6 p.m.

Related to predProbs in ProbMarg...