Learn R Programming

CFM (version 0.8.0)

CFM: Censored Factor Models Data Generation

Description

Generate multivariate data that follow a latent factor structure with censoring errors drawn from Normal, Student-t or Logistic distributions. Convenience wrapper around rcnorm, rct, and rclogis.

Usage

CFM(n, p, m, cens.dist = c("normal", "t", "logistic"), df = 5, seed = NULL)

Value

A named list with components:

data

numeric \(n \times p\) matrix of observations.

F

factor scores matrix (\(n \times m\)).

A

factor loadings matrix (\(p \times m\)).

D

unique variances diagonal matrix (\(p \times p\)).

Arguments

n

sample size (\(n \times 1\) observations).

p

number of manifest variables.

m

number of latent factors.

cens.dist

censoring error distribution: "normal", "t", or "logistic".

df

degrees of freedom when cens.dist = "t".

seed

optional random seed for reproducibility.

Examples

Run this code
# \donttest{
set.seed(2025)
# Normal censoring
obj <- CFM(n = 200, p = 10, m = 3, cens.dist = "normal")
head(obj$data)

# t-censoring with 6 d.f.
obj <- CFM(n = 300, p = 12, m = 4, cens.dist = "t", df = 6)
psych::KMO(obj$data)
# }

Run the code above in your browser using DataLab