R/data.R

# ======================================================================================
# WMAP PACKAGE - DEMO DATASET
# ======================================================================================

# This file contains documentation for the demo dataset used in examples

# ======================================================================================
# VERSION HISTORY
# ======================================================================================

# Version 1.3 - Documentation Improvements
#               * Added roxygen2 documentation to all functions
#               * Removed data(demo, envir = environment()) line
#                 data.R should only contain documentation. Actual data
#                 can be loaded with the data() call.

# ======================================================================================

#' Demo Dataset for WMAP Examples
#'
#' A demonstration dataset containing multi-site, multi-group observational data for 
#' testing WMAP weighting methods. The data simulates a study of breast cancer subtypes
#' across mutliple hospitals.
#'
#' @title Demo Dataset
#' @description A dataset containing example data for demonstration purposes.
#'
#' @docType data
#' @name demo
#' @aliases S X Y Z groupNames naturalGroupProp
#' @usage data(demo)
#' @format An rda object, with 450 observations and the following variables:
#' \describe{
#'   \item{S}{A vector of factor levels, representing the study memberships.}
#'   \item{Z}{A vector of factor levels, representing the group memberships.}
#'   \item{X}{A covariate matrix.}
#'   \item{Y}{An outcome matrix.}
#'   \item{naturalGroupProp}{The relative group prevalences of the larger natural population. Necessary only for FLEXOR weights; it should be skipped for IC and IGO weights.}
#'   \item{groupNames}{Disease subtype names "IDC" or "ILC"}
#' }
#'
#' @seealso
#' \code{\link{balancing.weights}} for computing weights
#' \code{\link{causal.estimate}} for estimating causal effects
#'
#' @examples
#' # Load the demo dataset
#' \donttest{
#' data(demo)
#'
#' # Examine the structure
#' str(S) # Study memberships
#' str(Z) # Group memberships
#' table(S, Z) # Cross-tabulation of studies and groups
#'
#' # Basic usage with IC method
#' weights <- balancing.weights(S, Z, X, method = "IC", naturalGroupProp)
#' summary(weights)
#'
#' # Full causal analysis
#' results <- causal.estimate(S, Z, X, Y, B = 10, method = "IC", naturalGroupProp)
#' summary(results)
#' plot(results)
#' }
#' 
NULL

Try the WMAP package in your browser

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

WMAP documentation built on Oct. 6, 2026, 1:07 a.m.