View source: R/normal_block_sequential.R
| normal_block_sequential | R Documentation |
Fits the two model families one after the other: a mean-block model (NormalBlockMeanBase) groups the variables by how they respond to the covariates, then a variance-block model (NormalBlockVarBase) groups the residuals of that fit by how they co-vary. The two answer different questions and generally return unrelated partitions, so running both is often more informative than choosing one.
normal_block_sequential(
data,
blocks_mean,
blocks_var,
crit = c("ICL", "BIC"),
zero_inflation = FALSE,
control_mean = NB_control(verbose = FALSE),
control_var = NB_control(verbose = FALSE)
)
data |
a NormalBlockData object |
blocks_mean |
number of clusters for the mean-block stage: an integer,
a vector of integers to explore, or a p x q indicator matrix. It can also be
a mean-block model or collection already fitted on |
blocks_var |
idem for the variance-block stage, run on the residuals |
crit |
criterion used to pick a model when a range is explored, "ICL" (the default) or "BIC" |
zero_inflation |
whether Y carries structural zeros. Both stages are then zero-inflated, sharing the same mask: the second one would otherwise re-derive it from residuals, which are never exactly zero. |
control_mean |
control list for the mean-block stage, see |
control_var |
control list for the variance-block stage |
The second stage uses an intercept-only design on purpose: the covariate effects have already been removed by the first stage.
This is a heuristic two-stage estimator, not a joint model.
an object of class normal_block_sequential, a list with the fitted
mean and var models and the residual matrix residuals handed from one
stage to the other.
ex <- generate_normal_block_mean_data(n = 80, p = 20, d = 1, q = 3)
data <- NormalBlockData$new(ex$Y, ex$X)
fit <- normal_block_sequential(data, blocks_mean = 3, blocks_var = 2)
fit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.