## example of PLS-PM in ecological analysis
  ## model with three LVs and formative indicators
  data(arizona)
  ari.inner <- matrix(c(0,0,0,0,0,0,1,1,0),3,3,byrow=TRUE)
  dimnames(ari.inner) <- list(c("ENV","SOIL","DIV"),c("ENV","SOIL","DIV"))
  ari.outer <- list(c(1,2),c(3,4,5),c(6,7,8)) 
  ari.mod <- c("B","B","B")  ## formative indicators
  res1 <- plspm(arizona, inner=ari.inner, outer=ari.outer, modes=ari.mod,
  scheme="factor", scaled=TRUE, plsr=TRUE)
  res1
  summary(res1)
  
  ## typical example of PLS-PM in customer satisfaction analysis
  ## model with six LVs and reflective indicators
  data(satisfaction)
  IMAG <- c(0,0,0,0,0,0)
  EXPE <- c(1,0,0,0,0,0)
  QUAL <- c(0,1,0,0,0,0)
  VAL  <- c(0,1,1,0,0,0)
  SAT  <- c(1,1,1,1,0,0) 
  LOY  <- c(1,0,0,0,1,0)
  sat.inner <- rbind(IMAG, EXPE, QUAL, VAL, SAT, LOY)
  sat.outer <- list(1:5,6:10,11:15,16:19,20:23,24:27)
  sat.mod <- rep("A",6)   ## reflective indicators
  res2 <- plspm(satisfaction, sat.inner, sat.outer, sat.mod, scaled=FALSE, boot.val=TRUE)
  summary(res2)
  plot(res2)
  
  ## example of PLS-PM in sensory analysis
  ## estimate a path model for the orange juice data
  data(orange)
  senso.inner <- matrix(c(0,0,0,1,0,0,1,1,0),3,3,byrow=TRUE)
  dimnames(senso.inner) <- list(c("PHYCHEM","SENSORY","HEDONIC"),
                              c("PHYCHEM","SENSORY","HEDONIC"))
  senso.outer <- list(1:9,10:16,17:112)
  senso.mod <- rep("A",3)
  res3 <- plspm.fit(orange, senso.inner, senso.outer, senso.mod, 
                scheme="centroid", scaled=TRUE)
  summary(res3)
  ## example of PLS-PM in multi-block data analysis
  ## estimate a path model for the wine data set 
  ## requires package FactoMineR 
  library(FactoMineR)
  data(wine)
  SMELL <- c(0,0,0,0)
  VIEW <- c(1,0,0,0)
  SHAKE <- c(1,1,0,0)
  TASTE <- c(1,1,1,0)
  wine.inner <- rbind(SMELL,VIEW,SHAKE,TASTE)
  wine.outer <- list(3:7,8:10,11:20,21:29)
  wine.mods <- rep("A",4)
  # using function plspm.fit (basic pls algorithm)
  res4 <- plspm.fit(wine, wine.inner, wine.outer, wine.mods, scheme="centroid")                
  plot(res4, what="all", arr.pos=.4, box.prop=.4, cex.txt=.8)Run the code above in your browser using DataLab