nfd_stats: Compute Statistics on NFD Objects

View source: R/nfd_stats.R

nfd_statsR Documentation

Compute Statistics on NFD Objects

Description

nfd_stats() computes six basic statistics for each trace in any nfd type objects. nfd_pdf() computes an empirical PDF for each trace and returns the probabilities and magnitudes associated with the PDF.

Usage

nfd_stats(x, site, flow_space, time_step, plot = FALSE)

nfd_pdf(x, site, flow_space, time_step, which, breaks = NULL, plot = FALSE)

nfd_pdf_get_breaks(nfdpdf)

Arguments

x

An object inheriting from nfd.

site

The site to compute the stats for. Numeric or name (character).

flow_space

"total" or "intervening".

time_step

"monthly" or "annual".

plot

Boolean. If TRUE will show the plot. Otherwise, user can subsequently call plot() on the returned data.

which

The month to compute the cdf for. A vector including any/all values in 1:12. Ignored if time_step is annual. Will be sorted if passed in out of order.

breaks

Specifies how the breaks are computed in stats::density(), which is used by nfd_pdf(). If breaks is NULL, then the number of breaks defaults to 25. If breaks is a single number, that is the number of breaks that will be used. Otherwise, breaks specifies the breaks, i.e., the number of breaks, and the minimum (from) and maximum (to) breaks that are used in stats::density(). If specifiying for monthly data, breaks should be a matrix where there is a column for each month that a cdf will be computed for (which).

nfdpdf

An object inheriting from nfd_pdf.

Details

The basic statistics are mean, variance, minimum, maximum, lag-1 correlation, and skew. The resulting statistics are stored in a special data.frame - a nfd_stats object that inherits from data.frame. The resulting statistics can be plotted by calling plot() on the resulting object.

If using the output from nfd_pdf() to then specify the breaks for another call to nfd_pdf(), it is highly recommended to use nfd_pdf_get_breaks(). nfd_pdf_get_breaks() will return a matrix of all the breaks if nfdpdf contains monthly data, which is the format expected in nfd_pdf(). For annual data, it still works but is less necesary.

Value

nfd_stats data.frame.

nfd_pdf data.frame.

nfd_pdf_get_breaks() returns a numeric vector (for annual data) or matrix (for monthly data).

See Also

nfd, plot.nfd_stats(), plot.nfd_pdf()


BoulderCodeHub/CRSSIO documentation built on July 2, 2023, 5:15 p.m.