View source: R/predict.ideal.r
predict.ideal | R Documentation |
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 class 'ideal'
predict(object,
cutoff=.5,
burnin=NULL,
...)
## S3 method for class 'predict.ideal'
print(x,digits=2,...)
object |
an object of class |
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 |
x |
object of class |
digits |
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.
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 |
overall.percent |
the total percent of votes correctly predicted. |
ideal |
the name of the |
desc |
string, the descriptive text from the
|
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.
ideal
, summary.ideal
, plot.predict.ideal
data(s109)
f <- system.file("extdata","id1.rda",package="pscl")
load(f)
phat <- predict(id1)
phat ## print method
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.