Last chance! 50% off unlimited learning
Sale ends in
constrain.items(obj, dropList = list(codes = "notInLegis", lop = 0),
x, d = 1)
rollcall
.list
containing elements with names matching
votes found in dimnames(object$votes)[[2]]
(but after any
subsetting specified by dropList
). Each component of the
list musobj
by d
.obj
by d
.obj
by d+1
.obj
by d+1
.obj
by d
.obj
by d+1
.constrain.items
and its cousin,
constrain.legis
are usefully thougt of as
x
, the prior mean for each dimension is set
to the value given in x
, and the prior precision for each
dimension is set to 1e12
(i.e., a near-degenerate
Start values are also generated for both ideal points and item
parameters. The start values for the items specified in x
are
set to the values specified in x
. The list resulting from
constrain.items
can then be given as the value for the
parameters priors
and startvals
when ideal
is run. The user is responsible for ensuring that a sufficient number
of items are constrained such that when ideal
is run,
the model parameters are identified.
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.
rollcall
, ideal
,
constrain.legis
## run ideal with the default parameters
data(s109)
## run a 1d model, look for lack of fit
id1 <- ideal(s109,
d=1,
meanzero=TRUE,
store.item=TRUE,
maxiter=1e5,
burnin=1e3,
thin=1e2)
id1sum <- summary(id1,include.beta=TRUE)
suspect1 <- id1sum$bSig[[1]]=="95close60 <- id1sum$bResults[[1]][,"Yea"] < 60
close40 <- id1sum$bResults[[1]][,"Yea"] > 40
suspect <- suspect1 & close60 & close40
id1sum$bResults[[1]][suspect,]
suspectVotes <- dimnames(id1sum$bResults[[1]][suspect,])[[1]]
## constraints on 2d model,
## close rollcall poorly fit by 1d model
## serves as reference item for 2nd dimension
cl <- constrain.items(s109,
x=list("2-150"=c(0,7),
"2-169"=c(7,0)),
d=2)
id1Constrained <- ideal(s109,
d=2,
meanzero=TRUE,
priors=cl,
startvals=cl,
maxiter=1e5,
burnin=1e3,
thin=1e2)
summary(id1Constrained,include.beta=TRUE)
Run the code above in your browser using DataLab