| simulate_su_hill_data {tidytreatment} | R Documentation |
Simulate data with scenarios from Hill and Su (2013)
Description
Sample n observations with the following scheme:
Covariates:
X_j ~ N(0,1).Assignment:
Z ~ Bin(n, p)withp = logit^{-1}(a + X \gamma^L + Q \gamma^N)wherea = \omega - mean(X \gamma^L + Q \gamma^N).Mean response:
E(Y(0)|X) = X \beta_0^L + Q \beta_0^NandE(Y(1)|X) = X \beta_1^L + Q \beta_1^N.Observation:
Y ~ N(\mu,\sigma_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 |