[R] path analysis help

Jinsong Zhao jszhao at yeah.net
Thu Aug 30 16:46:54 CEST 2012


Hi there,

I searched R-help list with "path analysis" as keyword, and learn that 
sem package can do it. However, I don't figure out a way to construct 
the model for the path diagram as Fig. 1. in Huang et al. (2002)[1].

I try the following code:

huang.cor <- readMoments(diag=FALSE, names=c('x1', 'x2', 'x3', 'y'))
0.76
0.91 0.72
0.94 0.77 0.83

huang.mod <- specifyModel()
x1 -> y, p1
x2 -> y, p2
x3 -> y, p3
x1 -> x2, p12
x2 -> x1, p21
x2 -> x3, p23
x3 -> x2, p32
x1 -> x3, p13
x3 -> x1, p31

huang.sem <- sem(huang.mod, huang.cor, 100)# 100 is arbitarious.

It give the error message:

Error in sem.default(ram, S = S, N = N, raw = raw, data = data, 
param.names = pars,  :
   The model has negative degrees of freedom = -3

I don't know why.

I hope to get direct effect, indirect effect and total effects for every 
variable. However, I don't figure out how to do with sem package. It 
there any other package that can do it?

Any suggestion or hint will be greatly appreciated.

Regards,
Jinsong


[1] Huang, B., Thornhill, N., Shah, S. and Shook, D. (2002). Path 
analysis for process troubleshooting. Proceedings of Advanced Control of 
Industrial Processes, Kumamoto, Japan, 10–12 June, 149–154.
url: http://eprints.ucl.ac.uk/494/1/HuangEtAl_AdConIP_2002.pdf



More information about the R-help mailing list