CorPcorProp: A Function That Calculates the Proportion of Correlations...

Description Usage Arguments Value Examples

View source: R/CorPcorProp.R

Description

This function calculates the proportion using either a raw data frame or a simulated common factor or network model. Based on procedure described by van Bork et al. (2019)

Usage

1
CorPcorProp(df, type = "obs", n = NULL, seed = NULL)

Arguments

df

input data frame consisting of variables in the measurement model

type

input character to (arbitrarily) name LV X in lavaan syntax. Defaults to "obs" for observed proportion but can simulate "ufm" (unidimensional factor model ) or "snm" (sparse network model)

n

optional input number of simulated samples to use if specifying latent or network model. If comparing ufm and snm, the same n should be specified.

seed

optional input number to set random seed for simulations. If comparing ufm and snm, the same seed should be specified.

Value

the observed proportion (for raw data) or a vector of simuluated proportions (based on specified model type)

Examples

1
2
3
obs <- CorPcorProp(df, type = "obs")
ufm <- CorPcorProp(df, type = "ufm", n = 100, seed = 123)
snm <- CorPcorProp(df, type = "snm", n = 100, seed = 123)

jsakaluk/scripty documentation built on Dec. 31, 2021, 9:17 p.m.