Skip to content

Mattriks/MeasurementErrorModels.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MeasurementErrorModels.jl

Build Status Coverage

Summary

A julia package for working with Measurement Error Models. This package was developed to calibrate Measurement Error Proxy System Models (MEPSMs).
The package provides functions to initialise informative prior distributions, and a main function Bmem() to calculate a posterior distribution. The package uses Distributions.jl and Measurements.jl.

Inputs include:
df: a dataframe with predictor variables and a response variable, given as Measurement types
ΩV: a 𝑛×𝑛 lag-covariance matrix for the response noise
ΣA: a 𝑛𝑝×𝑛𝑝 lag-covariance matrix for the predictor noise

An auxiliary function dataf() will provide defaults for ΩV and ΣA based on df.

using MeasurementErrorModels, LinearAlgebra, Distributions

μ₀, Σ₀ = [-0.22, 0.97*0.27], Diagonal([0.02^2, 0.15^2])
Bprior = Priors.makeprior(df, MvNormal(μ₀, Σ₀), ip=1000.0)

Y, ΩV, σV, X, ΣA, σA = dataf(df, ycol=ycol)
Bposterior = Bmem(Y, X, ΩV, ΣA, Bprior=Bprior)

Functions are also provided to estimate the noise auto- and cross-covariance in the predictors and response e.g.,

ΣA = CovEst.SigmaA(Bposterior.A, σA, lags=0:100)

Installation

Install using the Julia package manager.

From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add https://github.com/Mattriks/MeasurementErrorModels.jl

or from the Julia prompt:

julia> using Pkg; Pkg.add("https://github.com/Mattriks/MeasurementErrorModels.jl")

Documentation