I have following simulated data of 2500 persons regarding the incidence of a rare disease over 20 years
year number_affected
1 0
2 0
3 1
4 0
5 0
6 0
7 1
8 0
9 1
10 0
11 1
12 0
13 0
14 1
15 1
16 0
17 1
18 0
19 2
20 1
What test can I apply to show that the disease is becoming more common?
Edit: as suggested by @Wrzlprmft I tried simple correlation using Spearman and also Kendall methods:
Spearman's rank correlation rho
data: year and number_affected
S = 799.44, p-value = 0.08145
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.3989206
Warning message:
In cor.test.default(year, number_affected, method = "spearman") :
Cannot compute exact p-value with ties
>
Kendall's rank correlation tau
data: year and number_affected
z = 1.752, p-value = 0.07978
alternative hypothesis: true tau is not equal to 0
sample estimates:
tau
0.3296319
Warning message:
In cor.test.default(year, number_affected, method = "kendall") :
Cannot compute exact p-value with ties
Are these sufficiently good for this type of data? Mann Kendall test using method shown by @AWebb gives P value of [1] 0.04319868. Poisson regression suggested by @dsaxton gives following result:
Call:
glm(formula = number_affected ~ year, family = poisson, data = mydf)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.3187 -0.8524 -0.6173 0.5248 1.2158
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.79664 0.85725 -2.096 0.0361 *
year 0.09204 0.05946 1.548 0.1217
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 16.636 on 19 degrees of freedom
Residual deviance: 14.038 on 18 degrees of freedom
AIC: 36.652
Number of Fisher Scoring iterations: 5
Year component here is not significant. What can I finally conclude? Also, in all these analyses, the number 2500 (denominator population number) has not been used. Does that number not make a difference? Can we use simple linear regression (Gaussian) using incidence (number_affected/2500) versus year?
drop1(fit, test="LRT")
to do a likelihood ratio test, instead of doing an asymptotic z-test on the Poisson statistic. (Doing so gives you a p-value of 0.107, so still not statistically significant.) You don’t need to include the population number in the regression if it’s the same for each year. Then it just plays the role of a scaling factor. But you should include it (with per-year population values), as the population at risk probably does vary over the twenty years. Just addoffset=log(pop_at_risk)
to theglm
call. $\endgroup$