| rStructuredFactor | R Documentation |
Simulating item response data from the bi-factor and second-order copula models for item response data.
rBifactor(n, d, grpsize, categ, copnames1,copnames2, theta1, theta2) rSecond_order(n, d, grpsize, categ, copnames1, copnames2, theta1, theta2)
n |
Sample size. |
d |
Number of observed variables/items. |
grpsize |
vector indicating the size for each group, e.g., c(4,4,4) indicating four items in all three groups. |
categ |
A vector of categories for the observed variables/items. |
theta1 |
For the bi-factor model: copula parameter vector of size d for items with the common factor. For the second-order copulas: copula parameter vector of size G for the common factor and group-specific factors. |
theta2 |
For the bi-factor model: copula parameter vector of size d for items with the group-specific factor. For the second-order copulas: copula parameter vector of size d for items with the group-specific factor. |
copnames1 |
For the bi-factor copula: d-vector with the names of bivariate copulas that link the each of the oberved variabels with the common factor. For the second-order factor copula: G-vector with the names of bivariate copulas that link the each of the group-specific factors with the common factor, where G is the number of groups of items. Choices are “bvn” for BVN, “bvtν” with ν = \{1, …, 9\} degrees of freedom for t-copula, “frk” for Frank, “gum” for Gumbel, “rgum” for reflected Gumbel, “1rgum” for 1-reflected Gumbel, “2rgum” for 2-reflected Gumbel. |
copnames2 |
For the bi-factor copula: d-vector with the names of bivariate copulas that link the each of the oberved variabels with the group-specific factor. For the second-order factor copula: d-vector with the names of bivariate copulas that link the each of the oberved variabels with the group-specific factor. Choices are “bvn” for BVN, “bvtν” with ν = \{1, …, 9\} degrees of freedom for t-copula, “frk” for Frank, “gum” for Gumbel, “rgum” for reflected Gumbel, “1rgum” for 1-reflected Gumbel, “2rgum” for 2-reflected Gumbel. |
Data matrix of dimension n\times d, where n is the sample size, and d is the total number of observed variables/items.
Sayed H. Kadhem s.kadhem@uea.ac.uk
Aristidis K. Nikoloulopoulos a.nikoloulopoulos@uea.ac.uk
Kadhem, S.H. and Nikoloulopoulos, A.K. (2023) Bi-factor and second-order copula models for item response data. Psychometrika, 88, 132–157. doi: 10.1007/s11336-022-09894-2.
# ---------------------------------------------------
# ---------------------------------------------------
#Sample size
n = 500
#Ordinal Variables ---------------------------------
d = 9
grpsize=c(3,3,3)
ngrp=length(grpsize)
#Categories for ordinal ----------------------------
categ = rep(3,d)
# ---------------------------------------------------
# ---------------------------------------------------
# Bi-factor copula model
# ---------------------------------------------------
# ---------------------------------------------------
#Copula parameters
theta = rep(2.5, d)
delta = rep(1.5, d)
#Copula names
copulanames1 = rep("gum", d)
copulanames2 = rep("gum", d)
#----------------- Simulating data ------------------
data_Bifactor = rBifactor(n, d, grpsize, categ, copulanames1,
copulanames2, theta, delta)
# ---------------------------------------------------
# ---------------------------------------------------
# Second-order copula model
# ---------------------------------------------------
# ---------------------------------------------------
#Copula parameters
theta= rep(1.5, ngrp)
delta = rep(2.5, d)
#Copula names
copulanames1 = rep("gum", ngrp)
copulanames2 = rep("gum", d)
data_Second_order = rSecond_order(n, d, grpsize, categ,
copulanames1, copulanames2, theta, delta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.