piecewise_summ_mr: Instrumental variable analysis using piecewise linear method...

View source: R/piecewise_new.R

piecewise_summ_mrR Documentation

Instrumental variable analysis using piecewise linear method based on summary data

Description

piecewise_summ_mr performs instumental variable analysis by fitting piecewise linear functions to localised average causal effects

Usage

piecewise_summ_mr(
  by,
  bx,
  byse,
  bxse,
  xmean,
  xmin,
  xmax,
  xbreaks = NULL,
  family = "gaussian",
  average.exposure.associations = FALSE,
  ci = "model_se",
  nboot = 1000,
  fig = T,
  ref = mean(xmean),
  pref_x = "x",
  pref_x_ref = "x",
  pref_y = "y",
  breaks = NULL,
  ci_fig = "point",
  seed = 875
)

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 original exposure in each iv-free strata (or whatever summary of the exposure level in the stratum is desired).

xmin

min value of the original exposure in each stratum (see note)

xmax

max value of the original exposure in each stratum (see note)

xbreaks

break points for the stratum x values (see note)

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. This should match whichever option was used in creating the summary data.

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 four 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 1000 replications.

fig

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

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. The default is the mean of x.

pref_x

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

pref_x_ref

the prefix for the reference value displayed on the y-axis. The default is "x".

pref_y

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

breaks

breaks on the y-axis of the figure.

ci_fig

setting confidence interval type. "point" places error bars at the mean of each stratum; "ribbon" draws upper and lower piecewise lines.

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

Note

The non-linearity tests uses 'method="DL"' to calculate the p-value for the hetrogeneity trend. The fractional polynomial equivalent function allows you to set the method, meaning you may get different results.

There is no option for covariates; they would need to be applied at an earlier stage in the individual data, using the mr_summarise function.

The min and max of x stratum values are used to choose the appropiete range for fitting of each causal estimate. In the code for summarising data, this is set at the 10% point, and the 90% of each stratum; 20% and 80% in the external ends of the end strata. The first lower value and all upper value are used to set the break points for the estimates in the graph. Alternatively you can hardset this using xbreaks.

Author(s)

Amy Mason, leaning heavily on work by James Statley and Matt Arnold


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