segmentation {segclust2d}R Documentation

Segmentation of movement data - Generic function

Description

Segmentation of movement data. No clustering. Method available for data.frame, move and ltraj object. The algorithm finds for each number of segment the optimal segmentation using a Dynamic Programming approach. The number of segment is then chosen using Lavielle's (2005) procedure based on locating rupture in the penalized likelihood.

Usage

segmentation(x, ...)

## S3 method for class 'data.frame'
segmentation(x, ...)

## S3 method for class 'Move'
segmentation(x, ...)

## S3 method for class 'ltraj'
segmentation(x, ...)

segmentation_internal(
  x,
  seg.var,
  diag.var,
  order.var,
  lmin,
  Kmax,
  scale.variable,
  sameSigma = FALSE,
  ...
)

Arguments

x

data.frame with observations

...

additional parameters given to chooseseg_lavielle

seg.var

names of the variables used for segmentation (either one or two names).

diag.var

names of the variables on which statistics are calculated.

order.var

names of the variable with which states are ordered.

lmin

minimum length of segments.

Kmax

maximum number of segments.

scale.variable

TRUE or FALSE for automatic scaling of variables (reduction and centering)

sameSigma

does segments have same variance ?

Value

a segmentation-class object

Examples

df <-  test_data()$data
#' # data is a data.frame with column 'x' and 'y'
# Simple segmentation with automatic subsampling
# if data has more than 1000 rows:
res <- segmentation(df, Kmax = 30, lmin = 10, seg.var = c("x","y"))
 # Plot results
 plot(res)
 segmap(res)
 # check likelihood of alternative number of segment possible. There should
 # be a clear break if the segmentation is good
 plot_likelihood(res)
## Not run: 
# Advanced options:
# Run with automatic subsampling if df has more than 500 rows:
res <- segmentation(df, Kmax = 30, lmin = 10,
 seg.var = c("x","y"),  subsample_over = 500)

# Run with subsampling by 2:
res <- segmentation(df, Kmax = 30, lmin = 10, 
seg.var = c("x","y"), subsample_by = 2)
 
# Disable subsampling:
res <- segmentation(df, Kmax = 30, lmin = 10,
 seg.var = c("x","y"), subsample = FALSE)

# Run on other kind of variables : 
 res <- segmentation(df, Kmax = 30, lmin = 10, seg.var = c("dist","angle"))
 
# Automatic scaling of variables for segmentation 
(set a mean of 0 and a standard deviation of 1 for both variables)

 res <- segmentation(df, Kmax = 30, lmin = 10, 
 seg.var = c("dist","angle"), scale.variable = TRUE)
 

## End(Not run)

[Package segclust2d version 0.3.3 Index]