I guess, we can assign any prior to the covariance matrix in usual manner as follows.
model {
for (dart in 1:n_of_darts) xy[dart] ~ multi_normal(mu, sigma);
sigma[1,1] ~ normal(1,prior);
}
Here, in the second line, I put a prior (prior
is arbitrarily fixed number) on the first component of the covariance matrix.
Generally speaking, the set of all positive definite symmetric matrices is a convex cone.
To ensure the covariance matrix of size 2,2 is in this cone, at least, we have to assume a certain prior to ensure the following inequalities.
a>0, ad - bc >0, \cdots \cdots \cdots(1)
b=c, \cdots \cdots \cdots(2)
for the covariance matrix
a,b
c,d
So, I guess, already, the declaration cov_matrix[2] sigma;
assigns certain prior whose support is in the convex cone defined by the equations (1) and (2) . So, I want to know what probability distribution is defined on the convex cone consisting of all positive definite symmetric matrices. Is there any famous (natural) distribution on the cone? Or is there any document about the default prior on the convex cone?
In the following, I show the code in which I put a prior on the first component of the covariance matrix.
library("MASS")
n_of_darts <- 55
Sigma <- matrix(c(10,3,3,2),2,2)
Sigma
mu <- c(0, 104)
xy <- mvrnorm(n = n_of_darts, mu, Sigma)
scode <- "data {
int<lower=1> n_of_darts; // number of darts thrown
matrix[n_of_darts, 2] xy; // actual xy coordinates
row_vector[2] mu; // [0,104]
real <lower=0> prior;
}
parameters {
cov_matrix[2] sigma;
}
model {
for (dart in 1:n_of_darts) xy[dart] ~ multi_normal(mu, sigma);
sigma[1,1] ~ normal(1,prior);
}"
f1 <- stan(model_code = scode, data = list(n_of_darts=n_of_darts, xy=xy, mu= mu, prior=1) , iter = 100, verbose = FALSE)
f2 <- stan(model_code = scode, data = list(n_of_darts=n_of_darts, xy=xy, mu= mu, prior=0.00001) , iter = 100, verbose = FALSE)
f1
f2