前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >R 计算年龄标化率(Age Adjusted Rates)

R 计算年龄标化率(Age Adjusted Rates)

作者头像
Jamesjin63
发布2022-10-25 14:55:16
2K0
发布2022-10-25 14:55:16
举报
文章被收录于专栏:EpiHub

计算年龄标化率(Age Adjusted Rates)

为了在不同群体(例如地理区域,种族)的比率之间进行有效的比较,往往需要考虑年龄的分布,调整年龄分布的差异,以消除年龄的混淆影响。通过还需要计算在标准化后的置信区间。(Anderson 1998) (ps:该死的预防医学,需要掌握率的标准化,但是R可以帮准你实现全部过程。)

1.计算年龄调整的标准化率

假设某地区5个年龄组的HIV感染人数与对应年龄组的人口数。计算该地区的HIV的年龄标化率。

代码语言:javascript
复制
library(tidyverse)
library(epitools)
df=tibble(age_group=c("<1", "1-4", "5-14", "15-24", "25-34", "35-44", "45-54",
                       "55-64", "65-74", "75-84", "85+"),
          case= c(141, 926, 1253, 1080, 1869, 4891, 14956, 30888,
                  41725, 26501, 5928),
          pop=c(1784033, 7065148, 15658730, 10482916, 9939972,
                10563872, 9114202, 6850263, 4702482, 1874619, 330915),
          standard_pop=c(906897, 3794573, 10003544, 10629526, 9465330,
                         8249558, 7294330, 5022499, 2920220, 1019504, 142532))

DT::datatable(df)

df %>% mutate(CrudeRate=case/pop ) 

image.png

1.HIV粗感染率(Crude Rates)

case/pop=CrudeRate;可以通过mutate来计算

代码语言:javascript
复制
df %>% mutate(CrudeRate=case/pop ) 
# A tibble: 11 x 5
   age_group  case      pop standard_pop CrudeRate
   <chr>     <dbl>    <dbl>        <dbl>     <dbl>
 1 <1          141  1784033       906897 0.0000790
 2 1-4         926  7065148      3794573 0.000131 
 3 5-14       1253 15658730     10003544 0.0000800
 4 15-24      1080 10482916     10629526 0.000103 
 5 25-34      1869  9939972      9465330 0.000188 
 6 35-44      4891 10563872      8249558 0.000463 
 7 45-54     14956  9114202      7294330 0.00164  
 8 55-64     30888  6850263      5022499 0.00451  
 9 65-74     41725  4702482      2920220 0.00887  
10 75-84     26501  1874619      1019504 0.0141   
11 85+        5928   330915       142532 0.0179  
2.HIV年龄标化率(Adjusting the Rates)

首先需要通过 standard_pop标准人口来计算各个年龄组的比例,这个standard_pop可以根据某省或者WHO的标准,主要目的是获取不同年龄组所占总人口比例。

  1. 计算年龄组的proportion

image.png

prop.table可以计算年龄组的proportion;确保proportion 总和为1.

  1. 计算年龄组调整的率

image.png

只需将每个年龄组的原始case乘以该年龄组的proportion即可。 (由于proportion均小于1,因此HIV的年龄标化率是各个年龄组调整后的累计效应)

代码语言:javascript
复制
(a=df %>% mutate(CrudeRate=case/pop,
                 proportion=prop.table(standard_pop),
                 Adjust_rates=CrudeRate*proportion)
)
# A tibble: 11 x 7
   age_group  case      pop standard_pop CrudeRate proportion Adjust_rates
   <chr>     <dbl>    <dbl>        <dbl>     <dbl>      <dbl>        <dbl>
 1 <1          141  1784033       906897 0.0000790    0.0153    0.00000121
 2 1-4         926  7065148      3794573 0.000131     0.0638    0.00000837
 3 5-14       1253 15658730     10003544 0.0000800    0.168     0.0000135 
 4 15-24      1080 10482916     10629526 0.000103     0.179     0.0000184 
 5 25-34      1869  9939972      9465330 0.000188     0.159     0.0000299 
 6 35-44      4891 10563872      8249558 0.000463     0.139     0.0000642 
 7 45-54     14956  9114202      7294330 0.00164      0.123     0.000201  
 8 55-64     30888  6850263      5022499 0.00451      0.0845    0.000381  
 9 65-74     41725  4702482      2920220 0.00887      0.0491    0.000436  
10 75-84     26501  1874619      1019504 0.0141       0.0171    0.000242  
11 85+        5928   330915       142532 0.0179       0.00240   0.0000429 

# CrudeRate
100000*(sum(a$case)/sum(a$pop))

# Adjust_rates
100000*sum(a$Adjust_rates)

根据该计算方式;可以得出 CrudeRate =166.0874; Adjust_rates=143.9176

3.标化率置信区间(Adjusting the Rates)

这种用于估计95%CI的方法很复杂,但是依据正态分布的方法,在标准正态分布上使用误差的余量+/-平均值,对于该特定计算,年龄调整率作为中心( Confidence Intervals)。因此,借助于epitools

代码语言:javascript
复制
##implement direct age standardization using 'ageadjust.direct'
asr = ageadjust.direct(count = df$case, pop = df$pop, stdpop = df$standard_pop)
round(100000*asr, 2) ##rate per 100,000 per year
4.间接法计算(两地区年龄组pop合并)

这里增加了一列数据standard_pop人口的各个感染病例数:standard_case;这样就相当于两个地区各年龄组都有HIV的发病数。合并两个地区的pop计算调整的年龄标化率。

代码语言:javascript
复制
df$standard_case=c(45, 201, 320, 670, 1126, 3160, 9723, 17935,
                   22179, 13461, 2238)

##implement indirect age standardization using 'ageadjust.indirect'
asr = ageadjust.indirect(count = df$case, pop = df$pop,
                          stdcount = df$standard_case, stdpop = df$standard_pop)
                          
round(asr$sir, 2)         ##standarized incidence ratio
 observed       exp       sir       lci       uci 
130158.00 109126.69      1.19      1.19      1.20 
round(100000*asr$rate, 1) ##rate per 100,000 per year
crude.rate   adj.rate        lci        uci 
     166.1      142.6      141.8      143.3 
     
     
asr = ageadjust.indirect(count = df$standard_case, pop = df$standard_pop,
                         stdcount = df$case, stdpop = df$pop)
round(asr$sir, 2)         ##standarized incidence ratio
round(100000*asr$rate, 1) ##rate per 100,000 per year

参考

  1. Age standardization by indirect method, with exact confidence
  2. Calculating Age-adjusted Rates
  3. Age Adjusted Rates - Steps for Calculating
  4. Chapter 7: Age-standardisation and denominators
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-11-20,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 计算年龄标化率(Age Adjusted Rates)
  • 1.计算年龄调整的标准化率
    • 1.HIV粗感染率(Crude Rates)
      • 2.HIV年龄标化率(Adjusting the Rates)
        • 3.标化率置信区间(Adjusting the Rates)
          • 4.间接法计算(两地区年龄组pop合并)
          • 参考
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档