Helpful Stan Functions
|
Functions | |
array[] matrix | normal_marginal (matrix y, matrix mu_glm, vector sigma) |
array[] matrix | bernoulli_marginal (array[,] int y, matrix mu_glm, matrix u_raw) |
array[] matrix | binomial_marginal (array[,] int num, array[,] int den, matrix mu_glm, matrix u_raw) |
array[] matrix | poisson_marginal (array[,] int y, matrix mu_glm, matrix u_raw) |
real | centered_gaussian_copula_cholesky_lpdf (array[,] matrix marginals, matrix L) |
The mixed-discrete normal copula. The method is from Smith, Michael & Khaled, Mohamad. (2011). Estimation of Copula Models With Discrete Margins via Bayesian Data Augmentation. Journal of the American Statistical Association. 107. 10.2139/ssrn.1937983.
array[] matrix bernoulli_marginal | ( | array int | y[,], |
matrix | mu_glm, | ||
matrix | u_raw | ||
) |
Bernoulli marginal
Bernoulli marginal for mixed continuous-discrete Gaussian copula.
The lb and ub: if y == 0, upper bound at inv_Phi( y, mu ) if y == 1, lower bound at inv_Phi( y - 1, mu )
y | int[,] 2d array of binary outcomes |
mu_glm | matrix of regression means |
u_raw | matrix of nuisance latent variables |
array[] matrix binomial_marginal | ( | array int | num[,], |
array int | den[,], | ||
matrix | mu_glm, | ||
matrix | u_raw | ||
) |
Binomial marginal
Binomial marginal for mixed continuous-discrete Gaussian copula.
The lb and ub: Always upper bound at inv_Phi( y, mu ) If n != 0, lower bound at inv_Phi(n-1, mu)
num | int[,] 2D array of numerator integers |
den | int[,] 2D array of denominator integers |
mu_glm | matrix of regression means |
u_raw | matrix of nuisance latent variables |
real centered_gaussian_copula_cholesky_lpdf | ( | array matrix | marginals[,], |
matrix | L | ||
) |
Mixed Copula Log-Probability Function
marginals | Nested arrays of matrices from marginal calculations |
L | Cholesky Factor Correlation |
array[] matrix normal_marginal | ( | matrix | y, |
matrix | mu_glm, | ||
vector | sigma | ||
) |
Normal marginal
Standardized normal marginal for mixed continuous-discrete Gaussian copula.
y | matrix of normal outcomes |
mu_glm | row_vector of regression means |
matrix | vector of outcome SD's |
array[] matrix poisson_marginal | ( | array int | y[,], |
matrix | mu_glm, | ||
matrix | u_raw | ||
) |
Poisson marginal
Poisson marginal for mixed continuous-discrete Gaussian copula.
The lower-bound and upper-bound:
The upper-bound is always at
If \(y \ne 0\), lower-bound at
.
At \(y = 0\) the lower-bound is \( 0 \).
y | int[,] 2D array of integer counts |
mu_glm | matrix of regression means |
u_raw | matrix of nuisance latent variables |