Skip to contents

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

assess(
  data,
  guided = TRUE,
  sample_indicator,
  covariates,
  estimation_method = "lr",
  disjoint_data = TRUE,
  trim_pop = FALSE
)

Arguments

data

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

guided

logical. Default is TRUE. If FALSE, then user must enter all arguments in function to bypass guided mode

sample_indicator

variable name denoting sample membership (1 = in sample, 0 = out of sample)

covariates

vector of covariate names in data set that predict sample membership

estimation_method

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

disjoint_data

logical. If TRUE, then sample and population data are considered disjoint. 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 sample covariates.

Value

returns generalizeR_assess object that includes the generalizability index, propensity scores, and a covariate table