Skip to content

Posts from the ‘Structural Equation Modelling’ Category

My Course Wish List at CMSE next year

Here is the list  of courses I wish to teach next year at Chiang Mai School of Economics, not so sure about the demand there!

Undergraduate (B.Econ.)

Curriculum (pdf) 

  1. ECON 304: Economics Statistics  with an applications in R)
  2. ECON 415: Efficiencies and Productivity Measurement of Industries (Focus on Supply Chain Performance Measurement)
  3. ECON 320: International Business Economics (Focus on Supply Chain Economics for AEC analysis)


  • ECON 444: Urban Economics  (Focus on City Logistics in Chiang Mai and other Lanna provinces)
  • ECON 442: Regional Economics (Focus on AEC and GMS)
  • ECON 417: Managerial Economics (Focus on Logistics and Supply Chain Economics)
  • ECON 345: Transportation Economics
  • ECON 408: Research Design in Economics
  • ECON 419: Economic Theory and Entrepreneurship
  • ECON 443: Industrial Economics
  • ECON 4xx: Introduction to Economics of Logistics and Supply Chains (Pre: ECON 301 and Intro. to Business 703103)
  • ECON 4xx: Introduction to Structural Equation Modeling for Economics (Pre: ECON 304) (with R)


Master (M.Econ.)

  1. ECON 729: Applied Logistics and Supply Chain Economics (Selected Topic in Economic Theory)
  2. ECON 719: Applied  Structural Equation Modeling in Economics (Selected Topics in Quantitative Economics) (with R)


  1. ECON 829: Advanced Logistics and Supply Chain Economics (Selected Topic in General Economic & Theory)
  2. ECON 819: Advanced  Structural Equation Modeling in Economics (Selected Topics in Advanced Econometrics) (with R)

Resources for Structural Equation Model (SEM)

This post lists some SEM resources available to learn online.
As I am adding and updating the list, if you know more useful resource  for SEM please leave then in the comments., Thank you 🙂


  1. SEM tutorial
    by David A. Kenney
  2. Wikia-Psychology
    Structural Equation Modeling including steps in performing SEM
  3. An Introduction to Structural Equation Modeling for Ecology and Evolutionary Biology
    by Jjarrett Byrnes

Software to fit SEM

  1. List of R packages for Structural Equation Model [url]
  2. SEM
    – Uses of packages in R (sem, OpenMx)
    Edinburgh R user group


  • Prof. Karl Joreskog’s story by David Burns [url]

OpenMx package for Structural Equation Model in R

OpenMx (Boker et al, 2011) is claimed to be a “ free and open source software for use with R that allows estimation of a wide variety of advanced multivariate statistical models.” contributed by experts in R and SEM.

The following is my OpenMx script I used in my presentation at R useR! 2011.

##    Measuring Transaction Cost in Supply Chains  ##
##               Pairach Piboonrungroj             ##
##         R useR conference August 2011           ##

#install OpenMx

# load the OpenMx package into R


# read the data into an R dataframe

hoteldata <- read.csv("")

# define which indicators load on each factor

indicatorsTC <- c("TC1", "TC2", "TC3", "TC6", "TC7" , "TC11" , "TC13")

indicatorsAS <- c("AS1", "AS2")

indicatorsUN <- c("UN1", "UN2")

# create a vector of all of the manifest variables

manifests <- c(indicatorsTC, indicatorsAS, indicatorsUN)

# define which indicator is to be used to scale each factor

scaleTC <- c("TC1")

scaleAS <- c("AS1")

scaleUN <- c("UN1")

# define the names of the factors

latents <- c("TC", "AS", "UN")

# define the MxModel and store it into "factorModel"

factorModel <- mxModel("TC Model",


manifestVars = manifests,

latentVars = latents,

# specify the free factor loadings

mxPath(from="TC", to=indicatorsTC, free=TRUE, values=.2),

mxPath(from="AS", to=indicatorsAS, free=TRUE, values=.2),

mxPath(from="UN", to=indicatorsUN, free=TRUE, values=.2),

# scale the two latent variables

mxPath(from="TC", to=scaleTC, free=FALSE, values=1),

mxPath(from="AS", to=scaleAS, free=FALSE, values=1),

mxPath(from="UN", to=scaleUN, free=FALSE, values=1),

# specify the unique variances

mxPath(from=manifests, arrows=2, free=TRUE, values=.8),

# specify the factor variances

mxPath(from=latents, arrows=2, free=TRUE, values=.8),

# specify the path

mxPath(from="AS", to="TC", arrows=2, free=TRUE, values=.3),

mxPath(from="UN", to="TC", arrows=2, free=TRUE, values=.3),

mxPath(from="AS", to="UN", arrows=2, free=TRUE, values=.3),

# specify the mean structure

mxPath(from="one", to=c(manifests, latents), arrows=1, free=FALSE, values=0),

# attach the data to the model

mxData(hoteldata, type="raw")


# run the factor model

factorModelOut <- mxRun(factorModel)

# print a summary of the results


See more details about the model and the comparison with other R packages and software

lavaan package for Structural Equation Model in R

lavaan is a package for running a “Structural Equation Models” or SEM in R. The script of lavaan is similar to Mplus, which is very comprehensive and compact. The lavaan package is developed by Yves Rosseel.

The following is my lavaan script I used in my presentation at R useR! 2011.

##    Measuring Transaction Cost in Supply Chains  ##
##               Pairach Piboonrungroj             ##
##         R useR conference August 2011           ##
# 1. Load data
hoteldata &lt;- read.csv(&quot;;)
# 2. Install Package
# 3. Load Package
#5. Structural Model
TC.Model &lt;- '
# latent variable definitions
cost =~ TC1 + TC2 + TC3 +TC6 + TC7   +TC11  + TC13
asset =~ AS1 + AS2
uncertainty  =~ UN1 + UN2
# regression
cost ~ uncertainty + asset
# resident (co)variance
TC1 ~~ TC3
TC6 ~~ TC13
TC11 ~~ TC13
TC13 ~~ AS1
fitTC &lt;- sem(TC.Model, data = hoteldata)
summary(fitTC, standardized = TRUE, fit.measures=TRUE)
# Coefficients
# coef(fitTC)
#More indices
# Fit indices e.g. CFI
fit.indices &lt;- inspect(fitTC, what = &quot;fit&quot;)
# Calling Modification Indices
# inspect(fitTC, what = &quot;mi&quot;)

See more details about the model and the comparison with other R packages and software

My presentation at The R useR! Conference 2011

At useR! 2011, I talked about using R (with packages sem, lavaan and OpenMx)  for Structural Equation Modeling by comparing to other commercial software i.e., AMOS, Lisrel and Mplus.

In this study, I compare R and other software by running the same model of ‘Transaction Costs in Supply Chain“.

Followings are the presentation slide, R codes and the abstract.

Click here to download the slide.

The R Codes

  1. sem
  2. lavaan
  3. OpenMx


View this document on Scribd
%d bloggers like this: