Description Usage Format Details Source References Examples
Data come from the 1991 Arizona cardiovascular patient files. A subset of the fields was selected to model the differential length of stay for patients entering the hospital to receive one of two standard cardiovascular procedures: CABG and PTCA. CABG is the standard acronym for Coronary Artery Bypass Graft, where the flow of blood in a diseased or blocked coronary artery or vein has been grafted to bypass the diseased sections. PTCA, or Percutaneous Transluminal Coronary Angioplasty, is a method of placing a balloon in a blocked coronary artery to open it to blood flow. It is a much less severe method of treatment for those having coronary blockage, with a corresponding reduction in risk.
1 |
A data frame with 3589 observations on the following 6 variables.
los
length of hospital stay
procedure
1=CABG;0=PTCA
sex
1=Male; 0=female
admit
1=Urgent/Emerg; 0=elective (type of admission)
age75
1= Age>75; 0=Age<=75
hospital
encrypted facility code (string)
azprocedure is saved as a data frame. Count models use los as response variable. 0 counts are structurally excluded
1991 Arizona Medpar data, cardiovascular patient files, National Health Economics & Research Co.
Hilbe, Joseph M (2014), Modeling Count Data, Cambridge University Press Hilbe, Joseph M (2007, 2011), Negative Binomial Regression, Cambridge University Press Hilbe, Joseph M (2009), Logistic Regression Models, Chapman & Hall/CRC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(MASS)
library(msme)
data(azprocedure)
glmazp <- glm(los ~ procedure + sex + admit, family=poisson, data=azprocedure)
summary(glmazp)
exp(coef(glmazp))
nb2 <- nbinomial(los ~ procedure + sex + admit, data=azprocedure)
summary(nb2)
exp(coef(nb2))
glmaznb <- glm.nb(los ~ procedure + sex + admit, data=azprocedure)
summary(glmaznb)
exp(coef(glmaznb))
|
Loading required package: msme
Loading required package: MASS
Loading required package: lattice
Loading required package: sandwich
Call:
glm(formula = los ~ procedure + sex + admit, family = poisson,
data = azprocedure)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.1987 -1.1451 -0.4756 0.5331 12.4784
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.49140 0.01539 96.91 <2e-16 ***
procedure 0.95738 0.01218 78.61 <2e-16 ***
sex -0.13022 0.01179 -11.04 <2e-16 ***
admit 0.33307 0.01210 27.52 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 16265.0 on 3588 degrees of freedom
Residual deviance: 8968.9 on 3585 degrees of freedom
AIC: 22483
Number of Fisher Scoring iterations: 5
(Intercept) procedure sex admit
4.4433339 2.6048728 0.8779003 1.3952480
There were 50 or more warnings (use warnings() to see the first 50)
Call:
ml_glm2(formula1 = formula1, formula2 = formula2, data = data,
family = family, mean.link = mean.link, scale.link = scale.link,
offset = offset, start = start, verbose = verbose)
Deviance Residuals:
Min. 1st Qu. Median Mean 3rd Qu. Max.
-2.0474 -0.8062 -0.3166 -0.1451 0.3387 6.4689
Pearson Residuals:
Min. 1st Qu. Median Mean 3rd Qu. Max.
-1.505133 -0.709226 -0.301576 -0.002558 0.354577 13.195139
Coefficients (all in linear predictor):
Estimate SE Z p LCL UCL
(Intercept) 1.451 0.02318 62.61 0 1.406 1.4968
procedure 0.978 0.01847 52.97 0 0.942 1.0143
sex -0.132 0.01915 -6.91 4.75e-12 -0.170 -0.0948
admit 0.379 0.01913 19.79 3.83e-87 0.341 0.4160
(Intercept)_s 0.163 0.00657 24.78 1.63e-135 0.150 0.1757
Null deviance: 6645.529 on 3587 d.f.
Residual deviance: 3527.73 on 3584 d.f.
Null Pearson: 7994.057 on 3587 d.f.
Residual Pearson: 4928.398 on 3584 d.f.
Dispersion: 1.375111
AIC: 19992.18
Number of optimizer iterations: 187
(Intercept) procedure sex admit (Intercept)_s
4.2691376 2.6593510 0.8760067 1.4601076 1.1768777
Call:
glm.nb(formula = los ~ procedure + sex + admit, data = azprocedure,
init.theta = 6.140143318, link = log)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.0474 -0.8062 -0.3166 0.3387 6.4690
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.45141 0.02293 63.31 < 2e-16 ***
procedure 0.97808 0.01837 53.25 < 2e-16 ***
sex -0.13238 0.01913 -6.92 4.52e-12 ***
admit 0.37851 0.01906 19.86 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for Negative Binomial(6.1401) family taken to be 1)
Null deviance: 6645.6 on 3588 degrees of freedom
Residual deviance: 3527.8 on 3585 degrees of freedom
AIC: 19992
Number of Fisher Scoring iterations: 1
Theta: 6.140
Std. Err.: 0.248
2 x log-likelihood: -19982.184
(Intercept) procedure sex admit
4.269141 2.659351 0.876007 1.460107
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.