estimate_mupp_params(resp, items, method = "MCMC", control = list(), ...)
a data.frame of (at least) [person, item, resp]
a data.frame of (at least) [item, statement, dim]
the estimation method (MCMC is the only one that works now)
a list of parameters to control the algorithm. See details.
other parameters to pass to the estimation algorithm. See details.
a list of [theta, params]
arrays with the third dimension indicating
the iteration as well as means and sds
For MCMC, additional parameters include
a named list with names indicating the parameter and values indicating the starting values/initial parameter estimates
a character vector with elements that are fixed to their initial parameters for the entire estimation algorithm
For MCMC, control parameters include
total number of iterations.
number of iterations to throw away when calculating summary statistics.
the standard deviation of the step size for subsequent Metropolis-Hastings draws.
if (FALSE) {
set.seed(3452345)
# simulate parameters and responses to the model
# (assumption is that params/resp will follow conventions)
params <- simulate_mupp_params(n_persons = 100,
n_items = 300,
n_dims = 9,
max_item_dims = 2,
unidim_items = TRUE)
resp <- do.call(simulate_mupp_resp,
params)
# thetas for comparison
thetas <- tidyr::spread(params$persons,
key = "dim",
value = "theta")[ , -1]
items <- params$items
# estimating thetas using algorithm (one start for comparison purposes)
est_params <- estimate_mupp_params(resp = resp$resp,
items = resp$items,
method = "MCMC",
control = list(n_iters = 1000,
n_burnin = 500),
initial_params = list(delta = sign(items$delta)))
# correlating (not great, but small iters and few people)
diag(cor(thetas, est_params$means$thetas))
cor(items$alpha, est_params$means$alpha)
cor(items$delta, est_params$means$delta)
cor(items$tau, est_params$mean$tau)
}