View source: R/find_invgamma_parms.R
| find_invgamma_parms | R Documentation |
Find parameters for Inverse gamma prior based on prior mean and one quantile
find_invgamma_parms(
lower_quantile,
upper_quantile,
response_variance,
lower_R2,
upper_R2,
probability,
plot_results = TRUE
)
lower_quantile |
lower quantile desired |
upper_quantile |
upper quantile desired |
response_variance |
variance of the response variable of the regression model |
lower_R2, upper_R2 |
We are a priori |
probability |
prior probability to be contained within the lower and upper quantiles |
plot_results |
logical. Should the resulting inverse gamma distribution be plotted? |
Either provide the lower and upper quantiles that contain probability
of the inverse gamma distribution, or if this is for linear regression, you
can specify that you are a priori probability sure that the coefficient
of determination (R^2) falls within the two bounds provided, assuming
that the residual variance is 1-R^2 times the total variance.
twice the shape and rate of the inverse gamma distribution.
# When aimed at linear regression via coefficient of determination...
hypothetical_s2_y = 2.0
lower_R2 = 0.05
upper_R2 = 0.85
find_invgamma_parms(response_variance = hypothetical_s2_y,
lower_R2 = lower_R2,
upper_R2 = upper_R2,
probability = 0.8)
# More arbitrary task...
find_invgamma_parms(0.3, # hypothetical_s2_y * (1.0 - upper_R2)
1.9, #hypothetical_s2_y * (1.0 - lower_R2)
probability = 0.8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.