Skip to content
Snippets Groups Projects
Commit ae741b41 authored by GILSON Matthieu's avatar GILSON Matthieu
Browse files

add notebooks

parent 8cfa9229
Branches
No related tags found
No related merge requests found
%% Cell type:code id:910b76de-7f01-4548-be82-48845592ea79 tags:
``` python
import numpy as np
import scipy.stats as stt
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sb
sb.set_style('whitegrid')
sb.set(font_scale=1.5)
```
%% Cell type:markdown id:90388ab5-77ae-4af4-90b4-79251f37a0d0 tags:
We generate 2 time series with a linear relationship between them (via a common input).
### EXERCICE
- Calculate the Pearson correlatrion between the time series (cd `stt.prearsonr`), which also provides you with a p-value for significance.
- Calculate surrogate time series by manipulating the temporal distribution of the time series.
- Make a non-parametric test by comparing the distribution of surrogate correlation values with the value obtained from the original time series.
%% Cell type:code id:f1e1d19c-066c-4d71-963c-b702e2363f96 tags:
``` python
# duration of time series
T = 100
# generate two sets of normally distributed random variables (white noise)
x1 = stt.norm.rvs(size=T)
x2 = stt.norm.rvs(size=T)
# add to create correlation between the two time series
x0 = stt.norm.rvs(size=T)
# desired level of correlation
c = 0.1
x1 = np.sqrt(1.0-c) * x1 + np.sqrt(c) * x0
x2 = np.sqrt(1.0-c) * x2 + np.sqrt(c) * x0
```
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment