# Multi-variate half-normal or half-student-t distribution

Hi, is it possible to specific a multi-variate half-normal or half-student-t distribution? As a matter of fact, is the uni-variate half-N(0,1) a real Stan syntax? I saw it in the Prior Recommendation page but I cannot find it in the manual to learn more about it. Thanks.

``````data {
int <lower = 1> N;
}
parameters {
vector <lower = 0> [N] x;
}
model {
target += normal_lpdf(x | 0.0, 1.0);
}
``````

specifies an `N`-dimensional half-normal prior on `x`.

Hi, this is not what I was after. I am looking for a correlated half-normal or correlated half-student-t distribution in N-dimensional space. Sorry for not being clear.

Is the covariance matrix of the half-(normal | Student-t) distribution a parameter or is it part of the prior?

If it is a parameter, then a multivariate normal, defined in terms of the Cholesky factor of its covariance matrix, truncated at 0 can be coded as:

``````data {
int <lower = 1> N;
}
transformed data {
vector [N] zero_vec = rep_vector(0.0, N);
}
parameters {
vector <lower = 0> [N] x;

// Cholesky
cholesky_factor_corr [N] L_omega;
// vector of prior standard deviations
vector <lower=0> [N] L_sigma;
}
model {
target += multi_normal_cholesky_lpdf(x | zero_vec, diag_pre_multiply(L_sigma, L_omega));
target += lkj_corr_cholesky_lpdf(L_omega | 5.0);
target += normal_lpdf(L_sigma | 0.0, 1.0);
}
``````

If it is part of the prior, then `L_omega` and `L_sigma` could be computed in the `transformed data` block, or outside of Stan.

I don’t actually know how to answer your question. But I have duration data on the individuals, but for multiple events. My analysis is to model the each time-to-event using exponential or Weibull distribution. However, the parameters for distributions between events are correlated. Since the parameters are positive for exponential or Weibull distribution, I believe I need to use a multi-variate distribution restricted to the positive numbers. Thanks

Tricky! Some follow up questions (though I think we are getting a bit off topic here):

• Do you have any covariates? Or just the individual, event type, and time from study entry to event?
• Is the set of events the same for all individuals? Perhaps you could build some kind of model?

If you want to ask more questions about your data / possible model, then I’d recommend starting a new topic :)

2 Likes

Hey there, check out the link above. Maybe that’s what you need?

Cheers,
Max