Calculate predicted probabilities

Share:

Description

This function calculates predicted probabilities for the selected covariate profiles.

Usage

1
2
3
4
boolprob(obj, vars = NULL, newdata = NULL, k = 50, conf.int = FALSE,
  n = 100, as.table = TRUE, scales = list(x = list(relation = "free")),
  between = list(x = 1, y = 1), xlab = "x",
  ylab = "Predicted probability", ...)

Arguments

obj

object of boolean-class containing a fit boolean model.

vars

vector selecting a set of covariates from the fitted model. This can be a character vector of covariate names (as output from summary(obj)), or a numeric vector indexing the desired covariates.

newdata

data.frame with the same structure as model.matrix(boolean).

k

integer indicating the number of points at which the predicted probability should be calculated.

conf.int

logical; should confidence intervals be simulated.

n

number of draws to take from the estimated parameter space.

as.table

logical (default TRUE), to be passed to xyplot.

scales

list of settings for the scales argument passed to xyplot.

between

numeric specifying the space between panels.

xlab

string, the x-axis label.

ylab

string, the y-axis label.

...

Additional arguments to pass to xyplot. See that documentation for details.

Value

Returns an object of boolprob-class, the default action being to present the default plot.

Author(s)

Jason W. Morgan (morgan.746@osu.edu)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 

## Note: This example assumes a boolean model has already been fit.

## Plot predicted probabilities for a fitted model. Either vars or
## newdata *must* be specified.
boolprob(fit, vars = c("x1_a", "x4_b"))
boolprob(fit, vars = c(2, 3, 4, 6))

## Specifying conf.int = TRUE produces simulated confidence intervals.
## The number of samples to pull from the distribution of the estimated
## coefficients is controlled by n; n=100 is default. This can take a
## while.
(prob <- boolprob(fit, vars = c(2, 3, 4, 6), n = 1000, conf.int = TRUE))

## End(Not run)