classifyTrips: Classification of VMS positions as fishing or steaming

Description Usage Arguments Details Value Examples

View source: R/classifyTrips.R

Description

Classifies positions as fishing or steaming using different techniques with VMS data. Possible techniques are: model-based clustering on speed data (with packages mclust or mixtools), model-based clustering with dependences on speed data (with the depmix package), model-based clustering on speed and hour of the day data (with the custom functions timeclust and circlust that into account that the hour of the day is circular data).

Usage

1
2
3
4
5
6
classifyTrips(
  data,
  methods = list(c("depmix", 3)),
  analysis = "vessel",
  runs = 3
)

Arguments

data

a data.frame with the VMS data. First column should contain time in POSIXlt format. Second column should contain the speed data. Columns 3 and 4 should contain the vessel id and the trip id respectively.

methods

a list of vectors with first element the method name and second element the number of clusters (if necessary). Different methods can be: depmix, mclust, mixtools, timeclust, circlust. If NULL it calculates the estimates from depmix and mclust with 2 and 3 clusters.

analysis

a character with the type of analysis, 'vessel' for vessel by vessel analysis, 'trip' for trip by trip analysis or 'all' to perform the analysis on the whole data set.

runs

an integer denoting the number of different runs of each method. (The inference doesn't guarantee a global optimum, so the maximum likelihood solution is chosen among different runs.)

Details

The labeling of the clusters required to perform the classification is performed by the function(s) callmix.labelling, classify.mixtools, classify.circular.

Value

A list of 2 elements: a data.frame with the input data and the resulting classification for each of the methods provided by the methods argument of the function. a list of lists containing the parameters infered by the relevant models. (Each list element, for each trip/ vessel of the analysis contains a list of parameters for each of the methods) In the depmix case, it is the outcome of the getpars command. In the mclust case, it is the parameters list of the output.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
res <- classifyTrips(DanishTrips, analysis='all')
misclassification <- function(v, s)
{
  d <- 0
  for (i in 1:length(v))
    if (v[i] != s[i])
      d <- d+1
    return(d/length(v)*100)
}
misclassification(res$states[[6]],DanishTrips$state_seq)

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