Description Usage Arguments Value Examples
View source: R/generate-data.R
This function generates data from an ItemResponseTrees model.
1 2 3 4 5 6 7 8 9 10 |
object |
Object of class |
N |
Integer, the number of persons. |
sigma |
Either a matrix or a function that returns a matrix. This matrix
is the variance-covariance matrix of the person parameters that is passed
to |
theta |
Optional numeric matrix of person parameters with one row per person and
one column per dimension (i.e., |
itempar |
Either a list or a function that returns a list. The list has
an element |
link |
Character. Link function to use. |
na_okay |
Logical indicating whether variables with unobserved response
categories are permitted. If |
skip |
Logical. Some features of the irtree_model syntax,
which are available for model fitting (e.g., |
A list with element data
containing the data and an
element spec
containing the true parameter values etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # IR-Tree Model -----------------------------------------------------------
m1 <- "
Equations:
1 = (1-m)*(1-t)*e
2 = (1-m)*(1-t)*(1-e)
3 = m
4 = (1-m)*t*(1-e)
5 = (1-m)*t*e
IRT:
t BY x1, x2, x3;
e BY x1, x2, x3;
m BY x1, x2, x3;
Class:
Tree
"
model1 <- irtree_model(m1)
dat1 <- irtree_gen_data(model1, N = 5, sigma = diag(3),
itempar = list(beta = matrix(rnorm(9), 3, 3),
alpha = matrix(1, 3, 3)))
dat1$data
# Partial Credit Model ----------------------------------------------------
m2 <- "
IRT:
t BY x1@1, x2@1, x3@1;
e BY x1@1, x2@1, x3@1;
m BY x1@1, x2@1, x3@1;
Weights:
t = c(0, 1, 2, 3, 4)
e = c(1, 0, 0, 0, 1)
m = c(0, 0, 1, 0, 0)
Class:
PCM
"
model2 <- irtree_model(m2)
dat2 <- irtree_gen_data(model2, N = 5, sigma = diag(3),
itempar = list(beta = matrix(sort(rnorm(12)), 3, 4)))
dat2$data
m3 <- "
IRT:
t BY x1@1, x2@1, x3@1;
Weights:
t = 0:4
Class:
PCM
"
model3 <- irtree_model(m3)
dat3 <- irtree_gen_data(model3, N = 5, sigma = diag(1),
itempar = list(beta = matrix(sort(rnorm(12)), 3, 4)))
dat3$data
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.