predicted_prob: Predicted probability from svyglm model and new data, along...

View source: R/other_utils.R

predicted_probR Documentation

Predicted probability from svyglm model and new data, along with 95% CI.

Description

Predicted probability from svyglm model and new data, along with 95% CI.

Usage

predicted_prob(mod, df)

Arguments

mod

A svyglm model object.

df

A data frame of new data created with, e.g., expand.grid.

Value

df with three additional columns:

Probability

The predicted probability at each value in df

LL

The lower 95% confidence limit

UL

The upper 95% confidence limit

Examples

m = glm(am ~ mpg + hp + cyl, family=binomial, data=mtcars)
newdata = expand.grid(mpg=10:35, hp=50:335, cyl=c(4,6,8))
df = predicted_prob(m, newdata)

grasshoppermouse/hagenutils documentation built on Dec. 6, 2024, 8:31 p.m.