Learn R Programming

xxIRT (version 2.0.3)

estimation: Estimation of 3PL Model

Description

Estimation of 3PL Model

estimate_mle estimates parameters using joint or maximum likelihood estimation method

estimate_bayesian estimates parameters using Bayesian estimation method

a helper function to process input arguments

Usage

estimate_mle(u, t = NULL, a = NULL, b = NULL, c = NULL, iter = 20,
  conv = 0.005, method = c("jmle", "mmle"), bound_t = 3.5, bound_a = 2,
  bound_b = 3.5, bound_c = 0.25, mmle_mu = 0, mmle_sig = 1,
  scale = c("none", "theta", "b"), scale_mean = 0, scale_sd = 1,
  debug = FALSE)

estimate_bayesian(u, t = NULL, a = NULL, b = NULL, c = NULL, method = c("map", "eap"), iter = 20, conv = 0.005, bound_t = 3.5, bound_a = 2, bound_b = 3.5, bound_c = 0.25, scale = c("none", "theta", "b"), scale_mean = 0, scale_sd = 1, t_mu = 0, t_sig = 1, a_mu = 0, a_sig = 0.2, b_mu = 0, b_sig = 1, c_alpha = 5, c_beta = 46, report_sd = FALSE, debug = FALSE)

estimate_check_input(u, t, a, b, c)

Arguments

u

a matrix of response data

t

theta parameters

a

a parameters

b

b parameters

c

c parameters

iter

the number of maximum iterations

conv

the convergence criterion

method

the estimation method of item parameters

bound_t

the bound of theta parameters

bound_a

the bound of a parameters

bound_b

the bound of b parameters

bound_c

the bound of c parameters

mmle_mu

the mean of the marginal distribution in MMLE

mmle_sig

the SD of the marginal parameters in MMLE

scale

the scaling parameter

scale_mean

the mean of the scale

scale_sd

the SD of the scale

debug

TRUE to print and report debugging information

t_mu

the mean of the prior distribution of theta parameters

t_sig

the SD of the prior distribution of theta parameters

a_mu

the mean of the prior distribution of a parameters

a_sig

the SD of the prior distribution of a parameters

b_mu

the mean of the prior distribution of b parameters

b_sig

the SD of the prior distribution of b parameters

c_alpha

the alpha of the prior distribution of c parameters

c_beta

the beta of the prior distribution of c parameters

report_sd

TRUE to report the posterior variance of thetas in EAP

Value

a list of t, a, b, c parameters

Details

When the t, a, b, c parameters are NULL, they are free to be estimated; otherwise, they are fixed at the provided values. When setting values for a parameter, use numeric values to fix parameters and NA to free parameters. For instance, an argument of t=c(-1, NA, 1) means to fix the 1st and 3rd theta parameters to -1 and 1 and estimate the 2nd theta parameters. The same is true for the a-, b-, and c-parameters. The method argument in estimate_mle controls whether to use joint (jmle) or maximum (mmle) likelihood method to estimate item parameters. The scale argument controls where to set the scale: b or theta parameters. When debug mode is on, print and report additional information regarding the convergence over the iterations.

The method argument in estimate_bayesian controls whether to use maximum (map) or expected (eap) a posteriori to estimate theta parameters.

Examples

Run this code
# NOT RUN {
library(ggplot2)
library(dplyr)
set.seed(10001)
### generate data
data <- model_3pl()$gendata(1000, 40)
### MLE
x <- estimate_mle(data$responses, debug=TRUE)
y <- rbind(data.frame(param='t', true=data$people$theta, est=x$t),
     data.frame(param='a', true=data$items$a, est=x$a),
     data.frame(param='b', true=data$items$b, est=x$b),
     data.frame(param='c', true=data$items$c, est=x$c))
group_by(y, param) %>% 
summarise(corr=cor(true, est), rmse=rmse(true, est))
ggplot(y, aes(x=true, y=est, color=param)) + 
  geom_point(alpha=.5) + facet_wrap(~param, scales="free") + 
  xlab("True Parameters") + ylab("Estimated Parameters") +
  theme_bw()
group_by(y, param) %>% summarise(corr=cor(true, est), 
    rmse=rmse(true, est), mean=mean(est), sd=sd(est))
### Bayesian
x <- estimate_bayesian(data$responses, debug=TRUE)
y <- rbind(data.frame(param='t', true=data$people$theta, est=x$t),
     data.frame(param='a', true=data$items$a, est=x$a),
     data.frame(param='b', true=data$items$b, est=x$b),
     data.frame(param='c', true=data$items$c, est=x$c))
group_by(y, param) %>% summarise(corr=cor(true, est), rmse=rmse(true, est))
ggplot(y, aes(x=true, y=est, color=param)) + 
  geom_point(alpha=.5) + facet_wrap(~param, scales="free") + 
  xlab("True Parameters") + ylab("Estimated Parameters") +
  theme_bw()
group_by(y, param) %>% summarise(corr=cor(true, est), 
    rmse=rmse(true, est), mean=mean(est), sd=sd(est))
# }

Run the code above in your browser using DataLab