フィルターのクリア

Interpolating Missing Data with Noise like Brownian Motion

3 ビュー (過去 30 日間)
Tatte Berklee
Tatte Berklee 2022 年 9 月 2 日
コメント済み: Tatte Berklee 2022 年 9 月 8 日
Hello folks,
I have a few questions regarding interpolating financial price data set.
I have a set of price points, but their frequency is not high, so I would like to interporlate between these between.
For instance, consider 24 by 2 double price data points where it spans over 24 hours.
Between each hour, I would like to interporlate 15, 30, 45, so total three interporlated points, that way I now have 72 points per day.
However, I would like to insert some noise that follows possibly a geometric brownian motion or random walk to give a flavor of randomness in the data and they are not all linear connected.
What might be the best way to do this?
I have the basic codes so far of importing the data and converting to 24 by 2 double format:
file= "pricedata.xlsx";
Tab =readtable(file);
T=table2array(Tab);
Any suggestions?
Thanks in advance!

採用された回答

Bruno Luong
Bruno Luong 2022 年 9 月 2 日
"What might be the best way to do this?'"
Interpolation THEN
adding noise.
There is no reason to mix the noise generation with interpolation step.
  9 件のコメント
Bruno Luong
Bruno Luong 2022 年 9 月 8 日
編集済み: Bruno Luong 2022 年 9 月 8 日
Because I read this:
"For instance, consider 24 by 2 double price data points where it spans over 24 hours.
...
that way I now have 72 points per day."
You start with 24 data per day and want to end up with 72. 72/24 is 3. But I might miss understanding what you wrote.
Tatte Berklee
Tatte Berklee 2022 年 9 月 8 日
Excellent. No, you are correct. I wanted this, but your sample code had 3600, so now it is clear to me you put 3600 for demonstration. Thanks!

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2022 年 9 月 2 日
Try this:
rows = 24;
prices = round(100*rand(rows, 2), 2) % [Beginning of day, end of day]
% Scan down getting prices.
% Allocate 72 points per day, including the start and end.
interpPrices = zeros(rows, 72);
for row = 1 : rows
% Add up to +/- 2 unit of noise.
noise = 2 * rand(1, 72);
interpPrices(row, :) = round(linspace(prices(row, 1), prices(row, 2), 72) + noise, 2);
end
  3 件のコメント
Image Analyst
Image Analyst 2022 年 9 月 2 日
Yes. prices is the opening and closing prices for the day. You said you already have this. Then you said you wanted to go between those two values with 70 interpolated values that had a bit of noise added to them, for a total of 72 prices per day. Each row of interpPrices is a day, and there are 72 prices at various times thoughout that day.
Tatte Berklee
Tatte Berklee 2022 年 9 月 6 日
Thanks for the response and comments. I will try this method as well!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Preprocessing についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by