plot.momentuHMM {momentuHMM}R Documentation

Plot momentuHMM

Description

Plot the fitted step and angle densities over histograms of the data, transition probabilities as functions of the covariates, and maps of the animals' tracks colored by the decoded states.

Usage

## S3 method for class 'momentuHMM'
plot(
  x,
  animals = NULL,
  covs = NULL,
  ask = TRUE,
  breaks = "Sturges",
  hist.ylim = NULL,
  sepAnimals = FALSE,
  sepStates = FALSE,
  col = NULL,
  cumul = TRUE,
  plotTracks = TRUE,
  plotCI = FALSE,
  alpha = 0.95,
  plotStationary = FALSE,
  ...
)

Arguments

x

Object momentuHMM

animals

Vector of indices or IDs of animals for which information will be plotted. Default: NULL ; all animals are plotted.

covs

Data frame consisting of a single row indicating the covariate values to be used in plots. If none are specified, the means of any covariates appearing in the model are used (unless covariate is a factor, in which case the first factor in the data is used).

ask

If TRUE, the execution pauses between each plot.

breaks

Histogram parameter. See hist documentation.

hist.ylim

An optional named list of vectors specifying ylim=c(ymin,ymax) for the data stream histograms. See hist documentation. Default: NULL ; the function sets default values for all data streams.

sepAnimals

If TRUE, the data is split by individuals in the histograms. Default: FALSE.

sepStates

If TRUE, the data is split by states in the histograms. Default: FALSE.

col

Vector or colors for the states (one color per state).

cumul

If TRUE, the sum of weighted densities is plotted (default).

plotTracks

If TRUE, the Viterbi-decoded tracks are plotted (default).

plotCI

Logical indicating whether to include confidence intervals in natural parameter plots (default: FALSE)

alpha

Significance level of the confidence intervals (if plotCI=TRUE). Default: 0.95 (i.e. 95% CIs).

plotStationary

Logical indicating whether to plot the stationary state probabilities as a function of any covariates (default: FALSE). Ignored unless covariate are included in formula.

...

Additional arguments passed to graphics::plot and graphics::hist functions. These can currently include asp, cex, cex.axis, cex.lab, cex.legend, cex.main, legend.pos, and lwd. See par. legend.pos can be a single keyword from the list “bottomright”, “bottom”, “bottomleft”, “left”, “topleft”, “top”, “topright”, “right”, and “center”. Note that asp and cex only apply to plots of animal tracks.

Details

The state-dependent densities are weighted by the frequency of each state in the most probable state sequence (decoded with the function viterbi). For example, if the most probable state sequence indicates that one third of observations correspond to the first state, and two thirds to the second state, the plots of the densities in the first state are weighted by a factor 1/3, and in the second state by a factor 2/3.

Confidence intervals for natural parameters are calculated from the working parameter point and covariance estimates using finite-difference approximations of the first derivative for the transformation (see grad). For example, if dN is the numerical approximation of the first derivative of the transformation N = exp(x_1 * B_1 + x_2 * B_2) for covariates (x_1, x_2) and working parameters (B_1, B_2), then var(N)=dN %*% Sigma %*% dN, where Sigma=cov(B_1,B_2), and normal confidence intervals can be constructed as N +/- qnorm(1-(1-alpha)/2) * se(N).

Examples

# m is a momentuHMM object (as returned by fitHMM), automatically loaded with the package
m <- example$m

plot(m,ask=TRUE,animals=1,breaks=20,plotCI=TRUE)


[Package momentuHMM version 1.5.5 Index]