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 |
Generates data based on the simulation settings provided by Cheung et al. (2021). Note that the reliability used here is omega.
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 )
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 )
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. |
A dataset simulated from the argument settings.
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)
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)
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.
resilp(fit, R = 2000, progress = T)
resilp(fit, R = 2000, progress = T)
fit |
A result object from |
R |
Integer. The number of bootstrap samples. Default is 2000. |
progress |
Logical. Whether to display a progress bar. Default is |
An object of class "Silp".
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)
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)
This function extends the lavaan
function, allowing users to define moderation effects using the symbol ":".
The RAPI method is used to estimate moderation effects.
silp(model, data, center = "double", tau.eq = F, npd = F, ...)
silp(model, data, center = "double", tau.eq = F, npd = F, ...)
model |
A |
data |
The dataset for |
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 |
npd |
Logical. Specifies the type of input used in |
... |
Other parameters passed to the |
An "Silp" class object.
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)
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
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).
Silp
in Package silp
Summary Methods for Class Silp
in Package silp.
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.