Dùng hàm names để xuất ra các values của object
head (d)
## id fu.days status drug age sex ascites
## 1 1 400 death penicillamine 21464 female 1
## 2 2 4500 censored penicillamine 20617 female 0
## 3 3 1012 death penicillamine 25594 male 0
## 4 4 1925 death penicillamine 19994 female 0
## 5 5 1504 censored due to liver tx placebo 13918 female 0
## 6 6 2503 death placebo 24201 female 0
## hepatom spiders edema bili chol albumin copper alk.phos sgot trig
## 1 1 1 1.0 14.5 261 2.60 156 1718.0 137.95 172
## 2 1 1 0.0 1.1 302 4.14 54 7394.8 113.52 88
## 3 0 0 0.5 1.4 176 3.48 210 516.0 96.10 55
## 4 1 1 0.5 1.8 244 2.54 64 6121.8 60.63 92
## 5 1 1 0.0 3.4 279 3.53 143 671.0 113.15 72
## 6 1 0 0.0 0.8 248 3.98 50 944.0 93.00 63
## platelet protime stage
## 1 190 12.2 4
## 2 221 10.6 3
## 3 151 12.0 4
## 4 183 10.3 4
## 5 136 10.9 3
## 6 NA 11.0 3
d$outcome[d$status=='death']=1
d$outcome[d$status!='death']=0
reg= glm (d$outcome ~ age, family=binomial, data=d)
summary(reg)
##
## Call:
## glm(formula = d$outcome ~ age, family = binomial, data = d)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.6231 -0.9929 -0.7585 1.2390 1.7978
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.951e+00 6.114e-01 -4.828 1.38e-06 ***
## age 1.381e-04 3.221e-05 4.287 1.81e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 420.12 on 311 degrees of freedom
## Residual deviance: 400.30 on 310 degrees of freedom
## AIC: 404.3
##
## Number of Fisher Scoring iterations: 4
names (reg)
## [1] "coefficients" "residuals" "fitted.values"
## [4] "effects" "R" "rank"
## [7] "qr" "family" "linear.predictors"
## [10] "deviance" "aic" "null.deviance"
## [13] "iter" "weights" "prior.weights"
## [16] "df.residual" "df.null" "y"
## [19] "converged" "boundary" "model"
## [22] "call" "formula" "terms"
## [25] "data" "offset" "control"
## [28] "method" "contrasts" "xlevels"
names (summary (reg))
## [1] "call" "terms" "family" "deviance"
## [5] "aic" "contrasts" "df.residual" "null.deviance"
## [9] "df.null" "iter" "deviance.resid" "coefficients"
## [13] "aliased" "dispersion" "df" "cov.unscaled"
## [17] "cov.scaled"