lor_lag_to_indep: Identify lag at which serial dependence is no longer present

Description Usage Arguments Details Value Examples

View source: R/lor_lag_to_indep.R

Description

This function identifies the spatial or temporal lag at which serial dependence is no longer present in binary data by determining when the first derivative of the pairwise log-odds ratios with respect to Δt reaches zero. It allows for non-zero asymptotic log-odds ratios due to non-stationarity in the mean process or among-site variation.

Usage

1
2
lor_lag_to_indep(data, n_knots = 5, plot_results = TRUE, outDir = "",
  plot_title = "", plot_x_title = "Lag")

Arguments

data

output of lorelogram function.

n_knots

numeric. Number of knots in the smoothing cubic spline (see splines::bs for details).

plot_results

logical. Create a .jpg plot of the results (default: TRUE)?

outDir

character. Directory into which .csv and plot file are saved.

plot_title

character. Title of the plot (default: NULL).

plot_x_title

character. Title of x-axis of the plot (default: Lag).

Details

data should be a data.frame containing the output of the lorelogram function.

First, a cubic spline is fitted to the pairwise log-odds ratios estimated by the lorelogram function at the series of sampling occassions separated in time or space. Then, the first derivative of the spline curve is calculated. The lag at which the first derivative is closest to 0 (in absolute value) is returned. Users should visually inspect the plot of the first derivative function to ensure the lorelogram asymptotes and that this lag results in a minimum.

Value

The function returns the minimum interval length necessary to approximate independence in the data.

Examples

1
2
3
data(GrayFox_Hour)
lor <- lorelogram(GrayFox_Hour, max_lag = 30)
lor_lag_to_indep(lor)

FabiolaIannarilli/lorelogram documentation built on March 4, 2020, 12:16 p.m.