Learn R Programming

BayesCPclust (version 0.1.0)

postK: Marginal probability of K

Description

Marginal probability of K

Usage

postK(kstar, w, M, Y, cluster, sigma2, lambda, clusteri)

Value

A numerical value corresponding to the sampled number of change points, k, for a given cluster

Arguments

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

See Also

[gibbs_alg()]

Examples

Run this code
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)

Run the code above in your browser using DataLab