update_Q: update the Q matrix element-wise

Description Usage Arguments Value

View source: R/sample_mcmc.R

Description

This function updates Q matrix by Gibbs sampler (with option to do constrained updates within the identifiability constraint). Only used when Q is not known. NB: - do we need M here? do we modify M after collapsing partner machines. - need to speed up.

Usage

1
update_Q(Y, Q_old, H, z, t, mylist, p, theta, psi, constrained = FALSE)

Arguments

Y

binary data matrix

Q_old

the Q matrix from the last scan in Gibbs sampler (of dimension M by L)

H

matrix of latent state profiles, rows for N subjects, columns for M latent states

z

a vector of individual cluster indicators

t

the number of clusters at a particular iteration

mylist

the ordered list that keeps the cluster ids in increasing order

p

Latent state prevalences; a vector of length identical to the columns of H.

theta, psi

True and false positive rates. Both are vectors of length L

constrained

Default to FALSE; Set to TRUE if doing constrained Gibbs sampling within identifiability constraints.

Value

A Q matrix with all its elements updated.


zhenkewu/rewind documentation built on Sept. 9, 2020, 3:40 p.m.