[R] Path Analysis
R Help
rhelp.stats at gmail.com
Mon May 24 17:18:07 CEST 2010
Hello list,
I'm trying to make sure that I'm performing a path analysis correctly
using the sem package. the figure at
http://flame.cs.dal.ca/~sstewart/regressDiag.png has a detailing of
the model.
The challenge I'm having is that reuse is an indicator (0/1) variable.
Here's the code I'm using:
corr = hetcor(dat[,c('intent','exposure','benefit','norms','childBarrier','parentBarrier','knowBenefit','recuse')],use="pairwise.complete.obs")$correlations
modMat = matrix(c(
'exposure -> intent', 'gam11',NA,
'benefit -> intent', 'gam12',NA,
'norms -> intent', 'gam13',NA,
'childBarrier -> intent', 'gam14',NA,
'parentBarrier -> intent', 'gam15',NA,
'knowBenefit -> intent', 'gam16',NA,
'intent<->intent','psi11',NA,
'intent->recuse','gam21',NA,
'recuse<->recuse','psi22',NA),
ncol=3,byrow=T)
model4 = sem(modMat,corr,N=1520,fixed.x=c('exposure','benefit','norms','childBarrier','parentBarrier','knowBenefit'))
Is this correctly modeling my diagram? I'm not sure if a) I'm dealing
with the categorical variable correctly, or b) whether fixed.x is
accurately modeling the correlations for me.
Any help would be appreciated. I'm also looking into creating a plot
function within R (similar to the path.diagram function, but using R
plots). If I get something useful I'll try and post it back
More information about the R-help
mailing list