按年龄和性别计算人口发生率

时间:2019-02-27 22:39:07

标签: r count

样本数据

data = data.frame(id=c(1,2,3,4,5,6,7,8,9,10),
                  sex = c(0,1,1,1,1,1,0,0,0,0),
age1=c(10,10,16,10,10,13,16,16,12,11),
age2=c(12,12,18,12,12,15,18,18,14,13),
age3=c(14,14,20,14,14,17,20,20,16,15),
survey1=c(1,0,1,1,0,0,1,1,0,1),
survey2=c(1,0,1,1,1,0,1,1,0,1),
survey3=c(1,0,1,1,1,1,1,1,1,1))

long = reshape(data, direction = "long",
                            varying = list(c("age1","age2","age3"),c("survey1","survey2","survey3")),
                            v.names = c("age","survey"),
                            idvar = "id", timevar = "year", times = c(2000,2002,2004))

在这里,我的目标是估算特定于年龄的特定年龄发病率,并按性别分开估算。我有较大的数据,但这是假数据。

我尝试使用“事故”包

i.sex <- incidence(long, interval = 2, group = sex, event = survey)

但这不起作用。

如果您有任何建议,我会看到https://stackoverflow.com/users/889960/tim-riffe在另一篇相关文章中所提供的建议。谢谢大家

0 个答案:

没有答案