likelihood_or_post_density: Likelihood or posterior density

Description Usage Arguments Value

Description

Get Likelihood or posterior density (with normal prior) over all included items, and derivatives, for a given set of answers to items.

Usage

1
2
3
4
likelihood_or_post_density(theta, answers = NULL, model, items_to_include,
  number_dimensions, estimator, alpha, beta, guessing,
  prior_parameters = NULL, return_log_likelihood_or_post_density = TRUE,
  inverse_likelihood_or_post_density = FALSE, with_derivatives = TRUE)

Arguments

theta

Vector with true or estimated theta.

answers

Vector with answers to the administered items.

model

One of "3PLM", "GPCM", "SM" or "GRM", for the three-parameter logistic, generalized partial credit, sequential or graded response model, respectively.

items_to_include

Vector with indices of items to which answers have been given.

number_dimensions

Number of dimensions of theta.

estimator

Type of estimator to be used, one of "maximum_likelihood", "maximum_aposteriori", or "expected_aposteriori"; see details.

alpha

Matrix of alpha parameters, one column per dimension, one row per item. Row names should contain the item keys. Note that so called within-dimensional models still use an alpha matrix, they simply have only one non-zero loading per item.

beta

Matrix of beta parameters, one column per item step, one row per item. Row names should contain the item keys. Note that shadowcat expects answer categories to be sequential, and without gaps. That is, the weight parameter in the GPCM model is assumed to be sequential, and equal to the position of the 'location' of the beta parameter in the beta matrix. The matrix should have a number of columns equal to the largest number of item steps over items, items with fewer answer categories should be right-padded with NA. NA values between answer categories are not allowed, and will lead to errors.

guessing

Matrix with one column of guessing parameters per item. Row names should contain the item keys. Optionally used in 3PLM model, ignored for all others.

prior_parameters

List containing mu and Sigma of the normal prior: list(mu = ..., Sigma = ...). Sigma should always be in matrix form.

return_log_likelihood_or_post_density

If TRUE, log of likelihood or posterior density is returned, else likelihood or posterior density on original scale.

inverse_likelihood_or_post_density

If TRUE, likelihood or posterior density value is reversed (useful for minimization, also reverses derivatives).

with_derivatives

If TRUE, first and second derivatives are added to the return value as attributes.

Value

The likelihood (estimator is maximum_likelihood) or posterior density with normal prior (estimator is not maximum_likelihood) of theta. If requested, first and second derivatives are added as attributes.


Karel-Kroeze/ShadowCAT documentation built on May 7, 2019, 12:28 p.m.