iv_free_exposure: linear model fitting to estimate exposure values in the...

View source: R/iv_free_exposure.R

iv_free_exposureR Documentation

linear model fitting to estimate exposure values in the absence of the instrument effect

Description

This function estimates exposure values in the absence of the instrument effect by fitting a linear model of instrument + covariates on exposure and extracting the residuals.

Usage

iv_free_exposure(
  wdata,
  exposure,
  instrument,
  covariates = NULL,
  exposure_mean_normalize = TRUE
)

Arguments

wdata

a data frame passed to function containing necessary data for analysis

exposure

a single string character of the column name for the exposure variable, which will be set as the response variable in this model.

instrument

a single string character of the column name for the instrument, which will be set as the independent or explanatory variable in the model.

covariates

a character vector that are also column names used to define variables that will be set as covariates.

exposure_mean_normalize

binary TRUE or FALSE. TRUE statements will re-center the residulas to have a mean value of that observed for the exposure.

Value

returns the data frame provided but with an additional column 'iv_free_exposure'.

Examples

iv_free_exposure()

hughesevoanth/glsmr documentation built on May 14, 2023, 3:41 p.m.