iv_predicted_exposure: linear model fitting to estimate the instrument predicted...

View source: R/iv_predicted_exposure.R

iv_predicted_exposureR Documentation

linear model fitting to estimate the instrument predicted exposure, sometimes referred to as d.hat in an MR framework.

Description

This function estimates instrument predicted exposure by fitting a linear model of instrument + covariates on exposure and extracting the fitted values.

Usage

iv_predicted_exposure(wdata, exposure, instrument, covariates = NULL)

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.

Value

returns a lmfit object that is a list containing (1) 'fit' a lm() object and (2) 'summary' a vector of summary statistics.

Examples

iv_predicted_exposure()

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