| predict.ideal {pscl} | 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 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. |
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 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 |
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)
## Not run:
id1 <- ideal(s109, meanzero=TRUE,
store.item=TRUE) ## too long for examples
## End(Not run)
id1 <- ideal(s109,
d=1,
meanzero=TRUE,
store.item=TRUE, ## need this to be TRUE for predict
maxiter=500,
burnin=100,
thin=10)
phat <- predict(id1)
phat ## print method