timeclust: Model-based clustering for one-dimensional circular data.

Description Usage Arguments Value Examples

View source: R/timeclust.R

Description

Model-based clustering with two clusters for one-dimensional hour of the day data. Expectation maximization algorithm is implemented that takes into account that the hour of the day data are circular, i.e. 00:00 is the same as 24:00. The circularity is being handled by defining a truncated normal distribution.

Usage

1

Arguments

x

a vector with the hour of the day data.

Value

loglik

Final log-likelihood estimate of the EM algorithm.

parameters

Parameters inferred by the algorithm:

  • pro: Mixing proportion of each distribution.

  • mean: Means of the two clusters.

  • sigma: Sigmas of the two clusters.

  • z: Responsibilities.

classification

Classification of the datapoints to the clusters.

iter

Number of iterations of the algorithm.

Examples

1
2
3
4
5
6
7
8
x1 <- rnorm(100, 0, 3)
x1[x1<0] <- x1[x1<0]+24
x2 <- rnorm(80, 9, 2)
x <- c(x1,x2)
x <- x[sample.int(length(x))]
res <- timeclust(x)
cat('mixing proportions:',res$parameters$pro,'\nmeans:',
    res$parameters$mean,'\nsigmas:',res$parameters$sigma)

gilles-guillot/HMMVMS documentation built on Dec. 23, 2019, 6:30 p.m.