Learn R Programming

⚠️There's a newer version (4.3-2) of this package.Take me there.

glm.predict

R GNU Package to simulate/bootstrap predicted values/probabilities and discrete changes for lm(), glm(), glm.nb(), polr(), multinom(), tobit() and lmer() models.

Example

Here an example how you can use the function predicts(). First we estimate an logistic regression to predict the gender of a person using height, smoking and pulse as independent variables.

model1 = glm(Sex ~ Height + Smoke + Pulse, data=MASS::survey, family=binomial(link=logit))

Now we can estimate predicted probabilities. For Height we take 150, 170 and 190, for Smoke we take all levels of the factor and for Pulse we take the average value of the data. We set a seed to always get the same results.

library(glm.predict)
predicts(model1, "150-190,20;all;mean", set.seed = 1848)

By setting position to the position of a variable, we can get discrete changes for that specific variable. If we want to get the difference between 150 and 170 body size, we can do that in the following way:

predicts(model1, "150,170;all;mean", set.seed = 1848, position = 1)

To get all possible values and other parameters you can read the documentation:

?predicts()

Installation

If you want to install the stable version from CRAN you can do that with the following command:

install.packages("glm.predict")

If you want to install the newest developer version from GitHub, you can do that with the package remotes:

install.packages("remotes")
remotes::install_github("benjaminschlegel/glm.predict")

You might need to install Rtools (for Windows) or XCode (for Mac OS) to install the package from GitHub.

Copy Link

Version

Install

install.packages('glm.predict')

Monthly Downloads

313

Version

4.3-0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Benjamin Schlegel

Last Published

January 15th, 2024

Functions in glm.predict (4.3-0)

dc.lmerMod

predicted values and discrete change
glm.predict-package

Predicted Values and Discrete Changes for GLM
dc.lm

predicted values and discrete change
dc.polr

predicted values and discrete change
dc.multinom

predicted values and discrete change
dc.glm

predicted values and discrete change
predicts

predicted values and discrete change
dc.tobit

predicted values and discrete change
dc.mlogit

predicted values and discrete change
selects2015

Swiss Electoral Studies (Selects) 2015 - Post-electoral study
dc.vglm

predicted values and discrete change
basepredict.mlogit

predicted value
basepredict.vglm

predicted value
basepredict.tobit

predicted value
dc

predicted values and discrete change
basepredict.lm

predicted value
basepredict.polr

predicted value
basepredict.multinom

predicted value
basepredict.glm

predicted value
basepredict.lmerMod

predicted value
basepredict

predicted value