# HuHuCAR.sim: Hu and Hu's General Covariate-Adaptive Randomization with... In carat: Covariate-Adaptive Randomization for Clinical Trials

## Description

Allocates patients to one of two treatments using general covariate-adaptive randomization proposed by Hu Y, Hu F (2012) <doi:10.1214/12-AOS983>, by simulating covariate profiles based on the assumption of independence between covariates and levels within each covariate.

## Usage

 ```1 2``` ```HuHuCAR.sim(n = 1000, cov_num = 2, level_num = c(2, 2), pr = rep(0.5, 4), omega = NULL, p = 0.85) ```

## Arguments

 `n` the number of patients. The default is `1000`. `cov_num` the number of covariates. The default is `2`. `level_num` a vector of level numbers for each covariate. Hence the length of `level_num` should be equal to the number of covariates. The default is `c(2, 2)`. `pr` a vector of probabilities. Under the assumption of independence between covariates, `pr` is a vector containing probabilities for each level of each covariate. The length of `pr` should correspond to the number of all levels, and the sum of the probabilities for each margin should be `1`. The default is `rep(0.5, 4)`, which corresponds to `cov_num = 2`, and `level_num = c(2, 2)`. `omega` a vector of weights at the overall, within-stratum, and within-covariate-margin levels. It is required that at least one element is larger than 0. If `omega = NULL` (default), the overall, within-stratum, and within-covariate-margin imbalances are weighted with porportions `0.2`, `0.3`, and `0.5/cov_num` for each covariate-margin, respectively, where `cov_num` is the number of covariates of interest. `p` the biased coin probability. `p` should be larger than `1/2` and less than `1`. The default is `0.85`.

## Details

See `HuHuCAR`.

## Value

See `HuHuCAR`.

## References

Hu Y, Hu F. Asymptotic properties of covariate-adaptive randomization[J]. The Annals of Statistics, 2012, 40(3): 1794-1815.

See `HuHuCAR` for allocating patients with complete covariate data; See `HuHuCAR.ui` for the command-line user interface.