|
1 | | - |
2 | | -<!-- README.md is generated from README.Rmd. Please edit that file --> |
3 | | -SEMinR |
4 | | -====== |
5 | | - |
6 | | -The `seminr` package provides a natural syntax for researchers to describe PLS structural equation models. |
7 | | - |
8 | | -Documentation |
9 | | -------------- |
10 | | - |
11 | | -The vignette for Seminr can be found in the [seminr/inst/doc/](https://github.com/ISS-Analytics/seminr/blob/master/inst/doc/SEMinR.html) folder or by running the `vignette("SEMinR")` command after installation. |
12 | | - |
13 | | -Demo code for use of Seminr can be found in the [seminr/demo/](https://github.com/ISS-Analytics/seminr/tree/master/demo) folder or by running the `demo("seminr-contained")`, `demo("seminr-ecsi")` or `demo("seminr-interaction")` commands after installation. |
14 | | - |
15 | | -Installation |
16 | | ------------- |
17 | | - |
18 | | -You can install seminr from github with: |
19 | | - |
20 | | -``` r |
21 | | -# install.packages("devtools") |
22 | | -devtools::install_github("ISS-Analytics/seminr") |
23 | | -``` |
24 | | - |
25 | | -Usage |
26 | | ------ |
27 | | - |
28 | | -Seminr can be used to create a plsm model, to estimate the model and to perform bootstrapping. |
29 | | - |
30 | | -``` r |
31 | | -# seminr syntax for creating measurement model |
32 | | -mobi_mm <- measure( |
33 | | - reflective("Image", multi_items("IMAG", 1:5)), |
34 | | - reflective("Expectation", multi_items("CUEX", 1:3)), |
35 | | - reflective("Value", multi_items("PERV", 1:2)), |
36 | | - reflective("Satisfaction", multi_items("CUSA", 1:3)) |
37 | | -) |
38 | | - |
39 | | -# interaction factors must be created after the measurement model is defined |
40 | | -mobi_xm <- interact( |
41 | | - interaction_combo("Image", "Expectation"), |
42 | | - interaction_combo("Image", "Value") |
43 | | -) |
44 | | - |
45 | | -# structural model: note that name of the interactions factor should be |
46 | | -# the names of its two main factors joined by a '.' in between. |
47 | | -mobi_sm <- structure( |
48 | | - paths(to = "Satisfaction", |
49 | | - from = c("Image", "Expectation", "Value", |
50 | | - "Image.Expectation", "Image.Value")) |
51 | | -) |
52 | | - |
53 | | -# Load data, assemble model, and estimate using semPLS |
54 | | -data("mobi", package = "semPLS") |
55 | | -seminr_model <- create_model(data = mobi, |
56 | | - measurement_model = mobi_mm, |
57 | | - interaction = mobi_xm, |
58 | | - structural_model = mobi_sm) |
59 | | -#> Generating the plsm model |
60 | | - |
61 | | -mobi_pls <- estimate_model(seminr_model, nboot = 200) |
62 | | -#> Estimating model using semPLS::sempls... |
63 | | -print_paths(mobi_pls) |
64 | | -#> Satisfaction |
65 | | -#> R^2 0.60 |
66 | | -#> Expectation 0.47 |
67 | | -#> Image 0.80 |
68 | | -#> Image.Expectation -0.52 |
69 | | -#> Image.Value -0.16 |
70 | | -#> Value 0.43 |
71 | | -#> Estimate Bootstrapped Estimate |
72 | | -#> Expectation -> Satisfaction 0.47 0.40 |
73 | | -#> Image -> Satisfaction 0.80 0.77 |
74 | | -#> Image.Expectation -> Satisfaction -0.52 -0.40 |
75 | | -#> Image.Value -> Satisfaction -0.16 -0.25 |
76 | | -#> Value -> Satisfaction 0.43 0.51 |
77 | | -#> Standard Error |
78 | | -#> Expectation -> Satisfaction 0.31 |
79 | | -#> Image -> Satisfaction 0.19 |
80 | | -#> Image.Expectation -> Satisfaction 0.51 |
81 | | -#> Image.Value -> Satisfaction 0.47 |
82 | | -#> Value -> Satisfaction 0.33 |
83 | | -``` |
84 | | - |
85 | | -Testing |
86 | | -------- |
87 | | - |
88 | | -To test: |
89 | | - |
90 | | -``` r |
91 | | -require(devtools) |
92 | | -devtools::test() |
93 | | -``` |
| 1 | + |
| 2 | +<!-- README.md is generated from README.Rmd. Please edit that file --> |
| 3 | +SEMinR |
| 4 | +====== |
| 5 | + |
| 6 | +SEMinR brings many advancements to creating and estimating structural equation models (SEM) using Partial Least Squares Path Modeling (PLS-PM): |
| 7 | + |
| 8 | +- A *natural* feeling, *domain-specific* language to build and estimate structural equation models in R |
| 9 | +- Uses *variance-based PLS estimation* to model both *composite* and *common-factor* constructs |
| 10 | +- *High-level functions* to quickly specify interactions and complicated structural models |
| 11 | + |
| 12 | +SEMinR follows the latest best-practices in methodological literature: |
| 13 | + |
| 14 | +- Automatically *adjusts PLS estimates to ensure consistency (PLSc)* wherever common factors are involved |
| 15 | +- Ajusts for known biases in interaction terms in PLS models |
| 16 | +- Continuously tested against leading PLSPM software to ensure parity of outcomes: SmartPLS (Ringle et al., 2015) and ADANCO (Henseler and Dijkstra, 2015), as well as other R packages such as semPLS (Monecke and Leisch, 2012) and matrixpls (Rönkkö, 2016) |
| 17 | +- *High performance, multi-core* bootstrapping function |
| 18 | + |
| 19 | +Documentation |
| 20 | +------------- |
| 21 | + |
| 22 | +The vignette for Seminr can be found in the [seminr/inst/doc/](https://github.com/ISS-Analytics/seminr/blob/master/inst/doc/SEMinR.html) folder or by running the `vignette("SEMinR")` command after installation. |
| 23 | + |
| 24 | +Demo code for use of Seminr can be found in the [seminr/demo/](https://github.com/ISS-Analytics/seminr/tree/master/demo) folder or by running the `demo("seminr-contained")`, `demo("seminr-ecsi")` or `demo("seminr-interaction")` commands after installation. |
| 25 | + |
| 26 | +Installation |
| 27 | +------------ |
| 28 | + |
| 29 | +You can install SEMinR with: |
| 30 | + |
| 31 | +``` r |
| 32 | +install.packages("seminr") |
| 33 | +``` |
| 34 | + |
| 35 | +Usage |
| 36 | +----- |
| 37 | + |
| 38 | +Briefly, there are four steps to specifying and estimating a structural equation model using SEMinR: |
| 39 | + |
| 40 | +1 Describe measurement model for each construct and its items: |
| 41 | + |
| 42 | +``` r |
| 43 | +# Distinguish and mix composite or reflective (common-factor) measurement models |
| 44 | +measurements <- constructs( |
| 45 | + composite("Image", multi_items("IMAG", 1:5), weights = mode_B), |
| 46 | + composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), |
| 47 | + reflective("Loyalty", multi_items("CUSL", 1:3)) |
| 48 | +) |
| 49 | +``` |
| 50 | + |
| 51 | +2 Specify any interactions between constructs: |
| 52 | + |
| 53 | +``` r |
| 54 | +# Easily create orthogonalized or scaled interactions between constructs |
| 55 | +intxns <- interactions( |
| 56 | + interaction_ortho("Image", "Expectation") |
| 57 | +) |
| 58 | +``` |
| 59 | + |
| 60 | +3 Describe the structural model of causal relationships between constructs (and interactions): |
| 61 | + |
| 62 | +``` r |
| 63 | +# Quickly create multiple paths "from" and "to" sets of constructs |
| 64 | +structure <- relationships( |
| 65 | + paths(from = c("Image", "Expectation", "Image.Expectation"), |
| 66 | + to = "Loyalty") |
| 67 | +) |
| 68 | +``` |
| 69 | + |
| 70 | +4 Put the above elements together to estimate and bootstrap the model: |
| 71 | + |
| 72 | +``` r |
| 73 | +# Dynamically compose SEM models from individual parts |
| 74 | +pls_model <- estimate_pls(data = mobi, measurements, intxns, structure) |
| 75 | +summary(pls_model) |
| 76 | + |
| 77 | +# Use multi-core parallel processing to speed up bootstraps |
| 78 | +boot_estimates <- bootstrap_model(pls_model, nboot = 1000, cores = 2) |
| 79 | +summary(boot_estimates) |
| 80 | +``` |
| 81 | + |
| 82 | +Authors |
| 83 | +------- |
| 84 | + |
| 85 | +- Soumya Ray |
| 86 | +- Nicholas Danks |
0 commit comments