[R] Path Analysis
John Fox
jfox at mcmaster.ca
Mon May 24 18:17:05 CEST 2010
Dear sstewart,
The model appears to reflect the path diagram, assuming that you intend to
allow the exogenous variables to be correlated and want the errors to be
uncorrelated.
This is one way to model the binary variable reuse. An alternative would be
to fit the equation for intent by least-squares regression (assuming that
the relationships are linear, etc.), and the equation of reuse by, e.g.,
logistic regression (again assuming that the model is correctly specified).
If you're right that the effects of the exogenous variables are entirely
mediated by intent, then if you put these variables in the equation for
reuse, their coefficients should be small.
I hope this helps,
John
--------------------------------
John Fox
Senator William McMaster
Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of R Help
> Sent: May-24-10 11:18 AM
> To: r-help
> Subject: [R] Path Analysis
>
> 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','parentBa
r
> rier','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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list