<<< identity_func >>>
real identity_func(real x) {
    return x;
}
<<<>>>

<<< inv_func >>>
real inv_func(real x) {
    return 1 / x;
}
<<<>>>

<<< square_func >>>
real square_func(real x) {
    return x^2;
}
<<<>>>

<<< inv_square_func >>>
real inv_square_func(real x) {
    return 1 / x^2;
}
<<<>>>

<<< inv_cauchit_func >>>
real inv_cauchit_func(real x) {
    return atan(x) / pi() + 0.5;
}
<<<>>>

<<< Gamma_lpdf >>>
real Gamma_lpdf(real x, real mu, real alpha) {
    return gamma_lpdf(x | alpha, alpha / mu);
}
<<<>>>

<<< inv_gaussian_lpdf >>>
real inv_gaussian_lpdf(real x, real mu, real lambda) {
    real constant = log(lambda) / 2.0 - log(2 * pi()) / 2.0;
    real kernel = -1.5 * log(x) - lambda * pow(x - mu, 2) / (2 * x * pow(mu, 2));
    return constant + kernel;
}
<<<>>>

<<< survival_Cox_lpdf >>>
real survival_Cox_lpdf(real x, real mu, real theta, int delta) {
    real term1 = theta + mu + (exp(theta) - 1) * log(x);
    real term2 = exp(mu) * pow(x, exp(theta));
    return delta * term1 - term2;
} 
<<<>>>

<<< survival_AFT_lpdf >>>
real survival_AFT_lpdf(real x, real mu, real sigma, int delta) {
    real term1 = normal_lccdf(log(x) | mu, sigma);
    real term2 = normal_lpdf(log(x) | mu, sigma);
    return (1 - delta) * term1 + delta * term2;
} 
<<<>>>

