--- title: "Implementation of formulas" author: "Kazuki Yoshida" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Implementation of formulas} %\VignetteEngine{knitr::rmarkdown} \usepackage[utf8]{inputenc} --- ```{r, message = FALSE, tidy = FALSE, echo = F} ## knitr configuration: http://yihui.name/knitr/options#chunk_options library(knitr) showMessage <- FALSE showWarning <- TRUE set_alias(w = "fig.width", h = "fig.height", res = "results") opts_chunk$set(comment = "##", error= TRUE, warning = showWarning, message = showMessage, tidy = FALSE, cache = FALSE, echo = TRUE, fig.width = 7, fig.height = 7, fig.path = "man/figures") ``` The bodies of the following functions contain the R implementation of the formulas in V2015. Although many models are covered, there are only four patterns. See the package top page for further references. The code seen here is compacted and lacks the comments. For more redable code, please refer to the [Github repo](https://github.com/kaz-yos/regmedint) and search for the function names without the preceding `regmedint:::`. For the type-set mathematical expressions and LaTeX source, please see the [supplement](https://github.com/kaz-yos/regmedint-supplement/blob/master/supplement.pdf). # mreg linear yreg linear (V2015 p466 Proposition 2.3) These functions are only used in the setting where both the mediator model and the outcome model are linear regression. ## Point estimates ```{r} regmedint:::calc_myreg_mreg_linear_yreg_linear_est ``` ## Standard error estimates ```{r} regmedint:::calc_myreg_mreg_linear_yreg_linear_se ``` # mreg linear yreg non-linear (V2015 p468 Proposition 2.4) These functions are used in all cases where the mediator model is linear regression and the outcome model is any one of the non-linear models. ## Point estimates ```{r} regmedint:::calc_myreg_mreg_linear_yreg_logistic_est ``` ## Standard error estimates ```{r} regmedint:::calc_myreg_mreg_linear_yreg_logistic_se ``` # mreg logistic yreg linear (V2015 p471 Proposition 2.5) These functions are only used in the setting where the mediator model is logistic regression and the outcome model is non-linear regression. ## Point estimates ```{r} regmedint:::calc_myreg_mreg_logistic_yreg_linear_est ``` ## Standard error estimates ```{r} regmedint:::calc_myreg_mreg_logistic_yreg_linear_se ``` # mreg logistic yreg non-linear (V2015 p473 Proposition 2.6) These functions are used in all cases where the mediator model is logistic regression and the outcome model is any one of the non-linear models. ## Point estimates ```{r} regmedint:::calc_myreg_mreg_logistic_yreg_logistic_est ``` ## Standard error estimates ```{r} regmedint:::calc_myreg_mreg_logistic_yreg_logistic_se ``` # Bibliography - V2015: VanderWeele (2015) Explanation in Causal Inference