inst/doc/count-medcare.R

## ----results='hide',eval=TRUE-------------------------------------------------
library(catdata)
data(medcare)
attach(medcare)

## ----eval=TRUE----------------------------------------------------------------
med1=glm(ofp ~ hosp+healthpoor+healthexcellent+numchron+age+married+school,
         family=poisson,data=medcare[male==1 & ofp<=30,])
summary(med1)

## ----eval=TRUE----------------------------------------------------------------
med2=glm(ofp ~ hosp+healthpoor+healthexcellent+numchron+age+married+school,
         family=quasipoisson,data=medcare[male==1 & ofp<=30,])
summary(med2)

## ----eval=TRUE----------------------------------------------------------------
library(MASS)
med3=glm.nb(ofp ~ hosp+healthpoor+healthexcellent+numchron+age+married+school,
            data=medcare[male==1 & ofp<=30,])
summary(med3)

## ----eval=TRUE----------------------------------------------------------------

## ----results='hide',eval=TRUE-------------------------------------------------
library(pscl)

## ----eval=TRUE----------------------------------------------------------------
med4=zeroinfl(ofp ~ hosp+healthpoor+healthexcellent+numchron+age+married+school|1,
              data=medcare[male==1 & ofp<=30,])
summary(med4)

## ----eval=TRUE----------------------------------------------------------------
med5=zeroinfl(ofp ~ hosp+healthpoor+healthexcellent+numchron+age+married+school,
              data=medcare[male==1 & ofp<=30,])
summary(med5)

## ----eval=TRUE----------------------------------------------------------------
med6=hurdle(ofp ~ hosp+healthpoor+healthexcellent+numchron+age+married+school|1
            ,data=medcare[male==1 & ofp<=30,])
summary(med6)

## ----eval=TRUE----------------------------------------------------------------
med7=hurdle(ofp ~ hosp+healthpoor+healthexcellent+numchron+age+married+school,
            data=medcare[male==1 & ofp<=30,])
summary(med7)

Try the catdata package in your browser

Any scripts or data that you put into this service are public.

catdata documentation built on June 22, 2024, 12:28 p.m.