th_est_ml: Latent Trait Estimation

Description Usage Arguments Value Examples

View source: R/theta_estimation.R

Description

Compute latent trait estimates using either maximum likelihood (ML) or expected a posteriori (EAP) trait estimation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
th_est_ml(dat, bmat, maxncat = 2, cvec = NULL, dvec = NULL, lb = -4, ub = 4)

th_est_eap(
  dat,
  bmat,
  maxncat = 2,
  cvec = NULL,
  dvec = NULL,
  int = int_mat(npts = 33)
)

Arguments

dat

Data matrix of binary item responses with one column for each item. Alternatively, a vector of binary item responses for one person.

bmat

Matrix of FMP item parameters, one row for each item.

maxncat

Maximum number of response categories (the first maxncat - 1 columns of bmat are intercepts)

cvec

Vector of lower asymptote parameters, one element for each item.

dvec

Vector of upper asymptote parameters, one element for each item.

lb

Lower bound at which to truncate ML estimates.

ub

Upper bound at which to truncate ML estimates.

int

Matrix with two columns used for numerical integration in EAP. Column 1 contains the x coordinates and Column 2 contains the densities.

Value

Matrix with two columns: est and either sem or psd

est

Latent trait estimate

sem

Standard error of measurement (mle estimates)

psd

Posterior standard deviation (eap estimates)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(3453)
bmat <- sim_bmat(n_items = 20, k = 0)$bmat

theta <- rnorm(10)
dat <- sim_data(bmat = bmat, theta = theta)

## mle estimates
mles <- th_est_ml(dat = dat, bmat = bmat)

## eap estimates
eaps <- th_est_eap(dat = dat, bmat = bmat)

cor(mles[,1], eaps[,1])
# 0.9967317

flexmet documentation built on July 14, 2021, 1:06 a.m.