
Bayesian regression samplers
morie_bayesian_regression.RdGibbs samplers for Bayesian ridge regression and the Bayesian alphabet used in genomic prediction.
Usage
morie_brr_gibbs(y, X, n_iter = 2000L, burn_in = 500L, nu = 5, nu_beta = 5, R2 = 0.5,
seed = 42L)Arguments
- y
numeric response vector
- X
predictor matrix
- n_iter
number of Gibbs iterations
- burn_in
iterations discarded as burn-in
- nu
argument
nu; not described in the source.- nu_beta
argument
nu_beta; not described in the source.- R2
argument
R2; not described in the source.- seed
argument
seed; not described in the source.
Value
A list holding the fitted quantities for the method called: point estimates, fitted values and any diagnostics it produces. See the individual method descriptions above for the components each returns.
Details
These functions mirror, in R, the implementations in the Python package
morie; the two are checked against each other by the parity
tests in tests/testthat/.
Examples
set.seed(6)
X <- matrix(rnorm(60), 20, 3)
y <- X %*% c(0.5, -0.3, 0.2) + rnorm(20, 0, 0.3)
morie_brr_gibbs(as.numeric(y), X, n_iter = 200L, burn_in = 50L, seed = 1L)
#> $mu
#> [1] -0.04873372
#>
#> $beta
#> [1] 0.43778331 -0.36021993 0.09793666
#>
#> $sigma2
#> [1] 0.1351945
#>
#> $sigma2_beta
#> [1] 0.3751684
#>
#> $n_kept
#> [1] 150
#>
#> $hyper
#> $hyper$S
#> [1] 1.840874
#>
#> $hyper$S_beta
#> [1] 1.840874
#>
#> $hyper$nu
#> [1] 5
#>
#> $hyper$nu_beta
#> [1] 5
#>
#> $hyper$var_y
#> [1] 0.525964
#>
#>