postK | R Documentation |
Marginal probability of K
postK(kstar, w, M, Y, cluster, sigma2, lambda, clusteri)
kstar |
A scalar with the number maximum of change points in all clusters |
w |
A scalar representing the minimum number of points in each interval between two change points |
M |
A scalar representing the number of points available for each data sequence |
Y |
A matrix M x N with the data sequences |
cluster |
A vector containing the cluster assignments for the data sequences (or its initial values) |
sigma2 |
A vector with the variances of the data sequences (or its initial values) |
lambda |
A scalar defining the parameter for the Truncate Poisson distribution that controls the number of change points (or its initial values) |
clusteri |
A scalar with the index of a cluster |
A numerical value corresponding to the sampled number of change points, k, for a given cluster
This function is called within the Gibbs sampler, but it can also de called separately.
[gibbs_alg()]
postK(kstar = 2, w = 10, M = 50, Y = data, cluster = c(1,1,2,1,2),
sigma2 = apply(data, 2, var), lambda = 2, clusteri = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.