[R] SEM GFI

Fox, John jfox at mcmaster.ca
Fri Jun 3 16:08:09 CEST 2016


Dear Vinay,

As you can see from the df for the model (i.e., LR chisquare), which is 39 in SAS and 52 using sem() in the sem package, you fit very different models in the two programs. It's consequently unremarkable that you got different results -- and not just for the GFI but for everything. The model you fit using sem() has many fewer parameters than the model fit in SAS. It's my guess that SAS automatically supplies more  variance/covariance parameters than sem() does; sem() would supply missing variance parameters, unless instructed not to do so, but not covariances.

BTW, I found it curious that proc calis in SAS apparently accepts sem()-like path model specification, including the (in sem() ) unnecessary NAs. Is this an example of convergent evolution?

I'm cc'ing this response to the r-help list, where you posed the original question, to keep readers of the list in the loop. That's useful if someone else experiences a similar problem.

Best,
 John

-----------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
Web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: VINAY KULKARNI [mailto:vinaypkulkarni at yahoo.com]
> Sent: June 3, 2016 2:04 AM
> To: Fox, John <jfox at mcmaster.ca>
> Subject: Re: [R] SEM GFI
> 
> Hi Jon,
> 
> 
> Please find attached all the files in zip file.
> 
> 
> - SAS code and R code
> - data in csv format and correlation from SAS
> - SAS SEM output and R SEM output in one excel file
> 
> 
> Yes GFI is not matching and some of the parameter estimates are not matching.
> 
> I will try today using specifyEquations(), i think this way it is little bit
> complicated.
> 
> Thanks for your help!
> 
> Vinay
> 
> 
> ________________________________
> 
> From: "Fox, John" <jfox at mcmaster.ca>
> To: "vinaypkulkarni at yahoo.com" <vinaypkulkarni at yahoo.com>
> Sent: Thursday, 2 June 2016 8:39 PM
> Subject: RE: [R] SEM GFI
> 
> 
> Dear Vinay,
> 
> Yes, you can send me the .R file and the SAS file. Also send me the SAS output --
> I don't currently have SAS on my computer -- and the data. Don't paste
> anything into an email; send the files.
> 
> You also didn't address my observation about the results -- are all of the results
> the same except for the GFI and one standard error? Have you tried coding
> your model using specifyEquations()?
> 
> John
> 
> 
> 
> > -----Original Message-----
> > From: VINAY KULKARNI [mailto:vinaypkulkarni at yahoo.com
> <mailto:vinaypkulkarni at yahoo.com> ]
> > Sent: Thursday, June 2, 2016 10:19 AM
> > To: Fox, John <jfox at mcmaster.ca <mailto:jfox at mcmaster.ca> >
> > Subject: RE: [R] SEM GFI
> >
> >
> > Hi Fox,
> > Thanks for your reply.
> > Please let me know if I can send the data ,both codes and both fit
> > indices directly to your email id.
> >
> > Data is in excel,if I paste the data directly in email it won't be clear
> > so.
> >
> > Thanks,
> > Vinay
> >
> > Sent from Yahoo Mail on Android
> > <https://overview.mail.yahoo.com/mobile/?.src=Android>
> >
> >
> >     On Thu, Jun 2, 2016 at 5:31 PM, Fox, John
> >     <jfox at mcmaster.ca <mailto:jfox at mcmaster.ca> > wrote:
> >     Dear Vinay and Burt,
> >
> >     I didn't see Vinay's original posting -- sorry about that.
> >
> >     Vinay: There's still not enough information here to tell why the
> > results are different, and posting in HTML makes the code very hard to
> > read.
> >
> >     To elaborate slightly: You don't provide the data, so it's not
> > possible to replicate your results. You also don't show the command or
> > results from SAS, so it's not possible to know how the results differ.
> > Your original message seems to imply that the results are identical
> > accept for the value of GFI and one coefficient standard error. That
> > seems unlikely. My guess: you inadvertently fit different models in SAS
> > and sem.
> >
> >     Additionally, you'd probably find it easier, and less error prone,
> > to specify the model in sem() using specifyEquations() rather than
> > specifyModel(), as the message printed by the latter tells you.
> >
> >     I hope this helps,
> >     John
> >
> >     -----------------------------
> >     John Fox, Professor
> >     McMaster University
> >     Hamilton, Ontario
> >     Canada L8S 4M4
> >     Web: socserv.mcmaster.ca/jfox
> >
> >
> >
> >
> >     > -----Original Message-----
> >     > From: R-help [mailto:r-help-bounces at r-project.org <mailto:r-help-
> bounces at r-project.org>
> > <javascript:return> ] On Behalf Of VINAY
> >     > KULKARNI via R-help
> >     > Sent: June 1, 2016 1:42 PM
> >     > To: Bert Gunter <bgunter.4567 at gmail.com
> <mailto:bgunter.4567 at gmail.com>  <javascript:return> >
> >     > Cc: r-help at r-project.org <mailto:r-help at r-project.org>
> <javascript:return>
> >     > Subject: Re: [R] SEM GFI
> >     >
> >     > Hi,
> >     > Please find below the code:
> >     > Thanks,Vinay
> >     > >library(sem) >data1=read.csv("data_1.csv") >corr=cor(data1)
> >     > >model1<-specifyModel()brand1_Pric_ind    ->
> >     > >Val_brand1,lamb1,NADist_brand1      ->
> >     > >Val_brand1,lamb2,NAbrand1_like_me    ->
> >     > >Val_brand1,lamb3,NAbrand2_Def_Drink -
> >     > >  Val_brand1,lamb4,NAbrand2_Like
> >     > >-> brand2_Def_Drink,lamb5,NAbrand2_Pleasure ->
> >     > >brand2_Def_Drink,lamb6,NAbrand1_Like ->
> >     > >brand1_like_me,lamb7,NAbrand1_Love ->
> >     > >brand1_like_me,lamb8,NAbrand1_P4WC ->
> >     > brand1_Like,lamb9,NAbrand1_P4WC
> >     > >-> brand1_Love,lamb10,NAbrand1_Energy ->
> >     > >brand1_P4WC,lamb11,NAbrand1_Different ->
> >     > >brand1_P4WC,lamb12,NAbrand1_Pric_ind <->
> >     > >brand1_Pric_ind,the1,NADist_brand1 <->
> >     > >Dist_brand1,the2,NAbrand1_like_me  <->
> >     > >brand1_like_me,the3,NAbrand2_Def_Drink <->
> >     > >brand2_Def_Drink,the4,NAbrand2_Like <->
> >     > >brand2_Like,the5,NAbrand2_Pleasure <->
> >     > >brand2_Pleasure,the6,NAbrand1_Like <->
> > brand1_Like,the7,NAbrand1_Love
> >     > ><-> brand1_Love,the8,NAbrand1_P4WC <->
> >     > brand1_P4WC,the9,NAbrand1_Energy
> >     > ><-> brand1_Energy,the10,NAbrand1_Different <->
> >     > >brand1_Different,the11,NAbrand1_like_me  <->
> >     > >brand2_Def_Drink,the12,NAbrand1_Like <->
> >     > brand1_Love,the13,NAVal_brand1
> >     > ><-> Val_brand1,1,NA  > opt <- options(fit.indices = c("GFI",
> > "AGFI",
> >     > >"RMSEA", "NFI", "NNFI", "CFI", "RNI", "IFI", "SRMR", "AIC",
> > "AICc",
> >     > >"BIC", "CAIC")) > sem.model1<-sem(model1,corr,36)
> >     > > summary(sem.model1)
> >     >
> >     >
> >     >
> >     >
> >     >      From: Bert Gunter <bgunter.4567 at gmail.com
> <mailto:bgunter.4567 at gmail.com>
> > <javascript:return> >
> >     >  To: VINAY KULKARNI <vinaypkulkarni at yahoo.com
> <mailto:vinaypkulkarni at yahoo.com>  <javascript:return>
> > >
> >     > Cc: "r-help at r-project.org <mailto:r-help at r-project.org>
> <javascript:return> " <r-help at r- <mailto:r-help at r->
> > project.org <javascript:return> >
> >     >  Sent: Wednesday, 1 June 2016 2:16 AM
> >     >  Subject: Re: [R] SEM GFI
> >     >
> >     > Probably impossible to answer without your following the posting
> > guide and
> >     > posting your code, etc.
> >     >
> >     > Cheers,
> >     >
> >     > Bert
> >     > Bert Gunter
> >     >
> >     > "The trouble with having an open mind is that people keep coming
> > along and
> >     > sticking things into it."
> >     > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip
> > )
> >     >
> >     >
> >     > On Tue, May 31, 2016 at 11:28 AM, VINAY KULKARNI via R-help <r-
> > help at r- <mailto:help at r->  <javascript:return>
> >     > project.org> wrote:
> >     > > Hi,
> >     > > I am exactly replicating the SEM model which was done in SAS
> > using Proc
> >     > Calis in R.
> >     > > Used sem package in R but not getting the GFI as same as in SAS
> >     > > (approximately 15% difference) and also one link is
> > insignificant but in SAS
> >     > am getting significant.
> >     > > Searched through online in different blogs but not able to get
> > the solution.
> >     > > Please let me know what might be the reason.
> >     > > Thanks,Vinay
> >     > >
> >     > >
> >     > >
> >     > >        [[alternative HTML version deleted]]
> >     > >
> >     > > ______________________________________________
> >     > > R-help at r-project.org <mailto:R-help at r-project.org>
> <javascript:return>  mailing list -- To
> > UNSUBSCRIBE and more, see
> >     > > 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.
> >
> >     >
> >     >
> >     >
> >     >    [[alternative HTML version deleted]]
> >     >
> >     > ______________________________________________
> >     > R-help at r-project.org <mailto:R-help at r-project.org>  <javascript:return>
> mailing list -- To
> 
> > UNSUBSCRIBE and more, see
> >     > https://stat.ethz.ch/mailman/listinfo/r-help
> >     > PLEASE do read the posting guide http://www.R- <http://www.r-/>
> > project.org/posting-
> >     > guide.html
> >     > and provide commented, minimal, self-contained, reproducible
> > code.
> >
> 
> 
> 



More information about the R-help mailing list