Skip to content

Commit aa29acd

Browse files
Merge pull request #46 from sem-in-r/release_0_3_1
Release 0 3 1
2 parents 8e67b45 + e7dcb61 commit aa29acd

File tree

14 files changed

+212
-219
lines changed

14 files changed

+212
-219
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
.Rproj.user/
22
.Rhistory
33
.RData
4-
delete this working file.R
5-
engage_2.csv
64
.Rproj.user
75
_*
8-
.*
6+
.DS*
7+
.R*

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: r
2+
3+
os:
4+
- linux
5+
- osx
6+
7+
cache: packages
8+
9+
# safelist
10+
branches:
11+
only:
12+
- develop

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Package: seminr
22
Type: Package
33
Title: Natural, Friendly, Domain-Specific Language for Building PLS Structural Equation Models
4-
Version: 0.3.0
5-
Date: 2017-10-12
4+
Version: 0.3.1
5+
Date: 2018-01-03
66
Authors@R: c(person("Soumya", "Ray",
7-
email = "soumya.ray@gmail.com", role = c("aut")),
7+
email = "soumya.ray@gmail.com", role = c("aut", "ths")),
88
person("Nicholas", "Danks",
99
email = "nicholasdanks@hotmail.com", role = c("aut","cre")))
1010
Description: A powerful, easy to write and easy to modify syntax for

R/evaluation.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ evaluate_model <- function(seminr_model) {
99

1010
## Reliability -------------------------
1111
# RhoC and AVE
12-
# Dillon-Goldstein's Rho as per: Dillon, W. R, and M. Goldstein. 1987. Multivariate Analysis: Methods
13-
# and Applications. Biometrical Journal 29 (6): 750–756.
12+
# Dillon-Goldstein's Rho as per: Dillon, W. R, and M. Goldstein. 1987. Multivariate Analysis: Methods
13+
# and Applications. Biometrical Journal 29 (6).
1414
# Average Variance Extracted as per: Fornell, C. and D. F. Larcker (February 1981). Evaluating
1515
# structural equation models with unobservable variables and measurement error, Journal of Marketing Research, 18, pp. 39-5
1616
rhoC_AVE <- function(seminr_model){
@@ -102,7 +102,7 @@ cross_loadings <- function(seminr_model) {
102102
}
103103

104104
# HTMT as per Henseler, J., Ringle, C. M., & Sarstedt, M. (2014). A new criterion for assessing discriminant validity in
105-
# variance-based structural equation modeling. Journal of the Academy of Marketing Science, 43(1), 115135.
105+
# variance-based structural equation modeling. Journal of the Academy of Marketing Science, 43(1), 115-135.
106106
# https://doi.org/10.1007/s11747-014-0403-8
107107
HTMT <- function(seminr_model) {
108108
HTMT <- matrix(, nrow=length(seminr_model$ltVariables), ncol=length(seminr_model$ltVariables),

R/library.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ calculate_loadings <- function(weights_matrix,fscores, normData) {
9999
# Function to adjust for the interaction
100100
# Adjustment of the SD of the interaction term as per Henseler, J., & Chin, W. W. (2010),
101101
# A comparison of approaches for the analysis of interaction effects between latent variables
102-
# using partial least squares path modeling. Structural Equation Modeling, 17(1), 82109. https://doi.org/10.1080/10705510903439003
102+
# using partial least squares path modeling. Structural Equation Modeling, 17(1), 82-109. https://doi.org/10.1080/10705510903439003
103103
adjust_interaction <- function(ltVariables, mmMatrix, outer_loadings, fscores, obsData){
104104
for(latent in ltVariables) {
105105
adjustment <- 0

R/summary.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ summary.seminr_model <- function(object, na.print=".", digits=3, ...) {
88

99
model_summary <- list(iterations=iterations,
1010
paths=path_reports,
11-
metrics=metrics,
1211
loadings=object$outer_loadings,
1312
cross_loadings=metrics$Validity$`Cross-Loadings`,
1413
weights=object$outer_weights,

README.Rmd

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@ knitr::opts_chunk$set(
1616

1717
# SEMinR
1818

19-
The `seminr` package provides a natural syntax for researchers to describe PLS structural equation models.
19+
SEMinR brings many advancements to creating and estimating structural equation models (SEM) using Partial Least Squares Path Modeling (PLS-PM):
20+
21+
* A _natural_ feeling, _domain-specific_ language to build and estimate structural equation models in R
22+
* Uses _variance-based PLS estimation_ to model both _composite_ and _common-factor_ constructs
23+
* _High-level functions_ to quickly specify interactions and complicated structural models
24+
25+
SEMinR follows the latest best-practices in methodological literature:
26+
27+
* Automatically _adjusts PLS estimates to ensure consistency (PLSc)_ wherever common factors are involved
28+
* Ajusts for known biases in interaction terms in PLS models
29+
* 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)
30+
* _High performance, multi-core_ bootstrapping function
2031

2132
## Documentation
2233

@@ -26,64 +37,55 @@ Demo code for use of Seminr can be found in the [seminr/demo/](https://github.co
2637

2738
## Installation
2839

29-
You can install seminr from github with:
40+
You can install SEMinR with:
3041

31-
```{r gh-installation, eval = FALSE}
32-
# install.packages("devtools")
33-
devtools::install_github("ISS-Analytics/seminr")
42+
```{r, eval=FALSE}
43+
install.packages("seminr")
3444
```
3545

3646
## Usage
3747

38-
Seminr can be used to create a plsm model, to estimate the model and to perform bootstrapping.
48+
Briefly, there are four steps to specifying and estimating a structural equation model using SEMinR:
3949

40-
```{r example}
41-
# seminr syntax for creating measurement model
42-
mobi_mm <- constructs(
43-
reflective("Image", multi_items("IMAG", 1:5)),
44-
reflective("Expectation", multi_items("CUEX", 1:3)),
45-
reflective("Value", multi_items("PERV", 1:2)),
46-
reflective("Satisfaction", multi_items("CUSA", 1:3))
50+
1 Describe measurement model for each construct and its items:
51+
```{r, eval=FALSE}
52+
# Distinguish and mix composite or reflective (common-factor) measurement models
53+
measurements <- constructs(
54+
composite("Image", multi_items("IMAG", 1:5), weights = mode_B),
55+
composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A),
56+
reflective("Loyalty", multi_items("CUSL", 1:3))
4757
)
58+
```
4859

49-
# interaction factors must be created after the measurement model is defined
50-
mobi_xm <- interactions(
51-
interaction_combo("Image", "Expectation"),
52-
interaction_combo("Image", "Value")
60+
2 Specify any interactions between constructs:
61+
```{r, eval=FALSE}
62+
# Easily create orthogonalized or scaled interactions between constructs
63+
intxns <- interactions(
64+
interaction_ortho("Image", "Expectation")
5365
)
66+
```
5467

55-
# structural model: note that name of the interactions factor should be
56-
# the names of its two main factors joined by a '.' in between.
57-
mobi_sm <- relationships(
58-
paths(to = "Satisfaction",
59-
from = c("Image", "Expectation", "Value",
60-
"Image.Expectation", "Image.Value"))
68+
3 Describe the structural model of causal relationships between constructs (and interactions):
69+
```{r, eval=FALSE}
70+
# Quickly create multiple paths "from" and "to" sets of constructs
71+
structure <- relationships(
72+
paths(from = c("Image", "Expectation", "Image.Expectation"),
73+
to = "Loyalty")
6174
)
62-
63-
# Load data, assemble model, and estimate using semPLS
64-
data("mobi", package = "semPLS")
65-
seminr_model <- estimate_model(data = mobi,
66-
measurement_model = mobi_mm,
67-
interactions = mobi_xm,
68-
structural_model = mobi_sm)
69-
70-
summary(seminr_model)
71-
72-
seminr_model_boot <- bootstrap_model(data = mobi,
73-
measurement_model = mobi_mm,
74-
interactions = mobi_xm,
75-
structural_model = mobi_sm,
76-
nboot = 200)
77-
78-
summary(seminr_model_boot)
7975
```
8076

81-
## Testing
77+
4 Put the above elements together to estimate and bootstrap the model:
78+
```{r, eval=FALSE}
79+
# Dynamically compose SEM models from individual parts
80+
pls_model <- estimate_pls(data = mobi, measurements, intxns, structure)
81+
summary(pls_model)
8282
83-
To test:
84-
85-
```{r devtools-test, eval = FALSE}
86-
require(devtools)
87-
devtools::test()
83+
# Use multi-core parallel processing to speed up bootstraps
84+
boot_estimates <- bootstrap_model(pls_model, nboot = 1000, cores = 2)
85+
summary(boot_estimates)
8886
```
8987

88+
## Authors
89+
90+
* Soumya Ray
91+
* Nicholas Danks

README.md

Lines changed: 86 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,86 @@
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

SEMinR.Rproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ BuildType: Package
1919
PackageUseDevtools: Yes
2020
PackageInstallArgs: --no-multiarch --with-keep.source
2121
PackageCheckArgs: --as-cran
22+
PackageRoxygenize: rd,collate,namespace

inst/doc/SEMinR.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ library(seminr)
2929
# summary(pls_model)
3030
#
3131
# # Use multi-core parallel processing to speed up bootstraps
32-
# boot_estimates <- bootstrap_model(pls_model, nboot = 200, cores = 4)
32+
# boot_estimates <- bootstrap_model(pls_model, nboot = 2000, cores = 4)
3333
# summary(boot_estimates)
3434

3535
## ---- eval=FALSE---------------------------------------------------------
@@ -155,7 +155,7 @@ mobi_pls <- estimate_pls(data = mobi,
155155
## ------------------------------------------------------------------------
156156
# use 2000 bootstraps and utilize 4 parallel cores
157157
boot_mobi_pls <- bootstrap_model(seminr_model = mobi_pls,
158-
nboot = 200,
158+
nboot = 2000,
159159
cores = 2)
160160

161161
## ------------------------------------------------------------------------

0 commit comments

Comments
 (0)