Learn R Programming

psychotools (version 0.2-0)

RSModel.fit: Rating Scale Model Fitting Function

Description

RSModel.fit is a basic fitting function for rating scale models.

Usage

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

Arguments

y
object that can be coerced (via as.matrix). Typically either already a matrix or a data.frame
weights
an optional vector of weights, interpreted as case weights (integer only).
deriv
character. If "sum" (the default), the first derivatives of the elementary symmetric functions are calculated with the sum algorithm. Otherwise ("diff") the difference algorithm (faster but numerically unstable) is used.
start
an optional vector of starting values.
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.

Value

  • RSModel.fit returns an S3 object of class "RSModel", i.e., a list with components as follows.
  • coefficientsa named vector of estimated item difficulty parameters (without first item parameter which is constrained to 0) and estimated treshold parameters (again without first threshold parameter which is also constrained to 0),
  • vcovcovariance matrix of the parameters in the model,
  • datamodified data, used for model-fitting, i.e., cleaned for items without variance, centralized so that the first category is zero for all items and without observations with zero weight. Be careful, this is different than for objects of class "RaschModel" or "btReg", where data contains the original data,
  • itemslogical vector of length ncol(y), which indicates which items have variance (TRUE), i.e., are identified and have been used for the estimation or not (FALSE),
  • categoriesinteger vector of length ncol(y), which contains the number of categories minus one per item,
  • nnumber of observations (with non-zero weights),
  • n_orgoriginal number of observations in y,
  • weightsthe weights used (if any),
  • nalogical indicating whether the data contains NAs,
  • esflist of elementary symmetric functions and their derivatives for estimated parameters,
  • logliklog-likelihood of the fitted model,
  • dfnumber of estimated parameters,
  • codeconvergence code from optim,
  • iterationsnumber of iterations used by optim,
  • reltoltolerance passed to optim.

Details

RSModel.fit provides a basic fitting function for rating scales models, intended as a building block for fitting rating scale trees. RSModel.fit returns an object of class "RSModel" (and class "PCModel") for which several basic methods are available, including print, plot, summary, coef, vcov, and logLik.

See Also

PCModel.fit, RaschModel.fit, btReg.fit

Examples

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

## Rating scale model for the other-to-blame situations
rsm <- RSModel.fit(VerbalAggression$resp[, 1:12])
summary(rsm)
plot(rsm)

Run the code above in your browser using DataLab