Learn R Programming

RM.weights (version 2.0)

PC.w: Estimation of the weighted partial credit model using CML

Description

This function estimates item and raw score parameters of a partial credit Rasch model which may include both dichotomous and polytomous item responses by using weighted CML estimation. The maximum number of response categories allowed is 4. Input data should be a 0/1 matrix (1 = Yes) for the dichotomous items and 0/1/2 or 0/1/2/3 for the polytomous items. Residual correlation, fit statistics and Rasch reliability are also reported.

Usage

PC.w(XX, wt=NULL, extr=NULL, maxiter=100,minconv=.00001,country=NULL,
write.file=FALSE, recode = 0, write.iteration=FALSE)

Arguments

XX

Input data matrix or data frame. Rows represent respondents, columns represent items. Dichotomous items are coded 0/1, polytomous items are coded 0/1/2 or 0/1/2/3; negative responses must be coded as 0s. Missing values must be coded as NA.

wt

Vector of sampling weights. The length must be the same as the number of rows of XX. If left unspecified, all the individuals will be equally weighted (wt = rep(1, nrow(XX))).

extr

Optional vector for the assumption on the extreme raw score parameters. Default is 0.5 and (k-0.5), k being the maximum number of response categories.

maxiter

Maximum number of iterations for convergence when parameter estimation is performed.

minconv

Minimum difference between parameter estimates considering two consecutive iterations for convergence.

country

Optional (character) name of the dataset.

write.file

If TRUE, a CSV file with the main model results will be saved in the working directory.

recode

It can be 0, 1, 2 or 3. recode = 0 does not imply any category aggregation. recode = 1 aggregates the two more severe categories (for example, Sometimes and Always). recode=2 aggregates the two middle categories (for example, Rarely and Sometimes). recode=3 aggregates the two less severe categories (for example, Never and Rarely). Default is 0.

write.iteration

If set TRUE a CSV file with information on the iteration process is produced in the working directory.

Value

A list with the following elements:

b Matrix of Rasch-Thurstone (R-T) thresholds (corresponding to item severity parameters in a Rasch model for dichotomous data).
se.b Matrix of standard errors for R-T thresholds.
infit Infit statistics corresponding to each R-T threshold.
outfit Outfit statistics corresponding to each R-T threshold.
reliab Rasch reliability.
reliab.fl Rasch reliability (equally weighted across raw scores). To be used for comparisons.
RS_distr Distribution of cases across raw scores (weighted and unweighted).
res.cor Matrix of residual correlation.
a Vector of raw score parameters.
se.a Vector of raw score parameter errors (or measurement errors).
XX Data matrix (after recoding).
wt Vector of sampling weights.
d Pseudo-raw-scores used for the estimation of extreme parameters.
N_valid_w Number of cases with any valid response.
Perc_valid_w Percentage of cases with any valid response.
N_tot Total sample size.
N_compl Number of complete non-extreme cases.

Details

The weighted CML method is used to estimate the item and Rasch-Thurstone parameters. Respondent parameters are estimated post-hoc as maximum likelihood given the item parameters. Cases with missing responses to some items can be included, but will not be used to estimate the Rasch model. Missing responses should be coded as NA in the input data file. If the total possible raw score is higher than 15, computer precision limits may distort results.

As the parameters for the extreme raw scores (0 and k), are undefined under the CML, some assumptions are needed unless the proportions of respondents with those raw scores are so small that they can be considered to be measured without error. Vector extr gives the option to include one assumption on the pseudo-raw-score on which raw score zero will be based and one assumption on the pseudo-raw-score on which raw score k will be based. The assumption for raw score zero can be a number between 0 and 1 (extremes excluded). The assumption for raw score k can be a number between k-1 and k (extremes excluded).

Examples

Run this code
# NOT RUN {
data(data.FAO_country1)
# Questionnaire data and weights
XX.country1 = data.FAO_country1[,1:8]
XX.country1[,c(7,8)] = cbind(rbinom(nrow(XX.country1), 3, .5), rbinom(nrow(XX.country1), 3, .4)) 
wt.country1 = data.FAO_country1$wt
# Fit weighted partial credit model with aggregation of the two more severe categories
rr.country1.pol2 = PC.w(XX.country1, wt.country1, recode = 1)
# }

Run the code above in your browser using DataLab