[R] glm with binomial errors in R and GLIM
Ronaldo Reis Jr.
chrysopa at insecta.ufv.br
Fri Mar 1 17:33:33 CET 2002
Hi all,
In my continuous transition of GLIM to R I try to make a glm with binomial
errors.
The data file have 3 vectors:
h -> the factor that is ajusted (have 3 levels)
d -> number of animais alive (the response)
n -> total number of animals
To test proportion of alive, make d/n.
In GLIM:
$yvar d$
$error binomial n$
$fit +h$
scale deviance = 25.730 (change = -9.138) at cycle 4
d.f. = 15 (change = -2)
factor h is significant by chisq² with 2df fron tables = 5.99
$disp e$
estimate se parameter
1 -0.1054 0.2055 1
2 0.7985 0.2961 h(2)
3 0.08827 0.26764 h(3)
Scale parameter taken as 1.000
In R:
> modelo.glex24.1 <- glm((d/n)~h,family=binomial)
Warning message:
non-integer #successes in a binomial glm! in: eval(expr, envir, enclos)
> summary(modelo.glex24.1)
Call:
glm(formula = (d/n) ~ h, family = binomial)
Deviance Residuals:
Min 1Q Median 3Q Max
-0.66227 -0.09918 -0.06041 0.18103 0.64740
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.06119 0.81688 -0.075 0.940
h2h 0.57994 1.17433 0.494 0.621
h3h 0.07761 1.15499 0.067 0.946
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 2.0737 on 17 degrees of freedom
Residual deviance: 1.7843 on 15 degrees of freedom
AIC: 31.147
Number of Fisher Scoring iterations: 2
> anova.glm(modelo.glex24.1,test="Chisq")
Analysis of Deviance Table
Model: binomial, link: logit
Response: (d/n)
Terms added sequentially (first to last)
Df Deviance Resid. Df Resid. Dev P(>|Chi|)
NULL 17 2.07368
h 2 0.28935 15 1.78433 0.86530
>
The values calculate by GLIM and R is very different, in GLIM h is
significant and in R no.
What is my error????
Another question is:
I make a barplot graphic with mean of (d/n) by h and I need to plot a SE bar.
The SE used is the same value returned by summary or need to make
transformations like means (1/(1+1/odds ratio))?
Thanks for all
Ronaldo
--
Newman's Discovery:
Your best dreams may not come true; fortunately, neither will
your worst dreams.
--
| //|\\ [*****************************][*******************]
|| ( õ õ ) [Ronaldo Reis Júnior ][PentiumIII-600 ]
| V [ESALQ/USP-Entomologia, CP-09 ][HD: 30 + 10 Gb ]
|| / l \ [13418-900 Piracicaba - SP ][RAM: 128 Mb ]
| /(lin)\ [Fone: 19-429-4199 r.229 ][Video: SiS620-8Mb ]
||/(linux)\ [chrysopa at insecta.ufv.br ][Modem: Pctel-onboar]
|/ (linux) \[ICQ#: 5692561 ][SO: CL 7.0 (2.2.19)]
|| ( x ) [*****************************][*******************]
||| _/ \_Powered by Conectiva Linux 7.0 D+:) | Lxuser#: 205366
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list