spfit (Single Parameter Fit) is an R implementation of Laurent Boué’s Real numbers, data science and chaos: How to fit any dataset with a single parameter. It can take any data and fit a continuous and differenciable model with just one parameter with arbitrary accuracy:
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("eliocamp/spfit")
Fit the rise of CO2 perfectly with one parameter
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?
as.character(co2_fit, digits = 30)
#> [1] "0.0416842755182496396583250113637... (1661 more digits)"