From 0f6883134a60fb5b2e854b91a786e16ac6053b2e Mon Sep 17 00:00:00 2001 From: Maia Kapur <39382798+mkapur-noaa@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:24:34 -0800 Subject: [PATCH] doc gam based functions --- NAMESPACE | 4 ++++ man/Deriv.Rd | 27 +++++++++++++++++++++++++++ man/check_Deriv.Rd | 25 +++++++++++++++++++++++++ man/check_data.Rd | 26 ++++++++++++++++++++++++++ man/confint_Deriv.Rd | 23 +++++++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 man/Deriv.Rd create mode 100644 man/check_Deriv.Rd create mode 100644 man/check_data.Rd create mode 100644 man/confint_Deriv.Rd diff --git a/NAMESPACE b/NAMESPACE index 6ae9268..5c6b8c9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,2 +1,6 @@ # Generated by roxygen2: do not edit by hand +export(Deriv) +export(check_Deriv) +export(check_data) +export(confint_Deriv) diff --git a/man/Deriv.Rd b/man/Deriv.Rd new file mode 100644 index 0000000..cab63c5 --- /dev/null +++ b/man/Deriv.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/Deriv.R +\name{Deriv} +\alias{Deriv} +\title{Evaluate first derivative of GAM smooth(s), adapted from +\href{https://gist.githubusercontent.com/gavinsimpson/e73f011fdaaab4bb5a30/raw/82118ee30c9ef1254795d2ec6d356a664cc138ab/Deriv.R}{Gavin Simpson}.} +\usage{ +Deriv(mod, n = 200, eps = 1e-04, newdata, term) +} +\arguments{ +\item{mod}{the output of {mgcv::gam()}} + +\item{n}{number of intervals over which to evaluate each smooth. default 200.} + +\item{eps}{tolerance threshold. default 1e-4.} + +\item{newdata}{optional; data.frame of new smooth parameters to evaluate} + +\item{term}{string smooth name, i.e. "year". must match values in mod and newdata} +} +\value{ +a vector of derivative values of length n +} +\description{ +Evaluate first derivative of GAM smooth(s), adapted from +\href{https://gist.githubusercontent.com/gavinsimpson/e73f011fdaaab4bb5a30/raw/82118ee30c9ef1254795d2ec6d356a664cc138ab/Deriv.R}{Gavin Simpson}. +} diff --git a/man/check_Deriv.Rd b/man/check_Deriv.Rd new file mode 100644 index 0000000..88e225e --- /dev/null +++ b/man/check_Deriv.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/check_Deriv.R +\name{check_Deriv} +\alias{check_Deriv} +\title{Check whether the CI of the derivative includes zero or not} +\usage{ +check_Deriv(x, d, upper, lower, eval = 0, crit.eval) +} +\arguments{ +\item{x}{vector of values over which derivatives were evaluated} + +\item{d}{vector output of {Deriv()}} + +\item{upper}{upper confidence interval; output of {confint_Deriv()}} + +\item{lower}{lower confidence interval; output of {confint_Deriv()}} + +\item{eval}{the value that you would like to examine. default 0} +} +\value{ +vector of confidence intervals of same length as object. +} +\description{ +Check whether the CI of the derivative includes zero or not +} diff --git a/man/check_data.Rd b/man/check_data.Rd new file mode 100644 index 0000000..1b645ee --- /dev/null +++ b/man/check_data.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/check_data.R +\name{check_data} +\alias{check_data} +\title{load, check and plot input data for use in breakpoint detection} +\usage{ +check_data(dat, sex = FALSE, showPlot = TRUE) +} +\arguments{ +\item{dat}{data.frame with columns year, age, length, sex (optional)} + +\item{sex}{logical. does your data frame include a sex column?} + +\item{showPlot}{logical. do you want to visualize your input data?} +} +\value{ +plots +} +\description{ +load, check and plot input data for use in breakpoint detection +} +\examples{ +\dontrun{ +read_rep(fn = 'inst/example_data/goasr.rep') +} +} diff --git a/man/confint_Deriv.Rd b/man/confint_Deriv.Rd new file mode 100644 index 0000000..8b22dff --- /dev/null +++ b/man/confint_Deriv.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/confint_Deriv.R +\name{confint_Deriv} +\alias{confint_Deriv} +\title{Calculate confidence interval of derivative, adapted from +\href{https://gist.githubusercontent.com/gavinsimpson/e73f011fdaaab4bb5a30/raw/82118ee30c9ef1254795d2ec6d356a664cc138ab/Deriv.R}{Gavin Simpson}.} +\usage{ +confint_Deriv(object, term, alpha = 0.05, ...) +} +\arguments{ +\item{object}{vector output of {Deriv()}} + +\item{term}{string smooth name, i.e. "year". must match values in mod and newdata} + +\item{alpha}{confidence threshold. default 0.05 (for 95% CI)} +} +\value{ +vector of confidence intervals of same length as object. +} +\description{ +Calculate confidence interval of derivative, adapted from +\href{https://gist.githubusercontent.com/gavinsimpson/e73f011fdaaab4bb5a30/raw/82118ee30c9ef1254795d2ec6d356a664cc138ab/Deriv.R}{Gavin Simpson}. +}