Setting up a Gibbs Sampler for Multivariate Normal Distribution

14 visualizaciones (últimos 30 días)
Lukas Riegler el 1 de Mzo. de 2021
Editada: Lukas Riegler el 5 de Mzo. de 2021
Good evening,
I am trying to write a code for Gibbs Sampling, for my master thesis. Unfortunately I have litlle to no experience in programming or writing code. Hence, I ran into some troubles.
I have three variables that need to be considered i call them x,y,z for simplicity.
In order to sample from the conditional distribution I need the mean vector and Covarince Matrix. However, i do not know how to write the vectors which are contaning 1x2 matrices.
So for example the mean vector would be {\mathbf {x}}={\begin{bmatrix}{\mathbf {mu}}_{1}\\{\mathbf {mu}}_{2}\end{bmatrix}}{\text{ with sizes }}{\begin{bmatrix}q\times 1\\(N-q)\times 1\end{bmatrix}}. How can i create in the first line my mu1 where I have an 1x1 "matrix" and in the second row my 2x1 matrix with mu2 and mu3?
Maybe someone could help me figuring this problem out?
Best, Lukas
0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Sindhu Karri el 5 de Mzo. de 2021
Editada: Sindhu Karri el 5 de Mzo. de 2021
Hii,
According to my understanding of the question ,I suppose ,you want to create a variable whose elements are matrices.This can be done by using structures.You can use struct function to create structures, mean function to calculate mean,cov function to calculate covariance matrix.
0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Categorías

Más información sobre Gamma Distribution en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by