compute_ERC2: Extract fitted Exposure-Response Curve (ERC)

Description Usage Arguments Details See Also

Description

Computes the exposure-response curve from a fitted outcome model

Usage

 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,
  ...
)

Arguments

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 exprange, but for specific known exposure values use expsequence.

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 ref_exposure is used as the new reference concentration.

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 ("equal") and can be set to be proportional to the number of observations in each study ("obs"). A vector of proportions can also be given.

study

Return the curve for a specific study, or the

beta_post

vector or matrix of posterior samples for 'beta' parameter. Only needed if stanfit not provided.

bs_post

vector or matrix of posterior samples for 'bS' parameter. Only needed if stanfit not provided.

nS

Number of studies. Only needed if standata not provided.

Mx

Spline matrix for exposure. Only needed if standata not provided.

Mx_attributes

Attributes for the spline matrix. Only needed if standata not provided.

xdf

Degrees of freedom in exposure splines

...

Passed to seq to control sequence of exposure values.

obj

Data frame, or list of data frames, containing exposure, mean, low, and high. Typically generated from compute_ERC2.

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 obj, which is typically the averaged intercept uncertainty. If multiple curves are fit, this selects which curve(s) is plotted.

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).

Details

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.

See Also

compute_ERC


jpkeller/PMerc documentation built on Sept. 11, 2020, 12:27 a.m.