• Stars
    star
    18
  • Rank 1,168,941 (Top 24 %)
  • Language
    Julia
  • Created over 10 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nonlinear regression in Julia

Nonlinear regression

Stable Dev Build Status Build Status Codecov

This package is an experiment in using the Zygote automatic differentiation package and the lowrankupdate! function in the LinearAlgebra package to solve the linear least squares problem for a Gauss-Newton update.

The data are represented as a Tables.RowTable, which is a vector of NamedTuples. The model parameters are also a NamedTuple. The model function is given as a function of two arguments - the parameters and a data row.

Example - a Michaelis-Menten fit

In the Michaelis-Menten model for enzyme kinetics,

v = Vm * c / (K + c)

the relationship between the velocity, v, of a reaction and the concentration, c, of the substrate depends on two parameters; Vm, the maximum velocity and K, the Michaelis parameter. The Vm parameter occurs linearly in this expression whereas K is a nonlinear parameter.

julia> using CSV, DataFrames, NLreg

julia> datadir = normpath(joinpath(dirname(pathof(NLreg)), "..", "data"));

julia> PurTrt = first(groupby(CSV.read(joinpath(datadir, "Puromycin.csv")), :state))
12×3 SubDataFrame
│ Row │ conc    │ rate    │ state   │
│     │ Float64 │ Float64 │ String  │
├─────┼─────────┼─────────┼─────────┤
│ 1   │ 0.02    │ 76.0    │ treated │
│ 2   │ 0.02    │ 47.0    │ treated │
│ 3   │ 0.06    │ 97.0    │ treated │
â‹®
│ 9   │ 0.56    │ 191.0   │ treated │
│ 10  │ 0.56    │ 201.0   │ treated │
│ 11  │ 1.1     │ 207.0   │ treated │
│ 12  │ 1.1     │ 200.0   │ treated │

julia> pm1 = fit(NLregModel, PurTrt, :rate, (p,d) -> p.Vm * d.conc/(p.K + d.conc),
                  (Vm = 200., K = 0.05))
Nonlinear regression model fit by maximum likelihood

Data schema (response variable is rate)
Tables.Schema:
 :conc   Float64
 :rate   Float64
 :state  String
Number of observations:                  12

Parameter estimates
───────────────────────────────────────
      Estimate   Std.Error  t-statistic
───────────────────────────────────────
Vm  212.684     6.94715        30.6145
K     0.064121  0.00828092      7.74322
───────────────────────────────────────

Sum of squared residuals at convergence: 1195.4488145417758
Achieved convergence criterion:          8.798637504793927e-6

More Repositories

1

RePsychLing

Data sets from subject/item type studies in Psychology and Linguistics
Jupyter Notebook
50
star
2

JuliaWorkshop

Materials for a workshop on Julia programming at UW-Madison Statistics Dept. in June 2014
Jupyter Notebook
31
star
3

MixedModelsinJulia

Notebooks on fitting mixed-effects models in Julia
Jupyter Notebook
22
star
4

stat692

Materials for Statistics 692 at UW-Madison, Fall 2014
R
15
star
5

JSM2021

Presentation at the Joint Statistical Meetings 2021
HTML
12
star
6

ParallelGLM.jl

Parallel fitting of GLMs using SharedArrays
Julia
11
star
7

Wordlegames.jl

Play Wordle and related games
Julia
8
star
8

WordleTutorials

Wordle and the Art of Julia Programming
Julia
7
star
9

BEDFiles.jl

Routines for reading and manipulating GWAS data in .bed files
Julia
6
star
10

RangeTrees.jl

Simple, augmented interval trees based on the UnitRange type in Julia.
Julia
5
star
11

Presentations

Source for various presentations.
HTML
5
star
12

CopenhagenEcon

Files for a short course at U. of Copenhagen Econ
4
star
13

ReTerms.jl

Package providing abstract random-effects terms and specific types
Julia
4
star
14

ecdfExample

An example evaluating an empirical cdf in R, R with Rcpp and in Julia
C++
4
star
15

Wordlebase3

Julia Programming and Wordle
Julia
3
star
16

MixedModelExamples

Sample data sets and model formulations for mixed-effects models
Julia
3
star
17

slides

Slides from various presentations
3
star
18

MindResearchRepository.jl

Access data sets from the Mind Research Repository
Julia
3
star
19

SuperLU.jl

Julia interface to the SuperLU solver package for sparse systems.
Julia
3
star
20

Vorbis.jl

Julia bindings for libvorbis and libogg
Julia
2
star
21

EnglishLexicon.jl

Julia code for proecessing data files in the English Lexicon Project
Julia
2
star
22

NESS2017

Materials for workshop at New England Statistics Symposium
Jupyter Notebook
2
star
23

asa-ssc-symp22

Presentation for the Amer. Statist. Assoc.'s Section on Statistical Computing Symposium 2022
2
star
24

hpmods

An R package for hierarchy-preserving submodels of a given model.
R
1
star
25

StatGenData.jl

Statistical analysis of genomic data
Julia
1
star
26

simpleGibbs

Comparisons of R, R with Rcpp and Julia on a simple Gibbs sampler
R
1
star
27

Devore6

R package containing the data sets from the 6th edition of Devore's Prob and Stats for Engr and the Sciences
R
1
star
28

PolMeth

Presentation at PolMethXXXIV
Jupyter Notebook
1
star
29

JuliaCon2016

Part of the JuliaCon presentation
1
star
30

plotdemo

A copy of the plotdemo Julia example from the Quarto docs
1
star
31

LendingClub

Analysis of some data from Lending Club
Jupyter Notebook
1
star
32

MKLsparseinspector.jl

Interface to MKL inspector-executor formulation for sparse BLAS and beyond
Julia
1
star
33

Tablo.jl

Julia interface to the Tablo OTA DVR
Julia
1
star
34

themoviedb.jl

Julia wrappers for the API at themoviedb.org
Julia
1
star
35

NlmeData.jl

A Julia data package of the datasets from R's nlme package
Julia
1
star