Skip to content

Normalize time series by quantile normalization to the normal distribution.

License

Notifications You must be signed in to change notification settings

UP-RS-ESP/Normalize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Normalize

Normalize time series by quantile normalization to the normal distribution.

Install

git clone https://github.com/UP-RS-ESP/Normalize.git
cd Normalize
sudo python setup.py install

Dependency

For the mapping to Gaussian percentiles the erfinv function of libit is used.

Examples

An example using random data for num = 55 time series of length len = 6000 using as many threads as possible:

import numpy as np
import Normalize

num = 55
len = 6000
data = np.random.random((num, len))
trans = Normalize.Quantile(data)

Transformed time series in trans are approximately normal distributed.

A more visual example of exponentially skewed AR(1) processes:

import numpy as np
import Normalize
from matplotlib import pyplot as pl

num = 5
tlen = 5000

# exponentially skewed AR(1)
data = np.random.normal(size = (num, tlen+100))
for t in xrange(1, tlen+100):
    data[:, t] += data[:, t-1] * 0.99 + 0.1
data = data[:, 100:]
data = np.exp(data)

# transformation
trans = Normalize.Quantile(data)

# visual comparison
f, ax = pl.subplots(2, 1, sharex = True)
ax[0].semilogy(data.T)
ax[1].plot(trans.T)
pl.show()

visual comparison

About

Normalize time series by quantile normalization to the normal distribution.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published