Description Usage Arguments Value
Function to perform Gibbs scan only for the observations associated with either i or j (randomly chosen), but not including the cluster indicator for i or j. This function does not change the cluster observation i or j currently is in, because the restricted Gibbs scan only updates other observations in S by randomly assigning them to the cluster with i or j.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | restricted_gibbs(
Y,
zsa,
zsb,
cia,
cib,
cja,
cjb,
ni,
nj,
i,
j,
S,
ns,
b,
active,
Q,
p,
theta,
psi
)
|
Y |
multivariate binary data (row for subjects, column for dimensions) |
zsa |
cluster assignment indicators prior to updating (transition from in MH) |
zsb |
cluster assignment indicators after updating (transition to in MH; same below.) both zsa and zsb will be set to zs when active is true, because we want the zs to be modified/updated. |
cia, cja |
cluster indicator for subject i,j prior to updating |
cib, cjb |
cluster indicator for subject i,j after updating |
ni, nj |
the number of subjects clustered with i (j) - including i (j). |
i, j |
two distinct subjects' indices |
S |
the set of indices clustered with either i or j (including i and j) |
ns |
size of S |
b |
gamma in the Dirichlet distribution in MFM. |
active |
TRUE for performing a split update (both updating cluster indicators and computing the transition probabilities), FALSE otherwise (only for calculating proposal density; used in q(Z|Z_merge) = q(Z|Z_launch)). |
Q |
a Q matrix of dimension M by L |
p |
a vector of machine (factor) prevalences of length M |
theta |
a vector of true positive rates of length L |
psi |
a vector of false positive rates of length L |
log_p
the log probability of transitioning from zsa to zsb (product of all subjects in S);
ni,nj
the number of subjects assigned to cluster for i,j
zsb
updated assignment indicators for subjects in S
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.