16
16
# ' the probability of an incorrect response for individuals with
17
17
# ' all of the required attributes
18
18
# '
19
- # ' @return
19
+ # ' @return
20
20
# ' A dichotomous item matrix with dimensions \eqn{N \times J}{N x J}.
21
- # '
22
- # ' @author
21
+ # '
22
+ # ' @author
23
23
# ' Steven Andrew Culpepper and James Joseph Balamuta
24
- # '
25
- # ' @seealso
24
+ # '
25
+ # ' @seealso
26
26
# ' [simcdm::sim_dina_attributes()] and [simcdm::sim_dina_items()]
27
- # '
27
+ # '
28
28
# ' @export
29
29
# ' @template sim-dina-class-example
30
30
sim_dina_class <- function (N , J , CLASS , ETA , gs , ss ) {
@@ -35,19 +35,19 @@ sim_dina_class <- function(N, J, CLASS, ETA, gs, ss) {
35
35
# '
36
36
# ' Generates a DINA model's \eqn{\eta} matrix based on alphas and
37
37
# ' the \eqn{\mathbf{Q}} matrix.
38
- # '
38
+ # '
39
39
# ' @inheritParams sim_dina_items
40
40
# '
41
- # ' @return
41
+ # ' @return
42
42
# ' The \eqn{\eta} `matrix` with dimensions \eqn{N \times J}{N x J} under
43
43
# ' the DINA model.
44
- # '
45
- # ' @author
44
+ # '
45
+ # ' @author
46
46
# ' Steven Andrew Culpepper and James Joseph Balamuta
47
- # '
48
- # ' @seealso
47
+ # '
48
+ # ' @seealso
49
49
# ' [simcdm::sim_dina_class()] and [simcdm::sim_dina_items()]
50
- # '
50
+ # '
51
51
# ' @export
52
52
# ' @template sim-dina-example-body
53
53
sim_dina_attributes <- function (alphas , Q ) {
@@ -61,20 +61,20 @@ sim_dina_attributes <- function(alphas, Q) {
61
61
# ' generated under DINA model.
62
62
# '
63
63
# ' @param alphas A \eqn{N} by \eqn{K} `matrix` of latent attributes.
64
- # ' @param Q A \eqn{J} by \eqn{K} `matrix` indicating which skills are required
65
- # ' for which items.
66
- # ' @param ss A \eqn{J} `vector` of item slipping parameters.
64
+ # ' @param Q A \eqn{J} by \eqn{K} `matrix` indicating which skills are
65
+ # ' required for which items.
66
+ # ' @param ss A \eqn{J} `vector` of item slipping parameters.
67
67
# ' @param gs A \eqn{J} `vector` of item guessing parameters.
68
68
# '
69
- # ' @return
69
+ # ' @return
70
70
# ' A \eqn{N} by \eqn{J} `matrix` of responses from the DINA model.
71
- # '
72
- # ' @author
71
+ # '
72
+ # ' @author
73
73
# ' Steven Andrew Culpepper and James Joseph Balamuta
74
- # '
75
- # ' @seealso
74
+ # '
75
+ # ' @seealso
76
76
# ' [simcdm::sim_dina_class()] and [simcdm::sim_dina_attributes()]
77
- # '
77
+ # '
78
78
# ' @export
79
79
# ' @template sim-dina-example-body
80
80
sim_dina_items <- function (alphas , Q , ss , gs ) {
@@ -113,9 +113,9 @@ sim_rrum_main <- function(Q, rstar, pistar, alpha) {
113
113
# ' @return Y A `matrix` with \eqn{N} rows and \eqn{J} columns indicating
114
114
# ' the indviduals' responses to each of the items, where \eqn{J}
115
115
# ' represents the number of items.
116
- # ' @author
116
+ # ' @author
117
117
# ' Steven Andrew Culpepper, Aaron Hudson, and James Joseph Balamuta
118
- # '
118
+ # '
119
119
# ' @export
120
120
# ' @template rrum-example
121
121
# ' @template rrum-references
@@ -127,18 +127,18 @@ sim_rrum_items <- function(Q, rstar, pistar, alpha) {
127
127
# '
128
128
# ' Computes the powers of 2 from \eqn{0} up to \eqn{K - 1} for
129
129
# ' \eqn{K}-dimensional attribute pattern.
130
- # '
130
+ # '
131
131
# ' @param K Number of Attributes.
132
- # '
133
- # ' @return
132
+ # '
133
+ # ' @return
134
134
# ' A \code{vec} with length \eqn{K} detailing the power's of 2.
135
- # '
136
- # ' @author
135
+ # '
136
+ # ' @author
137
137
# ' Steven Andrew Culpepper and James Joseph Balamuta
138
- # '
139
- # ' @seealso
138
+ # '
139
+ # ' @seealso
140
140
# ' [simcdm::attribute_inv_bijection()]
141
- # '
141
+ # '
142
142
# ' @export
143
143
# ' @examples
144
144
# ' ## Construct an attribute bijection ----
@@ -154,17 +154,17 @@ attribute_bijection <- function(K) {
154
154
# '
155
155
# ' @param CL An `integer` between \eqn{0} and \eqn{2^{K-1}}
156
156
# ' @inheritParams attribute_bijection
157
- # '
158
- # ' @return
157
+ # '
158
+ # ' @return
159
159
# ' A \eqn{K}-dimensional vector with an attribute pattern corresponding
160
160
# ' to `CL`.
161
- # '
162
- # ' @author
161
+ # '
162
+ # ' @author
163
163
# ' Steven Andrew Culpepper and James Joseph Balamuta
164
- # '
165
- # ' @seealso
164
+ # '
165
+ # ' @seealso
166
166
# ' [simcdm::attribute_bijection()]
167
- # '
167
+ # '
168
168
# ' @export
169
169
# ' @examples
170
170
# ' ## Construct an attribute inversion bijection ----
@@ -182,22 +182,22 @@ attribute_inv_bijection <- function(K, CL) {
182
182
# ' @param J Number of Items
183
183
# ' @param K Number of Attributes
184
184
# '
185
- # ' @return
185
+ # ' @return
186
186
# ' A dichotomous \code{matrix} for Q.
187
- # '
188
- # ' @author
187
+ # '
188
+ # ' @author
189
189
# ' Steven Andrew Culpepper and James Joseph Balamuta
190
- # '
191
- # ' @seealso
190
+ # '
191
+ # ' @seealso
192
192
# ' [simcdm::attribute_bijection()] and [simcdm::attribute_inv_bijection()]
193
- # '
193
+ # '
194
194
# ' @export
195
195
# ' @examples
196
196
# ' ## Simulate identifiable Q matrices ----
197
- # '
197
+ # '
198
198
# ' # 7 items and 2 attributes
199
199
# ' q_matrix_j7_k2 = sim_q_matrix(7, 2)
200
- # '
200
+ # '
201
201
# ' # 10 items and 3 attributes
202
202
# ' q_matrix_j10_k3 = sim_q_matrix(10, 3)
203
203
sim_q_matrix <- function (J , K ) {
@@ -211,29 +211,29 @@ sim_q_matrix <- function(J, K) {
211
211
# ' @param K Number of Attribute Levels
212
212
# ' @param J Number of Assessment Items
213
213
# ' @param Q Q Matrix with dimensions \eqn{K \times J}{K x J}.
214
- # '
215
- # ' @return
214
+ # '
215
+ # ' @return
216
216
# ' A `mat` with dimensions \eqn{J \times 2^K}{J x 2^K}.
217
- # '
218
- # ' @author
217
+ # '
218
+ # ' @author
219
219
# ' Steven Andrew Culpepper and James Joseph Balamuta
220
- # '
221
- # ' @seealso
220
+ # '
221
+ # ' @seealso
222
222
# ' [simcdm::sim_q_matrix()], [simcdm::attribute_bijection()], and
223
223
# ' [simcdm::attribute_inv_bijection()]
224
- # '
224
+ # '
225
225
# ' @export
226
226
# ' @examples
227
227
# ' ## Simulation Settings ----
228
- # '
228
+ # '
229
229
# ' # Fixed Number of Assessment Items for Q
230
230
# ' J = 18
231
231
# '
232
232
# ' # Fixed Number of Attributes for Q
233
233
# ' K = 3
234
234
# '
235
235
# ' ## Pre-specified configuration ----
236
- # '
236
+ # '
237
237
# ' # Specify Q
238
238
# ' qbj = c(4, 2, 1, 4, 2, 1, 4, 2, 1, 6, 5, 3, 6, 5, 3, 7, 7, 7)
239
239
# '
@@ -242,47 +242,49 @@ sim_q_matrix <- function(J, K) {
242
242
# ' for (j in seq_len(J)) {
243
243
# ' Q[j,] = attribute_inv_bijection(K, qbj[j])
244
244
# ' }
245
- # '
245
+ # '
246
246
# ' # Create an eta matrix
247
247
# ' ETA = sim_eta_matrix(K, J, Q)
248
- # '
248
+ # '
249
249
# ' ## Random generation of Q matrix with ETA matrix ----
250
- # '
250
+ # '
251
251
# ' # Construct a random q matrix
252
252
# ' Q_sim = sim_q_matrix(J, K)
253
- # '
253
+ # '
254
254
# ' # Generate the eta matrix
255
255
# ' ETA_gen = sim_eta_matrix(K, J, Q_sim)
256
256
sim_eta_matrix <- function (K , J , Q ) {
257
257
.Call(`_simcdm_sim_eta_matrix` , K , J , Q )
258
258
}
259
259
260
- # ' Simulate all the Latent Attribute Profile \eqn{\mathbf{\alpha}_c} in Matrix form
260
+ # ' Simulate all the Latent Attribute Profile \eqn{\mathbf{\alpha}_c} in
261
+ # ' Matrix form
261
262
# '
262
- # ' Generate the \eqn{\mathbf{\alpha}_c = (\alpha_{c1}, \ldots, \alpha_{cK})'}
263
- # ' attribute profile matrix for members of class \eqn{c} such that \eqn{\alpha_{ck}}
264
- # ' is 1 if members of class \eqn{c} possess skill \eqn{k} and zero otherwise.
263
+ # ' Generate the \eqn{\mathbf{\alpha}_c = (\alpha_{c1}, \ldots, \alpha_{cK})'}
264
+ # ' attribute profile matrix for members of class \eqn{c} such that
265
+ # ' \eqn{\alpha_{ck}} ' is 1 if members of class \eqn{c} possess skill \eqn{k}
266
+ # ' and zero otherwise.
265
267
# '
266
268
# ' @param K Number of Attributes
267
269
# '
268
- # ' @return
270
+ # ' @return
269
271
# ' A \eqn{2^K} by \eqn{K} `matrix` of latent classes
270
- # ' corresponding to entry \eqn{c} of \eqn{pi} based upon
272
+ # ' corresponding to entry \eqn{c} of \eqn{pi} based upon
271
273
# ' mastery and nonmastery of the \eqn{K} skills.
272
- # '
273
- # ' @author
274
+ # '
275
+ # ' @author
274
276
# ' James Joseph Balamuta and Steven Andrew Culpepper
275
- # '
277
+ # '
276
278
# ' @seealso
277
279
# ' [simcdm::sim_subject_attributes()] and [simcdm::attribute_inv_bijection()]
278
- # '
280
+ # '
279
281
# ' @export
280
282
# ' @examples
281
283
# ' ## Simulate Attribute Class Matrix ----
282
- # '
284
+ # '
283
285
# ' # Define number of attributes
284
286
# ' K = 3
285
- # '
287
+ # '
286
288
# ' # Generate an Latent Attribute Profile (Alpha) Matrix
287
289
# ' alphas = attribute_classes(K)
288
290
attribute_classes <- function (K ) {
@@ -292,35 +294,36 @@ attribute_classes <- function(K) {
292
294
# ' Simulate Subject Latent Attribute Profiles \eqn{\mathbf{\alpha}_c}
293
295
# '
294
296
# ' Generate a sample from the
295
- # ' \eqn{\mathbf{\alpha}_c = (\alpha_{c1}, \ldots, \alpha_{cK})'}
296
- # ' attribute profile matrix for members of class \eqn{c} such that \eqn{\alpha_{ck}}
297
- # ' is 1 if members of class \eqn{c} possess skill \eqn{k} and zero otherwise.
297
+ # ' \eqn{\mathbf{\alpha}_c = (\alpha_{c1}, \ldots, \alpha_{cK})'}
298
+ # ' attribute profile matrix for members of class \eqn{c} such that
299
+ # ' \eqn{\alpha_{ck}} ' is 1 if members of class \eqn{c} possess skill \eqn{k}
300
+ # ' and zero otherwise.
298
301
# '
299
302
# ' @param N Number of Observations
300
303
# ' @param K Number of Skills
301
- # ' @param probs A `vector` of probabilities that sum to 1.
302
- # '
303
- # ' @return
304
+ # ' @param probs A `vector` of probabilities that sum to 1.
305
+ # '
306
+ # ' @return
304
307
# ' A \eqn{N} by \eqn{K} `matrix` of latent classes
305
- # ' corresponding to entry \eqn{c} of \eqn{pi} based upon
308
+ # ' corresponding to entry \eqn{c} of \eqn{pi} based upon
306
309
# ' mastery and nonmastery of the \eqn{K} skills.
307
- # '
308
- # ' @author
310
+ # '
311
+ # ' @author
309
312
# ' James Joseph Balamuta and Steven Andrew Culpepper
310
- # '
311
- # ' @seealso
313
+ # '
314
+ # ' @seealso
312
315
# ' [simcdm::attribute_classes()] and [simcdm::attribute_inv_bijection()]
313
- # '
316
+ # '
314
317
# ' @export
315
318
# ' @examples
316
319
# ' # Define number of subjects and attributes
317
320
# ' N = 100
318
321
# ' K = 3
319
- # '
322
+ # '
320
323
# ' # Generate a sample from the Latent Attribute Profile (Alpha) Matrix
321
324
# ' # By default, we sample from a uniform distribution weighting of classes.
322
325
# ' alphas_builtin = sim_subject_attributes(N, K)
323
- # '
326
+ # '
324
327
# ' # Generate a sample using custom probabilities from the
325
328
# ' # Latent Attribute Profile (Alpha) Matrix
326
329
# ' probs = rep(1 / (2 ^ K), 2 ^ K)
0 commit comments