Description Usage Arguments Value Examples
MCMC method for generating vectors with multivariate normal distribution using Gibbs sampler.
1 | gbs_norm(n, mu, A, init, burn = 1000)
|
n |
The numbers of samples one wants to obtain. |
mu, A |
Parameters for normal distribution, mu being the mean vecter while A being the covariance matrix |
init |
The initial value vector, which indicates the dimensions. |
burn |
Times of iterations one wants to omit before recording. |
A "mcmcn" object 'list("chain" = chain)' with chain storing samples by row.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Generating Multivariate Normal Distribution Samples------------------------
# provide some parameters
# mu <- c(1,3)
# A <- matrix(c(1, 0.1, 0.1, 1), nrow = 2)
# generating random variates using function `gibbs_norm`
x.norm <- gbs_norm(10000, c(1,3), matrix(c(1, 0.1, 0.1, 1), nrow = 2), c(1,3), burn = 0)
# exploring the results
summary(x.norm)
plot(x.norm)
qqnorm(x.norm$chain[, 1], main = "QQ plot, 1st variable")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.