How do we interpolate a data set with noise?

Hello folks,
I am given an 1-D data set representing the daily prices of gold.
I have looked at the 1-D data interpolation that is nicely written by MathWorks: https://www.mathworks.com/help/matlab/ref/interp1.html
Because gold is traded intraday, an hourly data set would better capture this noise than a daily data set, and a 30-minute data would better capture it than the hourly data set ,and so on.
My objective is to interporlate the daily price data with some noise such as a Brownian noise.
Ultimately, I would like to collect these noise-incorporated points as a reasonably good interporlated data and run some other experiments on it.
Any comments or suggestions would be appreciated.
Thanks!

 채택된 답변

John D'Errico
John D'Errico 2022년 7월 30일
Um, you generally don't want to interpolate noisy data! That is just a good way to amplify the noise. I did show many years ago, that the best way to interpolate noisy data is probably simple linear interpolation, thus connect the dots. Even better in that respect is just nearest neighbor interpolation. Typically higher order methods, such as a spline interpolation can produce a solution that is higher variance at any intermediate point. So you don't want to interpolate noise.
Perhaps better is to first smooth your data. Now you can use tools to interpolate the smoothed response. There are of course many tools you can use to smooth data.
t = 1:100;
Y = sin(t/10) + randn(size(t))/3;
plot(t,Y,'o')
Now, if we interpolate the noisy data, we get noisy crap.
tint = linspace(min(t),max(t),1000);
Yint = interp1(t,Y,tint,'spline');
plot(t,Y,'ro',tint,Yint,'r-')
plot(t,smooth(Y),'o')
Clearly an interpolation will fare better based on the smoothed result, though when the noise to signal ratio is high enough, we can still get crap.

댓글 수: 3

Hi John, thanks for the answer.
I am actaully starting the other way around.
I already have a data set that is smooth, because it only has hourly prices meaning the data points are scarce.
What I want is more data points thus to interpolate.
But I want the noise to be present in the interpolation.
Any thoughts?
John D'Errico
John D'Errico 2022년 7월 30일
편집: John D'Errico 2022년 7월 31일
Huh? Why in the name of god and little green apples would you do that?
So just use interpolation. A spline will be fine then. And THEN add noise to it. What is the problem? Ok, I still have no clue why you would do that. Yes, I suppose you are probably generating noisy data for an example problem of some sort. But doing it is trivial.
Hi John, thanks for the reply. When you say "doing it is trivial", can you explain a bit more?
What I am thinking of fitting a spline and obtain both the original and interpolated points.
After that, how do I add noise to these data points?
Specifically, I do not want to perturb the original data points but just add noise in between the spline-interpolated points.
As to why I want to do that, it is to generate a reasonable approximation of how the data would have behaved if it followed something like a geometric Brownian motion.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2022년 7월 30일

댓글:

2022년 7월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by