覦覯襷 覲企.
--一危磯, 覈
diabetes <- read.csv("c:\\data\\diabetes.csv", header=T)
str(diabetes)
diabetes.glm <- glm(deaths ~ age + gender, offset=l_popn, family="poisson", data=diabetes)
summary(diabetes.glm)
anova(diabetes.glm)
蠍(http://freesearch.pe.kr/archives/2555) 一危磯ゼ 伎 覲伎.
tmp <- textConnection(
"蟲′譴 ′一ろ
譟 螻狩′ 51
螻譟 螻狩′ 22
譴譟 螻狩′ 43
譟 ′ 92
螻譟 ′ 21
譴譟 ′ 28
譟 觜′ 68
螻譟 觜′ 9
譴譟 觜′ 22")
x <- read.table(tmp, header=TRUE)
close.connection(tmp)
head(x)
豺伎伎螻 覿
t <- xtabs(~蟲′譴+′一ろ, data=x)
summary(t)
豺伎伎螻 覿 蟆郁骸
> summary(t)
Call: xtabs(formula = ~ 蟲′譴 + ′一ろ, data = x)
Number of cases in table: 356
Number of factors: 2
Test for independence of all factors:
Chisq = 18.51, df = 4, p-value = 0.0009808
>
蟆郁骸襯 覲企 蟲′譴 ′一 レ 殊 蟆 覲 . 願 possion regression 企慨.
fit <- glm(~蟲′譴+′一ろ, data=x, family=poisson)
summary(fit)
> summary(fit)
Call:
glm(formula = ~ 蟲′譴 + ′一ろ, family = poisson,
data = x)
Deviance Residuals:
1 2 3 4 5 6
-2.24478 1.17378 2.16834 0.90724 0.08884 -1.52052
7 8 9
1.18683 -1.54454 -0.77967
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.8299 0.1582 17.883 < 2e-16 ***
蟲′譴譟 1.4006 0.1548 9.047 < 2e-16 ***
蟲′譴譴譟 0.5814 0.1732 3.357 0.000787 ***
′一ろ觜′ -0.1585 0.1368 -1.158 0.246791
′一ろ′ 0.1952 0.1254 1.557 0.119474
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 137.880 on 8 degrees of freedom
Residual deviance: 18.663 on 4 degrees of freedom
AIC: 76.454
Number of Fisher Scoring iterations: 4
>
覘.. 蟆郁骸螳 ′ ̄讌 . 蟆郁骸襯 襾轟企慨. 譟, 螻狩′壱 覈覈 手?
predict(fit, data.frame(蟲′譴=c("譟"), ′一ろ=c("螻狩′")), type="response")
# exp(predict(fit, data.frame(蟲′譴=c("譟"), ′一ろ=c("螻狩′"))))
> predict(fit, data.frame(蟲′譴=c("譟"), ′一ろ=c("螻狩′")), type="response")
1
68.75281
69覈 . R襷螻 るジ一 襾轟朱 れ螻 螳 summary() 伎 襾轟朱 .
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.8299 0.1582 17.883 < 2e-16 ***
蟲′譴譟 1.4006 0.1548 9.047 < 2e-16 ***
蟲′譴譴譟 0.5814 0.1732 3.357 0.000787 ***
′一ろ觜′ -0.1585 0.1368 -1.158 0.246791 ---------> 蠍 覲企 覈語 譬る 蟆 .
′一ろ′ 0.1952 0.1254 1.557 0.119474 ---------> 蠍 覲企 覈語 譬る 蟆 .
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
- (Intercept) 2.8299
- 蟲′譴譟 1.4006
- ′一ろ螻狩′ -> X .
- 蟆郁骸朱 exp(2.8299 + 1.4006) 覃 68.7516 企蟆 .
...69 51 譬 谿願 . poisson regression 麹讌 蠏碁危.