Description Usage Arguments Details See Also
Computes the exposure-response curve from a fitted outcome model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | compute_ERC2(
exprange = c(0, 100),
expsequence = NULL,
ref_exposure = NULL,
ciband = 0.95,
inclInterceptUncertainty = TRUE,
inclIntercept = FALSE,
intercept_prop = c("equal"),
study = NULL,
beta_post,
bs_post,
nS,
Mx,
Mx_attributes = attributes(Mx),
xdf = ncol(Mx),
...
)
plot_ERC2(
obj,
incS = NULL,
expERC = TRUE,
ylab = "Relative Risk",
xlab = "Exposure",
ribbon = FALSE
)
center_ERC2(obj, ref_exposure = min(obj$exposure))
compute_OR2(
exprange = c(0, 100),
expsequence = NULL,
ref_exposure = 0,
ciband = 0.95,
inclInterceptUncertainty = TRUE,
inclIntercept = FALSE,
intercept_prop = c("equal", "obs"),
study = NULL,
beta_post,
bs_post,
nS,
Mx,
Mx_attributes,
xdf,
...
)
|
exprange |
range of exposure values over which to compute the curve |
expsequence |
sequence of exposure values at which the curve should be evaluated. For plotting, it is preferable to use |
ref_exposure |
Exposure concentration at which the spline should be shifted to have value 0 on log scale (value 1 on exponentiated scale). The largest exposure value less than or equal to |
ciband |
width of credible interval band |
inclInterceptUncertainty |
Should intercept uncertainty be included uncertainty estimates? See details for more information. |
inclIntercept |
Should the intercept term be included in the curve? |
intercept_prop |
Proportions used in calculating the "average" intercept. Defaults to equal proportions for each study ( |
study |
Return the curve for a specific study, or the |
beta_post |
vector or matrix of posterior samples for 'beta' parameter. Only needed if |
bs_post |
vector or matrix of posterior samples for 'bS' parameter. Only needed if |
nS |
Number of studies. Only needed if |
Mx |
Spline matrix for exposure. Only needed if |
Mx_attributes |
Attributes for the spline matrix. Only needed if |
xdf |
Degrees of freedom in exposure splines |
... |
Passed to |
obj |
Data frame, or list of data frames, containing |
incS |
If model has a single curve but with different selections of intercept uncertainty, this indicates which choice of uncertainty to use. Defaults to the last column of the curve in |
expERC |
Should the fitted curve be exponentiated (TRUE) or not (FALSE). |
ylab |
String providing y-axis label. |
xlab |
String providing x-axis label. |
ribbon |
Should the uncertainty be represented as a filled ribbon (TRUE) or lines without fill (FALSE). |
These functions are derived from the functions of similar name in the 'bercs' package (e.g. 'compute_ERC2()'). They are included here in 'PMerc' to facilitate calculating ERC values without requiring the full 'bercs' package (which requires compiled C code for the STAN model objects). This package is recommended only for calculating specific risk measures from the accompanying data files. If developing your own models, it is recommended to use the functions in the 'bercs' package and not these. To avoid namespace issues, these functions have '2' appended in their name.
This function creates a data frame containing the values of the exposure-response curve over a given range of values. The output is designed for easy plotting. Currently, the fitted curve is plotted based upon the posterior means of the parameters, with the uncertainty bands based upon quantiles.
Uncertainty from the intercepts is included in the confidence bands by default, since this corresponds to a common interpretation of such intervals. This requires picking a single value for the intercept.
For models fit to multiple studies, a separate set of uncertainty will be created for each study. Additionally, a set of results corresponding to "average" intercept is created. The intercept_prop
argument controls the relative contribution of the intercepts from each model.
To calculate odds ratios for specific combinations of exposure values, use the 'compute_OR2' function, which will correctly calculate the credible intervals for the relative difference.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.