frac_poly_summ_mr: Instrumental variable analysis using fractional polynomials...

View source: R/nlme_summ_aes_rest.R

frac_poly_summ_mrR Documentation

Instrumental variable analysis using fractional polynomials based on summary data

Description

frac_poly_summ_mr performs instumental variable analysis by fitting fractional polynomial models to localised average causal effects using meta-regression.

Please note that if you provide synthetic data that are too regular (eg the by associations are all zero or the xmean values are exactly 1, 2, 3, ...), the function may error as several fractional polynomials provide the same fit.

Usage

frac_poly_summ_mr(
  by,
  bx,
  byse,
  bxse,
  xmean,
  method = "FE",
  d = "both",
  powers = c(0, -2, -1.5, -1, -0.5, 1, 2),
  pd = 0.05,
  average.exposure.associations = FALSE,
  ci = "model_se",
  nboot = 100,
  fig = FALSE,
  family = "binomial",
  offset = 0,
  pref_x = "x",
  pref_y = "y",
  ref = NA,
  ci_type = "overall",
  breaks = NULL,
  ylim_lower = NA,
  ylim_upper = NA,
  xlim_lower = NA,
  xlim_upper = NA,
  seed = 335
)

Arguments

by

vector of gene-outcome associations.

bx

vector of gene-exposure associations.

byse

vector of standard errors of gene-outcome associations.

bxse

vector of standard errors of gene-exposure associations.

xmean

average value of the exposure in each stratum (or whatever summary of the exposure level in the stratum is desired).

method

meta-regression method parsed to the rma package. The default is fixed-effects ('FE').

d

fractional polynomial degree. The default is degree 1. The other options are: 1, 2, or 'both'.

powers

fractional polynomial powers to test.

pd

p-value cut-off for choosing the best-fitting fractional polynomial of degree 2 over the best-fitting fractional polynomial degree 1. This option is only used if d='both'. The default is 0.05.

average.exposure.associations

TRUE means that the bx estimates are averaged across strata, FALSE means that they are not. Default option is FALSE.

ci

the type of 95\% confidence interval. There are three options: (i) using the model standard errors ('model_se'), (ii) using bootstrap standard errors ('bootstrap_se'), (iii) using bootstrap percentile confidence intervals ('bootstrap_per'). The default is the model standard errors.

nboot

the number of bootstrap replications (if required). The default is 100 replications.

fig

a logical statement as to whether the user wants the results displayed in a figure. The default is false.

family

a character string named either 'gaussian' (for continuous data) or binomial (for binary data) or cox (for survival data) family function. This only affects the plotting function - whether the y-axis is log-transformed or not, and the graph's default label.

offset

offset on the x-axis (default is zero).

pref_x

the prefix/label for the x-axis. The default is 'x'.

pref_y

the prefix/label for the y-axis. The default is 'y'.

ref

the reference point for the figure. This is the value of the function that represents the expected difference in the outcome compared with this reference value when the exposure is set to different values. If ref = NA (the default option), then it is set to the mean of x.

ci_type

the type of confidence interval to be displayed on the graph. The default is 'overall' where confidence intervals are presented as bands across the range of x. The alternative option is 'quantile' where the confidence intervals are presented as error bars at the mean in each quantile of x.

breaks

breaks on the y-axis of the figure.

ylim_lower

lower limit for the y-axis of the figure.

ylim_upper

upper limit for the y-axis of the figure.

xlim_lower

lower limit for the x-axis of the figure.

xlim_upper

upper limit for the x-axis of the figure.

seed

The random seed to use when generating the bootstrap samples (for reproducibility). If set to NA, the random seed will not be set.

Value

model the model specifications. The first column is the number of quantiles (q); the second column is the position used to relate x to the LACE in each quantiles (xpos); the third column is the type of confidence interval constructed (ci); the fourth column is the number of bootstrap replications performed (nboot).

powers the powers of the chosen polynomial.

coefficients the regression estimates. The first column is the regression coefficients (beta); the second column is the standard errors of regression coefficients (se); the third column is the lower confidence interval (lci); the fourth column is the upper confidence interval (uci); the fifth column is the p-value (pval).

lace the localised average causal effect estimate in each quantile. The first column is the regression coefficients (beta); the second column is the standard errors of regression coefficients (se); the third column is the lower confidence interval (lci); the fourth column is the upper confidence interval (uci); the fifth column is the p-value (pval).

xcoef the association between the instrument and the exposure in each quantile. The first column is the regression coefficients (beta); the second column is the standard errors of regression coefficients (se).

p_tests the p-value of the non-linearity tests. The first column is the p-value of the test between the fractional polynomial degrees (fp_d1_d2); the second column is the p-value from the fractional polynomial non-linearity test (fp); the third column is the p-value from the quadratic test (quad); the fourth column is the p-value from the Cochran Q test (Q). The first column is the p-value of the Cochran Q heterogeneity test (Q); the second column is the p-value from the trend test (trend).

figure ggplot command to produce a figure.

Author(s)

Stephen Burgess sb452@medschl.cam.ac.uk, leaning heavily on James R Staley js16174@bristol.ac.uk


amymariemason/SUMnlmr documentation built on July 22, 2024, 10:03 a.m.