knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

{nlstimedist}

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Travis-CI Build Status CRAN downloads codecov

{nlstimedist} fits a biologically meaningful distribution function to time-sequence data (phenology), estimates parameters to draw the cumulative distribution function and probability density function and calculates standard statistical moments and percentiles.

Installation

You can install:

install.packages("nlstimedist")
# install.packages("remotes")
remotes::install_github("nathaneastwood/nlstimedist")

Usage

Preparing the data

Data should be in tidy format. {nlstimedist} provides three example tidy datasets: lobelia, pupae and tilia.

library(nlstimedist)
head(tilia)

We first need to calculate the cumulative number of trees as well as the proportions. We do this using the tdData() function.

tdTilia <- tdData(tilia, x = "Day", y = "Trees")
tdTilia

Fitting the model

We fit the model to the proportion of the cumulative number of trees (propMax) in the tdTilia object using the timedist() function.

model <- timedist(data = tdTilia, x = "Day", y = "propMax", r = 0.1, c = 0.5, t = 120)
model

Extracting the moments

We can extract the mean, variance, standard deviation, skew, kurtosis and entropy of the model as follows.

model$m$getMoments()

Extracting the RSS

Similarly we can extract the RSS of the model

model$m$rss()

Plotting the PDF and CDF

The probability density function (PDF) and the cumulative distribution function (CDF) of the model have their own plotting functions.

tdPdfPlot(model)
tdCdfPlot(model)


NattyE/nlstimedist documentation built on Aug. 24, 2020, 5:18 a.m.