assess: Assess Generalizability of Randomized Trial to Population

Description Usage Arguments Details

View source: R/assess.R

Description

This function, given a stacked data frame containing both sample and population data, assesses the generalizability of the sample to the population on given covariates.

Usage

1
2
3
4
5
6
7
8
9
assess(
  trial,
  selection_covariates,
  data,
  selection_method = "lr",
  is_data_disjoint = TRUE,
  trim_pop = FALSE,
  seed = 12222
)

Arguments

trial

variable name denoting binary trial participation (1 = trial participant, 0 = not trial participant)

selection_covariates

vector of covariate names in data set that predict trial participation

data

data frame comprised of "stacked" trial and target population data

selection_method

method to estimate the probability of trial participation. Default is logistic regression ("lr"). Other methods supported are Random Forests ("rf") and Lasso ("lasso")

is_data_disjoint

logical. If TRUE, then trial and population data are considered independent. This affects calculation of the weights - see details for more information.

trim_pop

logical. If TRUE, then population data are subset to exclude individuals with covariates outside bounds of trial covariates.

seed

numeric. By default, the seed is set to 12222, otherwise can be specified (such as for simulation purposes).

Details

'assess_wrap()' is a wrapper for this function that allows assessment over levels of a grouping variable.


katiecoburn/generalizeR documentation built on Oct. 28, 2020, 4:43 a.m.