https://github.com/eliocamp/spfit
Single Parameter Fit
https://github.com/eliocamp/spfit
Last synced: about 1 year ago
JSON representation
Single Parameter Fit
- Host: GitHub
- URL: https://github.com/eliocamp/spfit
- Owner: eliocamp
- Created: 2019-09-03T20:42:55.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-05T17:45:07.000Z (almost 7 years ago)
- Last Synced: 2025-02-14T13:40:38.497Z (over 1 year ago)
- Language: R
- Size: 290 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
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
[](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)
```