Title: | Simple Method for Purging Mediation Effects among Independent Variables |
---|---|
Description: | Simple method of purging independent variables of mediating effects. First, regress the direct variable on the indirect variable. Then, used the stored residuals as the new purged (direct) variable in the updated specification. This purging process allows for use of a new direct variable uncorrelated with the indirect variable. Please cite the method and/or package using Waggoner, Philip D. (2018) <doi:10.1177/1532673X18759644>. |
Authors: | Philip D. Waggoner <[email protected]> |
Maintainer: | Philip D. Waggoner <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2024-10-24 04:13:04 UTC |
Source: | https://github.com/pdwaggoner/purging |
Purges mediator effects between two independent variables, where selection (direct) variable is continuous, and returns new "purged" direct variable to be used in multivariate specification.
purge.lm(x, "direct", "indirect")
purge.lm(x, "direct", "indirect")
x |
Represents data frame, though usage requires the data.frame name |
direct |
Represents "direct", or mediator variable, though usage requires column's name |
indirect |
Represents "indirect", or mediated variable, though usage requires column's name |
Purging of mediator effects between two independent variables in two steps. First, the function regresses the direct (mediator) variable on the indirect (mediated) variable. Second, it stores and uses the residuals from the bivariate specification as the new "purged" variable to be used in place of the original "direct" variable in multivariate analyses. Regarding syntax, the function is built with placeholder objects to calculate the quantities of interest. Then, the usage allows placing the real objects' names from working datasets (including, data frame, direct variable name in quotes, and indirect variable name in quotes) for intuitive usage.
purged
df <- data.frame(A = 1:10, B = 2:11) # linear/continuous example purge.lm(df, "A", "B")
df <- data.frame(A = 1:10, B = 2:11) # linear/continuous example purge.lm(df, "A", "B")
Purges mediator effects between two independent variables, where selection (direct) variable is binary, and returns new "purged" direct variable to be used in multivariate specification.
purge.logit(x, "direct", "indirect")
purge.logit(x, "direct", "indirect")
x |
Represents data frame, though usage requires the data.frame name |
direct |
Represents "direct", or mediator variable, though usage requires column's name |
indirect |
Represents "indirect", or mediated variable, though usage requires column's name |
Purging of mediator effects between two independent variables in two steps. First, the function regresses the direct (mediator) variable on the indirect (mediated) variable. Second, it stores and uses the residuals from the bivariate specification as the new "purged" variable to be used in place of the original "direct" variable in multivariate analyses. Regarding syntax, the function is built with placeholder objects to calculate the quantities of interest. Then, the usage allows placing the real objects' names from working datasets (including, data frame, direct variable name in quotes, and indirect variable name in quotes) for intuitive usage.
purged
df <- data.frame(A = rep(0:1, 20), B = 1:20) # logit/binary example purge.logit(df, "A", "B")
df <- data.frame(A = rep(0:1, 20), B = 1:20) # logit/binary example purge.logit(df, "A", "B")
Purges mediator effects between two independent variables, where selection (direct) variable is an event count, and returns new "purged" direct variable to be used in multivariate specification.
purge.negbin(x, "direct", "indirect")
purge.negbin(x, "direct", "indirect")
x |
Represents data frame, though usage requires the data.frame name |
direct |
Represents "direct", or mediator variable, though usage requires column's name |
indirect |
Represents "indirect", or mediated variable, though usage requires column's name |
Purging of mediator effects between two independent variables in two steps. First, the function regresses the direct (mediator) variable on the indirect (mediated) variable. Second, it stores and uses the residuals from the bivariate specification as the new "purged" variable to be used in place of the original "direct" variable in multivariate analyses. Regarding syntax, the function is built with placeholder objects to calculate the quantities of interest. Then, the usage allows placing the real objects' names from working datasets (including, data frame, direct variable name in quotes, and indirect variable name in quotes) for intuitive usage.
purged
df <- data.frame(A = c(1,1,1,1,2,2,3,3,4,5), B = 1:10) # negative binomial/counts example purge.negbin(df, "A", "B")
df <- data.frame(A = c(1,1,1,1,2,2,3,3,4,5), B = 1:10) # negative binomial/counts example purge.negbin(df, "A", "B")
Purges mediator effects between two independent variables, where selection (direct) variable is an event count, and returns new "purged" direct variable to be used in multivariate specification.
purge.poisson(x, "direct", "indirect")
purge.poisson(x, "direct", "indirect")
x |
Represents data frame, though usage requires the data.frame name |
direct |
Represents "direct", or mediator variable, though usage requires column's name |
indirect |
Represents "indirect", or mediated variable, though usage requires column's name |
Purging of mediator effects between two independent variables in two steps. First, the function regresses the direct (mediator) variable on the indirect (mediated) variable. Second, it stores and uses the residuals from the bivariate specification as the new "purged" variable to be used in place of the original "direct" variable in multivariate analyses. Regarding syntax, the function is built with placeholder objects to calculate the quantities of interest. Then, the usage allows placing the real objects' names from working datasets (including, data frame, direct variable name in quotes, and indirect variable name in quotes) for intuitive usage.
purged
df <- data.frame(A = c(1,1,1,1,1,2,2,2,3,4), B = 1:10) # Poisson/counts example purge.poisson(df, "A", "B")
df <- data.frame(A = c(1,1,1,1,1,2,2,2,3,4), B = 1:10) # Poisson/counts example purge.poisson(df, "A", "B")
Purges mediator effects between two independent variables, where selection (direct) variable is binary, and returns new "purged" direct variable to be used in multivariate specification.
purge.probit(x, "direct", "indirect")
purge.probit(x, "direct", "indirect")
x |
Represents data frame, though usage requires the data.frame name |
direct |
Represents "direct", or mediator variable, though usage requires column's name |
indirect |
Represents "indirect", or mediated variable, though usage requires column's name |
Purging of mediator effects between two independent variables in two steps. First, the function regresses the direct (mediator) variable on the indirect (mediated) variable. Second, it stores and uses the residuals from the bivariate specification as the new "purged" variable to be used in place of the original "direct" variable in multivariate analyses. Regarding syntax, the function is built with placeholder objects to calculate the quantities of interest. Then, the usage allows placing the real objects' names from working datasets (including, data frame, direct variable name in quotes, and indirect variable name in quotes) for intuitive usage.
purged
df <- data.frame(A = rep(0:1, 20), B = 2:21) # probit/binary example purge.probit(df, "A", "B")
df <- data.frame(A = rep(0:1, 20), B = 2:21) # probit/binary example purge.probit(df, "A", "B")