Compute predicted probabilities from an ideal
object. This predict method uses the posterior mean values of \(x\)
and \(\beta\) to make predictions.
# S3 method for ideal
predict(object,
cutoff=.5,
burnin=NULL,
...)# S3 method for predict.ideal
print(x,digits=2,...)
An object of class predict.ideal, containing:
the calculated predicted probability for each legislator for each vote.
the calculated prediction (0 or 1) for each legislator for each vote.
for each legislator for each vote, whether the prediction was correct.
for each legislator, the percent of votes correctly predicted.
for each vote, the percent correctly predicted.
the percent of yea votes correctly predicted.
the percent of nay votes correctly predicted.
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.
the total percent of votes correctly predicted.
the name of the ideal object, which can be
later evaluated
string, the descriptive text from the
rollcall object passed to ideal
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
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.
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.
object of class predict.ideal
number of digits in printed object
further arguments passed to or from other methods.
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.
ideal, summary.ideal, plot.predict.ideal
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