# Estimation of embedding parameters for multivariate data
This repository contains MATLAB code for estimating parameters for phase space reconstruction of multivariate data. The functions provided in this repository are described in the article:
> Wallot & Mønster (2018) Calculation of average mutual information (AMI) and false-nearest neighbors (FNN) for the estimation of embedding parameters of multidimensional time-series in MATLAB *Frontiers in Psychology, 9: 1679* [DOI:10.3389/fpsyg.2018.01679](https://dx.doi.org/10.3389%2Ffpsyg.2018.01679)
## Installation
The functions in this repository can be used if you place the files containing them in a directory that is in your MATLAB Path. You can simply download [mdDelay.m](mdDelay.m), [autoMI.m](autoMI.m) and [mdFnn.m](mdFnn.m) or you can clone the whole repository to get all the files and examples:
```
git clone https://github.com/danm0nster/mdembedding.git mdembedding
```
If you want your cloned copy in a different directory you can change the last parameter to something else, e.g. `mde-copy`.
To embed time series data using the time-delayed embedding method two parameters are needed: the time delay and the embeddding dimension. We provide two functions to estimate these parameters: `mdDelay()` and `mdFnn()`.
## Example
This is a short example of how to use the functions using the well-known Lorenz attractor. The data have been pre-generated and the MATLAB code for generating the plots can be found in this repository under docs/Lorenz, and you can also view the full [output of the MATLAB notebook](https://danm0nster.github.io/mdembedding/Lorenz/html/). Here, we will just show the basic commands used to produce plots and other outputs.
We start by loading the data generated by a numerical solution to the Lorenz equations
```MATLAB
data = load('lorenz_3d_timeseries.txt');
```
The data can be visualized by plotting the three variables x, y and z.
```MATLAB
plot3(data(:,1), data(:,2), data(:,3), 'k')
```
![Figure 1a from paper](docs/Lorenz/Figure1a.png)
### Estimating the time delay
To estimate the proper time delay for embedding the data we use the function `mdDelay`.
```MATLAB
tau = mdDelay(data, 'maxLag', 25, 'plottype', 'all');
```
![Figure 2a from paper](docs/Lorenz/Figure2a.png)
This gives a value of `tau` that rounds to 15. A visual inspection of the plot of mutual information indicates that this is a reasonable value, since all three curves have minima close to that value. Alternatively we can get `mdDelay()` to plot the mean mutual information, by setting the plot type to "mean".
```MATLAB
tau = mdDelay(data, 'maxLag', 25, 'plottype', 'mean');
```
![Plot of mean AMI](docs/Lorenz/Figure2a_mean.png)
### Estimating the embedding dimension
The optimal embedding dimension is estimated using the method of false nearest neighbors (FNN), which is implemented in the function `mdFnn()`. We call this function with the value of `tau` found above rounded to nearest integer (in this case 15). The function returns a vector with the percent of FNN and another vector with the corresponding embedding dimensions.
```MATLAB
[fnnPercent, embeddingDimension] = mdFnn(data, round(tau));
```
![Figure 2b from paper](docs/Lorenz/Figure2b.png)
Since the number of false nearest neighbors drops to zero already at 2 embeddings we see that it is enough to embed the data in the three dimensions already present in the data, which is not surprising because we have sampled all the variables in the dynamical system.
## Testing the functions
You can run a short test suite for the functions by typing the following command in the MATLAB command window.
```MATLAB
runtests('tests/mdDelayTest.m')
```
If the test is successful you should see something like the output below.
```
Running mdDelayTest
No value below threshold found. Will use first local minimum instead
.No value below threshold found. Will use first local minimum instead
No value below threshold found. Will use first local minimum instead
.No value below threshold found. Will use first local minimum instead
No value below threshold found. Will use first local minimum instead
No value below threshold found. Will use first local minimum instead
No value below threshold found. Will use first local minimum instead
No value below threshold found. Will use first local minimum instead
.Teardown called. No action taken here.
Done mdDelayTest
__________
ans =
1×3 TestResult array with properties:
Name
Passed
Failed
Incomplete
Duration
Details
Totals:
3 Passed, 0 Failed, 0 Incomplete.
0.097622 seconds testing time.
```
## How to cite
If you find these functions useful and publish results where you have used them, please cite our paper:
Wallot & Mønster (2018) Calculation of average mutual information (AMI) and false-nearest neighbors (FNN) for the estimation of embedding parameters of multidimensional time-series in MATLAB *Frontiers in Psychology, 9: 1679* [DOI:10.3389/fpsyg.2018.01679](https://dx.doi.org/10.3389%2Ffpsyg.2018.01679)
没有合适的资源?快使用搜索试试~ 我知道了~
MATLAB code for estimating parameters for phase space reconstruc
共43个文件
png:29个
m:6个
html:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 73 浏览量
2023-07-24
20:03:22
上传
评论
收藏 627KB ZIP 举报
温馨提示
MATLAB code for estimating parameters for phase space reconstruction of multivariate data.zip
资源推荐
资源详情
资源评论
收起资源包目录
MATLAB code for estimating parameters for phase space reconstruction of multivariate data.zip (43个子文件)
mdembedding-master
.gitattributes 147B
autoMI.m 1KB
LICENSE 763B
tests
autoMITest.m 486B
mdDelayTest.m 1KB
mdFnn.m 6KB
docs
Lorenz
Figure2a.png 41KB
Lorenz.m 6KB
html
Lorenz_07.png 18KB
Lorenz_03.png 27KB
Lorenz_11.png 13KB
Lorenz_08.png 18KB
Figure2_04.png 18KB
Lorenz_13.png 17KB
Lorenz_05.png 18KB
Lorenz_02.png 12KB
Lorenz_04.png 22KB
Figure2_02.png 27KB
Figure2_08.png 13KB
Figure2_03.png 18KB
Lorenz.html 23KB
Figure2_09.png 17KB
Figure2_01.png 18KB
Figure2_06.png 12KB
Figure2.png 2KB
Lorenz_06.png 27KB
Figure2_07.png 15KB
Figure2.html 14KB
index.html 11B
Lorenz_01.png 22KB
Figure2_10.png 17KB
Lorenz.png 2KB
Lorenz_09.png 12KB
Lorenz_12.png 17KB
Figure2_05.png 12KB
Lorenz_10.png 15KB
Figure2a_mean.png 40KB
lorenz_3d_timeseries.txt 84KB
Figure2b.png 62KB
Figure1a.png 58KB
mdDelay.m 7KB
.gitignore 18B
README.md 5KB
新建文件夹
共 43 条
- 1
资源评论
AbelZ_01
- 粉丝: 896
- 资源: 5441
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Java实现的pagerank算法.zip
- 基于C++实现的pagerank算法.zip
- 基于Python实现的pagerank算法.zip
- java面试题-leetcode题解之第14题最长公共前缀.zip
- java面试题-leetcode题解之第28题找出字符串中第一个匹配项的下标.zip
- java面试题-leetcode题解之第31题下一个排列.zip
- java面试题-leetcode题解之第6题Z字形变换.zip
- java面试题-leetcode题解之第8题字符串转换整数atoi.zip
- java面试题-leetcode题解之第13题罗马数字转整数.zip
- 夏总-2405232148.awb
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功