
Setting Default Values in clustGLMM
default_varying.RdSets default values for the hyperparameters of the priors default_param, indicators of group-specificity default_varying, integer and double valued tuning parameters default_tuning and indicators of what variables should be saved default_save.
Usage
default_param(sparse = TRUE, ...)
default_save(...)
default_tuning(experience = FALSE, ...)
default_varying(...)Details
If arguments param, save, tuning and varying of clustGLMM are not specified, these functions are used to create the default values. They can also be used to create prototypical param, varying, tuning and save argument specifications and then adjust them.
Value
The output of default_varying is a named vector that contains a Boolean for each model parameter that may be considered group-specific. The default values are:
varying["prec_num"] = TRUEgroup-specific precisions for numeric outcomes,
varying["c_ord"] = TRUEgroup-specific ordered intercepts for ordinal outcomes,
varying["InvSigma"] = FALSEgroup-invariant combined precision matrix for all random effects,
varying["InvQ"] = FALSEgroup-invariant precision matrix used in prior for
InvSigma,varying["naY"] = FALSEgroup-invariant imputed missing outcome values.
The output of default_save is a named vector that contains a Boolean for each model parameter including some transformed parameters indicating if they are saved and included in the return object. The default values are:
save["beta_num_fix"] = TRUEfixed effects for numeric outcomes,
save["beta_num"] = TRUEgroup-specific effects for numeric outcomes,
save["prec_num"] = TRUEprecisions for numeric outcomes,
save["sd_num"] = TRUEstandard deviations for numeric outcomes (transformed from
prec_num),save["var_num"] = TRUEvariances for numeric outcomes (transformed from
prec_num),save["beta_poi_fix"] = TRUEfixed effects for count outcomes,
save["beta_poi"] = TRUEgroup-specific effects for count outcomes,
save["beta_bin_fix"] = TRUEfixed effects for binary outcomes,
save["beta_bin"] = TRUEgroup-specific effects for binary outcomes,
save["beta_ord_fix"] = TRUEfixed effects for ordinal outcomes,
save["beta_ord"] = TRUEgroup-specific effects for ordinal outcomes,
save["c_ord"] = TRUEordered intercepts for ordinal outcomes,
save["a_ord"] = FALSEtransformed ordered intercepts for ordinal outcomes into unrestricted variables,
save["pi_ord"] = TRUEtransformed
a_ordinto probabilities,save["beta_cat_fix"] = TRUEfixed effects for general categorical outcomes,
save["beta_cat"] = TRUEgroup-specific effects for general categorical outcomes,
save["InvSigma"] = TRUEcombined precision matrix for all random effects,
save["Sigma"] = TRUEcombined covariance matrix for all random effects (transformed from
InvSigma),save["sdSigma"] = TRUEstandard deviations for all random effects (transformed from
InvSigma),save["corSigma"] = TRUEcorrelations between all random effects (transformed from
InvSigma),save["detInvSigma"] = FALSEdeterminant of
InvSigmamatrix,save["InvQ"] = FALSEprecision matrix used in prior for
InvSigma,save["Q"] = FALSEcovariance matrix used in prior for
InvSigma(transformed fromInvQ),save["detInvQ"] = FALSEdeterminant of
InvQmatrix,save["b"] = FALSEa matrix of random effects for all outcomes and units,
save["w"] = TRUEmixture weights of length
Gthat sum up to 1,save["ng"] = TRUEcluster occupancies of length
Gthat sum up to number of units,save["loglik"] = TRUENOT a log-likelihood but a very crude approximation to it created as an easy to evaluate byproduct of full-conditional cluster allocation probabilities,
save["pUig"] = FALSEa matrix of full-conditional cluster allocation probabilities,
save["U"] = TRUEa vector of current allocations of units into clusters (values in
1, ..., G),save["Gplus"] = TRUEa number of non-empty components,
save["e0"] = TRUEprecision parameter for prior of
w,save["naY"] = FALSEimputed missing outcome values.
The output of default_param is a named list that contains values of the hyperparameters needed to set up the priors. The default values are:
param[["InvSigma_df"]] = 1prior degrees of freedom for Wishart prior for
InvSigma(dimension of this matrix is automatically added to this value),param[["InvQ_df"]] = 1prior degrees of freedom for Wishart prior for
InvQ(dimension of this matrix is automatically added to this value),param[["prec_num_shp"]] = 1prior shape for precision parameter
prec_numfor numeric outcomes,param[["prec_num_rte"]] = 10prior rate for precision parameter
prec_numfor numeric outcomes,param[["beta_num_fix_sd"]] = 1standard deviation for fixed effects for numeric outcomes,
param[["beta_num_sd"]] = 1standard deviation for group-specific effects for numeric outcomes,
param[["beta_poi_fix_sd"]] = 1standard deviation for fixed effects for count outcomes,
param[["beta_poi_sd"]] = 1standard deviation for group-specific effects for count outcomes,
param[["beta_bin_fix_sd"]] = 1standard deviation for fixed effects for binary outcomes,
param[["beta_bin_sd"]] = 1standard deviation for group-specific effects for binary outcomes,
param[["beta_ord_fix_sd"]] = 1standard deviation for fixed effects for ordinal outcomes,
param[["beta_ord_sd"]] = 1standard deviation for group-specific effects for ordinal outcomes,
param[["api_prior"]] = 1prior parameter for Dirichlet distribution of
pi_ord(same for all levels),param[["beta_cat_fix_sd"]] = 1standard deviation for fixed effects for general categorical outcomes,
param[["beta_cat_sd"]] = 1standard deviation for group-specific effects for general categorical outcomes,
param[["init_b_sd"]] = 0.01standard deviation for sampling initial values of random effects
b,param[["e0_shp"]] = 1prior shape of
e0,param[["e0_rte"]] = 100prior rate of
e0,param[["InvV"]] = 0.01diagonal element of the prior inverse scale matrix for
InvQ.
By adjusting the values of e0_shp and e0_rte different levels of sparsity can be achieved.
The lower e0_shp/e0_rte is, the more sparse results are expected.
With sparse = TRUE the prior distribution is a gamma distribution with e0_shp = 1 and e0_rte = 100.
Otherwise e0_shp = 4 and e0_rte = 1 will be used, which prefers non-sparse solutions.
The output of default_tuning is a named list of parameters that tune the sampling algorithm. For clarity, the parameters are split into two sublists depending on the expected type (integer or double). The default values are:
$integer$freq_proposal_update = 10every
freq_proposal_updateiterations change the proposal distributions for Metropolis steps,$integer$times_proposal = 1how many times a new state is proposed within one Metropolis step,
$integer$maxiter = 25maximum iterations allowed during Newton-Raphson update of proposal distribution,
$integer$maxnrep = 100maximum number of repetitions of Newton-Raphson with a different start location,
$integer$kspec_bi_cat = 0Boolean as integer, if
TRUEthen each categorical outcome has a different set of random effects for each ofKcat-1levels,$double$const_proposal_beta_poi_fix = 1.0constant by which the proposal direction for
beta_poi_fixis multiplied (const_proposal^2 to variance),$double$const_proposal_beta_poi = 1.0constant by which the proposal direction for
beta_poiis multiplied (const_proposal^2 to variance),$double$const_proposal_beta_bin_fix = 1.0constant by which the proposal direction for
beta_bin_fixis multiplied (const_proposal^2 to variance),$double$const_proposal_beta_bin = 1.0constant by which the proposal direction for
beta_binis multiplied (const_proposal^2 to variance),$double$const_proposal_beta_ord_fix = 1.0constant by which the proposal direction for
beta_ord_fixis multiplied (const_proposal^2 to variance),$double$const_proposal_beta_ord = 1.0constant by which the proposal direction for
beta_ordis multiplied (const_proposal^2 to variance),$double$const_proposal_beta_cat_fix = 1.0constant by which the proposal direction for
beta_cat_fixis multiplied (const_proposal^2 to variance),$double$const_proposal_beta_cat = 1.0constant by which the proposal direction for
beta_catis multiplied (const_proposal^2 to variance),$double$const_proposal_a_ord = 1.0constant by which the proposal direction for
a_ordis multiplied (const_proposal^2 to variance),$double$const_proposal_b = 1.0constant by which the proposal direction for
bis multiplied (const_proposal^2 to variance),$double$const_proposal_e0 = 1.0constant by which the proposal direction for
e0is multiplied (const_proposal^2 to variance),$double$df_proposal_beta_poi_fix = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofbeta_poi_fix,$double$df_proposal_beta_poi = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofbeta_poi,$double$df_proposal_beta_bin_fix = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofbeta_bin_fix,$double$df_proposal_beta_bin = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofbeta_bin,$double$df_proposal_beta_ord_fix = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofbeta_ord_fix,$double$df_proposal_beta_ord = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofbeta_ord,$double$df_proposal_beta_cat_fix = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofbeta_cat_fix,$double$df_proposal_beta_cat = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofbeta_cat,$double$df_proposal_a_ord = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofa_ord,$double$df_proposal_b = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofb,$double$df_proposal_e0 = Infthe degrees of freedom for multivariate Student-t proposal (
Infresults in standard multivariate normal proposal) ofe0,$double$tolerance = 1e-07tolerance when computing the norm of the shift within Newton-Raphson.
With experience = TRUE the chosen values will be set to those proven suitable from empirical experience.
References
Vávra, J., Komárek, A., Grün, B., Malsiner-Walli, G. Clusterwise multivariate regression of mixed-type panel data. Stat Comput 34, 46 (2024). https://doi.org/10.1007/s11222-023-10304-5
Examples
(param <- default_param())
#> $InvSigma_df
#> [1] 1
#>
#> $InvQ_df
#> [1] 1
#>
#> $prec_num_shp
#> [1] 1
#>
#> $prec_num_rte
#> [1] 10
#>
#> $beta_num_fix_sd
#> [1] 1
#>
#> $beta_num_sd
#> [1] 1
#>
#> $beta_poi_fix_sd
#> [1] 1
#>
#> $beta_poi_sd
#> [1] 1
#>
#> $beta_bin_fix_sd
#> [1] 1
#>
#> $beta_bin_sd
#> [1] 1
#>
#> $beta_ord_fix_sd
#> [1] 1
#>
#> $beta_ord_sd
#> [1] 1
#>
#> $api_prior
#> [1] 1
#>
#> $beta_cat_fix_sd
#> [1] 1
#>
#> $beta_cat_sd
#> [1] 1
#>
#> $init_b_sd
#> [1] 0.01
#>
#> $e0_shp
#> [1] 1
#>
#> $e0_rte
#> [1] 100
#>
#> $InvV
#> [1] 0.01
#>
(param <- default_param(sparse = FALSE))
#> $InvSigma_df
#> [1] 1
#>
#> $InvQ_df
#> [1] 1
#>
#> $prec_num_shp
#> [1] 1
#>
#> $prec_num_rte
#> [1] 10
#>
#> $beta_num_fix_sd
#> [1] 1
#>
#> $beta_num_sd
#> [1] 1
#>
#> $beta_poi_fix_sd
#> [1] 1
#>
#> $beta_poi_sd
#> [1] 1
#>
#> $beta_bin_fix_sd
#> [1] 1
#>
#> $beta_bin_sd
#> [1] 1
#>
#> $beta_ord_fix_sd
#> [1] 1
#>
#> $beta_ord_sd
#> [1] 1
#>
#> $api_prior
#> [1] 1
#>
#> $beta_cat_fix_sd
#> [1] 1
#>
#> $beta_cat_sd
#> [1] 1
#>
#> $init_b_sd
#> [1] 0.01
#>
#> $e0_shp
#> [1] 4
#>
#> $e0_rte
#> [1] 1
#>
#> $InvV
#> [1] 0.01
#>
(save <- default_save())
#> beta_num_fix beta_num prec_num sd_num var_num beta_poi_fix
#> TRUE TRUE TRUE TRUE TRUE TRUE
#> beta_poi beta_bin_fix beta_bin beta_ord_fix beta_ord c_ord
#> TRUE TRUE TRUE TRUE TRUE TRUE
#> a_ord pi_ord beta_cat_fix beta_cat InvSigma Sigma
#> FALSE TRUE TRUE TRUE TRUE TRUE
#> sdSigma corSigma detInvSigma InvQ Q detInvQ
#> TRUE TRUE FALSE FALSE FALSE FALSE
#> b w ng loglik pUig U
#> FALSE TRUE TRUE TRUE FALSE TRUE
#> Gplus e0 naY
#> TRUE TRUE FALSE
(tuning <- default_tuning())
#> $integer
#> $integer$freq_proposal_update
#> [1] 10
#>
#> $integer$times_proposal
#> [1] 1
#>
#> $integer$maxiter
#> [1] 25
#>
#> $integer$maxnrep
#> [1] 100
#>
#> $integer$kspec_bi_cat
#> [1] 0
#>
#>
#> $double
#> $double$const_proposal_beta_poi_fix
#> [1] 1
#>
#> $double$const_proposal_beta_poi
#> [1] 1
#>
#> $double$const_proposal_beta_bin_fix
#> [1] 1
#>
#> $double$const_proposal_beta_bin
#> [1] 1
#>
#> $double$const_proposal_beta_ord_fix
#> [1] 1
#>
#> $double$const_proposal_beta_ord
#> [1] 1
#>
#> $double$const_proposal_beta_cat_fix
#> [1] 1
#>
#> $double$const_proposal_beta_cat
#> [1] 1
#>
#> $double$const_proposal_a_ord
#> [1] 1
#>
#> $double$const_proposal_b
#> [1] 1
#>
#> $double$const_proposal_e0
#> [1] 1
#>
#> $double$df_proposal_beta_poi_fix
#> [1] Inf
#>
#> $double$df_proposal_beta_poi
#> [1] Inf
#>
#> $double$df_proposal_beta_bin_fix
#> [1] Inf
#>
#> $double$df_proposal_beta_bin
#> [1] Inf
#>
#> $double$df_proposal_beta_ord_fix
#> [1] Inf
#>
#> $double$df_proposal_beta_ord
#> [1] Inf
#>
#> $double$df_proposal_beta_cat_fix
#> [1] Inf
#>
#> $double$df_proposal_beta_cat
#> [1] Inf
#>
#> $double$df_proposal_a_ord
#> [1] Inf
#>
#> $double$df_proposal_b
#> [1] Inf
#>
#> $double$df_proposal_e0
#> [1] Inf
#>
#> $double$tolerance
#> [1] 1e-07
#>
#>
(tuning <- default_tuning(experience = TRUE))
#> $integer
#> $integer$freq_proposal_update
#> [1] 10
#>
#> $integer$times_proposal
#> [1] 10
#>
#> $integer$maxiter
#> [1] 25
#>
#> $integer$maxnrep
#> [1] 100
#>
#> $integer$kspec_bi_cat
#> [1] 0
#>
#>
#> $double
#> $double$const_proposal_beta_poi_fix
#> [1] 1
#>
#> $double$const_proposal_beta_poi
#> [1] 1
#>
#> $double$const_proposal_beta_bin_fix
#> [1] 1
#>
#> $double$const_proposal_beta_bin
#> [1] 1
#>
#> $double$const_proposal_beta_ord_fix
#> [1] 0.5
#>
#> $double$const_proposal_beta_ord
#> [1] 0.5
#>
#> $double$const_proposal_beta_cat_fix
#> [1] 1
#>
#> $double$const_proposal_beta_cat
#> [1] 1
#>
#> $double$const_proposal_a_ord
#> [1] 0.5
#>
#> $double$const_proposal_b
#> [1] 0.5
#>
#> $double$const_proposal_e0
#> [1] 1
#>
#> $double$df_proposal_beta_poi_fix
#> [1] Inf
#>
#> $double$df_proposal_beta_poi
#> [1] Inf
#>
#> $double$df_proposal_beta_bin_fix
#> [1] Inf
#>
#> $double$df_proposal_beta_bin
#> [1] Inf
#>
#> $double$df_proposal_beta_ord_fix
#> [1] Inf
#>
#> $double$df_proposal_beta_ord
#> [1] Inf
#>
#> $double$df_proposal_beta_cat_fix
#> [1] Inf
#>
#> $double$df_proposal_beta_cat
#> [1] Inf
#>
#> $double$df_proposal_a_ord
#> [1] Inf
#>
#> $double$df_proposal_b
#> [1] Inf
#>
#> $double$df_proposal_e0
#> [1] Inf
#>
#> $double$tolerance
#> [1] 1e-07
#>
#>
(varying <- default_varying())
#> prec_num c_ord InvSigma InvQ naY
#> TRUE TRUE FALSE FALSE FALSE