| Title: | Conditional Process Analysis (CPA) via SEM Approach |
| Version: | 1.0.3 |
| Description: | 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., N = 100, 'omega' = 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. Cheung et al.(2021)<doi:10.1007/s10869-020-09717-0> Hsiao et al.(2018)<doi:10.1177/0013164416679877>. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Imports: | Matrix, methods, lavaan, MASS, purrr, semTools, stats, stringr |
| NeedsCompilation: | no |
| Packaged: | 2025-04-06 08:37:31 UTC; tsengyishang |
| Maintainer: | Yi-Hsuan Tseng <r12227115@g.ntu.edu.tw> |
| Depends: | R(≥ 4.1.0) |
| URL: | https://github.com/TomBJJJ/silp |
| BugReports: | https://github.com/TomBJJJ/silp/issues |
| Author: | Yi-Hsuan Tseng [aut, cre], Po-Hsien Huang [aut] |
| Repository: | CRAN |
| Date/Publication: | 2025-04-06 14:00:01 UTC |
Define silp class
Description
Define silp class
Slots
raw_modelThe user-specified
lavaansyntax model.rapi_modelThe revised model with the RAPI method.
timeThe operation time for
silp(in seconds).npdLogical. Whether the nearest positive definite matrix is used.
raw_dataThe input data.
faAn object of class
lavaanrepresenting the CFA result.reliabilityThe reliability index.
composite_dataThe composite data for RAPI.
paThe result of
silp.bootThe results of
resilpfrom R bootstrap samples.origineThe original
silpestimation.time_resilpThe operation time for
resilp(in seconds).techdetail of
resilpoperation
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, max_try = 100)
Arguments
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 |
max_try |
Maximum resampling attempts per bootstrap sample. |
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 |
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 |
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)
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. Ifmethod = "BC_b", the bias-corrected bootstrap result is presented.