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.

1 2 3 4 5 | ```
zyp.trend.dataframe(indat, metadata.cols, method=c("yuepilon", "zhang"),
conf.intervals=TRUE, preserve.range.for.sig.test=TRUE)
zyp.trend.csv(filename, output.filename, metadata.cols,
method=c("yuepilon", "zhang"), conf.intervals=TRUE,
csv.header=TRUE, preserve.range.for.sig.test=TRUE)
``` |

`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. |

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).

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). |

`zyp.trend.vector`

, zyp-package.

1 2 | ```
#zyp.trend.csv("in.csv", "out.csv", 2, "yuepilon", F)
#trends <- zyp.trend.dataframe(indat, 2, "yuepilon")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.