# Determining accuracy of darts player using xy coordinates of each throw and multivaratie distribution

Hi all,

My goal is to determine the throwing accuracy of a darts player. Let’s assume that he/she aims for triple 20 (T20). We can divide the darts board into xy coordinates. The xy-coordinates of target µ T20 are

µ = [0, 104]

Let [x y] denote the xy coordinates of the actual observed dart throws. We can write the following model

[x, y] ~ N(µ, Σ)

Using the documentation about multivariate outcomes I come up with the following Stan-model

``````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]
}

parameters {
cov_matrix[2] sigma;
}

model {
for (dart in in 1:n_of_darts)
xy[dart] ~ multi_normal(mu, sigma);
}
``````

How can I assign a prior to the covariance matrix? In addition, do you see room for improvement in this model?

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``````