85-86頁のRコマンドと出力の訂正
> noudo = (1:7) * 1.5 # 濃度の値を生成 > death = c(1,4,20,45,75,95,98)/100 # 死亡率の入力 > plot(noudo, death) # データのプロット > glm.dn = glm(death ~ noudo, binomial, weights=c(100,100,100,100,100,100,100)) # モデルのあてはめ > summary(glm.dn) # 結果の出力 Call: glm(formula = death ~ noudo, family = binomial, weights = c(100, 100, 100, 100, 100, 100, 100)) Deviance Residuals: 1 2 3 4 5 6 7 -0.2310 -0.4188 0.7241 -0.1508 -0.5626 0.7181 -0.1902 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -5.77180 0.42627 -13.54 <2e-16 *** # 推定されたb0 noudo 0.93357 0.06634 14.07 <2e-16 *** # 推定されたb1 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 515.3078 on 6 degrees of freedom Residual deviance: 1.6440 on 5 degrees of freedom AIC: 31.329 Number of Fisher Scoring iterations: 4 > dnfc = function(x) exp(-5.77180+0.93357 * x)/(1+exp(-5.77180+0.93357 * x)) # 結果からロジスティック曲線の関数を定義 > plot(dnfc,1,11,add=TRUE) # ロジスティック曲線を散布図にプロット