Coder Social home page Coder Social logo

markusloew / myfits Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 18 KB

Fits one of three functions (inverse quadratic, bell-shaped, or waiting-in-line) to x, y data using nls.

License: GNU General Public License v2.0

R 100.00%
nls curve-fitting inverse-quadratic bell

myfits's Introduction

MyFits

Build Status

R package to add either a inverse-quadratic, bell-shaped, or "waiting-in-line" curve fit to data.

See

help(package = "MyFits") 

for details on the function provided by this package. The import functions returns either a list of curve fit coefficients and r2, or the nls-model, or the predicted values.

Installation

Installation straight from github (if package "devtools" is already installed) via

devtools::install_github("MarkusLoew/MyFits")

Example session

d <- data.frame(x = 1:10,
                 y = c(0.5, 2, 10, 9, 8, 6.5, 5, 4, 3, 2.5))
MyFits(x = x, y = y, data = d)
MyFits(x = x, y = y, data = d, fit = "Wait")
nls.fit <- MyFits(x = x, y = y, data = d, fit = "Bell", model = TRUE)
my.x <- seq(min(d$x), max(d$x), length.out = 100)
my.predicted <- predict(nls.fit, data.frame(x = my.x))
mod.pred <- data.frame(x = my.x,
                       y = my.predicted)
plot(d)
lines(y ~ x, data = mod.pred)

require(ggplot2)
p <- ggplot(d, aes(x = x, y = y))
 p <- p + geom_point()
 p <- p + stat_myfits(fit = "Inverse_quad", colour = "blue")
 p <- p + stat_myfits(fit = "Bell", colour = "red")
 p <- p + stat_myfits(fit = "Wait", colour = "green")
p 

myfits's People

Contributors

markusloew avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.