Stella Copeland
2010-Jan-03 20:40 UTC
[R] Questions regarding sem using hetcor() function from polycor and diagrams
Hello R Users, While I have attempted to dig into the R help files and I have not identified the answer to these questions, I apologize in advance if my questions were answered in the past. I also recognize that one of my questions unfortunately verges on statistical rather than code territory. I have two rather unrelated questions about using the sem and polycor packages for a relatively simple confirmatory path analysis: (1) My data requires using the hetcor function from the polycor package, and I ran the sem() function using a matrix from this code: hcor<-function(data) hetcor(data,std.err=FALSE,use="pairwise.complete.obs")$correlations I believe this means I am using a correlation rather than a covariance matrix for the model fit statistics. I am then assuming (perhaps incorrectly) that the model fit and coefficient p values are reliable. However, I don't know if there are additional steps I should go to in order to report the correct standardized coefficients for my the model? The boot.sem() function results in identical parameter estimates but slightly altered standard errors. Are these boot strapped errors the right ones to report if I am interested in reporting standardized coefficients from this model? If this description sets off alarm bells (as in, it appears I have misunderstood the basics of the statistics behind the code I am using), I would appreciate constructive criticism regarding the correct code to use. (2) I also searching for a way to use graphviz to create graphs with arrow widths corresponding to the value of the standardized coefficients (as in several J.B. Grace publications with data similar to my own). Ideally, the coefficient values would also be embedded within the arrows. Any insight is much appreciated. Thank you, Stella -- Stella Copeland PhD Student Graduate Group in Ecology University of California, Davis
John Fox
2010-Jan-03 21:15 UTC
[R] Questions regarding sem using hetcor() function from polycor and diagrams
Dear Stella,> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]On> Behalf Of Stella Copeland > Sent: January-03-10 3:40 PM > To: r-help at r-project.org > Subject: [R] Questions regarding sem using hetcor() function from polycorand> diagrams > > Hello R Users, > > While I have attempted to dig into the R help files and I have not > identified the answer to these questions, I apologize in advance if my > questions were answered in the past. I also recognize that one of my > questions unfortunately verges on statistical rather than code > territory. I have two rather unrelated questions about using the sem and > polycor packages for a relatively simple confirmatory path analysis: > > (1) My data requires using the hetcor function from the polycor package, > and I ran the sem() function using a matrix from this code: > > hcor<-function(data) > hetcor(data,std.err=FALSE,use="pairwise.complete.obs")$correlations > > I believe this means I am using a correlation rather than a covariance > matrix for the model fit statistics. I am then assuming (perhaps > incorrectly) that the model fit and coefficient p values are reliable.Because your ordinal variables have no metric, you may as well use the standardized variables implied by the polychoric correlations computed by hetcor(). If, however, some of the variables are metric variables with understandable units of measurement, then you could restore the metrics of these variables by converting the correlation matrix computed by hetcor() to a covariance matrix -- that is change the polyserial and Pearson correlations in this matrix to covariances along with the variances of the metric variables. The model-fit statistics and coefficient standard errors (and p-values) are in any event inappropriate since they don't reflect the additional uncertainty in estimating the correlations induced by having ordinal indicators.> However, I don't know if there are additional steps I should go to in > order to report the correct standardized coefficients for my the model? > The boot.sem() function results in identical parameter estimates but > slightly altered standard errors. Are these boot strapped errors the > right ones to report if I am interested in reporting standardized > coefficients from this model? If this description sets off alarm bells > (as in, it appears I have misunderstood the basics of the statistics > behind the code I am using), I would appreciate constructive criticism > regarding the correct code to use.You don't give much detail (about sample size, complexity of model, etc.), but the bootstrapped standard errors should be more reliable than those computed by sem(), since the latter assume directly observed multinormal variables. Typically, the bootstrap standard errors will be at least a little larger than the ones computed by sem(). Also, if the bootstrap estimates of the parameters are equal to the estimates computed by sem(), that implies that the bootstrap estimates of bias are zero.> > (2) I also searching for a way to use graphviz to create graphs with > arrow widths corresponding to the value of the standardized coefficients > (as in several J.B. Grace publications with data similar to my own). > Ideally, the coefficient values would also be embedded within the arrows.path.diagram() in the sem package will construct commands for dot to draw a path diagram. That might serve as a starting point. I'm afraid that I can't help with details. 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> > Any insight is much appreciated. > > Thank you, > Stella > > > -- > Stella Copeland > PhD Student > Graduate Group in Ecology > University of California, Davis > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.