resp_loglik: Log-likelihood of a Response String

resp_loglikR Documentation

Log-likelihood of a Response String

Description

resp_loglik returns the log-likelihood of a response string for given items and ability.

Usage

resp_loglik(ip, resp, theta, derivative = 0)

## S4 method for signature 'Item,ANY'
resp_loglik(ip, resp, theta, derivative = 0)

## S4 method for signature 'Itempool,ANY'
resp_loglik(ip, resp, theta, derivative = 0)

## S4 method for signature 'Testlet,ANY'
resp_loglik(ip, resp, theta, derivative = 0)

## S4 method for signature 'numMatDfListChar,ANY'
resp_loglik(ip, resp, theta, derivative = 0)

## S4 method for signature 'Itempool,Response'
resp_loglik(ip, resp, theta, derivative = 0)

## S4 method for signature 'Itempool,Response_set'
resp_loglik(ip, resp, theta, derivative = 0)

Arguments

ip

An Item-class, Itempool-class or a Testlet-class object.

resp

A vector of item responses.

theta

An vector containing ability parameters.

derivative

Whether to calculate the first or second derivative of response log-likelihood.

0

No derivative will be calculated. This is the default value

1

Calculate the first derivative of the response log-likelihood

2

Calculate the second derivative of the response log-likelihood

Value

A matrix of log-likelihood(s)

Author(s)

Emre Gonulates

Examples

item <- generate_item(model = "3PL")
theta <- rnorm(6)
resp <- sim_resp(ip = item, theta = theta, prop_missing = .1)
resp_loglik(ip = item, resp = resp, theta = theta)

item <- generate_item(model = "GRM")
resp <- sim_resp(ip = item, theta = theta, prop_missing = .1)
resp_loglik(ip = item, resp = resp, theta = theta)
ip <- generate_ip(model = "3PL")
theta <- rnorm(6)
resp <- sim_resp(ip = ip, theta = theta, prop_missing = .1)
resp_loglik(ip = ip, resp = resp, theta = theta)
resp_loglik(ip = ip, resp = resp, theta = theta, derivative = 1)
resp_loglik(ip = ip, resp = resp, theta = theta, derivative = 2)

ip <- generate_ip(model = "GPCM")
resp <- sim_resp(ip = ip, theta = theta, prop_missing = .1)
resp_loglik(ip = ip, resp = resp, theta = theta)
resp_loglik(ip = ip, resp = resp, theta = theta, derivative = 1)
resp_loglik(ip = ip, resp = resp, theta = theta, derivative = 2)

irt documentation built on Nov. 10, 2022, 5:50 p.m.