Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

build_W

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.

Author(s)

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.

See Also

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.
llraDat2a <- matrix(unlist(llraDat2[1:20]),ncol=4)
groupvec <-rep(1:3*5,each=20)
W <- build_W(llraDat2a,nitems=5,mpoints=4,grp_n=c(10,20,40),groupvec=groupvec,itmgrps=1:5)

#There are 55 parameters
dim(W)

## Not run: 
#Estimating LLRA by specifiying W
ex2W <- LLRA(llraDat2[1:20],W=W,mpoints=4,groups=llraDat2[21])
## End(Not run)

eRm

Extended Rasch Modeling

v1.0-2
GPL-3
Authors
Patrick Mair [cre, aut], Reinhold Hatzinger [aut], Marco J. Maier [aut], Thomas Rusch [ctb], Rudolf Debelak [ctb]
Initial release
2021-02-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.