Description Usage Arguments Value Author(s) References Examples
View source: R/Bayesian_Linear_Regression.R
Bayesian Linear Regression with Normal-Inverse Gamma prior.
1 | posterior_nig(formula, data, m, M, a, b)
|
formula |
A string fromula. |
data |
A data frame with your data including response. |
m |
A matrix with the hyperparameter of the mean for the normal distribution. |
M |
A matrix with the hyperparameter of the covariance for the normal distribution. |
a |
A number of hyperparameter for the gamma distribution. |
b |
A number of hyperparameter for the gamma distribution. |
A list with the estimated coefficients and standard deviations of the model from the Classical and Bayesian approach
Camilo Gonzalez <cigonzalez2@uc.cl>
L. Fahrmeir, T. Kneib, S. Lang, and B. Marx, Regression: Models, Methods and Applications. Springer-Verlag GmbH, 2013.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Noninformative Prior (same results Bayesian and Classical Linear Regression)
m <- matrix(0, nrow = 2, ncol = 1)
M <- diag(10000000000000000000, 2)
a <- 0.000000000000000000000000001
b <- 0.000000000000000000000000001
test <- posterior_nig(
formula = 'dist ~ speed',
data = cars,
m = m,
M = M,
a = a,
b = b
)
test$classic_coef
test$classic_sigma
test$bayesian_coef
test$bayesian_sigma
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.