| rfactor | R Documentation |
Simulating standard uniform and ordinal response data from factor copula models.
r1factor(n, d1, d2, categ, theta, copF1) r2factor(n, d1, d2, categ, theta, delta, copF1, copF2)
n |
Sample size. |
d1 |
Number of standard uniform variables. |
d2 |
Number of ordinal variables. |
categ |
A vector of categories for the ordinal variables. |
theta |
Copula parameters for the 1st factor. |
delta |
Copula parameters for the 2nd factor. |
copF1 |
(d_1+d_2)-vector with the names of bivariate copulas that link the each of the oberved variabels with the 1st 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, “joe” for Joe, “rjoe” for reflected Joe, “1rjoe” for 1-reflected Joe, “2rjoe” for 2-reflected Joe, “BB1” for BB1, “rBB1” for reflected BB1, “BB7” for BB7, “rBB7” for reflected BB7, “BB8” for BB8, “rBB8” for reflected BB8, “BB10” for BB10, “rBB10” for reflected BB10. |
copF2 |
(d_1+d_2)-vector with the names of bivariate copulas that link the each of the oberved variabels with the 2nd 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, “joe” for Joe, “rjoe” for reflected Joe, “1rjoe” for 1-reflected Joe, “2rjoe” for 2-reflected Joe, “BB1” for BB1, “rBB1” for reflected BB1, “BB7” for BB7, “rBB7” for reflected BB7, “BB8” for BB8, “rBB8” for reflected BB8, “BB10” for BB10, “rBB10” for reflected BB10. |
Data matrix of dimension n\times d, where n is the sample size, and d=d_1+d_2 is the total number of variables.
Sayed H. Kadhem s.kadhem@uea.ac.uk
Aristidis K. Nikoloulopoulos a.nikoloulopoulos@uea.ac.uk
Kadhem, S.H. and Nikoloulopoulos, A.K. (2021) Factor copula models for mixed data. British Journal of Mathematical and Statistical Psychology, 74, 365–403. doi: 10.1111/bmsp.12231.
# ---------------------------------------------------
# ---------------------------------------------------
# One-factor copula model
# ---------------------------------------------------
# ---------------------------------------------------
#Sample size ----------------------------------------
n = 100
#Continuous Variables ------------------------------
d1 = 5
#Ordinal Variables ---------------------------------
d2 = 3
#Categories for ordinal ----------------------------
categ = c(3,4,5)
#Copula parameters ---------------------------------
theta = rep(2, d1+d2)
#Copula names --------------------------------------
copnamesF1 = rep("gum", d1+d2)
#----------------- Simulating data ------------------
datF1 = r1factor(n, d1=d1, d2=d2, categ, theta, copnamesF1)
#------------ Plotting continuous data -------------
pairs(qnorm(datF1[, 1:d1]))
# ---------------------------------------------------
# ---------------------------------------------------
# Two-factor copula model
# ---------------------------------------------------
# ---------------------------------------------------
#Sample size ----------------------------------------
n = 100
#Continuous Variables ------------------------------
d1 = 5
#Ordinal Variables ---------------------------------
d2 = 3
#Categories for ordinal ----------------------------
categ = c(3,4,5)
#Copula parameters ---------------------------------
theta = rep(2.5, d1+d2)
delta = rep(1.5, d1+d2)
#Copula names --------------------------------------
copnamesF1 = rep("gum", d1+d2)
copnamesF2 = rep("gum", d1+d2)
#----------------- Simulating data ------------------
datF2 = r2factor(n, d1=d1, d2=d2, categ, theta, delta,
copnamesF1, copnamesF2)
#----------------- Plotting data ------------------
pairs(qnorm(datF2[,1:d1]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.