Learn R Programming

pscl (version 1.5.9)

predict.ideal: predicted probabilities from an ideal object

Description

Compute predicted probabilities from an ideal object. This predict method uses the posterior mean values of \(x\) and \(\beta\) to make predictions.

Usage

# S3 method for ideal
predict(object,
                        cutoff=.5,
                        burnin=NULL,
                        ...)

# S3 method for predict.ideal print(x,digits=2,...)

Value

An object of class predict.ideal, containing:

pred.probs

the calculated predicted probability for each legislator for each vote.

prediction

the calculated prediction (0 or 1) for each legislator for each vote.

correct

for each legislator for each vote, whether the prediction was correct.

legis.percent

for each legislator, the percent of votes correctly predicted.

vote.percent

for each vote, the percent correctly predicted.

yea.percent

the percent of yea votes correctly predicted.

nay.percent

the percent of nay votes correctly predicted.

party.percent

the average value of the percent correctly predicted by legislator, separated by party, if party information exists in the rollcall object used for ideal. If no party information is available, party.percent = NULL.

overall.percent

the total percent of votes correctly predicted.

ideal

the name of the ideal object, which can be later evaluated

desc

string, the descriptive text from the rollcall object passed to ideal

Arguments

object

an object of class ideal (produced by ideal) with item parameters (beta) stored; i.e., store.item=TRUE was set when the ideal object was fitted

cutoff

numeric, a value between 0 and 1, the threshold to be used for classifying predicted probabilities of a Yea votes as predicted Yea and Nay votes.

burnin

of the recorded MCMC samples, how many to discard as burnin? Default is NULL, in which case the value of burnin in the ideal object is used.

x

object of class predict.ideal

digits

number of digits in printed object

...

further arguments passed to or from other methods.

Details

Predicted probabilities are computed using the mean of the posterior density of of \(x\) (ideal points, or latent ability) and \(\beta\) (bill or item parameters). The percentage correctly predicted are determined by counting the percentages of votes with predicted probabilities of a Yea vote greater than or equal to the cutoff as the threshold.

See Also

ideal, summary.ideal, plot.predict.ideal

Examples

Run this code
data(s109)

f <- system.file("extdata","id1.rda",package="pscl")
load(f)
phat <- predict(id1)
phat         ## print method

Run the code above in your browser using DataLab