pvalueplot {fmsb} | R Documentation |
Drawing the p-value function (a.k.a. nested confidence intervals) plot of risk ratio (RR) or odds ratio (OR) for a given 2 by 2 cross table, which is strongly recommended by Rothman KJ "Epidemiology: An introduction. 2nd Ed." Oxford Univ. Press.
Until fmsb-0.4.2, the formula to calculate p-values was not appropriate, so that the curve was not correct. Through discussion with Professor Rothman, I realized my mistake, then fixed it in fmsb-0.4.3. The feasible calculation is only possible in the manner of back-calculation from p-values to RR or OR, so that the calculation of p-values is restricted to the given range from 0.0005 to 1.
pvalueplot(XTAB, plot.OR, plot.log, xrange, add, ...)
XTAB |
A 2 by 2 matrix to draw p-value function (in another term, nested confidence intervals). The table should be given as the cross table for the exposure status being column and the health outcome status being row, opposite from usual manner for cross tabulation. To note, usually the numbers of incidence and the total observed numbers for exposed and nonexposed population as risk data, but in this function, the numbers of incidence and the remaining numbers without disease should be given as rows. |
plot.OR |
Logical. If you want to draw the p-value function for the odds ratio, it should be set at TRUE, otherwise the p-value function for the risk ratio is drawn. Default FALSE. |
xrange |
A numeric vector includes 2 elements for minimum and maximum of x axis. Default is c(0.01, 5). |
plot.log |
Logical. If TRUE, the horizontal axis becomes logarythmic scale. Default FALSE. |
add |
Logical. If TRUE, the line is overlayed on the existing pvalueplot, otherwise the graph is newly plotted. Default FALSE. |
... |
Other options handed down to plot() or lines(). pch, lty or col may be useful. |
The data.frame containing the set of p-values (ranging from 0.0005 to 1) and corresponding RR or OR is returned.
Minato Nakazawa minato-nakazawa@people.kobe-u.ac.jp https://minato.sip21c.org/
Rothman KJ (2012) Epidemiology: An Introduction. 2nd Ed., Oxford University Press, Oxford.
pvalueplot(matrix(c(321, 411, 686-321, 689-411), 2, 2), xrange=c(0.7, 0.9)) pvalueplot(matrix(c(4, 386, 4, 1250), 2, 2), xrange=c(0.1, 20), plot.log=TRUE) pvalueplot(matrix(c(468, 480, 229, 205), 2, 2), plot.OR=TRUE, xrange=c(0.7, 1.0))