Hi everyone,
newbee query!
I've installed R 2.8.0 and tried to run this simple glm -
x is no of cars in a given year, y is the number voted in an election
that year while n is the population 18+:
votes <- data.frame(x = c(0.62,0.77,0.71,0.74,0.77,0.86,1.13,1.44),
+ y=c(502,542,711,653,771,806,934,1123), n
c(1617,1734,1680,1793,1678,1751,1807,1879))
> votes$YM <- cbind(votes$y, votes$n - votes$y)
> fml <- glm(YM ~ x, family = binomial, data = votes)
> summary(fml)
and got the following which seem really wrong!
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.43498 0.06233 -23.02 <2e-16 ***
x 1.30739 0.06705 19.50 <2e-16 ***
> dfr = votes
> prd.mdl <- predict(fml,newdata=dfr)
> prd.mdl
1 2 3 4 5
6 7 8
-0.62439978 -0.42829203 -0.50673513 -0.46751358 -0.42829203
-0.31062738 0.04236657 0.44765592
> predict(fml, type="response")
1 2 3 4 5 6 7
8
0.3487815 0.3945343 0.3759592 0.3852049 0.3945343 0.4229616 0.5105901
0.6100818
the original proportions are
|------+------+------+------+------+------+-------+------|
| 0.76| 0.76| 0.70| 0.73| 0.69| 0.68| 0.66| 0.63|
|------+------+------+------+------+------+-------+------|
and I would expect intercept to be about -0.14 and beta = 0.83?
Am I missing something obvious? Any help or suggestions appreciated!
Thanks
Gerard
**********************************************************************************
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material. Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error, please contact
the sender and delete the material from any computer. It is the policy of the
Department of Justice, Equality and Law Reform and the Agencies and Offices
using its IT services to disallow the sending of offensive material.
Should you consider that the material contained in this message is offensive you
should contact the sender immediately and also mailminder[at]justice.ie.
Is le haghaidh an duine n? an eintitis ar a bhfuil s? d?rithe, agus le haghaidh
an duine n? an eintitis sin amh?in, a bhearta?tear an fhaisn?is a tarchuireadh
agus f?adfaidh s? go bhfuil ?bhar faoi r?n agus/n? faoi phribhl?id inti.
Toirmisctear aon athbhreithni?, atarchur n? leathadh a dh?anamh ar an bhfaisn?is
seo, aon ?s?id eile a bhaint aisti n? aon ghn?omh a dh?anamh ar a hiontaoibh, ag
daoine n? ag eintitis seachas an faighteoir beartaithe. M? fuair t? ? seo tr?
dhearmad, t?igh i dteagmh?il leis an seolt?ir, le do thoil, agus scrios an
t-?bhar as aon r?omhaire. Is ? beartas na Roinne Dl? agus Cirt, Comhionannais
agus Athch?irithe Dl?, agus na nOif?g? agus na nGn?omhaireachta? a ?s?ideann
seirbh?s? TF na Roinne, seoladh ?bhair chol?il a dh?chead?.
M?s rud ? go measann t? gur ?bhar col?il at? san ?bhar at? sa teachtaireacht seo
is ceart duit dul i dteagmh?il leis an seolt?ir l?ithreach agus le
mailminder[ag]justice.ie chomh maith.
***********************************************************************************