[R] correct rate
Carlos Mauricio Cardeal Mendes
mcardeal at ufba.br
Wed Oct 26 14:45:14 CEST 2005
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[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
More information about the R-help
mailing list