[R] SEM with a categorical predictor variable

John Fox jfox at mcmaster.ca
Wed Apr 2 13:49:35 CEST 2008


Dear Vera,

If the smoker/non-smoker variable is exogenous (as seems to be implied by
your calling it a "predictor") then you can simply create a 0/1 dummy
regressor for it and calculate covariances in the usual manner. The
coefficient for the variable would have the usual interpretation for a dummy
regressor. I wouldn't calculate correlations, as opposed to covariances,
since this would muddy the interpretation. A also wouldn't use Spearman or
Kendall correlations.

On the other hand, if smoker/non-smoker is endogenous, then you could use
biserial/tetrachoric correlations: see the hector() function in the polycor
package. There's an example (though with polytomous rather than dichotomous
variables) in ?boot.sem and in a paper on the sem package that appeared in
Structural Equation Modeling, which is available at
<http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf>.

I hope this helps,
 John

--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
905-525-9140x23604
http://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 Lila86
> Sent: April-01-08 5:32 PM
> To: r-help at r-project.org
> Subject: [R] SEM with a categorical predictor variable
> 
> 
> Hi,
> 
> we are trying to do structural equation modelling on R. However, one of
> our
> predictor variables is categorical (smoker/nonsmoker). Now, if we want
> to
> run the sem() command (from the sem library), we need to specify a
> covariance matrix (cov). However, Pearson's correlation does not work
> on the
> dichotomous variable, so instead we produced a covariance matrix using
> the
> Spearman's (or Kendalls) correlation method, which works.
> 
> Running the sem() command on our model using that covariance matrix
> works
> fine, but I am not sure if it was okay to make the covariance matrix
> using
> Spearman or Kendall. Can we interpret the regression coefficients that
> we
> find in summary(sem) just as if we had used Pearsons correlation in the
> covariance matrix? Or is there any other way to define a SEM including
> categorical variables without using a covariance matrix?
> 
> I appreciate every help. Thank you very much,
> Vera
> 
> 
> --
> View this message in context: http://www.nabble.com/SEM-with-a-
> categorical-predictor-variable-tp16425959p16425959.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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