-
Notifications
You must be signed in to change notification settings - Fork 1
/
readme.Rmd
76 lines (56 loc) · 2.47 KB
/
readme.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(litterfitter)
```
# litterfitter <img src="man/figures/litterfitter_hex.png" align="right" alt="" width="120" />
> R package for fitting and testing alternative models for single cohort litter decomposition data
<!-- badges: start -->
[![R-CMD-check](https://github.com/traitecoevo/litterfitter/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/traitecoevo/litterfitter/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/traitecoevo/litterfitter/branch/master/graph/badge.svg)](https://app.codecov.io/gh/traitecoevo/litterfitter?branch=master)
[![](https://img.shields.io/badge/doi-10.1111/2041--210X.12138-blue.svg)](https://doi.org/10.1111/2041-210X.12138)
`r badger::badge_cran_release("litterfitter", "orange")`
<!-- badges: end -->
### Installation
```{R, eval = FALSE}
#install.packages("remotes")
remotes::install_github("cornwell-lab-unsw/litterfitter")
library(litterfitter)
```
### Getting started
At the moment there is one key function which is `fit_litter` which can fit 6 different types of decomposition trajectories. Note that the fitted object is a `litfit` object
```{R,results="hide",warning=FALSE,message = FALSE}
fit <- fit_litter(time=c(0,1,2,3,4,5,6),
mass.remaining =c(1,0.9,1.01,0.4,0.6,0.2,0.01),
model="weibull",
iters=500)
class(fit)
```
You can visually compare the fits of different non-linear equations with the `plot_multiple_fits` function:
```{R,fig.height=6,results='hide',fig.keep=TRUE,warning=FALSE,message = FALSE}
plot_multiple_fits(time=c(0,1,2,3,4,5,6),
mass.remaining=c(1,0.9,1.01,0.4,0.6,0.2,0.01),
model=c("neg.exp","weibull"),
iters=500)
```
Calling `plot` on a `litfit` object will show you the data, the curve fit, and even the equation, with the estimated coefficients:
```{R,fig.keep=TRUE}
plot(fit)
```
The summary of a `litfit` object will show you some of the summary statistics for the fit.
```{R,echo=FALSE,fig.keep=TRUE}
summary(fit)
```
From the `litfit` object you can then see the uncertainty in the parameter estimate by bootstrapping
```{R,echo=FALSE,fig.keep=TRUE}
post<-bootstrap_parameters(fit)
plot(post)
```