raschmodel: Rasch Model Fitting Function

View source: R/raschmodel.R

raschmodelR Documentation

Rasch Model Fitting Function

Description

raschmodel is a basic fitting function for simple Rasch models.

Usage

raschmodel(y, weights = NULL, start = NULL, reltol = 1e-10,
  deriv = c("sum", "diff", "numeric"), hessian = TRUE,
  maxit = 100L, full = TRUE, gradtol = reltol, iterlim = maxit, ...)

Arguments

y

item response object that can be coerced (via as.matrix) to a binary 0/1 matrix (e.g., from class itemresp.

weights

an optional vector of weights (interpreted as case weights).

start

an optional vector of starting values.

deriv

character. Which type of derivatives should be used for computing gradient and Hessian matrix? Analytical with sum algorithm ("sum"), analytical with difference algorithm ("diff", faster but numerically unstable), or numerical.

hessian

logical. Should the Hessian of the final model be computed? If set to FALSE, the vcov method can only return NAs and consequently no standard errors or tests are available in the summary.

reltol, maxit, ...

further arguments passed to optim.

full

logical. Should a full model object be returned? If set to FALSE, no variance-covariance matrix and no matrix of estimating functions are computed.

gradtol, iterlim

numeric. For backward compatibility with previous versions these arguments are mapped to reltol and maxit, respectively.

Details

raschmodel provides a basic fitting function for simple Rasch models, intended as a building block for fitting Rasch trees and Rasch mixtures in the psychotree and psychomix packages, respectively.

raschmodel returns an object of class "raschmodel" for which several basic methods are available, including print, plot, summary, coef, vcov, logLik, estfun, discrpar, itempar, threshpar, and personpar.

Value

raschmodel returns an S3 object of class "raschmodel", i.e., a list with the following components:

coefficients

estimated item difficulty parameters (without first item parameter which is always constrained to be 0),

vcov

covariance matrix of the parameters in the model,

loglik

log-likelihood of the fitted model,

df

number of estimated parameters,

data

the original data supplied (excluding columns without variance),

weights

the weights used (if any),

n

number of observations (with non-zero weights),

items

status indicator (0, 0/1, 1) of all original items,

na

logical indicating whether the data contains NAs,

elementary_symmetric_functions

List of elementary symmetric functions for estimated parameters (up to order 2; or 1 in case of numeric derivatives),

code

convergence code from optim,

iterations

number of iterations used by optim,

reltol

tolerance passed to optim,

deriv

type of derivatives used for computing gradient and Hessian matrix,

call

original function call.

See Also

nplmodel, pcmodel, rsmodel, gpcmodel, btmodel

Examples

o <- options(digits = 4)

## Verbal aggression data
data("VerbalAggression", package = "psychotools")

## Rasch model for the other-to-blame situations
m <- raschmodel(VerbalAggression$resp2[, 1:12])
## IGNORE_RDIFF_BEGIN
summary(m)
## IGNORE_RDIFF_END

## visualizations
plot(m, type = "profile")
plot(m, type = "regions")
plot(m, type = "curves")
plot(m, type = "information")
plot(m, type = "piplot")

options(digits = o$digits)

psychotools documentation built on May 29, 2024, 8:12 a.m.