Skip to content

RobbieMackenzie/Odrpack.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

138 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Odrpack.jl

Test Coverage Ask DeepWiki

Description

This Julia package provides bindings for the well-known weighted orthogonal distance regression (ODR) solver odrpack95.

Orthogonal distance regression, also known as errors-in-variables regression, is designed primarily for instances when both the explanatory and response variables have significant errors.

Deming regression; special case of ODR.

Installation

You can install the package in the usual way:

using Pkg
Pkg.add("Odrpack")

Documentation and Usage

The following example demonstrates a simple use of the package. For more comprehensive examples and explanations, please refer to the documentation pages.

using Odrpack

function f!(x::Vector{Float64}, beta::Vector{Float64}, y::Vector{Float64})
    y .= beta[1] .* exp.(beta[2] .* x)
    return nothing
end

xdata = [0.982, 1.998, 4.978, 6.01]
ydata = [2.7, 7.4, 148.0, 403.0]

beta0 = [2.0, 0.5]
bounds = ([0.0, 0.0], [10.0, 0.9])

sol = odr_fit(
    f!,
    xdata,
    ydata,
    beta0,
    bounds=bounds,
    # rptfile="test_output.txt",
    # report=:long
)

println("Optimized β    :", sol.beta)
println("Optimized δ    :", sol.delta)
println("Optimized x + δ:", sol.xplusd)
Optimized β    :[1.633376, 0.9]
Optimized δ    :[-0.368861, -0.312730, 0.029286, 0.110314]
Optimized x + δ:[0.613138, 1.685269, 5.007286, 6.120314]

About

Julia bindings for the modernized version of odrpack95. Fork for adding Unitful.jl and Measurements.jl support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Julia 100.0%