R glm()

(R언어 glm()에서 넘어옴)

1 개요[ | ]

R glm()
  • "Generalized Linear Model"
R
CPU
2.6s
MEM
101M
3.7s
Reload
Copy
library("MASS")
str(menarche)
summary(glm(cbind(Menarche, Total-Menarche) ~ Age, family=binomial, data=menarche))
'data.frame':	25 obs. of  3 variables:
 $ Age     : num  9.21 10.21 10.58 10.83 11.08 ...
 $ Total   : num  376 200 93 120 90 88 105 111 100 93 ...
 $ Menarche: num  0 0 0 2 2 5 10 17 16 29 ...
Call:
glm(formula = cbind(Menarche, Total - Menarche) ~ Age, family = binomial, 
    data = menarche)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-2.0363  -0.9953  -0.4900   0.7780   1.3675  

Coefficients:
             Estimate Std. Error z value Pr(>|z|)    
(Intercept) -21.22639    0.77068  -27.54   <2e-16 ***
Age           1.63197    0.05895   27.68   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 3693.884  on 24  degrees of freedom
Residual deviance:   26.703  on 23  degrees of freedom
AIC: 114.76

Number of Fisher Scoring iterations: 4
R
Reload
Copy
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
z <- glm(counts ~ outcome + treatment, family = poisson())
summary(z)
Loading
Copy
anova(z)
Loading

2 같이 보기[ | ]

3 참고[ | ]