| give_id | R Documentation |
This function can be used to decode the classified classes by the model generates using hyreg2 or hyreg2_het and see,
which group or observation was signed to which class
give_id(data, model, id_col = NULL)
data |
a |
model |
a flexmix |
id_col |
|
dataframe of two columns, first column named as provided id_col or "observation" if id_col was not given as
an input. second column named "mod_comp" indicating the assigned class for this group or observation
Svenja Elkenkamp & John Grosser
# estimate a model using simulated_data_rnorm
### using grouping variable id ####
formula <- y ~ -1 + x1 + x2 + x3 | id
k <- 1
stv <- setNames(c(0.2,0.2,0.2,1,1),c(colnames(simulated_data_norm)[3:5],c("sigma","theta")))
control <- list(iter.max = 1000, verbose = 4)
hyflex_mod <- hyreg2(formula = formula,
data = simulated_data_norm,
type = simulated_data_norm$type,
stv = stv,
k = k,
type_cont = "TTO",
type_dich = "DCE_A",
opt_method = "L-BFGS-B",
control = control,
latent = "both",
id_col = "id"
)
# use of function give_id
give_id(data = simulated_data_norm,
model = hyflex_mod,
id_col = "id")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.