An open API service indexing awesome lists of open source software.

https://github.com/eliocamp/spfit

Single Parameter Fit
https://github.com/eliocamp/spfit

Last synced: about 1 year ago
JSON representation

Single Parameter Fit

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# spfit

[![Travis build status](https://travis-ci.org/eliocamp/spfit.svg?branch=master)](https://travis-ci.org/eliocamp/spfit)

spfit (**S**ingle **P**arameter Fit) is an R implementation of Laurent Boué's [Real numbers, data science and chaos: How to fit any dataset with a single parameter](https://arxiv.org/abs/1904.12320). It can take any data and fit a continuous and differenciable model with just one parameter with arbitrary accuracy:



## Installation

You can install the development version from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("eliocamp/spfit")
```


## Example

Fit the rise of CO2 perfectly with one parameter
```{r example}
library(spfit)
data("co2")
co2 <- c(co2)

co2_fit <- sp_fit(co2)

co2_pred <- predict(co2_fit)

plot(co2, type = "l")
points(predict(co2_fit), col = "red")
```

What's our alpha parameter?

```{r}
as.character(co2_fit, digits = 30)
```