# [R] correct rate

From: Carlos Mauricio Cardeal Mendes <mcardeal_at_ufba.br>
Date: Wed 26 Oct 2005 - 22:45:14 EST

Hi everone !

I know its not a epidemiologic or statistic list, but since I´m using R to solve related problems ... here it goes:

This is a code to solve the rate problem, but the real question is: what´s the correct way to calculate the period rate (3 years period put together)
The third option is quite different (middle period). Any suggestions ?

Thanks
Mauricio, Brazil

# Example from Field epidemiology basics computer lab 1

# annual period rates (1989, 1990, 1991)

years <- 1989:1991
deaths <- c(125, 130, 131)
pop <- c(361975, 361401, 366613)

# rates and rates per 10.000 per year

rates <- deaths/pop
ratesf <- round(rates*10000,digits=2)
rates
ratesf

# to calculate the period rate we have 3 possibilities:

# 1) sum of deaths by sum of populations:

```rates89_91_1 <- sum(deaths)/sum(pop)
rates89_91f_1 <- round(rates89_91_1*10000,digits=2)
rates89_91_1
rates89_91f_1

```

# 2) mean rates:

```rates89_91_2 <- (rates+rates+rates)/3
rates89_91f_2 <- round(rates89_91_2*10000,digits=2)
rates89_91_2
rates89_91f_2

```

# 3) sum of deahts by middle population (1990):

```rates89_91_3 <- (deaths+deaths+deaths)/pop
rates89_91f_3 <- round(rates89_91_3*10000,digits=2)
rates89_91_3
rates89_91f_3

______________________________________________
```
R-help@stat.math.ethz.ch mailing list