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

thetaComb

Create all possible combinations of vector input


Description

This function constructs all possible k-way combinations of an input vector. It is primarily useful when used in conjunction with the mdirt function, though users may have other uses for it as well. See expand.grid for more flexible combination formats.

Usage

thetaComb(theta, nfact, intercept = FALSE)

Arguments

theta

the vector from which all possible combinations should be obtained

nfact

the number of observations (and therefore the number of columns to return in the matrix of combinations)

intercept

logical; should a vector of 1's be appended to the first column of the result to include an intercept design component? Default is FALSE

Value

a matrix with all possible combinations

Author(s)

References

Chalmers, R., P. (2012). mirt: A Multidimensional Item Response Theory Package for the R Environment. Journal of Statistical Software, 48(6), 1-29. doi: 10.18637/jss.v048.i06

Examples

# all possible joint combinations for the vector -4 to 4
thetaComb(-4:4, 2)

# all possible binary combinations for four observations
thetaComb(c(0,1), 4)

# all possible binary combinations for four observations (with intercept)
thetaComb(c(0,1), 4, intercept=TRUE)

mirt

Multidimensional Item Response Theory

v1.33.2
GPL (>= 3)
Authors
Phil Chalmers [aut, cre] (<https://orcid.org/0000-0001-5332-2810>), Joshua Pritikin [ctb], Alexander Robitzsch [ctb], Mateusz Zoltak [ctb], KwonHyun Kim [ctb], Carl F. Falk [ctb], Adam Meade [ctb], Lennart Schneider [ctb], David King [ctb], Chen-Wei Liu [ctb], Ogreden Oguzhan [ctb]
Initial release

We don't support your browser anymore

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