Skip to content
/ arx Public
forked from Alymantara/arx

Maximum likelihood estimator of the mean and intrinsic rms of a time-series (based on Keith Horne avgrmsx).

License

Notifications You must be signed in to change notification settings

Astroberta/arx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arx

Maximum likelihood estimator of the mean and intrinsic rms of a time-series dataset (based on Keith Horne's avgrmsx). For a detail description of the method, see Keith Horne's lecture on the subject at http://star-www.st-and.ac.uk/~kdh1/ada/ada12.pdf

Requirements & Installation

You can compile the cython code inside the folder by using the following command:

python setup.py build_ext --inplace

This will make the routine available as a standard python package.

Section 1: The method

avgrmsx measures the optimally weighted average $\langle D \rangle$ of a data set $D$ with $N$ measurements and associated uncertainties, where:

$${\rm avg}=\langle D \rangle = \frac{\sum\limits_{i} D_i \cdot w_i}{\sum\limits_{i} w_i},$$

where the weights, $w_i$, are the inverse of the variance of each datapoint,

$$w_i = \frac{1}{\sigma_i^2},$$

where $\sigma_i$ is the uncertainty of each datapoint.

The routine calculates this optimal average as well as an additional dispersion $rms$ not quantified by the uncertainty in the data. The routine maximises the following likelihood:

$$-2\ln L = \sum\limits_{i}^{N}\left[\frac{\left(D_i - \langle D \rangle\right)^2}{\sigma_t^2}\right] +\sum\limits_{i}^{N}\ln(\sigma_t^2)$$

where the total variance for the model $\sigma_t$:

$$\sigma_t^2 ={\sigma_i^2 + {rms}^2}$$

Section 2: Usage

import arx
data = [-1,2,1.5]
errors = [0.3,0.5,0.2]
avg,avg_err,rms, rms_err = arx(data,errors)

About

Maximum likelihood estimator of the mean and intrinsic rms of a time-series (based on Keith Horne avgrmsx).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Cython 79.8%
  • Python 20.2%