View source: R/basic_functions.R
thetas_to_priors | R Documentation |
This function creates the priors on the variance and coefficients of the regressions from the three hyperparameters described in the mathematical description. The coefficients are assumed to have zero mean apriori, so only three prior elements are returned (the variance shape/scale, and the coefficnet variances).
thetas_to_priors(thetas, n, thresh = 0.001)
thetas |
3 real numbers representing the three hyperparameters; as it is on the log scale, it should generally be between -6 and 4 to avoid numerical issues (overflow or underflow) |
n |
the number of locations |
thresh |
the threshold for determining the number of neighbors based on the third hyperparameter, defaults to 1e-3 |
List of priors, where
the first element is a vector of length n containing the shape parameters of the IG prior on the variances,
the second element similarly is of length n containing the corresponding scale parameters, and
the last element is an n * m matrix, where each row contains the prior variances for the regression coefficients (i.e. the diagonal of the prior covariance matrix)
thetas_ex <- c(1, 1, 1) priors <- thetas_to_priors(thetas_ex, 100) #with smaller threshold (leading to larger number of neighbors) priors2 <- thetas_to_priors(thetas_ex, 500, thresh = 1e-6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.