R packages for CB-SEM and PLS-SEM

The R package commonly used for Partial Least Squares Structural Equation Modeling (PLS-SEM) is plspm. Another popular package for PLS-SEM in R is semPLS. Additionally, lavaan is widely used for SEM but focuses more on covariance-based SEM (CB-SEM) rather than PLS-SEM.

Here’s a brief overview of these packages:

plspm:

  • Focuses on PLS path modeling.Allows users to estimate PLS models, evaluate model quality, and visualize the results.Suitable for exploratory research where theory is less developed.
You can install it using:

    install.packages("plspm")
    

    semPLS:

    • Also used for PLS path modeling.Provides tools to specify, estimate, and evaluate PLS-SEM models.
    You can install it using:

    install.packages("semPLS")
    

    lavaan:

    • Primarily used for covariance-based SEM but can be adapted for PLS-SEM with some workarounds.Comprehensive package for SEM with a broad range of features.
    You can install it using: install.packages("lavaan")

      install.packages("lavaan")
      

      For PLS-SEM, plspm and semPLS are specifically designed and are the most appropriate choices.

      To perform PLS-SEM using the plspm package in R, you’ll need to follow these steps: defining the path model, running the PLS-SEM analysis, evaluating the model quality, and visualizing the results. Below is a step-by-step guide with example code.

      Step 1: Install and Load the plspm Package

      First, you need to install and load the plspm package.

      install.packages("plspm")
      library(plspm)

      Step 2: Define the Path Model

      You need to define the inner model (the relationships between latent variables) and the outer model (the relationships between latent variables and their manifest variables).

      Example:

      Assume we have three latent variables: Customer Satisfaction, Image, and Loyalty. Each latent variable is measured by several manifest variables.

      # Define the inner model matrix (structural model)
      # 1: cause -> effect, 0: no relationship
      image_matrix <- rbind(
        c(0, 0, 0),  # Image has no predictors
        c(1, 0, 0),  # Customer Satisfaction is predicted by Image
        c(1, 1, 0)   # Loyalty is predicted by Image and Customer Satisfaction
      )
      colnames(image_matrix) <- rownames(image_matrix) <- c("Image", "Satisfaction", "Loyalty")
      
      # Define the outer model (measurement model)
      outer_model <- list(
        Satisfaction = c("SAT1", "SAT2", "SAT3"),
        Image = c("IMG1", "IMG2", "IMG3"),
        Loyalty = c("LOY1", "LOY2", "LOY3")
      )
      
      # Define the modes for the blocks (A for reflective, B for formative)
      modes <- c("A", "A", "A")

      Step 3: Run the PLS-SEM Analysis

      With the inner and outer models defined, you can run the PLS-SEM analysis.

      # Load example data
      data("plspm_data")
      
      # Run PLS-PM analysis
      plspm_model <- plspm(
        data = plspm_data,     # your data frame
        path_matrix = image_matrix,  # inner model
        blocks = outer_model,  # outer model
        modes = modes,         # modes for each block
        scaled = TRUE          # whether to scale data
      )

      Step 4: Evaluate Model Quality

      After estimating the model, you can evaluate the model’s quality, including the R-squared values, path coefficients, loadings, and model fit indices.

      # Print the summary of the PLS-PM model
      summary(plspm_model)
      
      # R-squared values
      plspm_model$inner_summary
      
      # Path coefficients
      plspm_model$path_coefs
      
      # Loadings and weights
      plspm_model$outer_model

      Step 5: Visualize the Results

      The plspm package provides basic visualization functions. You can visualize the path diagram and other components of the model.

      # Plot the path coefficients
      plot(plspm_model)
      
      # Plot the loadings of manifest variables
      plot(plspm_model, what = "loadings")
      
      # Biplot for examining relationships between cases and loadings
      biplot(plspm_model)

      This code provides a basic framework for performing PLS-SEM using the plspm package in R. You should adjust the paths, blocks, and modes according to your specific model and data. Additionally, consider exploring more advanced evaluation techniques depending on your research requirements.

      Leave a Reply

      Your email address will not be published. Required fields are marked *