Description Usage Arguments Value Examples
An fast implementation for sampling from the Gram-Schmidt Walk Design. Maintains a cholesky factorization of (I + A * A^T ) for faster repeated linear system solves and has a recursive component for more effective memory allocation.
1 2 3 4 5 6 7 8 9 | sample_gs_walk(X, phi, balanced = FALSE, treatment_probs = 0.5)
sample_many_gs_walk(
X,
phi,
num_samples,
balanced = FALSE,
treatment_probs = 0.5
)
|
X |
a n-by-x matrix with covariates to balance |
phi |
a real value in (0,1) specifying the balancing weight |
balanced |
set true to run the balanced version of the GSW design |
treatment_probs |
a vector of marginal assignment probabilities. If scalar, the probabilities for all units are set to the provided value. |
num_samples |
number of treatment assignments to sample. |
sample_gs_walk
returns a single logical vector containing the assignments.
sample_many_gs_walk
returns a list of num_samples
such vectors.
1 2 3 4 5 6 7 8 | ## Not run:
gswdesign_setup()
set_julia_seed(123456789L)
X <- matrix(rnorm(1000), nrow = 100)
assignment <- sample_gs_walk(X, 0.3)
assignments <- sample_many_gs_walk(X, 0.3, 1000L)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.