hybrid_simultanee: 'hybrid_simultanee' performs a simultaneous seg - clustering...

Description Usage Arguments Value Examples

View source: R/hybrid_simultanee.R

Description

It is an algorithm which combines dynamic programming and the EM algorithm to calculate the MLE of phi and T, which are the mixture parameters and the change point instants. this algorithm is run for a given number of clusters, and estimates the parameters for a segmentation/clustering model with P clusters and 1:Kmax segments

Usage

1
hybrid_simultanee(x, P, Kmax, lmin, sameSigma = TRUE)

Arguments

x

the two-dimensionnal signal, one line per dimension

P

the number of classes

Kmax

the maximal number of segments

Value

a list with tau posterior probability

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
K  <- 5; rupt <- sample(1:20, K+1, replace=TRUE); rupt <- cumsum(rupt); 
n <- max(rupt)
muSim <- matrix(rnorm(2*K+2,  mean=20, sd=5), nrow=2) 
muSim <- apply(muSim,1, cumsum)
muSim <- t(muSim)
sdSim <- matrix(sqrt(1/rgamma(2*K+2, shape = 10, rate = 10)), nrow=2)
print(muSim)
pos <- lapply(1:(K+1), function(d) 1*(rupt[d]<(1:n )))
pos <- Reduce('+', x=pos)+1
x <- matrix(rnorm(2*length(pos), mean=muSim[,pos], sd=sdSim[,pos]), nrow=2)
bisig_plot(x = x)
n  = dim(x)[2]
res <- hybrid_simultanee(x, P=2, Kmax=10)
Kopt=5
param <- res$param[[Kopt]]
bisig_plot(x = x, rupt = param$rupt, mu=param$phi$mu )

MarieEtienne/segTraj documentation built on May 7, 2019, 2:51 p.m.