View source: R/solve_for_hiershrink_scale.R
solve_for_hiershrink_scale | R Documentation |
This function calculates a numerical-based solution to the quantity c / sigma
in the equation at the end of first paragraph on page e50. It is intended to
be provided as the value for beta_orig_scale and beta_aug_scale in the
functions glm_sab
, glm_nab
, and glm_standard
solve_for_hiershrink_scale(
target_mean,
npar,
local_dof = 1,
global_dof = 1,
slab_dof = Inf,
slab_scale = 15,
n,
tol = .Machine$double.eps^0.5,
max_iter = 100,
n_sim = 2e+05,
slab_precision = NULL
)
target_mean |
(pos. reals): the desired prior number of effective parameters (tilde xi_eff in Boonstra and Barbaro). An error will be thrown if target_mean > npar |
npar |
(pos. integers): the number of covariates. |
local_dof |
(pos. integer) number indicating the degrees of freedom for lambda_j. Boonstra and Barbaro always used local_dof = 1. Choose a negative value to tell the function that there are no local hyperparameters. |
global_dof |
(pos. integer) number indicating the degrees of freedom for tau. Boonstra and Barbaro always used global_dof = 1. Choose a negative value to tell the function that there is no global hyperparameter. |
slab_dof |
see |
slab_scale |
(pos. real) these control the slab-part of the regularized
horseshoe. Specifically, in the notation of Boonstra and Barbaro,
d^2~InverseGamma( |
n |
(pos. integer) sample size of the study |
tol |
(pos. real) numerical tolerance for convergence of solution |
max_iter |
(pos. integer) maximum number of iterations to run without convergence before giving up |
n_sim |
(pos. integer) number of simulated draws from the underlying student-t hyperpriors to calculate the Monte Carlo-based approximation of the expectation. |
slab_precision |
(pos. real) the slab-part of the regularized horseshoe,
this is equivalent to (1/d)^2 in the notation of Boonstra and Barbaro. If
specified, it is assumed that you want a fixed slab component and will take
precedence over any provided values of |
If the outcome of interest is binary, then sigma doesn't actually exist as a
real parameter, and it will be set equal to 2 inside glm_sab
, glm_nab
,
or glm_standard
. If the outcome of interest is continuous, then sigma is
equipped with its own weak prior. In either case, it is not intended that the
user scale by sigma "manually".
A list
containing the following named elements:
scalethe solution, interpreted as c / sigma
diff_from_targetthe difference between the numerical value and the target, should be close to zero
iternumber of iterations performed
prior_numthe resulting value of m_eff corresponding to this solution
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.