如何计算 R 中的年龄和性别调整死亡率?

问题描述 投票:0回答:0

我是 R 的新手,我正在寻找一种方法来计算 3 个类别的年龄和性别调整死亡率(每 1,000 人年),按种族分层,并为估计添加 CI使用泊松回归(以对数跟踪时间作为偏移量)。

我的数据如下: death_time 是从进入研究到死亡或随访结束的年数

 category sex death ethnicity  age death_time
1     A    F    1     A         95  1.13
2     B    M    0     B         79  3.24
3     C    M    1     A         78  4.22
4     B    F    1     A         88  2.30

正在尝试拟合这样的模型:

m1<- glm(formula = death ~ age+sex+category+ethnicity,
        family = poisson(link="log"),
        data=df,
        offset = log(death_time))

但不确定这是正确的方法,也不确定如何创建测试数据集并使用模型中的数据预测 dest rate..

我期待得到一张按类别和种族分类的死亡率表:

              category A      category B      category C
ethnicity A    X (95%CI)       X (95%CI)       X (95%CI)
ethnicity B    X (95%CI)       X (95%CI)       X (95%CI)

任何帮助将不胜感激!

r statistics poisson rate
© www.soinside.com 2019 - 2024. All rights reserved.