View source: R/simulate-su-hill.R
simulate_su_hill_data | R Documentation |
Sample n
observations with the following scheme:
Covariates: X_j ~ N(0,1)
.
Assignment: Z ~ Bin(n, p)
with p = logit^{-1}(a + X \gamma^L + Q \gamma^N)
where a = \omega - mean(X \gamma^L + Q \gamma^N)
.
Mean response: E(Y(0)|X) = X \beta_0^L + Q \beta_0^N
and E(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.
simulate_su_hill_data(
n,
treatment_linear = TRUE,
response_parallel = TRUE,
response_aligned = TRUE,
y_sd = 1,
tau = 4,
omega = 0,
add_categorical = FALSE,
n_subjects = 0,
sd_subjects = 1,
coef_categorical_treatment = NULL,
coef_categorical_nontreatment = NULL
)
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) |
n_subjects |
How many subjects are there? For repeated observations. (Hill and Su = 0, default) |
sd_subjects |
Random effect intercept standard deviation for subjects. (Not in Hill and Su. Used if n_subjects > 0) |
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) |
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
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 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.