Generate sample data with a count outcome for bs_count() examples
Source:R/sample-data.R
sample_ps_data_count.RdProduces a synthetic data frame with a Poisson-distributed count outcome
(rbc_tot, total intra-operative RBC units transfused), along with
baseline covariates and an optional multiply-imputed stacked format.
Mirrors the dataset used in tp.pm.count.balncing_score.sas.
Arguments
- n
Number of patients. Default
500L.- seed
Random seed. Default
42L. The fixed default gives the same demo dataset on every call.NULLdraws from the caller's random-number stream, asps_match()does: the data differ from call to call, andset.seed()before the call reproduces them. A negative seed gives the same data as its absolute value.- n_imputations
If
> 1, returnsn_imputationsdatasets stacked in the long format, with an_IMPUTATION_index column. Each is an independent draw ofnpatients, covariates and outcome alike, that reuses theidvalues1ton. They exercise the stacked format; they do not resemble real imputations, in which one patient's observed values and outcome agree across datasets. Default1L(single complete dataset).
Value
A data frame with columns: id, rbc_tot (count), age,
female, diabetes, hypertension, hct_pr (pre-op haematocrit),
cpb_time (cardiopulmonary bypass time, minutes), and optionally
_IMPUTATION_ when n_imputations > 1.
