[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 Im using R to solve related problems ... here it goes:

This is a code to solve the rate problem, but the real question is: whats 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[1]+rates[2]+rates[3])/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[1]+deaths[2]+deaths[3])/pop[2]
rates89_91f_3 <- round(rates89_91_3*10000,digits=2)
rates89_91_3
rates89_91f_3

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Oct 26 23:00:20 2005

This archive was generated by hypermail 2.1.8 : Thu 27 Oct 2005 - 00:39:00 EST