View source: R/immer_proc_data.R
immer_proc_data | R Documentation |
The function immer_proc_data
processes datasets containing rating data
into a dataset into a long format of pseudoitems (item \times
raters).
The function immer_create_design_matrix_formula
creates a design matrix
for a processed dataset and a provided formula.
immer_proc_data(dat, pid=NULL, rater=NULL, weights=NULL, maxK=NULL)
immer_create_design_matrix_formula( itemtable, formulaA )
dat |
Datasets with integer item responses |
pid |
Vector with person identifiers |
rater |
Vector with rater identifiers |
weights |
Vector with sampling weights |
maxK |
Optional vector with maximum category per item |
itemtable |
Processed item table. The table must include the column
|
formulaA |
An R formula. The facets |
The output of immer_proc_data
is a list with several entries (selection)
dat2 |
Dataset containing pseudoitems |
dat2.resp |
Dataset containing response indicators for pseudoitems |
dat2.NA |
Dataset containing pseudoitems and missing responses coded as |
dat |
Original dataset |
person.index |
Person identifiers |
rater.index |
Rater identifiers |
VV |
Number of items |
N |
Number of persons |
RR |
Number of raters |
dat2.ind.resp |
Array containing indicators of pseudoitems and categories |
ND |
Number of person-rater interactions |
itemtable |
Information about processed data |
The output of immer_create_design_matrix_formula
is a list with several
entries (selection)
A |
design matrix |
itemtable2 |
Processed item table |
#############################################################################
# EXAMPLE 1: Processing rating data
#############################################################################
data(data.immer01a, package="immer")
dat <- data.immer01a
res <- immer::immer_proc_data( dat=dat[,paste0("k",1:5)], pid=dat$idstud,
rater=dat$rater)
str(res, max.level=1)
## Not run:
#############################################################################
# EXAMPLE 2: Creating several design matrices for rating data
#############################################################################
data(data.ratings1, package="sirt")
dat <- data.ratings1
resp <- dat[,-c(1,2)]
#- redefine the second and third item such that the maximum category score is 2
for (vv in c(2,3)){
resp[ resp[,vv] >=2,vv ] <- 2
}
#--- process data
res0 <- immer::immer_proc_data( dat=resp, pid=dat$idstud, rater=dat$rater)
#--- rating scale model
des1 <- immer::immer_create_design_matrix_formula( itemtable=res0$itemtable,
formulaA=~ item + step )
des1$des
#--- partial scale model
des2 <- immer::immer_create_design_matrix_formula( itemtable=res0$itemtable,
formulaA=~ item + item:step )
des2$des
#--- multi-facets Rasch model
des3 <- immer::immer_create_design_matrix_formula( itemtable=res0$itemtable,
formulaA=~ item + item:step + rater )
des3$des
#--- polytomous model with quadratic step effects
des4 <- immer::immer_create_design_matrix_formula( itemtable=res0$itemtable,
formulaA=~ item + item:I(step_num^2) )
des4$des
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.