s.curve: Specification curve maker function

Description Usage Arguments Value

View source: R/s.curve.R

Description

Specification curve maker function

Usage

1
2
3
4
5
6
7
8
s.curve(dat, outcomes, treatment, cov.list, no.cov.exclude = NULL,
  extra.models = NULL, extra.treatment = NULL, mod.type = lm,
  mod.family = NULL, alpha = 0.05, tail = NULL, subsets = NULL,
  subsets.exclude = TRUE, weights = NULL, weights.exclude = TRUE,
  weights.ipw.vars = NULL, permutations = NULL, perm.pvalues = FALSE,
  perm.seed = NULL, cluster = FALSE, cluster.var = NULL,
  robust.se = NULL, cat.percent = TRUE, keep.tidy.models = TRUE,
  keep.full.models = FALSE, model.only = FALSE)

Arguments

dat

a dataframe containing the variables

outcomes

vector of outcome variables

treatment

vector of treatment variables

cov.list

named list, sets of covariates / moderators - write moderators as "var1:var2"; eg: cov.list = list(gender = c("gender.roster", "gender.selfreport")

no.cov.exclude

Will add a model where each item of the list above is missing, unless specified here

extra.models

Models written literally; will be appended to the set (still crossed against subsets and weights)

extra.treatment

Treatment variable in extra models (length 1 or same as other, needed if doing inverse probability weighting

mod.type

takes lm, glm

mod.family

if family needed

alpha

nominal alpha value (if one tailed, will test against p <= .1 on that side)

tail

One tailed test? Takes "upper" and "lower"

subsets

runs subsets of data based on the specifications listed here (vector of conditions)

subsets.exclude

if subsets added, includes an un-subsetted version

weights

vector of weight variables names to add to runs, re-named if desired or, a weighting method (currenly accepts "ipw.calc" for inverse probability weighting)

weights.exclude

Includes an unweighted version where weights added

weights.ipw.vars

in addition to treatment variable, any other (factor or categorical) variables to consider when (re)weighting subsets

permutations

optional, number of permutations for p-curve

perm.pvalues

logical, calculates permutation test-based pvalues (if permutation test active)

perm.seed

optional, RNG seed to use for permutation test (integer, will create one if not present)

cluster

optional, Cluster robust standard errors

cluster.var

optional, Variable on which to cluster, string

robust.se

optional, heteroskedasticity-consistent standard error adjustment provided by package "sandwich". See details in ?vcovHC.

cat.percent

logical, displays summary output of end of the data for convenience in interactive mode. Set to false if using as a part of an Rmarkdown file.

keep.tidy.models

logical, set to false for large model samples

keep.full.models

logical, set to false for large model samples

model.only

logical, outputs the model for later use, rather than running (default is FALSE)

Value

depending on paramters, either a fitted s-curve object or a template for fitting an s-curve object


jmobrien/SpecCurve documentation built on Feb. 12, 2020, 11:35 a.m.