The data, 1383 observations, are from a study at the Hospital del
Mar, Barcelona during the years 1988 and 1990, Gange *et
al.* (1996).

`data(aep)`

A data frame with 1383 observations on the following 8 variables.

- los
the total number of days patients spent in hospital: a discrete vector

- noinap
the number of inappropriate days spent in hospital: a discrete vector

- loglos
the log(los/10): a numeric vector

- sex
the gender of patient: a factor with levels

`1`

=male,`2`

=female- ward
the type of ward in the hospital: a factor with levels

`1`

=medical`2`

=surgical,`3`

=others- year
the specific year 1988 or 1990: a factor with levels

`88`

and`90`

- age
the age of the patient subtracted from 55: a numeric vector

- y
the response variable a matrix with 2 columns, the first is noinap the second is equal to (los-noinap)

Gange *et al.* (1996) used a logistic regression model for the number of inappropriate
days (noinap) out of the total number of days spent in hospital (los), with binomial and beta binomial errors and found that the later
provided a better fit to the data. They modelled both the mean and
the dispersion of the beta binomial distribution (BB) as functions
of explanatory variables

Gange, S. J. Munoz, A. Saez, M. and Alonso, J. (1996) Use of the beta-binomial distribution to model
the effect of policy changes on appropriateness of hospital stays. *Appl. Statist*, **45**, 371--382

```
data(aep)
attach(aep)
pro<-noinap/los
plot(ward,pro)
rm(pro)
detach(aep)
```

Run the code above in your browser using DataLab