# Print, Export, and Plot PLS Results in SEMinR

### Learn to Print, Export, and Plot PLS Results

This series of lecture on SEMinR Package will introduce the SEMinR package.

## SEMinR

There are four steps to specify and estimate a structural equation model using SEMinR:

- Loading and cleaning the data
- Specifying the measurement models
- Specifying the structural model
- Estimating, bootstrapping, and summarizing the model

## Review of the Steps

- When model estimation, evaluation, and analysis have been completed, it is often necessary to export the results generated in R to a report. It is recommended that tables and matrices are exported to .csv files.
- The
**write.csv()**function takes an object and writes it into a .csv file in the working directory of the project. - This function applies two arguments:
is the name of the object to be written to file, and*x*is the name of the file to be created and written to.*file* - Thus, if we wish to report the bootstrapped paths from the previously discussed simple model, we would use the
**write.csv()**function with argument*x***=****summary_boot$bootstrapped_loadings**and*file***= “boot_loadings.csv”**.

## Plots

- When plotting the results, use plot() function as shown in the figure below with command plot (summary_simple$reliability) to extract the reliability plot.
- Next, we discuss how to generate high-quality figures from the SEMinR results.
- First, we generate a sample plot for export from RStudio. To do this, we use a sub-object of
**summary_simple**and plot the constructs’ internal consistency reliabilities (i.e., Cronbach’s alpha, rhoA, and rhoC) with

**plot(****summary_simple$reliability****)**

- Once this plot displays in the plots tab in RStudio (Fig), click the
**Export**dropdown list and select**Save as PDF**to bring up the save plot as a .pdf window. Select the size and output name and save the document.

## Measurement and Structural Model in SEMinR

- When plotting the results, use plot() function as shown in the figure below.

- In simple terms in the plot function provide, simple_model or boot_model as arguments. Both are the estimated models. simple_model is the estimated pls model whereas boot_model is the bootstrapped model.

## Review of the Steps

Following is a brief review of the steps that have been discussed in SEMinR tutorials.

- Load the Library –
**library ()** - Load the Data –
**read.csv** - Review the Data –
**head()** - Specify the Measurement Model –
**constructs()** - Specify the Structural Model –
**relationships()** - Estimate the Model –
**estimate_pls()** - Summarize the Results –
**summary()** - Bootstrap the Model –
**bootstrap_model()** - Summarize the Results –
**summary()**

The next step is Plotting and Writing Results – plot() and Write.csv

## Complete Code

```
#load the library
library(seminr)
# Load the Data
datas <- read.csv(file = "Data.csv", header = TRUE, sep = ",")
head(datas)
# Create measurement model
simple_mm <- constructs(
composite("Vision", multi_items("VIS", 1:4)),
composite("Development", multi_items("DEV", 1:7)),
composite("Rewards", multi_items("RW",1:4)),
composite("Collaborative Culture", multi_items("CC", 1:6)))
# Create structural model
simple_sm <- relationships(
paths(from = c("Vision", "Development", "Rewards"), to = "Collaborative Culture"))
# Estimate the model
simple_model <- estimate_pls(data = datas,
measurement_model = simple_mm,
structural_model = simple_sm)
# Summarize the model results
summary_simple <- summary(simple_model)
#Retreive Full Summary
summary_simple
# Inspect the model path coefficients and the R^2 values
summary_simple$paths
# Inspect the construct reliability metrics
summary_simple$reliability
# Bootstrap the model
boot_simple <- bootstrap_model(seminr_model = simple_model,
nboot = 1000,
cores = NULL,
seed = 123)
# Store the summary of the bootstrapped model
summary_boot <- summary(boot_simple)
#Retreive Full Report
summary_boot
# Inspect the bootstrapped structural paths
summary_boot$bootstrapped_paths
# Inspect the bootstrapped indicator loadings
Summary_boot $bootstrapped_loadings
#Generating Plots
plot(simple_model)
plot(summary_simple$reliability)
plot(boot_simple)
# Write the bootstrapped paths object to csv file
write.csv(x = summary_boot$bootstrapped_loadings, file = "boot_loadings.csv")
```

## Reference

Hair Jr, J. F., Hult, G. T. M., Ringle, C. M., Sarstedt, M., Danks, N. P., & Ray, S. (2021). Partial Least Squares Structural Equation Modeling (PLS-SEM) Using R: A Workbook.

The tutorials on SEMinR are based on the mentioned book. The book is open source and available for download under this link.

## Video Tutorial

## Additional SEMinR Tutorials

- An Introduction to R and R Studio
- An Introduction to SEMinR Package
- Create Project, Load, and Inspect the Data
- SEMinR Package: An Introduction to Evaluating Formative Measurement Model
- SEMinR Package: Analyzing Categorical Predictor Variables
- SEMinR Package: Bootstrapping PLS Model
- SEMinR Package: Evaluating Formative Measurement Model – Convergent Validity and Collinearity
- SEMinR Package: Evaluating Formative Measurement Model – Step 3- Indicator Weights
- SEMinR Package: Evaluating Formative Measurement Model – When to Delete Formative Indicators
- SEMinR Package: Evaluating Reflective Measurement Model
- SEMinR Package: Evaluating Structural Model
- SEMinR Package: Evaluating Structural Model – Step 4: Predictive Power (PLSPredict)
- SEMinR Package: Higher Order Analysis – REF-FOR
- SEMinR Package: Higher Order Analysis – REF-REF
- SEMinR Package: How to Solve Convergent and Discriminant Validity Problems
- SEMinR Package: Mediation Analysis
- SEMinR Package: Moderation Analysis
- SEMinR Package: PLS Estimation
- SEMinR Package: Reflective Measurement Model Step 2: Consistency and Step 3: Convergent Validity
- SEMinR Package: Reflective Measurement Model Step 4: Discriminant Validity
- SEMinR Package: Single Item, SmartPLS Comparison and Summary of SEMinR
- SEMinR Package: Specifying Measurement Model
- SEMinR Package: Specifying the Structural Model