Title: | Building and Estimating Structural Equation Models |
---|---|
Description: | A powerful, easy to syntax for specifying and estimating complex Structural Equation Models. Models can be estimated using Partial Least Squares Path Modeling or Covariance-Based Structural Equation Modeling or covariance based Confirmatory Factor Analysis. Methods described in Ray, Danks, and Valdez (2021). |
Authors: | Soumya Ray [aut, ths], Nicholas Patrick Danks [aut, cre], André Calero Valdez [aut], Juan Manuel Velasquez Estrada [ctb], James Uanhoro [ctb], Johannes Nakayama [ctb], Lilian Koyan [ctb], Laura Burbach [ctb], Arturo Heynar Cano Bejar [ctb], Susanne Adler [ctb] |
Maintainer: | Nicholas Patrick Danks <[email protected]> |
License: | GPL-3 |
Version: | 2.3.1 |
Built: | 2025-02-10 04:45:25 UTC |
Source: | https://github.com/sem-in-r/seminr |
Converts all contructs of a measurement model, or just a single construct into reflective factors.
as.reflective(x, ...)
as.reflective(x, ...)
x |
A measurement model defined by |
... |
Any further parameters for the specific construct. |
A list of reflective constructs.
as.reflective.measurement_model
,
as.reflective.construct
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)) ) new_mm <- as.reflective(mobi_mm)
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)) ) new_mm <- as.reflective(mobi_mm)
Converts a contruct of a measurement model into a reflective factor.
## S3 method for class 'construct' as.reflective(x, ...)
## S3 method for class 'construct' as.reflective(x, ...)
x |
A measurement model defined by |
... |
Any further parameters for the specific construct. |
A list of reflective constructs.
as.reflective.measurement_model
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)) ) new_mm <- as.reflective(mobi_mm)
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)) ) new_mm <- as.reflective(mobi_mm)
Converts interaction of a measurement model into a reflective factors.
## S3 method for class 'interaction' as.reflective(x, ...)
## S3 method for class 'interaction' as.reflective(x, ...)
x |
A measurement model defined by |
... |
Any further parameters for the specific construct. |
A list of reflective constructs.
as.reflective.measurement_model
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)) ) new_mm <- as.reflective(mobi_mm)
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)) ) new_mm <- as.reflective(mobi_mm)
Converts all contructs of a measurement model, or just a single construct into reflective factors.
## S3 method for class 'measurement_model' as.reflective(x, ...)
## S3 method for class 'measurement_model' as.reflective(x, ...)
x |
A measurement model defined by |
... |
Any further parameters for the specific construct. |
A list of reflective constructs.
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)) ) new_mm <- as.reflective(mobi_mm)
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)) ) new_mm <- as.reflective(mobi_mm)
estimate_cbsem
) or
CFA estimation (estimate_cfa
)Specifies inter-item covariances that should be supplied to
CBSEM estimation (estimate_cbsem
) or
CFA estimation (estimate_cfa
)
associations(...)
associations(...)
... |
One or more associations defined by |
A matrix of items that covary.
covaries <- associations( item_errors(c("a1", "a2"), c("b1", "b2")), item_errors("a3", "c3") )
covaries <- associations( item_errors(c("a1", "a2"), c("b1", "b2")), item_errors("a3", "c3") )
Return all path bootstraps as a long dataframe. Columns of the dataframes are specified paths and rows are the estimated coefficients for the paths at each bootstrap iteration.
boot_paths_df(pls_boot)
boot_paths_df(pls_boot)
pls_boot |
bootstrapped PLS model |
data(mobi) mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Satisfaction", multi_items("CUSA", 1:3)) ) mobi_sm <- relationships( paths(from = c("Image", "Expectation"), to = "Satisfaction") ) pls_model <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) pls_boot <- bootstrap_model(seminr_model = pls_model, nboot = 50, cores = 2, seed = NULL) boot_paths_df(pls_boot)
data(mobi) mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Satisfaction", multi_items("CUSA", 1:3)) ) mobi_sm <- relationships( paths(from = c("Image", "Expectation"), to = "Satisfaction") ) pls_model <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) pls_boot <- bootstrap_model(seminr_model = pls_model, nboot = 50, cores = 2, seed = NULL) boot_paths_df(pls_boot)
The seminr
package provides a natural syntax for researchers to describe PLS
structural equation models.
bootstrap_model
provides the verb for bootstrapping a pls model from the model
parameters and data.
bootstrap_model(seminr_model, nboot = 500, cores = NULL, seed = NULL, ...)
bootstrap_model(seminr_model, nboot = 500, cores = NULL, seed = NULL, ...)
seminr_model |
A fully estimated model with associated data, measurement model and structural model |
nboot |
A parameter specifying the number of bootstrap iterations to perform, default value is 500. If 0 then no bootstrapping is performed. |
cores |
A parameter specifying the maximum number of cores to use in the parallelization. |
seed |
A parameter to specify the seed for reproducibility of results. Default is NULL. |
... |
A list of parameters passed on to the estimation method. |
A list of the estimated parameters for the bootstrapped model including:
boot_paths |
An array of the 'nboot' estimated bootstrap sample path coefficient matrices. |
boot_loadings |
An array of the 'nboot' estimated bootstrap sample item loadings matrices. |
boot_weights |
An array of the 'nboot' estimated bootstrap sample item weights matrices. |
boot_HTMT |
An array of the 'nboot' estimated bootstrap sample model HTMT matrices. |
boot_total_paths |
An array of the 'nboot' estimated bootstrap sample model total paths matrices. |
paths_descriptives |
A matrix of the bootstrap path coefficients and standard deviations. |
loadings_descriptives |
A matrix of the bootstrap item loadings and standard deviations. |
weights_descriptives |
A matrix of the bootstrap item weights and standard deviations. |
HTMT_descriptives |
A matrix of the bootstrap model HTMT and standard deviations. |
total_paths_descriptives |
A matrix of the bootstrap model total paths and standard deviations. |
Hair, J. F., Hult, G. T. M., Ringle, C. M., and Sarstedt, M. (2017). A Primer on Partial Least Squares Structural Equation Modeling (PLS-SEM), 2nd Ed., Sage: Thousand Oaks.
relationships
constructs
paths
interaction_term
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = "Expectation", method = orthogonal), interaction_term(iv = "Image", moderator = "Value", method = orthogonal) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation", "Image*Value")) ) seminr_model <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) # Load data, assemble model, and bootstrap boot_seminr_model <- bootstrap_model(seminr_model = seminr_model, nboot = 50, cores = 2, seed = NULL) summary(boot_seminr_model)
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = "Expectation", method = orthogonal), interaction_term(iv = "Image", moderator = "Value", method = orthogonal) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation", "Image*Value")) ) seminr_model <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) # Load data, assemble model, and bootstrap boot_seminr_model <- bootstrap_model(seminr_model = seminr_model, nboot = 50, cores = 2, seed = NULL) summary(boot_seminr_model)
Open Edotor graphViz Website with the preloaded in the Browser
browse_plot(model, theme = seminr_theme_get())
browse_plot(model, theme = seminr_theme_get())
model |
A SEMinR Model |
theme |
An optional SEMinR theme |
## Not run: browse_plot(model) ## End(Not run)
## Not run: browse_plot(model) ## End(Not run)
A function to create regression plots (maybe not needed?)
check_test_plot(plot, title, plot_dir = "regression_plots", refresh = FALSE)
check_test_plot(plot, title, plot_dir = "regression_plots", refresh = FALSE)
plot |
the plot |
title |
a unique title |
plot_dir |
optional directory name |
refresh |
whether to refresh all test cases |
TRUE if plots were the same, FALSE if they did not exist, or failed
composite
creates the composite measurement model matrix for a specific construct,
specifying the relevant items of the construct and assigning the relationship of either
correlation weights (Mode A) or regression weights (Mode B).
composite(construct_name, item_names,weights = correlation_weights)
composite(construct_name, item_names,weights = correlation_weights)
construct_name |
of construct |
item_names |
returned by the |
weights |
is the relationship between the construct and its items. This can be
specified as |
This function conveniently maps composite defined measurement items to a construct and is estimated using PLS.
A vector of the indicators for a composite.
See constructs
, reflective
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5), weights = correlation_weights), composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), composite("Quality", multi_items("PERQ", 1:7), weights = regression_weights), composite("Value", multi_items("PERV", 1:2), weights = mode_B) )
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5), weights = correlation_weights), composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), composite("Quality", multi_items("PERQ", 1:7), weights = regression_weights), composite("Value", multi_items("PERV", 1:2), weights = mode_B) )
Function to calculate Akaike weights for IT Criteria
compute_itcriteria_weights(vector_of_itcriteria)
compute_itcriteria_weights(vector_of_itcriteria)
vector_of_itcriteria |
This argument is a vector consisting of the IT criterion estimated value for each model. |
constructs
creates the constructs from measurement items by assigning the
relevant items to each construct and specifying reflective or formative (composite/causal) measurement models
constructs(...)
constructs(...)
... |
Comma separated list of the construct variable measurement specifications, as generated by the
|
This function conveniently maps measurement items to constructs using root name, numbers, and affixes with explicit definition of formative or reflective relationships
A list of constructs, their indicators and estimation technique (SEMinR measurement model).
See composite
, reflective
mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) )
mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) )
Returns R-sq of a dv given correlation matrix of ivs, dv cors <- cbsem_summary$descriptives$correlations$constructs cor_rsq(cors, dv_name = "Value", iv_names = c("Image", "Quality"))
cor_rsq(cor_matrix, dv_name, iv_names)
cor_rsq(cor_matrix, dv_name, iv_names)
cor_matrix |
A correlation matrix that includes ivs and dv |
dv_name |
Character string of dependent variable |
iv_names |
Vector of character strings for independent variables |
The data set is used as measurement instrument for corporate reputation.
corp_rep_data
corp_rep_data
A data frame with 344 rows and 46 variables:
A categorical variable for the service provider: 1, 2, 3, or 4.
A categorical variable for the service type: 1=Prepaid plan (n=125); 2=Contract plan (n=219).
The company behaves in a socially conscious way.
The company is forthright in giving information to the public.
The company has a fair attitude toward competitors.
The company is concerned about the preservation of the environment.
The company is not only concerned about the profits.
Please assess the extent to which the company acts in socially conscious ways 0 (not at all) to 7 (definitely).
The company is succesful in attracting high-quality employees.
I could see myself working at the company.
I like the physical appearance of the company/buildings/shops, etc.
Please assess the company’s overall attractiveness; 0=very low; 7=very high.
The company is a very well managed company.
The company is an economically stable company.
The business risk for the company is modest compared to its competitors.
The company has growth potential.
The company has a clear vision about the future of the company.
Please assess the company’s overall performance; 0=very low; 7=very high.
The products/services offered by the company are of high quality.
The company is an innovator, rather than an imitator with respect to industry.
The company's services/products offer good quality for money.
The services the company offered are good.
Customer concerns are held in high regard at the company.
The company is a reliable partner for customers.
The company is a trustworthy company.
I have a lot of respect for the company.
Please assess the overall quality of the company’s activities; 0=very low; 7=very high.
The company is a copany that I can better identify with than other companies.
The company is a company that I would regret more not having if it no longer existed than other companies.
I regard the company as a likeable company.
The company is a top competitor in its market.
As far as I know, the company is recognized worldwide.
I believe that the company performs at a premium level.
I would recommend the company to friends and relatives.
If I had to choose again, I would choose the company as my mobile phone services provider.
I will remain a customer of the company in the future.
I am satisfied with company.
?
Categorical for education.
Categorical for type of occupation.
?
?
Multi Group Analysis 1.
Multi Group Analysis 2.
Multi Group Analysis 3.
Multi Group Analysis 4.
It takes me a great deal of time to switch to another company.
It costs me too much to switch to another company.
It takes a lot of effort to get used to a new company with its specific "rules" and practices.
In general, it would be a hassle switching to another company.
The data frame mobi contains the observed data for the model specified by Corporate Reputation.
Hair, J. F., Hult, G. T. M., Ringle, C. M., and Sarstedt, M. (2017). A Primer on Partial Least Squares Structural Equation Modeling (2nd ed.). Thousand Oakes, CA: Sage.
data("corp_rep_data")
data("corp_rep_data")
The data set is used as measurement instrument for corporate reputation.
corp_rep_data2
corp_rep_data2
A data frame with 347 rows and 49 variables:
A categorical variable for the service type: 1=Postpaid plan; 2=Prepaid plan.
A categorical variable for the service provider: 1, 2, 3, or 4.
If you consider your experiences with "company", how satisfied are you with "company"?
I would recommend "the company" to friends and relatives.
If I had to choose again, I would choose "the company" as my mobile phone services provider.
I will remain a customer of "the company" in the future.
The products/services offered by "the company" are of high quality.
"The company" is an innovator, rather than an imitator with respect to the mobile phone service industry.
"The company's" services/products offer good quality for money.
The services "the company" offers are good.
Customer concerns are held in high regard at "the company".
"The company" is a reliable partner for customers.
"The company" is a trustworthy company.
I have a lot of respect for "the company".
"The company" is a very well managed company.
"The company" is an economically stable company.
The business risk of "the company" is reasonable compared to its competitors.
The growth of "the company" is promising.
"The company" has a clear vision about the future of the company.
"The company" behaves in a socially conscious way.
"The company" is honest in giving information to the public.
"The company" competes fairly in the indsutry.
"The company" cares for the preservation of the environment.
"The company" is doing more than just making profits.
"The company" is succesful in attracting high-quality employees.
I could see myself working at "the company".
I like the physical appearance of "the company" (company/buildings/shops, etc.).
"The company" is a top competitor in its market.
As far as I know, "the company" is recognized worldwide.
I believe that "the company" performs at a premium level.
"The company" is a company that I can better identify with than other companies.
When comparing with other companies, "The company" is the company I would regret more if it no longer existed.
I regard "the company" as a likeable company.
Please assess the general quality of "the company".
Please assess the general performance of "the company".
Please assess the extent to which "the company" acts in socially conscious ways.
Please assess the attractiveness of "the company".
It takes me a great deal of time to switch to another mobile phone services provider.
It costs me too much to switch to another mobile phone services provider.
It takes a lot of effort to get used to a new mobile phone services provider with its specific "rules" and practices.
In general, it would be a hassle switching to another mobile phone services provider.
The data frame mobi contains the observed data for the model specified by Corporate Reputation.
Sarstedt, M., Hair Jr, J. F., Cheah, J. H., Becker, J. M., & Ringle, C. M. (2019). How to specify, estimate, and validate higher-order constructs in PLS-SEM. Australasian Marketing Journal (AMJ), 27(3), 197-211.
data("corp_rep_data2")
data("corp_rep_data2")
Converts lavaan syntax for composite models used by cSEM
package to SEMinR
model specifications
csem2seminr(lav_syntax)
csem2seminr(lav_syntax)
lav_syntax |
A |
A SEMinR model.
lav_syntax <- ' Composite model Image <~ IMAG1 + IMAG2 + IMAG3 + IMAG4 + IMAG5 Expectation <~ CUEX1 + CUEX2 + CUEX3 Value <~ PERV1 + PERV2 Satisfaction <~ CUSA1 + CUSA2 + CUSA3 # Structural model Satisfaction ~ Image + Expectation + Value ' csem_model <- estimate_pls(mobi, model = csem2seminr(lav_syntax))
lav_syntax <- ' Composite model Image <~ IMAG1 + IMAG2 + IMAG3 + IMAG4 + IMAG5 Expectation <~ CUEX1 + CUEX2 + CUEX3 Value <~ PERV1 + PERV2 Satisfaction <~ CUSA1 + CUSA2 + CUSA3 # Structural model Satisfaction ~ Image + Expectation + Value ' csem_model <- estimate_pls(mobi, model = csem2seminr(lav_syntax))
Cross-tabulates columns of a dataframe into a matrix with NAs for unspecified pairs
df_xtab_matrix(model, df, rows, columns)
df_xtab_matrix(model, df, rows, columns)
model |
A |
df |
A |
rows |
A |
columns |
A |
A cross-tabulated matrix matrix with NAs for unspecified pairs.
Generates the dot code for the measurement model
dot_component_mm(model, theme)
dot_component_mm(model, theme)
model |
the model to use |
theme |
the theme to use |
With the help of the DiagrammeR
package this dot graph can then be plotted in
various in RMarkdown, shiny, and other contexts.
Depending on the type of model, different parameters can be used.
For a full description of parameters for lavaan models see semPaths method in the semPlot package.
dot_graph(model, title = "", theme = NULL, ...) ## S3 method for class 'cfa_model' dot_graph( model, title = "", theme = NULL, what = "std", whatLabels = "std", ... ) ## S3 method for class 'cbsem_model' dot_graph( model, title = "", theme = NULL, what = "std", whatLabels = "std", ... ) ## S3 method for class 'measurement_model' dot_graph(model, title = "", theme = NULL, ...) ## S3 method for class 'structural_model' dot_graph(model, title = "", theme = NULL, ...) ## S3 method for class 'specified_model' dot_graph( model, title = "", theme = NULL, measurement_only = FALSE, structure_only = FALSE, ... ) ## S3 method for class 'boot_seminr_model' dot_graph( model, title = "", theme = NULL, measurement_only = FALSE, structure_only = FALSE, ... ) ## S3 method for class 'pls_model' dot_graph( model, title = "", theme = NULL, measurement_only = FALSE, structure_only = FALSE, ... )
dot_graph(model, title = "", theme = NULL, ...) ## S3 method for class 'cfa_model' dot_graph( model, title = "", theme = NULL, what = "std", whatLabels = "std", ... ) ## S3 method for class 'cbsem_model' dot_graph( model, title = "", theme = NULL, what = "std", whatLabels = "std", ... ) ## S3 method for class 'measurement_model' dot_graph(model, title = "", theme = NULL, ...) ## S3 method for class 'structural_model' dot_graph(model, title = "", theme = NULL, ...) ## S3 method for class 'specified_model' dot_graph( model, title = "", theme = NULL, measurement_only = FALSE, structure_only = FALSE, ... ) ## S3 method for class 'boot_seminr_model' dot_graph( model, title = "", theme = NULL, measurement_only = FALSE, structure_only = FALSE, ... ) ## S3 method for class 'pls_model' dot_graph( model, title = "", theme = NULL, measurement_only = FALSE, structure_only = FALSE, ... )
model |
Model created with |
title |
An optional title for the plot |
theme |
Theme created with |
... |
Unused |
what |
The metric to use for edges ("path", "est", "std", "eq", "col") |
whatLabels |
The metric to use for edge labels |
measurement_only |
Plot only measurement part |
structure_only |
Plot only structure part |
Current limitations: - Only plots PLS Models - no higher order constructs
The path model as a formatted string in dot language.
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) # adapt nboot for better results mobi_boot <- bootstrap_model(mobi_pls, nboot = 20, cores = 1) # generate dot-Notation res <- dot_graph(mobi_pls, title = "PLS-Model plot") ## Not run: DiagrammeR::grViz(res) ## End(Not run) # generate dot-Notation res <- dot_graph(mobi_boot, title = "Bootstrapped PLS-Model plot") ## Not run: DiagrammeR::grViz(res) ## End(Not run) # - - - - - - - - - - - - - - - - # Example for plotting a measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) dot_graph(mobi_mm, title = "Preview measurement model") # - - - - - - - - - - - - - - - - # Example for plotting a structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) res <- dot_graph(mobi_sm, title = "Preview structural model") ## Not run: DiagrammeR::grViz(res) ## End(Not run)
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) # adapt nboot for better results mobi_boot <- bootstrap_model(mobi_pls, nboot = 20, cores = 1) # generate dot-Notation res <- dot_graph(mobi_pls, title = "PLS-Model plot") ## Not run: DiagrammeR::grViz(res) ## End(Not run) # generate dot-Notation res <- dot_graph(mobi_boot, title = "Bootstrapped PLS-Model plot") ## Not run: DiagrammeR::grViz(res) ## End(Not run) # - - - - - - - - - - - - - - - - # Example for plotting a measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) dot_graph(mobi_mm, title = "Preview measurement model") # - - - - - - - - - - - - - - - - # Example for plotting a structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) res <- dot_graph(mobi_sm, title = "Preview structural model") ## Not run: DiagrammeR::grViz(res) ## End(Not run)
Using a bootstrapped model this functions shows which constructs show insufficient discriminant validity.
dot_graph_htmt( model, title = "HTMT Plot", theme = seminr::seminr_theme_get(), htmt_threshold = 1, omit_threshold_edges = TRUE, use_ci = FALSE )
dot_graph_htmt( model, title = "HTMT Plot", theme = seminr::seminr_theme_get(), htmt_threshold = 1, omit_threshold_edges = TRUE, use_ci = FALSE )
model |
A bootsrapped PLS-Model |
title |
Optional title over the plot. |
theme |
Optional theme to use for plotting |
htmt_threshold |
The threshold to use under which constructs are highlighted (default = 1.0) |
omit_threshold_edges |
Whether or not to omit constructs that have low HTMT values (default = TRUE) |
use_ci |
Whether or not to rely on the upper threshold of the CI instead of the bootstrapped mean (default = FALSE) |
Returs a dot string of the plot
generates the dot code for a subgraph (per construct)
dot_subcomponent_mm(index, model, theme)
dot_subcomponent_mm(index, model, theme)
index |
the index of the construct |
model |
the model to use |
theme |
the theme to use |
The default template for labeling bootstrapped edges
edge_template_default()
edge_template_default()
The template string
A minimal template for labeling bootstrapped edges that only shows the bootstrapped mean value
edge_template_minimal()
edge_template_minimal()
The template string
Wrap a text in single quotes
esc_node(x)
esc_node(x)
x |
a character string |
The seminr
package provides a natural syntax for researchers to describe
structural equation models.
estimate_cbsem(data, measurement_model = NULL, structural_model = NULL, item_associations = NULL, model = NULL, lavaan_model = NULL, estimator = "MLR", ...)
estimate_cbsem(data, measurement_model = NULL, structural_model = NULL, item_associations = NULL, model = NULL, lavaan_model = NULL, estimator = "MLR", ...)
data |
A The entire CBSEM model can be specified in one of three ways: The pair of measurement and structural models, along associated items, can optionally be specified as separate model components |
measurement_model |
An optional |
structural_model |
An optional |
item_associations |
An item-to-item matrix representing error
covariances that are freed for estimation.
This matrix is created by The combination of measurement and structural models and inter-item associations can also be specified as a single |
model |
An optional The entire model can also be specified in Lavaan syntax (this overrides any other specifications) |
lavaan_model |
Optionally, a single character string containing the relevant model specification in Any further optional parameters to alter the estimation method: |
estimator |
A character string indicating which estimation method to use in Lavaan. It defaults to "MLR" for robust estimation. See the Lavaan documentation for other supported estimators. |
... |
Any other parameters to pass to |
A list of the estimated parameters for the CB-SEM model including:
data |
A matrix of the data upon which the model was estimated. |
measurement_model |
The SEMinR measurement model specification. |
factor_loadings |
The matrix of estimated factor loadings. |
associations |
A matrix of model variable associations. |
mmMatrix |
A Matrix of the measurement model relations. |
smMatrix |
A Matrix of the structural model relations. |
constructs |
A vector of the construct names. |
construct scores |
A matrix of the estimated construct scores for the CB-SEM model. |
item_weights |
A matrix of the estimated CFA item weights. |
lavaan_model |
The lavaan model syntax equivalent of the SEMinR model. |
lavaan_output |
The raw lavaan output generated after model estimation. |
Joreskog, K. G. (1973). A general method for estimating a linear structural equation system In: Goldberger AS, Duncan OD, editors. Structural Equation Models in the Social Sciences. New York: Seminar Press.
as.reflective
relationships
constructs
paths
associations
item_errors
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for freeing up item-item covariances mobi_am <- associations( item_errors(c("PERQ1", "PERQ2"), "IMAG1") ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = c("Image", "Quality"), to = c("Value", "Satisfaction")), paths(from = c("Value", "Satisfaction"), to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # Estimate model and get results mobi_cbsem <- estimate_cbsem(mobi, mobi_mm, mobi_sm, mobi_am) # Use or capture the summary object for more results and metrics summary(mobi_cbsem) cbsem_summary <- summary(mobi_cbsem) cbsem_summary$descriptives$correlations$constructs
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for freeing up item-item covariances mobi_am <- associations( item_errors(c("PERQ1", "PERQ2"), "IMAG1") ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = c("Image", "Quality"), to = c("Value", "Satisfaction")), paths(from = c("Value", "Satisfaction"), to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # Estimate model and get results mobi_cbsem <- estimate_cbsem(mobi, mobi_mm, mobi_sm, mobi_am) # Use or capture the summary object for more results and metrics summary(mobi_cbsem) cbsem_summary <- summary(mobi_cbsem) cbsem_summary$descriptives$correlations$constructs
Estimates a Confirmatory Factor Analysis (CFA) model
estimate_cfa(data, measurement_model = NULL, item_associations=NULL, model = NULL, lavaan_model = NULL, estimator="MLR", ...)
estimate_cfa(data, measurement_model = NULL, item_associations=NULL, model = NULL, lavaan_model = NULL, estimator="MLR", ...)
data |
A The entire CBSEM model can be specified in one of three ways: The pair of measurement and structural models, along associated items, can optionally be specified as separate model components |
measurement_model |
An optional |
item_associations |
An item-to-item matrix representing error
covariances that are freed for estimation.
This matrix is created by The combination of measurement and structural models and inter-item associations can also be specified as a single |
model |
An optional The entire model can also be specified in Lavaan syntax (this overrides any other specifications) |
lavaan_model |
Optionally, a single character string containing the relevant model specification in Any further optional parameters to alter the estimation method: |
estimator |
A character string indicating which estimation method to use in Lavaan. It defaults to "MLR" for robust estimation. See the Lavaan documentation for other supported estimators. |
... |
Any other parameters to pass to |
A list of the estimated parameters for the CFA model including:
data |
A matrix of the data upon which the model was estimated. |
measurement_model |
The SEMinR measurement model specification. |
construct scores |
A matrix of the estimated construct scores for the CB-SEM model. |
item_weights |
A matrix of the estimated CFA item weights. |
lavaan_model |
The lavaan model syntax equivalent of the SEMinR model. |
lavaan_output |
The raw lavaan output generated after model estimation. |
Jöreskog, K.G. (1969) A general approach to confirmatory maximum likelihood factor analysis. Psychometrika, 34, 183-202.
constructs
reflective
associations
item_errors
as.reflective
#' @examples mobi <- mobi
#seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)) )
#seminr syntax for freeing up item-item covariances mobi_am <- associations( item_errors(c("PERQ1", "PERQ2"), "CUEX3"), item_errors("IMAG1", "CUEX2") )
mobi_cfa <- estimate_cfa(mobi, mobi_mm, mobi_am)
Estimates factor scores using ten Berge method for a fitted Lavaan model
estimate_lavaan_ten_berge(fit)
estimate_lavaan_ten_berge(fit)
fit |
A fitted |
A list with two elements: ten berge scores; weights for calculating scores
#' #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for freeing up item-item covariances mobi_am <- associations( item_errors(c("PERQ1", "PERQ2"), "IMAG1") ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = c("Image", "Quality"), to = c("Value", "Satisfaction")), paths(from = c("Value", "Satisfaction"), to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # Estimate model and get results cbsem <- estimate_cbsem(mobi, mobi_mm, mobi_sm, mobi_am) tb <- estimate_lavaan_ten_berge(cbsem$lavaan_output) tb$scores tb$weights
#' #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for freeing up item-item covariances mobi_am <- associations( item_errors(c("PERQ1", "PERQ2"), "IMAG1") ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = c("Image", "Quality"), to = c("Value", "Satisfaction")), paths(from = c("Value", "Satisfaction"), to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # Estimate model and get results cbsem <- estimate_cbsem(mobi, mobi_mm, mobi_sm, mobi_am) tb <- estimate_lavaan_ten_berge(cbsem$lavaan_output) tb$scores tb$weights
Estimates a pair of measurement and structural models using PLS-SEM, with optional estimation methods
estimate_pls(data, measurement_model = NULL, structural_model = NULL, model = NULL, inner_weights = path_weighting, missing = mean_replacement, missing_value = NA, maxIt = 300, stopCriterion = 7)
estimate_pls(data, measurement_model = NULL, structural_model = NULL, model = NULL, inner_weights = path_weighting, missing = mean_replacement, missing_value = NA, maxIt = 300, stopCriterion = 7)
data |
A The pair of measurement and structural models can optionally be specified as separate model objects |
measurement_model |
An optional |
structural_model |
An optional The pair of measurement and structural models can also be specified as a single |
model |
An optional |
inner_weights |
Function that implements inner weighting scheme:
|
missing |
Function that replaces missing values.
|
missing_value |
Value in dataset that indicates missing values. NA is used by default. |
maxIt |
A parameter that specifies that maximum number of iterations when estimating the PLS model. Default value is 300. |
stopCriterion |
A parameter specifying the stop criterion for estimating the PLS model. Default value is 7. |
A list of the estimated parameters for the SEMinR model including:
meanData |
A vector of the indicator means. |
sdData |
A vector of the indicator standard deviations |
mmMatrix |
A Matrix of the measurement model relations. |
smMatrix |
A Matrix of the structural model relations. |
constructs |
A vector of the construct names. |
mmVariables |
A vector of the indicator names. |
outer_loadings |
The matrix of estimated indicator loadings. |
outer_weights |
The matrix of estimated indicator weights. |
path_coef |
The matrix of estimated structural model relationships. |
iterations |
A numeric indicating the number of iterations required before the algorithm converged. |
weightDiff |
A numeric indicating the minimum weight difference between iterations of the algorithm. |
construct_scores |
A matrix of the estimated construct scores for the PLS model. |
rSquared |
A matrix of the estimated R Squared for each construct. |
inner_weights |
The inner weight estimation function. |
data |
A matrix of the data upon which the model was estimated (INcluding interactions. |
rawdata |
A matrix of the data upon which the model was estimated (EXcluding interactions. |
measurement_model |
The SEMinR measurement model specification. |
specify_model
relationships
constructs
paths
interaction_term
bootstrap_model
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm, missing = mean_replacement, missing_value = NA) summary(mobi_pls) plot_scores(mobi_pls)
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm, missing = mean_replacement, missing_value = NA) summary(mobi_pls) plot_scores(mobi_pls)
Performs PLS-MGA to report significance of path differences between two subgroups of data
estimate_pls_mga(pls_model, condition, nboot = 2000, ...)
estimate_pls_mga(pls_model, condition, nboot = 2000, ...)
pls_model |
SEMinR PLS model estimated on the full sample |
condition |
logical vector of TRUE/FALSE indicating which rows of sample data are in group 1 |
nboot |
number of bootstrap resamples to use in PLS-MGA |
... |
any further parameters for bootstrapping (e.g., cores) |
Henseler, J., Ringle, C. M. & Sinkovics, R. R. New Challenges to International Marketing. Adv Int Marketing 277–319 (2009) doi:10.1108/s1474-7979(2009)0000020014
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Quality", multi_items("PERQ", 1:7)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), composite("Complaints", single_item("CUSCO")), composite("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm, missing = mean_replacement, missing_value = NA) # Should usually use nboot ~2000 and don't specify cores for full parallel processing mobi_mga <- estimate_pls_mga(mobi_pls, mobi$CUEX1 < 8, nboot=50, cores = 2)
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Quality", multi_items("PERQ", 1:7)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), composite("Complaints", single_item("CUSCO")), composite("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm, missing = mean_replacement, missing_value = NA) # Should usually use nboot ~2000 and don't specify cores for full parallel processing mobi_mga <- estimate_pls_mga(mobi_pls, mobi$CUEX1 < 8, nboot=50, cores = 2)
extract bootstrapped statistics from an edge using a row_index
extract_bootstrapped_values(ltbl, row_index, model, theme)
extract_bootstrapped_values(ltbl, row_index, model, theme)
ltbl |
a table of bootstrapped values (weights, loadings, path coefficients) |
row_index |
the index for the specific edge to extract |
model |
the model to use |
theme |
the theme to use |
Helper function that applies formatting to each construct
extract_htmt_nodes(model, theme)
extract_htmt_nodes(model, theme)
model |
the model to use |
theme |
the theme to use |
Returns a string of the structural model in dot notation.
extracts the constructs and their types from the model
extract_mm_coding(model)
extract_mm_coding(model)
model |
the model to use |
gets the mm_edge value (loading, weight) for bootstrapped and regular models
extract_mm_edge_value(model, theme, indicator, construct)
extract_mm_edge_value(model, theme, indicator, construct)
model |
the model to use |
theme |
the theme to use |
indicator |
the indicator to use |
construct |
the construct to use |
extract mm edges from model for a given index of all constructs
extract_mm_edges(index, model, theme, weights = 1000)
extract_mm_edges(index, model, theme, weights = 1000)
index |
the index of the construct |
model |
the model to use |
theme |
the theme to use |
weights |
a default weight for measurment models (high values suggested) |
gets the individual nodes and applies formatting
extract_mm_nodes(index, model, theme)
extract_mm_nodes(index, model, theme)
index |
the index of the construct |
model |
the model to use |
theme |
the theme to use |
Helper function that applies formatting to each construct
extract_sm_nodes(model, theme, structure_only = FALSE)
extract_sm_nodes(model, theme, structure_only = FALSE)
model |
the model to use |
theme |
the theme to use |
structure_only |
is this called in a structure_only model |
Returns a string of the structural model in dot notation.
Helps to render a node label for endogenous variables
format_endo_node_label(theme, name, rstring)
format_endo_node_label(theme, name, rstring)
theme |
the theme to use |
name |
the content of the name placeholder |
rstring |
the content of the rstring placeholder |
Returns the formatted string
Helps to render a node label for exogenous variables
format_exo_node_label(theme, name)
format_exo_node_label(theme, name)
theme |
the theme to use |
name |
the content of the name placeholder |
Returns the formatted string
The fSquared
function calculates f^2 effect size for a given IV and DV
fSquared(seminr_model, iv, dv)
fSquared(seminr_model, iv, dv)
seminr_model |
A |
iv |
An independent variable in the model. |
dv |
A dependent variable in the model. |
A matrix of the estimated F Square metric for each construct.
Cohen, J. (2013). Statistical power analysis for the behavioral sciences. Routledge.
mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) fSquared(mobi_pls, "Image", "Satisfaction")
mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) fSquared(mobi_pls, "Image", "Satisfaction")
Currently orients on reflective theme settings
get_construct_element_size(model, theme)
get_construct_element_size(model, theme)
model |
the model to use |
theme |
the theme to use |
Returns a two-element vector with c(width, height)
Returns the type of a construct from a model
get_construct_type(model, construct)
get_construct_type(model, construct)
model |
the model to get the type from |
construct |
the character string name of the construct |
Returns a character string
Currently orients on reflective theme settings
get_manifest_element_size(model, theme)
get_manifest_element_size(model, theme)
model |
the model to use |
theme |
the theme to use |
Returns a two-element vector with c(width, height)
individual styles for measurement model edges
get_mm_edge_style(theme, construct_type, flip = FALSE)
get_mm_edge_style(theme, construct_type, flip = FALSE)
theme |
the theme to use |
construct_type |
Forward direction? |
flip |
invert the arrow direction because of sink? |
Get a string to insert into a node specification using the themed shape
get_mm_node_shape(model, construct, theme)
get_mm_node_shape(model, construct, theme)
model |
the model to use |
construct |
the construct to use |
theme |
the theme to use |
Returns a string that determines the shape of a node
get global measurement model node style
get_mm_node_style(theme)
get_mm_node_style(theme)
theme |
the theme to use |
Get a string to insert into a node specification using the themed shape
get_sm_node_shape(model, construct, theme)
get_sm_node_shape(model, construct, theme)
model |
the model to use |
construct |
the construct to use |
theme |
the theme to use |
Returns a string that determines the shape of a node
Formats the style of the structural model edges
get_value_dependent_mm_edge_style(value, theme)
get_value_dependent_mm_edge_style(value, theme)
value |
value to compare for negativity |
theme |
the theme to use |
Returns the style for the edge (both style and color)
Formats the style of the structural model edges
get_value_dependent_sm_edge_style(value, theme)
get_value_dependent_sm_edge_style(value, theme)
value |
value to compare for negativity |
theme |
the theme to use |
Returns the style for the edge (both style and color)
higher_composite
creates a higher order construct from first-order constructs using the two-stage method (Becker et al., 2012).
higher_composite(construct_name, dimensions, method, weights)
higher_composite(construct_name, dimensions, method, weights)
construct_name |
of second-order construct |
dimensions |
the first-order constructs |
method |
is the estimation method, default is two_stage |
weights |
is the relationship between the second-order construct and first-order constructs. This can be
specified as |
This function conveniently maps first-order constructs onto second-order constructs using construct names.
A vector of the indicators for a higher-order-composite.
See constructs
, reflective
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5), weights = correlation_weights), composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), higher_composite("Quality", c("Image","Expectation"), method = two_stage), composite("Value", multi_items("PERV", 1:2), weights = mode_B) )
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5), weights = correlation_weights), composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), higher_composite("Quality", c("Image","Expectation"), method = two_stage), composite("Value", multi_items("PERV", 1:2), weights = mode_B) )
higher_reflective
creates a higher-order reflective construct
higher_reflective(construct_name, dimensions)
higher_reflective(construct_name, dimensions)
construct_name |
of second-order construct |
dimensions |
the first-order constructs |
This function maps first-order constructs onto second-order reflective constructs using construct names. It is currently only suitable for CB-SEM and not PLS
A vector of the indicators for a higher-order-factor.
See constructs
, reflective
mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), higher_reflective("Quality", c("Image", "Expectation")) )
mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), higher_reflective("Quality", c("Image", "Expectation")) )
The data set is used as measurement instrument for the Influencer Model which is used in Partial Least Squares Structural Equation Modeling (PLS-SEM) Using R - A Workbook (2021) Hair, J.F. (Jr), Hult, T.M., Ringle, C.M., Sarstedt, M., Danks, N.P., and Ray, S.
influencer_data
influencer_data
A data frame with 250 rows and 24 variables:
The influencer reflects who I am.
I can identify with the influencer.
I feel a personal connection to the influencer.
I (can) use the influencer to communicate who I am to other people.
I think the influencer (could) help(s) me become the type of person I want to be.
I consider the influencer to be "me".
The influencer suits me well.
My personality and the personality of the influencer relate accordingly to one another.
The product has excellent quality.
The product looks to be reliable and durable.
The product will have fewer problems.
The product has excellent quality features.
I dislike the product (reverse coded).
The product is appealing to me.
The presented product raises a positive feeling in me.
The product is interesting to me.
It is very likely that I will purchase this product.
I will purchase this product the next time I need it.
I would definitely try the product out.
I would recommend this product to my friends.
I am willing to purchase this product.
The influencer is qualified.
The influencer is competent.
The influencer is an expert.
The influencer is experienced.
The influencer is knowledgeable.
Please state your willingness to pay (in Euro) for the presented product.
A binary variable indicating which group the influencer belongs to.
The data frame influencer_data contains the observed data for the model specified in the Influencer Model.
data("influencer_data")
data("influencer_data")
interaction_term
creates interaction measurement items by applying
product indicator, two stage, or orthogonal approaches to creating new
interaction constructs.
interaction_term(iv, moderator, method, weights)
interaction_term(iv, moderator, method, weights)
iv |
The independent variable that is subject to moderation. |
moderator |
The moderator variable. |
method |
The method to generate the estimated interaction term with a default of 'two_stage'. |
weights |
The weighting mode for interaction items in a PLS model (only) with default of 'modeA'. |
This function automatically generates interaction measurement items for a PLS or a CBSEM model.
An un-evaluated function (promise) for generating a vector of interaction terms.
Interaction Combinations as generated by the interaction
or
interaction_term
methods.
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = "Expectation", method = orthogonal), interaction_term(iv = "Image", moderator = "Value", method = product_indicator) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation", "Image*Value")) ) mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm) summary(mobi_pls)
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = "Expectation", method = orthogonal), interaction_term(iv = "Image", moderator = "Value", method = product_indicator) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation", "Image*Value")) ) mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm) summary(mobi_pls)
Tests whether the i_th construct is endogenous or not
is_sink(model, index)
is_sink(model, index)
model |
the model object |
index |
the index of the construct to test |
whether the construct is endogenous or not
associations
.Specifies pair of items, or sets of items, that should covary. Used to
specify error covariances for associations
.
item_errors(items_a, items_b)
item_errors(items_a, items_b)
items_a |
One or more items that should covary |
items_b |
One or more items that should covary |
A vector of items that covary.
item_errors(c("a1", "a2"), c("b1", "b2"))
item_errors(c("a1", "a2"), c("b1", "b2"))
The seminr
package provides a natural syntax for researchers to describe PLS
structural equation models.
mean_replacement(data)
mean_replacement(data)
data |
A dataset to be used for estimating a SEMinR model |
mean_replacement
provides the verb for replacing all omitted values (NA only) in the dataset with
the mean of the variable.
A dataset with all missing values replaced with column means
Hair, J. F., Hult, G. T. M., Ringle, C. M., and Sarstedt, M. (2017). A Primer on Partial Least Squares Structural Equation Modeling (PLS-SEM), 2nd Ed., Sage: Thousand Oaks.
The data set is used as measurement instrument for the european customer satisfaction index (ECSI) adapted to the mobile phone market, see Tenenhaus et al. (2005).
mobi
mobi
A data frame with 250 rows and 24 variables:
Expectations for the overall quality of "your mobile phone provider" at the moment you became customer of this provider
Expectations for "your mobile phone provider" to provide products and services to meet your personal need
How often did you expect that things could go wrong at "your mobile phone provider
Overall satisfaction
Fulfillment of expectations
How well do you think "your mobile phone provider" compares with your ideal mobile phone provider?
You complained about "your mobile phone provider" last year. How well, or poorly, was your most recent complaint handled or You did not complain about "your mobile phone provider" last year. Imagine you have to complain to "your mobile phone rovider" because of a bad quality of service or product. To what extent do you think that "your mobile phone provider" will care about your complaint?
If you would need to choose a new mobile phone provider how likely is it that you would choose "your provider" again?
Let us now suppose that other mobile phone providers decide to lower their fees and prices, but "your mobile phone provider" stays at the same level as today. At which level of difference (in percentage) would you choose another mobile phone provider?
If a friend or colleague asks you for advice, how likely is it that you would recommend "your mobile phone provider"?
It can be trusted what it says and does
It is stable and firmly established
It has a social contribution to society
It is concerned with customers
It is innovative and forward looking
Overall perceived quality
Technical quality of the network
Customer service and personal advice offered
Quality of the services you use
Range of services and products offered
Reliability and accuracy of the products and services provided
Clarity and transparency of information provided
Given the quality of the products and services offered by "your mobile phone provider" how would you rate the fees and prices that you pay for them?
Given the fees and prices that you pay for "your mobile phone provider" how would you rate the quality of the products and services offered by "your mobile phone provider"?
The data frame mobi contains the observed data for the model specified by ECSImobi.
Tenenhaus, M., V. E. Vinzi, Y.-M. Chatelin, and C. Lauro (2005) PLS path modeling. Computational Statistics & Data Analysis 48, 159-205.
data("mobi")
data("mobi")
mode_A
, correlation_weights
and mode_B
, regression_weights
specify the outer weighting
scheme to be used in the estimation of the construct weights and score.
mode_A(mmMatrix, i, normData, construct_scores)
mode_A(mmMatrix, i, normData, construct_scores)
mmMatrix |
is the |
i |
is the name of the construct to be estimated. |
normData |
is the dataframe of the normalized item data. |
construct_scores |
is the matrix of construct scores generated by |
A matrix of estimated measurement model relations.
mode_A
, correlation_weights
and mode_B
, regression_weights
specify the outer weighting
scheme to be used in the estimation of the construct weights and score.
mode_B(mmMatrix, i, normData, construct_scores)
mode_B(mmMatrix, i, normData, construct_scores)
mmMatrix |
is the |
i |
is the name of the construct to be estimated. |
normData |
is the dataframe of the normalized item data. |
construct_scores |
is the matrix of construct scores generated by |
A matrix of estimated measurement model relations.
multi_items
creates a vector of measurment names given the item prefix and number range.
multi_items(item_name, item_numbers, ...)
multi_items(item_name, item_numbers, ...)
item_name |
Prefix name of items |
item_numbers |
The range of number suffixews for the items |
... |
Additional Item names and nubers |
A vector of numbered indicators.
See single_item
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5), weights = correlation_weights), composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), composite("Quality", multi_items("PERQ", 1:7), weights = regression_weights), composite("Value", multi_items("PERV", 1:2), weights = mode_B) )
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5), weights = correlation_weights), composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), composite("Quality", multi_items("PERQ", 1:7), weights = regression_weights), composite("Value", multi_items("PERV", 1:2), weights = mode_B) )
The default template for labeling endogenous construct nodes
node_endo_template_default()
node_endo_template_default()
The template string
The default template for labeling exogenous construct nodes
node_exo_template_default()
node_exo_template_default()
The template string
orthogonal
creates interaction measurement items by using the
orthogonalized approach whereinThis function automatically generates interaction measurement items for a PLS SEM using the orthogonalized approach..
# orthogonalization approach as per Henseler & Chin (2010): orthogonal(iv, moderator, weights)
# orthogonalization approach as per Henseler & Chin (2010): orthogonal(iv, moderator, weights)
iv |
The independent variable that is subject to moderation. |
moderator |
The moderator variable. |
weights |
is the relationship between the items and the interaction terms. This can be
specified as |
An un-evaluated function (promise) for estimating an orthogonal interaction effect.
Henseler & Chin (2010), A comparison of approaches for the analysis of interaction effects between latent variables using partial least squares path modeling. Structural Equation Modeling, 17(1),82-109.
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = "Expectation", method = orthogonal), interaction_term(iv = "Image", moderator = "Value", method = orthogonal) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation", "Image*Value")) ) mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm) summary(mobi_pls)
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = "Expectation", method = orthogonal), interaction_term(iv = "Image", moderator = "Value", method = orthogonal) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation", "Image*Value")) ) mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm) summary(mobi_pls)
path_factorial
and path_weighting
specify the inner weighting scheme to be used in the estimation of the
inner paths matrix
path_factorial(smMatrix,construct_scores, dependant, paths_matrix)
path_factorial(smMatrix,construct_scores, dependant, paths_matrix)
smMatrix |
is the |
construct_scores |
is the matrix of construct scores generated by |
dependant |
is the vector of dependant constructs in the model. |
paths_matrix |
is the matrix of estimated path coefficients estimated by |
A matrix of estimated structural relations.
Lohmoller, J.-B. (1989). Latent variables path modeling with partial least squares. Heidelberg, Germany: Physica Verlag.
path_factorial
and path_weighting
specify the inner weighting scheme to be used in the estimation of the
inner paths matrix
path_weighting(smMatrix,construct_scores, dependant, paths_matrix)
path_weighting(smMatrix,construct_scores, dependant, paths_matrix)
smMatrix |
is the |
construct_scores |
is the matrix of construct scores generated by |
dependant |
is the vector of dependant constructs in the model. |
paths_matrix |
is the matrix of estimated path coefficients estimated by |
A matrix of estimated structural relations.
Lohmoller, J.B. (1989). Latent variables path modeling with partial least squares. Heidelberg, Germany: Physica-Verlag.
Using a bootstrapped model this functions shows which constructs show insufficient discriminant validity.
plot_htmt( model, title = "HTMT Plot", theme = seminr::seminr_theme_get(), htmt_threshold = 1, omit_threshold_edges = TRUE, use_ci = FALSE )
plot_htmt( model, title = "HTMT Plot", theme = seminr::seminr_theme_get(), htmt_threshold = 1, omit_threshold_edges = TRUE, use_ci = FALSE )
model |
A bootsrapped PLS-Model |
title |
Optional title over the plot. |
theme |
Optional theme to use for plotting |
htmt_threshold |
The threshold to use under which constructs are highlighted (default = 1.0) |
omit_threshold_edges |
Whether or not to omit constructs that have low HTMT values (default = TRUE) |
use_ci |
Whether or not to rely on the upper threshold of the CI instead of the bootstrapped mean (default = FALSE) |
Returs a dot string of the plot
plot_interaction
generates an interaction plot for the effect of an antecedent
on an outcome given a mediator variable.
plot_interaction(moderated_model, intxn, dv, legend)
plot_interaction(moderated_model, intxn, dv, legend)
moderated_model |
SEMinR model that contains an interaction. |
intxn |
Name (character) of the interaction term in the structural model. Must look like a product of independent variabel and moderator (e.g., "ABC*XYZ") |
dv |
Name (character) of the dependant consutruct affected by the moderator. |
legend |
Location (character) of the legend on the plot; must be a combination of bottom|top and left|right (e.g., "bottomright"). |
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = c("Expectation"), method = orthogonal)) # Structural model # note: interactions should be the names of its main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation"))) # Load data, assemble model, and estimate mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) plot_interaction(mobi_pls, "Image*Expectation", "Satisfaction", "bottomright")
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = c("Expectation"), method = orthogonal)) # Structural model # note: interactions should be the names of its main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation"))) # Load data, assemble model, and estimate mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) plot_interaction(mobi_pls, "Image*Expectation", "Satisfaction", "bottomright")
plot.reliability_table
generates an easy to read visualization of the rhoA, Cronbachs
alpha, and Composite Reliability for all constructs. The plot visualizes the metrics
in such a way as to draw meaning from not only the absolute values, but their relative
values too.
## S3 method for class 'reliability_table' plot(x, ...)
## S3 method for class 'reliability_table' plot(x, ...)
x |
A |
... |
All other arguments inherited from |
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value")) ) mobi_pls <- estimate_pls(mobi, measurement_model = mobi_mm, structural_model = mobi_sm) plot(summary(mobi_pls)$reliability)
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value")) ) mobi_pls <- estimate_pls(mobi, measurement_model = mobi_mm, structural_model = mobi_sm) plot(summary(mobi_pls)$reliability)
With the help of the DiagrammeR
package this dot graph can then be plotted in
various in RMarkdown, shiny, and other contexts.
Depending on the type of model, different parameters can be used.
Please check the dot_graph
function for additional parameters.
## S3 method for class 'seminr_model' plot(x, title = "", theme = NULL, ...)
## S3 method for class 'seminr_model' plot(x, title = "", theme = NULL, ...)
x |
The model description |
title |
An optional title for the plot |
theme |
Theme created with |
... |
Please check the |
Returns the plot.
The PLSc
function calculates the consistent PLS path coefficients and loadings for
a common-factor model. It returns a seminr_model
containing the adjusted and consistent
path coefficients and loadings for common-factor models and composite models.
PLSc(seminr_model)
PLSc(seminr_model)
seminr_model |
A |
A SEMinR model object which has been adjusted according to PLSc.
Dijkstra, T. K., & Henseler, J. (2015). Consistent Partial Least Squares Path Modeling, 39(X).
relationships
constructs
paths
interaction_term
bootstrap_model
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) seminr_model <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) PLSc(seminr_model)
mobi <- mobi #seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) seminr_model <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) PLSc(seminr_model)
predict_EA
and predict_DA
specify the predictive scheme to be used in the generation of the
predictions. EA refers to Earliest Antecedents nad DA to Direct Antecedents.
predict_DA(smMatrix, path_coef, construct_scores)
predict_DA(smMatrix, path_coef, construct_scores)
smMatrix |
is the |
path_coef |
is the Path Coefficients matrix from a SEMinR model. |
construct_scores |
is the matrix of construct scores generated by SEMinR. |
predict_EA
and predict_DA
specify the predictive scheme to be used in the generation of the
predictions. EA refers to Earliest Antecedents nad DA to Direct Antecedents.
predict_EA(smMatrix, path_coef, construct_scores)
predict_EA(smMatrix, path_coef, construct_scores)
smMatrix |
is the |
path_coef |
is the Path Coefficients matrix from a SEMinR model. |
construct_scores |
is the matrix of construct scores generated by SEMinR. |
predict_pls
uses cross-validation to generate in-sample and out-sample predictions for PLS models generated by SEMinR.
predict_pls(model, technique, noFolds, reps, cores)
predict_pls(model, technique, noFolds, reps, cores)
model |
A SEMinR model that has been estimated on the FULL dataset. |
technique |
The predictive technique to be employed, Earliest Antecedents (EA) |
noFolds |
The required number of folds to use in k-fold cross validation. If NULL, then parallel LOOCV will be executed. Default is NULL. |
reps |
The number of times the cross-validation will be repeated. Default is NULL. |
cores |
The number of cores to use for parallel LOOCV processing. If k-fold is used, the process will not be parallelized. |
This function generates cross-validated in-sample and out-sample predictions for PLS models generated by SEMinR. The cross validation technique can be k-fold if a number of folds are specified, or leave-one-out-cross-validation (LOOCV) if no folds arew specified. LOOCV is recommended for small datasets.
A list of the estimated PLS and LM prediction results:
PLS_out_of_sample |
A matrix of the out-of-sample indicator predictions generated by the SEMinR model. |
PLS_in_sample |
A matrix of the in-sample indicator predictions generated by the SEMinR model. |
lm_out_of_sample |
A matrix of the out-of-sample indicator predictions generated by a linear regression model. |
lm_in_sample |
A matrix of the in-sample indicator predictions generated by a linear regression model. |
item_actuals |
A matrix of the actual indicator scores. |
PLS_out_of_sample_residuals |
A matrix of the out-of-sample indicator PLS prediction residuals. |
PLS_in_sample_residuals |
A matrix of the in-sample indicator PLS prediction residuals. |
lm_out_of_sample_residuals |
A matrix of the out-of-sample LM indicator prediction residuals. |
lm_in_sample_residuals |
A matrix of the in-sample LM indicator prediction residuals. |
mmMatrix |
A Matrix of the measurement model relations. |
smMatrix |
A Matrix of the structural model relations. |
constructs |
A vector of the construct names. |
mmVariables |
A vector of the indicator names. |
outer_loadings |
The matrix of estimated indicator loadings. |
outer_weights |
The matrix of estimated indicator weights. |
path_coef |
The matrix of estimated structural model relationships. |
iterations |
A numeric indicating the number of iterations required before the algorithm converged. |
weightDiff |
A numeric indicating the minimum weight difference between iterations of the algorithm. |
construct_scores |
A matrix of the estimated construct scores for the PLS model. |
rSquared |
A matrix of the estimated R Squared for each construct. |
inner_weights |
The inner weight estimation function. |
data |
A matrix of the data upon which the model was estimated (INcluding interactions. |
rawdata |
A matrix of the data upon which the model was estimated (EXcluding interactions. |
measurement_model |
The SEMinR measurement model specification. |
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)) ) mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value")) ) mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm) cross_validated_predictions <- predict_pls(model = mobi_pls, technique = predict_DA, noFolds = 10, cores = NULL)
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)) ) mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value")) ) mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm) cross_validated_predictions <- predict_pls(model = mobi_pls, technique = predict_DA, noFolds = 10, cores = NULL)
Summary function for PLS-MGA
## S3 method for class 'seminr_pls_mga' print(x, digits = 3, ...)
## S3 method for class 'seminr_pls_mga' print(x, digits = 3, ...)
x |
estimated seminr_pls_mga object |
digits |
number of digits to print |
... |
any further parameters for printing |
product_indicator
creates interaction measurement items by scaled product indicator approach.This function automatically generates interaction measurement items for a PLS SEM using scaled product indicator approach.
# standardized product indicator approach as per Henseler & Chin (2010): product_indicator(iv, moderator, weights)
# standardized product indicator approach as per Henseler & Chin (2010): product_indicator(iv, moderator, weights)
iv |
The independent variable that is subject to moderation. |
moderator |
The moderator variable. |
weights |
is the relationship between the items and the interaction terms. This can be
specified as |
An un-evaluated function (promise) for estimating a product-indicator interaction effect.
Henseler & Chin (2010), A comparison of approaches for the analysis of interaction effects between latent variables using partial least squares path modeling. Structural Equation Modeling, 17(1),82-109.
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5),weights = mode_A), composite("Expectation", multi_items("CUEX", 1:3),weights = mode_A), composite("Value", multi_items("PERV", 1:2),weights = mode_A), composite("Satisfaction", multi_items("CUSA", 1:3),weights = mode_A), interaction_term(iv = "Image", moderator = "Expectation", method = product_indicator, weights = mode_A), interaction_term(iv = "Image", moderator = "Value", method = product_indicator, weights = mode_A) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation", "Image*Value")) ) # Load data, assemble model, and estimate using semPLS mobi <- mobi seminr_model <- estimate_pls(mobi, mobi_mm, mobi_sm, inner_weights = path_factorial)
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5),weights = mode_A), composite("Expectation", multi_items("CUEX", 1:3),weights = mode_A), composite("Value", multi_items("PERV", 1:2),weights = mode_A), composite("Satisfaction", multi_items("CUSA", 1:3),weights = mode_A), interaction_term(iv = "Image", moderator = "Expectation", method = product_indicator, weights = mode_A), interaction_term(iv = "Image", moderator = "Value", method = product_indicator, weights = mode_A) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation", "Image*Value")) ) # Load data, assemble model, and estimate using semPLS mobi <- mobi seminr_model <- estimate_pls(mobi, mobi_mm, mobi_sm, inner_weights = path_factorial)
reflective
creates the reflective measurement model matrix for a specific common-factor,
specifying the relevant items of the construct and assigning the relationship of reflective.
By definition this construct will be estimated by PLS consistent.
reflective(construct_name, item_names)
reflective(construct_name, item_names)
construct_name |
of construct |
item_names |
returned by the |
This function conveniently maps reflectively defined measurement items to a construct and is estimated using PLS consistent.
A vector of the indicators for a reflective construct.
See composite
, constructs
mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) )
mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) )
paths
creates the structural paths of a PLS SEM model and relationships
generates
the matrix of paths.
relationships(...) paths(from,to)
relationships(...) paths(from,to)
... |
A comma separated list of all the structural relationships in the the model. These paths take the form (from = c(construct_name), to = c(construct_name)). |
to |
The destination construct of a structural path |
from |
The source construct of a structural path |
paths |
The function |
A vector of construct names and structural relationships.
mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") )
mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") )
report_paths
generates an easy to read table reporting path coefficients
and R2 values for endogenous constructs.plot_scores
generates a
scatterplot matrix of each construct's scores against every other construct's scores.
report_paths(seminr_model, digits=3) plot_scores(seminr_model, constructs=NULL)
report_paths(seminr_model, digits=3) plot_scores(seminr_model, constructs=NULL)
seminr_model |
The PLS model estimated by |
digits |
A |
constructs |
a |
These functions generate an easy to read table reporting path coefficients and R2 values for endogenous constructs or a scatterplot matrix of construct scores.
A matrix of structural paths.
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value")) ) mobi_pls <- estimate_pls(mobi, measurement_model = mobi_mm, structural_model = mobi_sm) report_paths(mobi_pls) plot_scores(mobi_pls)
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value")) ) mobi_pls <- estimate_pls(mobi, measurement_model = mobi_mm, structural_model = mobi_sm) report_paths(mobi_pls) plot_scores(mobi_pls)
Reruns a previously specified seminr model/analysis
rerun(x, ...)
rerun(x, ...)
x |
An estimated seminr_model object - refer to specific rerun methods |
... |
Any parameters to change during the rerun. |
A re-estimated model of the same class
Reruns a previously specified seminr PLS model
## S3 method for class 'pls_model' rerun(x, ...)
## S3 method for class 'pls_model' rerun(x, ...)
x |
An estimated pls_model object produced by |
... |
Any parameters to change during the re-estimation (e.g., data, measurement_model, etc.) |
A re-estimated pls_model object
mobi <- mobi mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Loyalty", multi_items("CUSL", 1:3)) ) mobi_sm <- relationships( paths(from = "Image", to = c("Loyalty")) ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm, missing = mean_replacement, missing_value = NA) # Re-estimate model faithfully mobi_pls2 <- rerun(mobi_pls) # Re-estimated model with altered measurement model mobi_pls3 <- rerun(mobi_pls, measurement_model=as.reflective(mobi_mm))
mobi <- mobi mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Loyalty", multi_items("CUSL", 1:3)) ) mobi_sm <- relationships( paths(from = "Image", to = c("Loyalty")) ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm, missing = mean_replacement, missing_value = NA) # Re-estimate model faithfully mobi_pls2 <- rerun(mobi_pls) # Re-estimated model with altered measurement model mobi_pls3 <- rerun(mobi_pls, measurement_model=as.reflective(mobi_mm))
The rho_A
function calculates the rho_A reliability indices for each construct. For
formative constructs, the index is set to 1.
rho_A(seminr_model, constructs)
rho_A(seminr_model, constructs)
seminr_model |
A |
constructs |
A vector containing the names of the constructs to calculate rhoA for. |
A matrix containing the rhoA metric for each construct.
Dijkstra, T. K., & Henseler, J. (2015). Consistent partial least squares path modeling. MIS quarterly, 39(2).
relationships
constructs
paths
interaction_term
bootstrap_model
#seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) rho_A(mobi_pls, mobi_pls$constructs)
#seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) rho_A(mobi_pls, mobi_pls$constructs)
Saves a SEMinR model plot to a graphical file. Default output is RPlots.pdf.
save_plot( filename = "RPlot.pdf", plot = last_seminr_plot(), width = NULL, height = NULL )
save_plot( filename = "RPlot.pdf", plot = last_seminr_plot(), width = NULL, height = NULL )
filename |
The name of the file output (can be png, pdf, webp, ps, or svg.) |
plot |
A plot that is created from the |
width |
An optional parameter for width in pixels. |
height |
An optional parameter for height in pixels. |
Does not return a value
mobi <- mobi # seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) # seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # estimate the model mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) ## Not run: # generate the plot plot(mobi_pls) # save to file save_plot("myplot.pdf") ## End(Not run)
mobi <- mobi # seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) # seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # estimate the model mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) ## Not run: # generate the plot plot(mobi_pls) # save to file save_plot("myplot.pdf") ## End(Not run)
All customizable options are parameters of this function. See the details all the way down for more information.
seminr_theme_create( plot.title.fontsize = 24, plot.title.fontcolor = "black", plot.fontname = "helvetica", plot.splines = TRUE, plot.rounding = 3, plot.adj = FALSE, plot.specialcharacters = TRUE, plot.randomizedweights = FALSE, plot.bgcolor = "transparent", mm.node.color = "dimgrey", mm.node.fill = "white", mm.node.label.fontsize = 8, mm.node.label.fontcolor = "black", mm.edge.positive.color = "dimgrey", mm.edge.negative.color = "dimgrey", mm.edge.positive.style = "solid", mm.edge.negative.style = "dashed", mm.edge.label.fontsize = 7, mm.edge.label.fontcolor = "black", mm.edge.label.show = TRUE, mm.edge.minlen = 1, mm.edge.width_multiplier = 3, mm.edge.width_offset = 0.5, mm.edge.use_outer_weights = TRUE, mm.edge.boot.show_t_value = FALSE, mm.edge.boot.show_p_value = FALSE, mm.edge.boot.show_p_stars = TRUE, mm.edge.boot.show_ci = FALSE, mm.edge.boot.template = edge_template_minimal(), sm.node.color = "black", sm.node.fill = "white", sm.node.label.fontsize = 12, sm.node.label.fontcolor = "black", sm.node.endo.template = node_endo_template_default(), sm.node.exo.template = node_exo_template_default(), sm.edge.boot.show_t_value = FALSE, sm.edge.boot.show_p_value = FALSE, sm.edge.boot.show_p_stars = TRUE, sm.edge.boot.show_ci = TRUE, sm.edge.boot.template = edge_template_default(), sm.edge.positive.color = "black", sm.edge.negative.color = "black", sm.edge.positive.style = "solid", sm.edge.negative.style = "dashed", sm.edge.label.fontsize = 9, sm.edge.label.fontcolor = "black", sm.edge.label.show = TRUE, sm.edge.label.all_betas = TRUE, sm.edge.minlen = NA_integer_, sm.edge.width_offset = 0.5, sm.edge.width_multiplier = 5, construct.reflective.shape = "ellipse", construct.reflective.arrow = "backward", construct.reflective.use_weights = FALSE, construct.compositeA.shape = "hexagon", construct.compositeA.arrow = "backward", construct.compositeA.use_weights = FALSE, construct.compositeB.shape = "hexagon", construct.compositeB.arrow = "forward", construct.compositeB.use_weights = TRUE, manifest.reflective.shape = "box", manifest.compositeA.shape = "box", manifest.compositeB.shape = "box", ... )
seminr_theme_create( plot.title.fontsize = 24, plot.title.fontcolor = "black", plot.fontname = "helvetica", plot.splines = TRUE, plot.rounding = 3, plot.adj = FALSE, plot.specialcharacters = TRUE, plot.randomizedweights = FALSE, plot.bgcolor = "transparent", mm.node.color = "dimgrey", mm.node.fill = "white", mm.node.label.fontsize = 8, mm.node.label.fontcolor = "black", mm.edge.positive.color = "dimgrey", mm.edge.negative.color = "dimgrey", mm.edge.positive.style = "solid", mm.edge.negative.style = "dashed", mm.edge.label.fontsize = 7, mm.edge.label.fontcolor = "black", mm.edge.label.show = TRUE, mm.edge.minlen = 1, mm.edge.width_multiplier = 3, mm.edge.width_offset = 0.5, mm.edge.use_outer_weights = TRUE, mm.edge.boot.show_t_value = FALSE, mm.edge.boot.show_p_value = FALSE, mm.edge.boot.show_p_stars = TRUE, mm.edge.boot.show_ci = FALSE, mm.edge.boot.template = edge_template_minimal(), sm.node.color = "black", sm.node.fill = "white", sm.node.label.fontsize = 12, sm.node.label.fontcolor = "black", sm.node.endo.template = node_endo_template_default(), sm.node.exo.template = node_exo_template_default(), sm.edge.boot.show_t_value = FALSE, sm.edge.boot.show_p_value = FALSE, sm.edge.boot.show_p_stars = TRUE, sm.edge.boot.show_ci = TRUE, sm.edge.boot.template = edge_template_default(), sm.edge.positive.color = "black", sm.edge.negative.color = "black", sm.edge.positive.style = "solid", sm.edge.negative.style = "dashed", sm.edge.label.fontsize = 9, sm.edge.label.fontcolor = "black", sm.edge.label.show = TRUE, sm.edge.label.all_betas = TRUE, sm.edge.minlen = NA_integer_, sm.edge.width_offset = 0.5, sm.edge.width_multiplier = 5, construct.reflective.shape = "ellipse", construct.reflective.arrow = "backward", construct.reflective.use_weights = FALSE, construct.compositeA.shape = "hexagon", construct.compositeA.arrow = "backward", construct.compositeA.use_weights = FALSE, construct.compositeB.shape = "hexagon", construct.compositeB.arrow = "forward", construct.compositeB.use_weights = TRUE, manifest.reflective.shape = "box", manifest.compositeA.shape = "box", manifest.compositeB.shape = "box", ... )
plot.title.fontsize |
Font size of the title. |
plot.title.fontcolor |
Fontcolor of the title of the plot. |
plot.fontname |
Font to be used throughout the plot. |
plot.splines |
Whether or not to use splines as edges (default = TRUE). |
plot.rounding |
The amount of decimals to keep for rounding (default = 3). |
plot.adj |
TRUE or FALSE (default). Whether or not to use adjusted r^2 in constructs. |
plot.specialcharacters |
Whether or not to use greek UTF-8 symbols in plots. |
plot.randomizedweights |
TRUE or FALSE (default), decides whether to add. minimal random weights to the measurement model. Can help with determinism in plot outcomes. |
plot.bgcolor |
The background color of the plot (default = "transparent"). |
mm.node.color |
Color of the measurement model nodes. |
mm.node.fill |
Fill of the measurement model nodes. |
mm.node.label.fontsize |
Font size of the measurement model node labels. |
mm.node.label.fontcolor |
Color of the measurement model node labels. |
mm.edge.positive.color |
Color of the measurement model edges, when values are positive. |
mm.edge.negative.color |
Color of the measurement model edges, when values are negative. |
mm.edge.positive.style |
Style of the measurement model edges, when values are positive. |
mm.edge.negative.style |
Style of the measurement model edges, when values are negative. |
mm.edge.label.fontsize |
Font size of the measurement model edge labels. |
mm.edge.label.fontcolor |
Font color of the measurement model edge labels. |
mm.edge.label.show |
Whether or not to show measurement model edge labels. |
mm.edge.minlen |
Minimum length of the measurement model edges. |
mm.edge.width_multiplier |
The multiplier for measurement model edge penwidth (default = 3). |
mm.edge.width_offset |
The minimal width of an edge of the measurement model (default = 0.5). |
mm.edge.use_outer_weights |
Whether or not to use outer weights as edge labels in the measurement model. |
mm.edge.boot.show_t_value |
Should boot-strapped loadings/weights show a t-value |
mm.edge.boot.show_p_value |
Should boot-strapped loadings/weights show a p-value |
mm.edge.boot.show_p_stars |
Should boot-strapped loadings/weights show significance stars |
mm.edge.boot.show_ci |
Should boot-strapped loadings/weights show a 95 percent confidence interval |
mm.edge.boot.template |
A template string for HTML formatting of edges for loadings/weights |
sm.node.color |
Color of the structural model nodes. |
sm.node.fill |
Fill of the structural model nodes. |
sm.node.label.fontsize |
Font size of the structural model node labels. |
sm.node.label.fontcolor |
Font color of the structural model node labels. |
sm.node.endo.template |
A template string for the nodes of endogenous constructs |
sm.node.exo.template |
A template string for the nodes of exogenous constructs |
sm.edge.boot.show_t_value |
Should boot-strapped path coefficients show a t-value |
sm.edge.boot.show_p_value |
Should boot-strapped path coefficients show a p-value |
sm.edge.boot.show_p_stars |
Should boot-strapped path coefficients show significance stars |
sm.edge.boot.show_ci |
Should boot-strapped path coefficients show a 95 percent confidence interval |
sm.edge.boot.template |
A template string for HTML formatting of edges |
sm.edge.positive.color |
Color of the structural model edges, when values are positive. |
sm.edge.negative.color |
Color of the structural model edges, when values are negative. |
sm.edge.positive.style |
Style of the structural model edges, when values are positive. |
sm.edge.negative.style |
Style of the structural model edges, when values are negative. |
sm.edge.label.fontsize |
Font size of the structural model edge labels. |
sm.edge.label.fontcolor |
Font color of the structural model edge labels. |
sm.edge.label.show |
Whether or not to show edge labels on structural model edges. |
sm.edge.label.all_betas |
Whether to label both endogenous and exogenous paths with a beta (default = TRUE). |
sm.edge.minlen |
Minimum length of the structural model edges. |
sm.edge.width_offset |
The minimal width of an edge of the structural model (default = 0.5). |
sm.edge.width_multiplier |
The multiplier for structural model edges (default = 5). |
construct.reflective.shape |
Dot shape of reflective constructs |
construct.reflective.arrow |
Direction of the arrow for reflective constructs. Can be forward, backward (default), or none. |
construct.reflective.use_weights |
Should measurements from reflective constructs show weights (TRUE) or loadings (FALSE: default). |
construct.compositeA.shape |
Dot shape of composite constructs using correlation weights |
construct.compositeA.arrow |
Direction of the arrow for constructs using correlation weight (default: backward) |
construct.compositeA.use_weights |
Should measurements from constructs using correlation weights show weights (TRUE) or loadings (FALSE: default). |
construct.compositeB.shape |
Dot shape of composite constructs using regression weights |
construct.compositeB.arrow |
Direction of the arrow for constructs using regression weights (default: forward) |
construct.compositeB.use_weights |
Should measurements from constructs using regression weights show weights (TRUE: default) or loadings (FALSE). |
manifest.reflective.shape |
Dot shape of manifest variables of reflective constructs |
manifest.compositeA.shape |
Dot shape of manifest variables of composite constructs using correlation weights |
manifest.compositeB.shape |
Dot shape of manifest variables of composite constructs using regression weights |
... |
additional parameters (unused) |
You can use the auto-complete feature of your editor to help you find the right parameter.
General settings start with plot.*
Measurement model settings start with mm.*
Structural model settings start with sm.*
Setting the shape of manifest or construct variables depending on their estimation type can be found under manifest.* and construct.*
A seminr.theme
object that can be supplied to dot_graph
The theme function for an inverted theme on black background.
seminr_theme_dark( plot.title.fontsize = 24, mm.node.label.fontsize = 8, sm.node.label.fontsize = 12, mm.edge.label.fontsize = 7, sm.edge.label.fontsize = 9 )
seminr_theme_dark( plot.title.fontsize = 24, mm.node.label.fontsize = 8, sm.node.label.fontsize = 12, mm.edge.label.fontsize = 7, sm.edge.label.fontsize = 9 )
plot.title.fontsize |
Title font size |
mm.node.label.fontsize |
Font size for measurement variables |
sm.node.label.fontsize |
Font size for constructs |
mm.edge.label.fontsize |
Font size for measurement model edges |
sm.edge.label.fontsize |
Font size for path edges |
a theme object
The current/active theme (see [seminr_theme()]) is automatically applied to every graph you draw. Use 'seminr_theme_get()' to get the current theme, and 'seminr_theme_set()' to completely override it.
seminr_theme_get() seminr_theme_set(new)
seminr_theme_get() seminr_theme_set(new)
new |
new theme (a list of theme elements) |
A theme function for a basic b/w theme
seminr_theme_old( plot.title.fontsize = 24, mm.node.label.fontsize = 8, sm.node.label.fontsize = 12, mm.edge.label.fontsize = 7, sm.edge.label.fontsize = 9 )
seminr_theme_old( plot.title.fontsize = 24, mm.node.label.fontsize = 8, sm.node.label.fontsize = 12, mm.edge.label.fontsize = 7, sm.edge.label.fontsize = 9 )
plot.title.fontsize |
Title font size |
mm.node.label.fontsize |
Font size for measurement variables |
sm.node.label.fontsize |
Font size for constructs |
mm.edge.label.fontsize |
Font size for measurement model edges |
sm.edge.label.fontsize |
Font size for path edges |
a theme object
A colored theme
A theme function for a modern approach of visualizing PLS models in b/w
seminr_theme_smart( plot.title.fontsize = 24, mm.node.label.fontsize = 8, sm.node.label.fontsize = 12, mm.edge.label.fontsize = 7, sm.edge.label.fontsize = 9 ) seminr_theme_default( plot.title.fontsize = 24, mm.node.label.fontsize = 8, sm.node.label.fontsize = 12, mm.edge.label.fontsize = 7, sm.edge.label.fontsize = 9, construct.reflective.shape = "ellipse", construct.compositeA.shape = "hexagon", construct.compositeB.shape = "hexagon", construct.reflective.arrow = "backward", construct.compositeA.arrow = "backward", construct.compositeB.arrow = "forward", ... )
seminr_theme_smart( plot.title.fontsize = 24, mm.node.label.fontsize = 8, sm.node.label.fontsize = 12, mm.edge.label.fontsize = 7, sm.edge.label.fontsize = 9 ) seminr_theme_default( plot.title.fontsize = 24, mm.node.label.fontsize = 8, sm.node.label.fontsize = 12, mm.edge.label.fontsize = 7, sm.edge.label.fontsize = 9, construct.reflective.shape = "ellipse", construct.compositeA.shape = "hexagon", construct.compositeB.shape = "hexagon", construct.reflective.arrow = "backward", construct.compositeA.arrow = "backward", construct.compositeB.arrow = "forward", ... )
plot.title.fontsize |
Title font size |
mm.node.label.fontsize |
Font size for measurement variables |
sm.node.label.fontsize |
Font size for constructs |
mm.edge.label.fontsize |
Font size for measurement model edges |
sm.edge.label.fontsize |
Font size for path edges |
construct.reflective.shape |
Shape of reflective constructs |
construct.compositeA.shape |
Shape of composite constructs mode A |
construct.compositeB.shape |
Shape of composite constructs mode B |
construct.reflective.arrow |
Direction of arrows of reflective constructs |
construct.compositeA.arrow |
Direction of arrows of composite constructs mode A |
construct.compositeB.arrow |
Direction of arrows of composite constructs mode B |
... |
Other parameters for the seminr_theme_create function |
a theme object
The seminr
package provides a natural syntax for researchers to describe PLS
structural equation models. seminr
is compatible with simplePLS.
simplePLS
provides the verb for estimating a pls model.
simplePLS(obsData,smMatrix, mmMatrix,inner_weights = path_weighting, maxIt=300, stopCriterion=7,measurement_mode_scheme)
simplePLS(obsData,smMatrix, mmMatrix,inner_weights = path_weighting, maxIt=300, stopCriterion=7,measurement_mode_scheme)
obsData |
A |
smMatrix |
A source-to-target matrix representing the inner/structural model,
generated by |
mmMatrix |
A source-to-target matrix representing the outer/measurement model,
generated by |
inner_weights |
A parameter declaring which inner weighting scheme should be used path_weighting is default, alternately path_factorial can be used. |
maxIt |
The maximum number of iterations to run (default is 300). |
stopCriterion |
The criterion to stop iterating (default is 7). |
measurement_mode_scheme |
A named list of constructs and measurement scheme functions |
A list of the estimated parameters for the SimplePLS model including:
meanData |
A vector of the indicator means. |
sdData |
A vector of the indicator standard deviations |
mmMatrix |
A Matrix of the measurement model relations. |
smMatrix |
A Matrix of the structural model relations. |
constructs |
A vector of the construct names. |
mmVariables |
A vector of the indicator names. |
outer_loadings |
The matrix of estimated indicator loadings. |
outer_weights |
The matrix of estimated indicator weights. |
path_coef |
The matrix of estimated structural model relationships. |
iterations |
A numeric indicating the number of iterations required before the algorithm converged. |
weightDiff |
A numeric indicating the minimum weight difference between iterations of the algorithm. |
construct_scores |
A matrix of the estimated construct scores for the PLS model. |
rSquared |
A matrix of the estimated R Squared for each construct. |
inner_weights |
The inner weight estimation function. |
relationships
constructs
paths
interaction_term
estimate_pls
bootstrap_model
#seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm)
#seminr syntax for creating measurement model mobi_mm <- constructs( reflective("Image", multi_items("IMAG", 1:5)), reflective("Expectation", multi_items("CUEX", 1:3)), reflective("Quality", multi_items("PERQ", 1:7)), reflective("Value", multi_items("PERV", 1:2)), reflective("Satisfaction", multi_items("CUSA", 1:3)), reflective("Complaints", single_item("CUSCO")), reflective("Loyalty", multi_items("CUSL", 1:3)) ) #seminr syntax for creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm)
single_item
specifies a single item name to be assigned to a construct.
single_item(item)
single_item(item)
item |
Name of item |
A vector of a single indicator for a composite.
See multi_items
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5), weights = correlation_weights), composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), composite("Quality", multi_items("PERQ", 1:7), weights = regression_weights), composite("Value", single_item("PERV1")) )
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5), weights = correlation_weights), composite("Expectation", multi_items("CUEX", 1:3), weights = mode_A), composite("Quality", multi_items("PERQ", 1:7), weights = regression_weights), composite("Value", single_item("PERV1")) )
slope_analysis
generates an interaction plot for the effect of an antecedent
on an outcome given a mediator variable.
slope_analysis(moderated_model, dv, moderator, iv, leg_place)
slope_analysis(moderated_model, dv, moderator, iv, leg_place)
moderated_model |
A SEMinR model that contains an interaction. |
dv |
The name of the dependant consutruct affected by the moderator (interaction term). |
moderator |
The name of the moderator construct. |
iv |
The name of the independant construct affected by the moderator. |
leg_place |
The location of the legend, in order to make sure the legend does not obscure the plot lines. |
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = c("Expectation"), method = orthogonal)) # Structural model # note: interactions should be the names of its main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation"))) # Load data, assemble model, and estimate mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) slope_analysis(mobi_pls, "Satisfaction", "Expectation", "Image", "bottomright")
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = c("Expectation"), method = orthogonal)) # Structural model # note: interactions should be the names of its main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation"))) # Load data, assemble model, and estimate mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) slope_analysis(mobi_pls, "Satisfaction", "Expectation", "Image", "bottomright")
The seminr
package provides a natural syntax for researchers to describe PLS
structural equation models.
specific_effect_significance
provides the verb for calculating the bootstrap mean, standard deviation, T value,
and confidence intervals for direct or mediated path in a bootstrapped SEMinR model.
specific_effect_significance(boot_seminr_model, from, to, through, alpha)
specific_effect_significance(boot_seminr_model, from, to, through, alpha)
boot_seminr_model |
A bootstrapped model returned by the |
from |
A parameter specifying the antecedent composite for the path. |
to |
A parameter specifying the outcome composite for the path. |
through |
A parameter to specify a vector of mediators for the path. Default is NULL. |
alpha |
A parameter for specifying the alpha for the confidence interval. Default is 0.05. |
A vector of lower and upper confidence intervals for a path.
Zhao, X., Lynch Jr, J. G., & Chen, Q. (2010). Reconsidering Baron and Kenny: Myths and truths about mediation analysis. Journal of consumer research, 37(2), 197-206.
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Quality", multi_items("PERQ", 1:7)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), composite("Complaints", single_item("CUSCO")), composite("Loyalty", multi_items("CUSL", 1:3)) ) # Creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # Estimating the model mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) # Load data, assemble model, and bootstrap boot_seminr_model <- bootstrap_model(seminr_model = mobi_pls, nboot = 50, cores = 2, seed = NULL) specific_effect_significance(boot_seminr_model = boot_seminr_model, from = "Image", through = c("Expectation", "Satisfaction","Complaints"), to = "Loyalty", alpha = 0.05)
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Quality", multi_items("PERQ", 1:7)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), composite("Complaints", single_item("CUSCO")), composite("Loyalty", multi_items("CUSL", 1:3)) ) # Creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # Estimating the model mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) # Load data, assemble model, and bootstrap boot_seminr_model <- bootstrap_model(seminr_model = mobi_pls, nboot = 50, cores = 2, seed = NULL) specific_effect_significance(boot_seminr_model = boot_seminr_model, from = "Image", through = c("Expectation", "Satisfaction","Complaints"), to = "Loyalty", alpha = 0.05)
Combines model components together into a single specified_model
object for estimation functions
specify_model( measurement_model, structural_model = NULL, item_associations = NULL )
specify_model( measurement_model, structural_model = NULL, item_associations = NULL )
measurement_model |
An optional |
structural_model |
An optional |
item_associations |
An item-to-item matrix representing error
covariances that are freed for estimation.
This matrix is created by |
A list containing a SEMinR measurement model, structural model, and item associations.
estimate_pls
estimate_cbsem
estimate_cfa
Standardize (scale) a matrix/df and report interpretable errors
standardize_safely(x)
standardize_safely(x)
x |
vector, data.frame, or matrix |
scaled object as returned by scale
function
total_indirect_ci
provides the verb for calculating the total indirect confidence intervals of a
direct or mediated path in a bootstrapped SEMinR model.
total_indirect_ci(boot_seminr_model, from, to, alpha)
total_indirect_ci(boot_seminr_model, from, to, alpha)
boot_seminr_model |
A bootstrapped model returned by the |
from |
A parameter specifying the antecedent composite for the path. |
to |
A parameter specifying the outcome composite for the path. |
alpha |
A parameter for specifying the alpha for the confidence interval. Default is 0.05. |
A vector of lower and upper confidence intervals for a path.
Zhao, X., Lynch Jr, J. G., & Chen, Q. (2010). Reconsidering Baron and Kenny: Myths and truths about mediation analysis. Journal of consumer research, 37(2), 197-206.
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Quality", multi_items("PERQ", 1:7)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), composite("Complaints", single_item("CUSCO")), composite("Loyalty", multi_items("CUSL", 1:3)) ) # Creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # Estimating the model mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) # Load data, assemble model, and bootstrap boot_seminr_model <- bootstrap_model(seminr_model = mobi_pls, nboot = 50, cores = 2, seed = NULL) total_indirect_ci(boot_seminr_model = boot_seminr_model, from = "Image", to = "Loyalty", alpha = 0.05)
mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Quality", multi_items("PERQ", 1:7)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), composite("Complaints", single_item("CUSCO")), composite("Loyalty", multi_items("CUSL", 1:3)) ) # Creating structural model mobi_sm <- relationships( paths(from = "Image", to = c("Expectation", "Satisfaction", "Loyalty")), paths(from = "Expectation", to = c("Quality", "Value", "Satisfaction")), paths(from = "Quality", to = c("Value", "Satisfaction")), paths(from = "Value", to = c("Satisfaction")), paths(from = "Satisfaction", to = c("Complaints", "Loyalty")), paths(from = "Complaints", to = "Loyalty") ) # Estimating the model mobi_pls <- estimate_pls(data = mobi, measurement_model = mobi_mm, structural_model = mobi_sm) # Load data, assemble model, and bootstrap boot_seminr_model <- bootstrap_model(seminr_model = mobi_pls, nboot = 50, cores = 2, seed = NULL) total_indirect_ci(boot_seminr_model = boot_seminr_model, from = "Image", to = "Loyalty", alpha = 0.05)
Creates an interaction measurement item using a two-stage approach. The two-stage procedure for both PLS and CBSEM models estimates construct scores in the first stage, and uses them to produce a single-item product item for the interaction term in the second stage. For a PLS model, the first stage uses PLS to compute construct scores. For a CBSEM model, the first stage uses a CFA to produce ten Berge construct scores.
# two stage approach as per Henseler & Chin (2010): two_stage(iv, moderator, weights)
# two stage approach as per Henseler & Chin (2010): two_stage(iv, moderator, weights)
iv |
The independent variable that is subject to moderation. |
moderator |
The moderator variable. |
weights |
is the relationship between the items and the interaction terms. This can be
specified as |
An un-evaluated function (promise) for estimating a two-stage interaction effect.
Henseler & Chin (2010), A comparison of approaches for the analysis of interaction effects between latent variables using partial least squares path modeling. Structural Equation Modeling, 17(1),82-109.
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = "Expectation", method = two_stage) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation")) ) # PLS example: mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm) summary(mobi_pls) # CBSEM example: mobi_cbsem <- estimate_cbsem(mobi, as.reflective(mobi_mm), mobi_sm) summary(mobi_cbsem)
data(mobi) # seminr syntax for creating measurement model mobi_mm <- constructs( composite("Image", multi_items("IMAG", 1:5)), composite("Expectation", multi_items("CUEX", 1:3)), composite("Value", multi_items("PERV", 1:2)), composite("Satisfaction", multi_items("CUSA", 1:3)), interaction_term(iv = "Image", moderator = "Expectation", method = two_stage) ) # structural model: note that name of the interactions construct should be # the names of its two main constructs joined by a '*' in between. mobi_sm <- relationships( paths(to = "Satisfaction", from = c("Image", "Expectation", "Value", "Image*Expectation")) ) # PLS example: mobi_pls <- estimate_pls(mobi, mobi_mm, mobi_sm) summary(mobi_pls) # CBSEM example: mobi_cbsem <- estimate_cbsem(mobi, as.reflective(mobi_mm), mobi_sm) summary(mobi_cbsem)
mode_A
, correlation_weights
and mode_B
, regression_weights
and unit_weights
specify the outer weighting
scheme to be used in the estimation of the construct weights and score.
unit_weights(mmMatrix, i, normData, construct_scores)
unit_weights(mmMatrix, i, normData, construct_scores)
mmMatrix |
is the |
i |
is the name of the construct to be estimated. |
normData |
is the dataframe of the normalized item data. |
construct_scores |
is the matrix of construct scores generated by |
A matrix of estimated measurement model relations.