build_W {eRm} R Documentation

## Automatized Construction of LLRA Design Matrix

### Description

Builds a design matrix for LLRA from scratch.

### Usage

build_W(X, nitems, mpoints, grp_n, groupvec, itmgrps)


### Arguments

 X Data matrix as described in Hatzinger and Rusch (2009). It must be of long format, e.g. for each person all item answers are written in subsequent rows. The columns correspond to time points. Missing values are not allowed. It can easily be constructed from data in wide format with matrix(unlist(data),ncol=mpoints) or from llra.datprep. nitems The number of items. mpoints The number of time points. grp_n A vector of number of subjects per g+1 groups (e.g. g treatment or covariate groups and 1 control or baseline group. The sizes must be ordered like the corresponding groups. groupvec Assignment vector, i.e. which person belongs to which treatment/item group itmgrps Specifies how many groups of items there are.

### Details

The function is designed to be modular and calls four internal function build_effdes (for treatment/covariate effects), build_trdes (for trend effects), build_catdes (for category parameter design matrix) and get_item_cats (checks how many categories each item has). Those functions are not intended to be used by the user.

Labeling of effects also happens in the internal functions.

### Value

An LLRA design matrix as described by Hatzinger and Rusch (2009). This can be passed as the W argument to LLRA or LPCM.

The design matrix specifies every item to lie on its own dimension. Hence at every time point > 1, there are effects for each treatment or covariate group as well as trend effects for every item. Therefore overall there are items x (groups-1) x (time points-1) covariate effect parameters and items x (time points-1) trend parameters specified. For polytomous items there also are parameters for each category with the first and second category being equated for each item. They need not be equidistant. The number of parameters therefore increase quite rapidly for any additional time point, item or covariate group.

### Warning

A warning is printed that the first two categories for polytomous items are equated.

Thomas Rusch

### References

Hatzinger, R. and Rusch, T. (2009) IRT models with relaxed assumptions in eRm: A manual-like instruction. Psychology Science Quarterly, 51, pp. 87–120.

This function is used for automatic generation of the design matrix in LLRA.

### Examples

##An LLRA with 2 treatment groups and 1 baseline group, 5 items and 4
##time points. Item 1 is dichotomous, all others have 3, 4, 5, 6
##categories respectively.