Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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 class 'ideal'
predict(object,
                        cutoff=.5,
                        burnin=NULL,
                        ...)

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

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 β (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.

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

Note

When specifying a value of burnin different from that used in fitting the ideal object, note a distinction between the iteration numbers of the stored iterations, and the number of stored iterations. That is, the n-th iteration stored in an ideal object will not be iteration n if the user specified thin>1 in the call to ideal. Here, iterations are tagged with their iteration number. Thus, if the user called ideal with thin=10 and burnin=100 then the stored iterations are numbered 100, 110, 120, .... Any future subsetting via a burnin refers to this iteration number.

See Also

Examples

data(s109)

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

pscl

Political Science Computational Laboratory

v1.5.5
GPL-2
Authors
Simon Jackman, with contributions from Alex Tahk, Achim Zeileis, Christina Maimone, Jim Fearon and Zoe Meers
Initial release
2020-02-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.