| id_me | R Documentation |
This function allows you to calculate ideal point marginal effects for a given person-level hierarchical covariate.
id_me(object, ...)
object |
A fitted |
... |
Other values passed on to methods. |
This function will calculate item-level ideal point marginal effects
for a given covariate that was passed to the id_make function using the
person_cov option. The function will iterate over all items in the model
and use numerical differentiation to calculate responses in the scale of the
outcome for each item. Note: if the covariate is binary (i.e., only has two values),
then the function will calculate the difference between these two values instead of
using numerical differentation.
Returns a tibble that has one row per posterior draw per item-specific marginal effect in the scale of the outcome.
data('senate114')
senate114$cast_code <- ifelse(senate114$cast_code=="Absent", NA,
as.integer(senate114$cast_code) - 1L)
senate114$age <- (2018 - senate114$born - mean(2018 - senate114$born)) / 10
sen_cov <- id_make(senate114, outcome_disc='cast_code',
person_id='bioname', item_id='rollnumber',
group_id='party_code', person_cov=~party_code+age)
sen_cov_est <- id_estimate(sen_cov, model_type=1, fixtype='vb_full',
use_method="pathfinder", ncores=4)
me <- id_me(sen_cov_est, covariate='age', draws=50)
me$sum_ideal_effects
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.