Package 'silp'

Title: Conditional Process Analysis (CPA) via SEM approach
Description: The "silp" package utilizes the Reliability-Adjusted Product Indicator (RAPI) method to estimate effects among latent variables, thus allowing for more precise definition and analysis of mediation and moderation models. Our simulation studies reveal that while "silp" may exhibit instability with smaller sample sizes and lower reliability scores (e.g., 𝑁 = 100, 𝜔 = 0.7), implementing nearest positive definite matrix correction and bootstrap confidence interval estimation can significantly ameliorate this volatility. When these adjustments are applied, "silp" achieves estimations akin in quality to those derived from LMS. In conclusion, the "silp" package is a valuable tool for researchers seeking to explore complex relational structures between variables without resorting to commercial software.
Authors: Yi-Hsuan Tseng [aut, cre], Po-Hsien Huang [aut]
Maintainer: Yi-Hsuan Tseng <[email protected]>
License: MIT + file LICENSE
Version: 1.0.1
Built: 2024-11-15 03:20:32 UTC
Source: https://github.com/tombjjj/silp

Help Index


generate_data

Description

Generates data based on the simulation settings provided by Cheung et al. (2021). Note that the reliability used here is omega.

Usage

generate_data(
  n_obs = 100,
  corr = 0.3,
  effect = 0.42,
  ld = c(1, 1, 1, 1),
  alp = 0.9,
  effect_x = 0.4,
  effect_z = 0.2
)

Arguments

n_obs

Integer. The number of observations.

corr

Numeric. The correlation of the latent variables.

effect

Numeric. The effect of the moderator.

ld

Numeric. The factor loading of the latent variable to its indicators.

alp

Numeric. The reliability of the latent variable.

effect_x

Numeric. The direct effect of x.

effect_z

Numeric. The direct effect of z.

Value

A dataset simulated from the argument settings.

Examples

n_obs = 100
corr = 0.1
effect = 0.12
ld = c(1,1,1,1)
alp = 0.9
generate_data(n_obs, corr, effect, ld, alp)

resilp

Description

An extended function from silp, applying the bootstrap method to obtain standard error estimation. Note: When using silp with the nearest positive definite matrix (npd = TRUE), this function should be used to obtain reliable inference.

Usage

resilp(fit, R = 2000, progress = T)

Arguments

fit

A result object from silp.

R

Integer. The number of bootstrap samples. Default is 2000.

progress

Logical. Whether to display a progress bar. Default is FALSE.

Value

An object of class "Silp".

Examples

n_obs = 100
corr = 0.1
effect = 0.12
ld = c(1,1,1,1)
alp = 0.9
data = generate_data(n_obs, corr, effect, ld, alp)
model = "
  fy =~ y1 + y2 + y3 + y4
  fx =~ x1 + x2 + x3 + x4
  fz =~ z1 + z2 + z3 + z4
  fy ~  fx + fz + fx:fz
"
fit = silp(model, data)
resilp(fit, R = 10)

silp

Description

This function extends the lavaan function, allowing users to define moderation effects using the symbol ":". The RAPI method is used to estimate moderation effects.

Usage

silp(model, data, center = "double", tau.eq = F, npd = F, ...)

Arguments

model

A lavaan syntax model with extension. The notation ":" implies interaction between two variables (see Example).

data

The dataset for lavaan SEM.

center

Character. Whether single or double mean centering is used for the product indicator. Default is "double".

tau.eq

Logical. Specifies the type of reliability used to estimate error variance. If TRUE, Cronbach's alpha reliability is used. If FALSE, omega reliability is used. Default is FALSE.

npd

Logical. Specifies the type of input used in lavaan SEM. Default is FALSE for raw data or TRUE for a covariance matrix. Applying a covariance matrix can resolve problems of a non-positive definite covariance matrix. If TRUE, resilp should be used to obtain reliable inference.

...

Other parameters passed to the lavaan SEM function.#'

Value

An "Silp" class object.

Examples

n_obs = 100
corr = 0.1
effect = 0.12
ld = c(1,1,1,1)
alp = 0.9
data = generate_data(n_obs, corr, effect, ld, alp)
model = "
  fy =~ y1 + y2 + y3 + y4
  fx =~ x1 + x2 + x3 + x4
  fz =~ z1 + z2 + z3 + z4
  fy ~  fx + fz + fx:fz
"
silp(model, data)

Define silp class

Description

Define silp class

Slots

raw_model

The user-specified lavaan syntax model.

rapi_model

The revised model with the RAPI method.

time

The operation time for silp (in seconds).

npd

Logical. Whether the nearest positive definite matrix is used.

raw_data

The input data.

fa

An object of class lavaan representing the CFA result.

reliability

The reliability index.

composite_data

The composite data for RAPI.

pa

The result of silp.

boot

The results of resilp from R bootstrap samples.

origine

The original silp estimation.

time_resilp

The operation time for resilp (in seconds).


Methods for Class Silp in Package silp

Description

Summary Methods for Class Silp in Package silp.

Methods

signature(object = "Silp", method = "Bootstrap")

Returns the summary result of 'silp' or 'resilp'. This method is for 'resilp' only. If method = "Bootstrap", the percentile bootstrap result is presented. If method = "BC_b", the bias-corrected bootstrap result is presented.