R/data.R

#' Simulated Survey Observational Data
#'
#' A simulated dataset drawn from a survey-weighted observational study with
#' treatment-dependent (retrospective) sampling. Contains 6 covariates, a
#' binary treatment indicator, observed outcome, and survey design weights.
#' The true PATE is approximately 0.8 and the true PATT approximately 1.0.
#'
#' @format A data frame with approximately 120 rows and 9 variables:
#' \describe{
#'   \item{Y}{Observed outcome (continuous).}
#'   \item{Z}{Binary treatment indicator (1 = treated, 0 = control).}
#'   \item{X1, X2, X3, X4, X5, X6}{Pre-treatment covariates (continuous).
#'     The true propensity and prognostic models include an \code{X1:X2}
#'     interaction.}
#'   \item{survey_weight}{Survey design weight (inverse selection probability).}
#' }
#'
#' @details
#' Generated by a simulation where:
#' \itemize{
#'   \item Treatment assignment: \eqn{P(Z=1|X) = \text{logit}^{-1}(0.3 + 0.6 X_1 + 0.4 X_2 - 0.3 X_3 + 0.2 X_1 X_2)}.
#'   \item Outcome model: \eqn{Y(0) = 1 + X_1 + 0.5 X_2 - 0.3 X_3 + 0.2 X_4 + 0.3 X_1 X_2 + \varepsilon},
#'     with treatment effect \eqn{\tau(X) = 0.8 + 0.2 X_1}.
#'   \item Survey selection: treatment-dependent (retrospective) with
#'     \eqn{P(S=1|Z,X) = \text{logit}^{-1}(-2 + 0.3 Z + 0.2 X_1 + 0.15 X_2)}.
#' }
#'
#' @examples
#' data(survey_obs)
#' head(survey_obs)
#'
#' # Estimate PATE
#' fit <- wdsmatchATE(Y = survey_obs$Y, X = survey_obs[, 3:8],
#'                    Z = survey_obs$Z, weights = survey_obs$survey_weight,
#'                    M = 3, varest = FALSE)
#' fit
#'
#' @source Simulated data; see \code{data-raw/make_survey_data.R}.
"survey_obs"

Try the wdsmatch package in your browser

Any scripts or data that you put into this service are public.

wdsmatch documentation built on Sept. 12, 2026, 1:06 a.m.