Regression analysis; How do I detect a delayed relation between two signals
古いコメントを表示
Hi. I have a math question regarding regression analysis. If one has two signals (a) a scalar time series of values, and another scalar time series of values (b), that are the same length in time. Now I want to know if there is any relation between a and b, so that if a behaves in a certain way, b behaves in a certain way but with a delay in reaction. I want to know if there is any mathematical method to figure out IF they have a relation at all, and if so to what degree (in a mix with random noise), and also what the delay is in time (or % of total length of the series) for the relation to appear in b. If someone can tell me or direct me to a method described as formulas or how to set this up in Matlab, I would be very happy.
回答 (4 件)
Jeff Miller
2019 年 2 月 7 日
0 投票
It sounds like you are looking for what is sometimes called "lagged regression". The basic idea is to use regular regression to predict the values b(t) from the values a(t-lag). You systematically try different lag values and see which one gives you the best predictions (e.g., lowest MSe). Some lag will always work best (even if it's just by chance).
DanR
2019 年 2 月 8 日
0 投票
1 件のコメント
Jeff Miller
2019 年 2 月 8 日
I've never used the curve fitting function so I can't say how to do it with that. I'd use regress something like this (code not checked):
% a and b hold pre-existing data
MaxLag = 10; % The largest lag you want to check
MSes = zeros(MaxLag,1); % to hold the results
for lag=1:MaxLag
ashort = a(1:end-lag); % data lost at the end of a because we have no b at the lag of interest
bshort = [ones(size(ashort)) b(lag+1:end)]; % matlab's regress requires a column of 1's
[b,bint,r,rint,stats] = regress(bshort,ashort); % fit regression eqn
MSes(lag) = stats(4);
end
plot(1:MaxLag,MSes);
DanR
2019 年 2 月 8 日
0 投票
4 件のコメント
Jeff Miller
2019 年 2 月 8 日
There is no way to do this for sure, within the existing data set. Of course if the relation you find is really strong, perhaps it is implausible that it was accidental.
Get a fresh data set and see if you get the same pattern again.
(By the way, it is better to use the "comment on this answer" link for discussing answers, rather than adding a new answer.)
DanR
2019 年 2 月 8 日
DanR
2019 年 2 月 8 日
Jeff Miller
2019 年 2 月 10 日
Something like that. I don't think I'd trust overlapping segments, though, since they share data and thus produce non-independent outcomes. If you have data minute by minute, you might split into much smaller segments (e.g., day by day) unless the time lag of the response is very slow.
カテゴリ
ヘルプ センター および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!