Conditional posterior distribution of the bivariate latents (Y,Z)

Share:

Description

This function simulates form the conditional posterior distribution of the latents (Y,Z).

Usage

1
fcondYZXA(x, distr, Tauy, Tauz, J)

Details

For internal use.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## The function is currently defined as
function (x, distr = 1, Tauy, Tauz, J) 
{
    K <- matrix(NA, nrow = length(Tauy), ncol = length(x))
    for (i in seq(Tauy)) {
        K[i, ] <- dk(x, distr = distr, mu = Tauy[i], sigma = Tauz[i]) * 
            J[i]
    }
    if (any(is.na(K))) 
        print(K, Tauy, Tauz, J)
    pK <- prop.table(K, margin = 2)
    j <- apply(pK, 2, function(x) sample(length(Tauy), size = 1, 
        prob = x))
    return(matrix(c(y = Tauy[j], z = Tauz[j]), nrow = length(x), 
        ncol = 2))
  }

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.