plot.shiftfit: Plot results of an range-shift fit

View source: R/plot.shiftfit.r

plot.shiftfitR Documentation

Plot results of an range-shift fit

Description

Plotting functions for illustrating the results of a range-shift fit.

Usage

## S3 method for class 'shiftfit'
plot(
  x,
  bars = FALSE,
  bar.params = c(n.sims = 1000, n.times = 100, n.bins = 10),
  plot.ts = TRUE,
  stretch = 0,
  pt.cex = 0.8,
  pt.col = "antiquewhite",
  CI.cols = NULL,
  layout = NULL,
  par = NULL,
  ...
)

Arguments

x

a fitted range shift object, i.e. output of the estimate_shift

bars

whether or not to draw "bars" - i.e. estimates of the range shift corridor (these are often poorly rendered and are a work in process)

bar.params

a vector of 3 simulation values, useful for smoothing the bars in the dumbbell plot. For smoothing, it might be recommended to increase the first value, n.sims - the number of draws from the fitted migation process.

plot.ts

whether or not to plot the time series as well

stretch

an extra parameter to extend the bars on the dumbbells (in real distance units).

pt.cex

point character expansion.

pt.col

points color.

CI.cols

three shading colors, from lightest to darkest. The default is a sequence of blues.

layout

the default layout places the x-y plot on the left and - if plot.ts==TRUE - the respective 1-d time series on the right.

par

graphics window parameters that, by default, look nice with the default layout.

...

additional parameters to pass to plot function (e.g. labels, title, etc.)

Examples

# load simulated tracks
data(SimulatedTracks)

# white noise fit
MWN.fit <- with(MWN.sim, estimate_shift(T=T, X=X, Y=Y))
# estimate_shift also works with POSIX class time. The following also works
MWN.fit <- with(MWN.sim, estimate_shift(T=strptime(MWN.sim$T,"%j", tz = "UTC"), X=X, Y=Y))
summary(MWN.fit)
plot(MWN.fit)

if(interactive()){
# OUF fit
MOUF.fit <- with(MOUF.sim.random, 
                estimate_shift(T=T, X=X, Y=Y, 
                               model = "ouf", 
                               method = "like"))
summary(MOUF.fit)
plot(MOUF.fit)

# Three range fit:
# it is helpful to have some initital values for these parameters 
# because the automated quickfit() method is unreliable for three ranges
# in the example, we set a seed that seems to work
# set.seed(1976)

 MOU.3range.fit <- with(MOU.3range, 
                       estimate_shift(T=T, X=X, Y=Y, 
                                      model = "ou", 
                                      method = "ar", 
                                      n.clust = 3))
 summary(MOU.3range.fit)
 plot(MOU.3range.fit)
}

EliGurarie/marcher documentation built on June 25, 2024, 5:16 a.m.