Skip to content

hendersontrent/GeneralizedAdditiveModels.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeneralizedAdditiveModels.jl

Fit, evaluate, and visualise generalised additive models (GAMs) in native Julia

Motivation

Generalised additive models (GAMs) are an incredibly powerful modelling tool for regression practitioners. However, the functionality of the excellent R package mgcv is yet to be built in native Julia. This package aims to do just that, albeit at much less complexity given how sophisticated mgcv is.

Usage

The basic interface to GeneralizedAdditiveModels.jl is the gam function, which is as easy as:

    mod = gam("Volume ~ s(Girth, k=10, degree=3) + s(Height, k=10, degree=3)", df)

by default, gam uses a Normal likliehood and the identity link function. In this example, df is the trees dataset included in R and in Julia through the RDatasets package. We are using two covariates in df -- Girth and Height -- and we are specifying 10 knots and a polynomial order of 3 for the splines for both. Note the similarity between the formula specification and that used by mgcv in R. Unfortunately, we have not yet solved a symbolic way to represent the formula using a macro instead of a string, but hopefully this will be come in the near future!

Users can also control the penalised iteratively reweighted least squares algorithm directly, as well as change the likelihood family and link function:

mod = gam("Volume ~ s(Girth, k=10, degree=3) + s(Height, k=10, degree=3)",
          df; Family = "Gamma", Link = "Log", 
          Optimizer = NelderMead(), maxIter = 1e5,
          tol = 1e-6)

Note that currently, the following families are supported:

  • Normal
  • Poisson
  • Gamma
  • Bernoulli

And the following link functions:

  • Identity
  • Log
  • Logit

Development notes

GeneralizedAdditiveModels.jl is very much in active development. Please check back for updates and new features or feel free to contribute yourself!

About

Fit, evaluate, and visualise generalised additive models (GAMs) in native Julia

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages