View source: R/pre_define_functions.r
RSAVS_Mu_to_Mat | R Documentation |
This function generate the group id matrix according to the subgroup effect vector mu_vec.
RSAVS_Mu_to_Mat(mu_vec)
mu_vec |
a length-n vector of the subgroup effect. |
n = length(mu_vec) is the number of observations.
p = length(unique(mu_vec)) is the number of subgroups.
res: a (n * p) matrix. Each row is for one observation and res[i, j] = 1 if i \in
group_j and res[i, j] = 0 o.w.
In the result, 1st observation of mu_vec will always be in the 1st subgroup.
set.seed(1024)
mu_vec <- sample(c(0.5, 0, -0.5), size = 10, replace = TRUE)
group_id_mat <- RSAVS:::RSAVS_Mu_to_Mat(mu_vec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.