Description Usage Arguments Details Value Author(s) References Examples
These functions allow to perform a segmentation and clustering of a
time series using the hybrid algorithm of Picard (2006). The function
picard
implements this approach either from a series of
observation or from an animal trajectory. The function plot
can then be used to plot the results.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
x |
for |
P |
an integer value indicating the number of classes used for the segmentation. |
Kmax |
an integer value indicating the maximum number of segments expected in the series. |
pos |
optionnally, a vector containing the same number of elements as x, corresponding to the "coordinates" of each observation in the series (e.g. the dates corresponding to each observation). |
which |
a character vector of length 2 indicating which variables of the object ltraj are to be used in the segmentation process (these variables may be selected in the infolocs component of the object). |
axes |
a logical value indicating whether the x and y axes are to be plotted. |
number |
optionally, an integer value indicating which of the two variable is to be plotted (by default, both variables are stored). |
addparam |
a logical value indicating whether the parameters (mean and sd) should be plotted. |
bg |
a logical value indicating whether colored rectangle indicating the model corresponding to each segment should be drawn in the background |
... |
additional arguments to be passed from or to other functions |
The method of Picard (2006)... to be continued.
The function picard
returns a list containing the following
elements:
Linc |
a vector containing the log-likelihood for the best segmentation of the signal with K-segment |
param |
a list containing the parameters of the segmentation with
one element per value of K; each element is itself a list
containing: (i) a list named |
Clement Calenge clement.calenge@oncfs.gouv.fr Marie-Pierre Etienne marie.etienne@agroparistech.fr Emilie Lebarbier emilie.lebarbier@agroparistech.fr
Picard, F. 2006. Process segmentation/clustering. Application to the analysis of CGH microarray data. PhD thesis, University Paris XI, Orsay.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ############################################
##
## Example 1:
set.seed(879)
## Generates a series with 3 segments
x1 <- c(rnorm(30, 3, 1), rnorm(20, 8, 1), rnorm(10, 3, 1))
x2 <- c(rnorm(30, -2, 2), rnorm(20, 5, 2), rnorm(10, -2, 2))
xk <- cbind(x1,x2)
## fits the segmentation:
seg <- picard(xk, 2, Kmax = 5)
## Plot the result:
## the models
plot(seg)
## show the parameters for the first variable
plot(seg, number = 1, bg = FALSE, addparam = TRUE)
## show the parameters for the first variable
plot(seg, number = 2, bg = FALSE, addparam = TRUE)
############################################
##
## Example 2: no clear sequence
set.seed(980)
x <- cbind(rnorm(50), rnorm(50))
seg2 <- picard(x, 3, 8)
## Les segments sont definis par deux obs a chaque fois
## bizarre, non?
plot(seg2)
## Au passage
## Les resultats sont identiques quand on utilise
## hybrid_simultanee:
oo <- hybrid_simultanee(t(x), 3, 8)
## Je retrouve la meme chose avec des vrais trajets
############################################
##
## Example 3: wild boar
data(puechcirc)
pu <- puechcirc[1]
seg3 <- picard(pu, 2, 7)
plot(seg3)
## bizarre, non?
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.