Greetings folks

I am a new user of the Stan programing language, and I could use some help with the implementation of a bivariate response variable following the Alpha-Skew Normal distribution.

For instance, let’s consider (Y_1,Y_2) \sim \text{bi-ASN}([\mu_1,\mu_2]',\Sigma,[\alpha_1,\alpha_2]') and the pdf is

f(y_1,y_2|\mu_1,\mu_2,\sigma_1,\sigma_2,\rho,\alpha_1,\alpha_2)=\frac{1 + (1-\alpha_1(\frac{y_1-\mu_1}{\sigma_1})-\alpha_2(\frac{y_2-\mu_2}{\sigma_2}))^2}{K}\phi_{\mathbb{Y}}(y_1,y_2)

whereas K=2+\alpha_1^2+\alpha_2^2+2\alpha_1\alpha_2\rho and the \phi_{\mathbb{Y}}(\cdot) is the bivariate normal dist. density (further details, Louzada, Ara & Fernandes, 2016).

```
functions{
real biASN_log(matrix y, vector mu, vector a, real s1, real s2, real r){
real prob = 0;
for (i in 1:(num_elements(y))){
prob += log((1-a[1]*((y[i][1]-mu[1])/s1)-a[2]*((y[i][2]-mu[2])/s2))^2+1)-
log(s1*s2*sqrt(1-r^2)*(2+a[1]^2+a[2]^2+2*a[1]*a[2]*r))-
((((y[i,1]-mu[1])/s1)^2+((y[i,2]-mu[2])/s2)^2-2*r*((y[i,1]-mu[1])/s1)*((y[i,2]-mu[2])/s2))/(1-r^2));
}
return prob;
}
}
data {
int<lower=0> N; // number of data items
matrix[N,2] Y; // outcome matrix
}
parameters {
row_vector[2] mu; // Location parameter
row_vector[2] a; // Asymmetry parameter (alpha)
real<lower=0> s1; // Sqrt of variances for Y1
real<lower=0> s2; // Sqrt of variances for Y2
real<lower=0> r; // correlation parameter
}
model {
// Priors
to_vector(mu) ~ normal(0,10);
to_vector(a) ~ exponential(0.5);
// Likelihood
Y ~ biASN(mu,a,s1,s2,r);
}
```

However, I am getting an error in the model’s likelihood line “Available argument signatures for biASN: Real return type required for probability function”.

Thanks in advance for the support!