simulate_su_hill_data: Simulate data with scenarios from Hill and Su (2013)

View source: R/simulate-su-hill.R

simulate_su_hill_dataR Documentation

Simulate data with scenarios from Hill and Su (2013)

Description

Sample n observations with the following scheme:

  1. Covariates: X_j ~ N(0,1).

  2. Assignment: Z ~ Bin(n, p) with p = logit^{-1}(a + X γ^L + Q γ^N) where a = ω - mean(X γ^L + Q γ^N).

  3. Mean response: E(Y(0)|X) = X β_0^L + Q β_0^N and E(Y(1)|X) = X β_1^L + Q β_1^N.

  4. Observation: Y ~ N(μ,σ_y^2)).

Superscript L denotes the linear components, whilst N denotes the non-linear components.

Usage

simulate_su_hill_data(
  n,
  treatment_linear = TRUE,
  response_parallel = TRUE,
  response_aligned = TRUE,
  y_sd = 1,
  tau = 4,
  omega = 0,
  add_categorical = FALSE,
  coef_categorical_treatment = NULL,
  coef_categorical_nontreatment = NULL
)

Arguments

n

Size of simulated sample.

treatment_linear

Treatment assignment mechanism is linear?

response_parallel

Response surface is parallel?

response_aligned

Response surface is aligned?

y_sd

Observation noise.

tau

Treatment effect for parallel response surfaces. Not applicable if surface is nonparallel.

omega

Offset to control treatment assignment ratios.

add_categorical

Should a categorical variable be added? (Not in Hill and Su)

coef_categorical_treatment

What are the coefficients of the categorical variable under treatment? (Not in Hill and Su)

coef_categorical_nontreatment

What are the coefficients of the categorical variable under nontreatment? (Not in Hill and Su)

Details

Coefficients used are returned in the list this function creates. See Table 1 in Su and Hill (2013) for the table of coefficients. The X_j are in a data.frame named data in the returned list. The formula for the model matrix [X,Q] is named su_hill_formula in the returned list. The coefficients used for the model matrix are contained in coefs. The Su and Hill (2013) simulations did not include categorical variables, but you can add them here using arguments: add_categorical, coef_categorical_treatment, coef_categorical_nontreatment.

Hill, Jennifer; Su, Yu-Sung. Ann. Appl. Stat. 7 (2013), no. 3, 1386–1420. doi:10.1214/13-AOAS630. https://projecteuclid.org/euclid.aoas/1380804800

Value

An object of class suhillsim that is a list with elements

data

Simulated data in data.frame

mean_y

The mean y values for each individual (row)

args

List of arguments passed to function

formulas

Response formulas used to generate data

coefs

Coefficients for the formulas


tidytreatment documentation built on March 18, 2022, 6:30 p.m.