[R] GLM fitting in R and Statistica
Greg.Snow at imail.org
Wed Apr 9 22:35:01 CEST 2008
Can you get fitted values out of Statistica? If the 2 models are
equivalent, just using different encodings of the categorical variables,
then the fitted values will be the same (within roundoff error) even
though the coefficient estimates may differ.
So as a first step you should compare the fitted values or predicted
values for new points and see if those are close or not.
Also, make sure that Statistica is treating site as a categorical
variable (does it show 2 degrees of freedom?), if it is seeing it as a
linear variable rather than a categorical, then it would show 1 line and
everything would be messed up.
Hope this helps, If not, can you send code/output from both using a
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Agnieszka Kloch
> Sent: Wednesday, April 09, 2008 12:09 PM
> To: R help
> Subject: [R] GLM fitting in R and Statistica
> I have a problem concerning discrepances between R (which I
> use) and Statistica (which uses my supervisor). I can't say
> what is the origin of these differences but unfortunately my
> supervisor doesn't know that either.
> Our response variable is number (or presence/absence) of
> parasites in rodents and explanatory variables are
> presence/absence of several alleles. The rodents were sampled
> in three sites and the sites differ in parasite frequency so
> we decided to include "site" as a factor.
> The problem concerns calculations of factor variable. In
> Statistica output there is only one term, just "site", and in
> R there are two contrats "site A", "site B". I realized that
> I can obtain similar results in Statistica clicking on
> "Estimate" button instead of "1LR"
> (what does my supervisor which gives only log-likelihood and
> p of variables but doesn't estimate parameter).
> But there is still one problem I can't explain. When we fit
> interaction terms (site x allele1, site x allele2 and so on)
> the results are completely different. I tried several
> different contrasts in R, such as contr.SAS, contr.treatment
> etc but I couldn't get nothing similar to Statistica output.
> Have anybody any idea how to deal with that? Or how to
> explain why R results are different (and hopefully better)? I
> tried to argue that I did everything according to Crawley's R
> Book so probably the models are constructed correctly but my
> supervisor wasn't convinced...
> Looking forward any suggestions,
> Agnieszka Kloch
> Instytute of Environmental Sciences, Jagielonian University
> ul. Gronostajowa 7, 30-387 Krakow, Poland, tel. (12) 664 51 51
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help