Learn R Programming

FactorCopula (version 0.9.3)

rStructuredFactor: Simulation of bi-factor and second-order copula models for item response data

Description

Simulating item response data from the bi-factor and second-order copula models for item response data.

Usage

rBifactor(n, d, grpsize, categ, copnames1,copnames2, theta1, theta2)
rSecond_order(n, d, grpsize, categ, copnames1, copnames2, theta1, theta2)

Value

Data matrix of dimension \(n\times d\), where \(n\) is the sample size, and \(d\) is the total number of observed variables/items.

Arguments

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\(\nu\)” with \(\nu = \{1, \ldots, 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\(\nu\)” with \(\nu = \{1, \ldots, 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.

Author

Sayed H. Kadhem s.kadhem@uea.ac.uk
Aristidis K. Nikoloulopoulos a.nikoloulopoulos@uea.ac.uk

References

Kadhem, S.H. and Nikoloulopoulos, A.K. (2023) Bi-factor and second-order copula models for item response data. Psychometrika, 88, 132--157. tools:::Rd_expr_doi("doi:10.1007/s11336-022-09894-2").

Examples

Run this code
# ---------------------------------------------------
# ---------------------------------------------------
#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)

Run the code above in your browser using DataLab