modmed_make_formula: Create a formula based on lists of variables. All independent...

Description Usage Arguments Value Examples

View source: R/modmed_make_formula.R

Description

Create a formula based on lists of variables. All independent variables will be interacted with the moderator if the latter is specified. Controls are not.

Usage

1
2
modmed_make_formula(dependent = NULL, independent = c(NA),
  moderator = c(NA), control = c(NA))

Arguments

dependent

Character string. Dependent variable.

independent

Character vector. Independent variables.

moderator

Character vector. Moderating variable.

control

Character vector. Control variables.

Value

A formula to run in regressions. Interactions are introduced under the form "independent_x_moderator" and therefore the corresponding variable must be created in the dataset.

Examples

1
2
3
4
5
6
library(modelest)
model <- modmed_make_formula(dependent = "turnover",
                             independent = "justice",
                             moderator = "pay",
                             control = c("age","gender"))
model

NicolasJBM/model documentation built on Feb. 15, 2018, 11:12 p.m.