This function computes the modified BIC(mBIC), given a specific solution.
RSAVS_Compute_BIC(
y_vec,
x_mat,
beta_vec,
mu_vec,
loss_type,
loss_param,
phi,
a,
double_log_lik = TRUE
)
numerical vector of response. n = length(y_vec)
is the number of observations.
numerical matrix of covariates. p = ncol(x_mat)
is the number of covariates.
numerical vector of covariate effects
numerical vector of subgroup effect(intercept term) for each observations
type and parameters of the loss function
loss_type = "L1"
: L-1 loss, no actual parameter is needed.
loss_type = "L2"
: L-2 loss, no actual parameter is needed.
loss_type = "Huber"
, Huber loss, and c = loss_param[0]
, where c
is the parameter needed by huber loss. A popular choice is c = 1.345
.
a positive constant.
a scalar controlling the regression part of mBIC. If not provided, then the number of observation(n
) is used.
boolen, whether to use log logLik(double log likelihood) in the regression part of mBIC. Defaults to TRUE
.
the mBIC value.
$$BIC = log(1 / a * sum(loss(y - mu - x * beta)) + |S| * Phi ,$$ where
mu is the intercept term of each observation. And the number of subgroups is
K = length(unique(mu_vec))
.
beta is the covariate effect vector. And the number of active covariates is
Q = sum(beta_vec != 0)
.
the loss function is determined by loss_type
and loss_param
.
|S| is the complexity of the model and \(|S| = K + Q\).
Phi is a constant and Phi = phi * log(log(n + p)) * log(n) / n
.
Note that in most cases, sum(loss_fun)
corresponds to log likelihood.