probci {DAMisc} R Documentation

## Confidence Intervals for Predicted Probabilities and Their Differences

### Description

Calculates predicted probabilities for any combination of x-variable values holding all other variables constant at either typical values (average case approach) or at observed values (average effect approach).

### Usage

probci(
obj,
data,
.b = NULL,
.vcov = NULL,
changeX = NULL,
numQuantVals = 5,
xvals = NULL,
type = c("aveEff", "aveCase"),
returnProbs = FALSE,
calcPW = FALSE
)


### Arguments

 obj A model of class glm, particularly those with binomial family. data Data frame used to estimate obj. .b A vector of coefficients to be passed down to the simulation. If NULL, coef() will be used to obtain coefficients from obj. .vcov A parameter variance covariance matrix to be passed to the simulation. If NULL, vcov() will be used to obtain the variance-covariance matrix of the parameters. changeX A vector of strings giving the names of variables for which changes are desired. numQuantVals For quantitative variables, if no x-values are specified in xvals, then numQuantVals gives the number of values used across the range of the variable. xvals A named list of values used to make the predictions. The names in the list should correspond with the variable names specified in changeX. type Type of effect to be generated. aveEff produces the average first difference across all observed values of X, while aveCase gives the first difference holding all other variables constant at typical values. returnProbs Whether or not the vecot/matrix of predicted probabilities should be returned as well. calcPW Should the pairwise differences be calculated?

### Details

Calculates predicted probabilities for any combination of x-variable values holding all other variables constant at either typical values (average case approach) or at observed values (average effect approach). The function uses a parametric bootstrap to provide generate confidence bounds for predicted probabilities and their differences. The confidence intervals produced are raw percentile interviews (at the 5% level).

### Value

An data frame with the following variables:

 variables The variables and the values at which they are held constant. For example, tmp1 would be the first value of tmp used in the probability calculation and tmp2 would be the second value of tmp used in the probability calculation. pred_prob The difference in predicted probability given the following change in X: tmp2-tmp1. lower, upper The lower and upper 95% confidence bounds.

Dave Armstrong

### Examples


data(france)
left.mod <- glm(voteleft ~ male + age + retnat +
poly(lrself, 2, raw=TRUE), data=france, family=binomial)
out <- probci(left.mod, france, changeX="retnat")
out
out2 <- probci(left.mod, france, changeX="lrself",
xvals = list(lrself = c(1,10)))
out2
out3 <- probci(left.mod, france, changeX=c("lrself", "retnat"),
xvals = list(lrself = c(1,10)))
out3



[Package DAMisc version 1.7.2 Index]