Closed maesaar closed 3 years ago
When using the emsim
option there is a much simpler (and better!) option to calculate the 95%CI of r/m. Each line of the file ending with suffix emsim.txt
contains sampled values of R/theta, delta and nu. Multiply these three values to get the sampled values of r/m for each line. The 95%CI is then obtained by taking the 2.5% and 97.5% quantiles of these sampled values. In R you can do this using: quantile(values,probs=c(0.025,0.975))
Yes if two 95%CI do not overlap then it suggests that there is a significant difference at the p=0.05 level.
When using embranch option things are a bit different since there will be parameter estimated for each branches.
@xavierdidelot thank you!
But in principle the calculations are correct either way? By calculating as I did and also as you suggested?
The intervals you get using my method based on the output of emsim are more statistically valid than the ones calculated using the method you described, but otherwise yes what you described is a correct application of what I had described in other issues.
Thank you again
Hello @xavierdidelot, I have read the issues #99 and #114 regarding CI95% calculations for r/m. Do I understand it correctly:
CFML has been ran with following parameters:
First to get overall CI95% I have to use following input like in issue #99.
Second I calculate r/m as follows:
r/m = 1/1/delta * R/theta * nu
therefore ther/m = 1/0.000530892 * 0.297706 * 0.0157936 = ~8.86
Third I calculate CI95% for each parameter using the formula in R
qgamma(c(0.025,0.975),shape=a_post,rate=b_post)
: R/theta CI95% is calculatedqgamma(c(0.025,0.975),shape=2162.84,rate=7261.02)
1/delta CI95% is calculatedqgamma(c(0.025,0.975),shape=2007.28,rate=3780950)
nu CI95% is calculatedqgamma(c(0.025,0.975),shape=59768,rate=3784310)
Summary of results of CI95% calculations:
Fourth I will calculate 0.025:
r/m(0.025) = 1/0.0005079198 * 0.2854475 * 0.01566726 = ~8.81
Fifth I will calculate 0.975:
r/m(0.975) = 1/0.0005543673 * 0.3105534 * 0.01592050 = 8.92
Finally the r/m(CI95%) is 8.86[8.81-8.92]
So here are my question: 1) Are my previous calculations correct? 2) When comparing r/m from different CFML runs (same bacteria, different STs) is it correct to assume if CI95% ranges don't overlap that the r/m differs significantly (p=0.05)? 3) In the issue #114 the r/m is calculated slightly differently (per-branch CI95% values multiplied with mean) is it due to the
-embranch true
parameter and because of the values being factors as stated in issue #87.Thank you in advance