Learn R Programming

UPG (version 0.2.2)

predict.UPG.Binomial: Predicted probabilities from UPG.Binomial objects

Description

predict generates predicted probabilities from estimated discrete choice models in an UPG.Binomial object. In addition, credible intervals for these probabilities are computed. Probabilities can be predicted from the data used for estimating the model or for a new data set with the same structure.

Usage

# S3 method for UPG.Binomial
predict(object = NULL, ..., newdata = NULL, q = c(0.025, 0.975))

Arguments

object

an object of class UPG.Binomial.

...

other predict parameters.

newdata

a matrix or a data.frame containing new explanatory data. The number of columns and the variable ordering must be the same as in the explanatory data used for estimation to generate valid predictions. If no new data is provided, predict will return predicted probabilities for the data used for estimating the model.

q

a numerical vector of length two holding the posterior quantiles to be extracted. Default are 0.025 and 0.975 quantiles.

Value

Returns a list containing posterior means of predicted probabilities as well as the desired credible interval.

See Also

summary.UPG.Binomial to summarize the estimates of a discrete choice model from an UPG.Binomial object and create tables. plot.UPG.Binomial to plot the results of a discrete choice model from an UPG.Binomial object. coef.UPG.Binomial to extract coefficients from an UPG.Binomial object.

Examples

Run this code
# NOT RUN {
# estimate a binomial logit model using example data
library(UPG)
data(titanic)
y  = titanic[,1]
Ni = titanic[,2]
X  = titanic[,-c(1,2)]
results.binomial = UPG(y = y, X = X, Ni = Ni, type = "binomial")

# extract predicted probabilities
predict(results.binomial)
# }

Run the code above in your browser using DataLab