View source: R/restrict.ideal.r
constrain.legis | R Documentation |
Sets constraints on specified legislators for ideal point estimation by generating appropriate priors and start values.
constrain.legis(obj, dropList = list(codes = "notInLegis", lop = 0),
x, d = 1)
obj |
an object of class |
dropList |
a |
x |
a |
d |
the number of dimensions for which to set up the priors and start values. |
constrain.items
and its cousin,
constrain.legis
are usefully thought of as
“pre-processor” functions, implementing identification
constraints for the ideal point model by generating priors and start
values for both the item parameters and the ideal points.
For the legislators specified in x
, the prior mean for each
dimension is set to the specified value and the prior precision for
each dimension is set to 1e12
(i.e., a near-degenerate
“spike” prior, and, for all practical purposes, constraining
that parameter to a fixed value). For the other legislators, the
priors on their ideal points are set to a mean of 0 and a small
precision of .01, corresponding to a prior variance of 100, or a prior
95 percent confidence interval of -20 to 20. All of the item
parameter priors are set to mean 0, precision 0.01.
Start values are also generated for both ideal points and item
parameters. The start values for the legislators named in
x
are set to the values specified in x
. The list
resulting from constrain.legis
can then be given as the value
for the parameters priors
and startvals
when
ideal
is run. constrain.legis
requires that
d+1
constraints be specified; if the constrained ideal points
points are linearly independent, then the parameters of the
item-response model are (at least locally) identified. For instance,
when fitting a 1 dimensional model, constraining the ideal points of
two legislators is sufficient to globally identify the model
parameters.
dropRollCall
is first called to generate the desired
roll call matrix. The entries of the roll call matrix are mapped to
c(0,1,NA)
using the codes
component of the
rollcall
object
. See the discussion in the
documentation of ideal
for details on the generation of
start values.
a list with elements:
xp |
prior means for ideal points. A matrix of dimensions number
of legislators in |
xpv |
prior meansprecisions for ideal points. A matrix of
dimensions number of legislators in |
bp |
prior means for item parameters. A matrix of
dimensions number of items or votes in |
bpv |
prior meansprecisions for item parameters. A matrix of
dimensions number of items or votes in |
x |
start values for ideal points. A matrix of dimensions
number of legislators in |
b |
start values for ideal points. A matrix of dimensions
number of items or votes in |
rollcall
, ideal
,
constrain.items
.
See pmatch
on how supplied names are matched against the
names in the rollcall
object.
data(s109)
cl <- constrain.legis(s109,
x=list("KENNEDY"=-1,
"ENZI"=1),
d=1)
## Not run:
## too long for examples
id1Constrained <- ideal(s109,
d=1,
priors=cl, ## use cl
startvals=cl, ## use cl
maxiter=5000,
burnin=500,
thin=25)
summary(id1Constrained)
cl2 <- constrain.legis(s109,
x=list("KENNEDY"=c(-1,0),
"ENZI"=c(1,0),
"CHAFEE"=c(0,-.5)),
d=2)
id2Constrained <- ideal(s109,
d=2,
priors=cl2, ## priors (w constraints)
startvals=cl2, ## start value (w constraints)
store.item=TRUE,
maxiter=5000,
burnin=500,
thin=25)
summary(id2Constrained,include.items=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.