zyp.trend.csv: zyp.trend.csv

View source: R/zyp.R

zyp.trend.csvR Documentation

zyp.trend.csv

Description

Computes prewhitened nonlinear trends on CSV files or data frames with 0 to n columns of metadata, with 1 row per location and each column containing data for a particular time (day, month, year). The zyp package allows you to use either Zhang's method, or the Yue Pilon method of computing nonlinear prewhitened trends.

Usage

zyp.trend.dataframe(indat, metadata.cols, method=c("zhang", "yuepilon"),
                    conf.intervals=TRUE, preserve.range.for.sig.test=FALSE)
zyp.trend.csv(filename, output.filename, metadata.cols,
              method=c("zhang", "yuepilon"), conf.intervals=TRUE,
              csv.header=TRUE, preserve.range.for.sig.test=FALSE)

Arguments

indat

the input data frame.

filename

the filename of the input CSV file.

output.filename

the filename to write output to.

metadata.cols

the number of columns of metadata.

method

the prewhitened trend method to use.

conf.intervals

whether to compute a 95 percent confidence interval based on all possible slopes.

preserve.range.for.sig.test

whether to re-inflate values by dividing by (1 - ac) following removal of autocorrelation prior to computation of significance.

csv.header

whether the input CSV file has a header.

Details

These routines compute prewhitened nonlinear trends on either CSV files with or without a header or data frames with 0 to n columns of metadata (which is preserved in the output). Each row is expected to contain metadata followed by a timeseries, and all rows are expected to have the same length of timeseries. NA values are handled correctly, so if you have several timeseries of unequal length you can pad them with NA values to provide valid input.

The prewhitened trend computation methods used are either Zhang's method (described in Wang and Swail, 2001) or Yue and Pilon's method (described in Yue and Pilon, 2002).

Value

A data frame containing the trends, in the case of zyp.trend.dataframe. Columns of the output are as follows.

lbound

the lower bound of the trend's confidence interval.

trend

the Sen's slope (trend) per unit time.

trendp

the Sen's slope (trend) over the time period.

ubound

the upper bound of the trend's confidence interval.

tau

Kendall's tau statistic computed on the final detrended timeseries.

sig

Kendall's P-value computed for the final detrended timeseries.

nruns

the number of runs required to converge upon a trend.

autocor

the autocorrelation of the final detrended timeseries.

valid_frac

the fraction of the data which is valid (not NA) once autocorrelation is removed.

linear

the least squares fit trend on the same dat.

intercept

the intercept of the Sen's slope (trend).

lbound_intercept

the lower bound of the estimate of the intercept of the Sen's slope (trend).

ubound_intercept

the upper bound of the estimate of the intercept of the Sen's slope (trend).

See Also

zyp.trend.vector.

Examples

## Not run: 
zyp.trend.csv("in.csv", "out.csv", 2, "yuepilon", F)
trends <- zyp.trend.dataframe(indat, 2, "yuepilon")

## End(Not run)

zyp documentation built on March 31, 2023, 10:04 p.m.

Related to zyp.trend.csv in zyp...