This function creates a tibble that includes all possible specifications based the dependent and independent variables, model types, and control variables that are specified. This function simply produces a tibble of all combinations. It can be used to check the specified analytical choices. This function is called within run_specs(), which estimates all specified models based on the data that are provided.

setup_specs(x, y, model, controls = NULL, all.comb = FALSE)

Arguments

x

a vector denoting independent variables

y

a vector denoting the dependent variables

model

a vector denoting the model(s) that should be estimated.

controls

a vector of the control variables that should be included. Defaults to NULL.

all.comb

a logical value indicating what type of combinations of the control variables should be specified. Defaults to FALSE (i.e., none, all, and each individually). If this argument is set to TRUE, all possible combinations between the control variables are specified (see examples).

Value

a tibble that includes all possible specifications based on combinations of the analytical choices.

See also

run_specs() to run the specification curve analysis.

Examples

setup_specs(y = c("y1"),
            x = c("x1", "x2"),
            model = c("lm"),
            controls = c("c1", "c2"))
#> # A tibble: 8 × 4
#>   x     y     model controls     
#>   <chr> <chr> <chr> <chr>        
#> 1 x1    y1    lm    c1 + c2      
#> 2 x2    y1    lm    c1 + c2      
#> 3 x1    y1    lm    c1           
#> 4 x2    y1    lm    c1           
#> 5 x1    y1    lm    c2           
#> 6 x2    y1    lm    c2           
#> 7 x1    y1    lm    no covariates
#> 8 x2    y1    lm    no covariates

setup_specs(y = c("y1"),
            x = c("x1", "x2"),
            model = c("lm"),
            controls = c("c1", "c2", "c3"),
            all.comb = TRUE)
#> # A tibble: 16 × 4
#>    x     y     model controls     
#>    <chr> <chr> <chr> <chr>        
#>  1 x1    y1    lm    c1           
#>  2 x2    y1    lm    c1           
#>  3 x1    y1    lm    c2           
#>  4 x2    y1    lm    c2           
#>  5 x1    y1    lm    c3           
#>  6 x2    y1    lm    c3           
#>  7 x1    y1    lm    c1 + c2      
#>  8 x2    y1    lm    c1 + c2      
#>  9 x1    y1    lm    c1 + c3      
#> 10 x2    y1    lm    c1 + c3      
#> 11 x1    y1    lm    c2 + c3      
#> 12 x2    y1    lm    c2 + c3      
#> 13 x1    y1    lm    c1 + c2 + c3 
#> 14 x2    y1    lm    c1 + c2 + c3 
#> 15 x1    y1    lm    no covariates
#> 16 x2    y1    lm    no covariates