sample.z {cbass}R Documentation

Draw samples of independent normals (matrix) given previous sample, and maximal values

Description

Draw samples of independent normals (matrix) given previous sample, and maximal values

Usage

sample.z(mu, y, z)

Arguments

mu

n by d matrix of latent means

y

n-length vector of maximal indices

z

n by d matrix of latent random variables

Value

A new sample of n by d matrix of latent random variables

Examples

set.seed(1)
n <- 100;  d <- 3
mu <- matrix(rnorm(n*d), n, d)
bound <- qnorm(1/d^(1/(d-1)))
mu[,1] <- bound
z <- mu
z[,-1] <- rnorm(length(mu[,-1]), mu[,-1], 1)
y <- apply(z, 1, which.max)
z.new <- sample.z(mu, y, z)
all(apply(z.new, 1, which.max) == y)

[Package cbass version 0.1 Index]