フィルターのクリア

I seem to be getting quite different results when I use regress vs fitlm to do multivariate regression. Why?

2 ビュー (過去 30 日間)
I am looking for a function suggestion for the best suited for this functionality
  2 件のコメント
Image Analyst
Image Analyst 2016 年 4 月 5 日
Can you post sample data and code that illustrate the problem?
Rajesh Rajaram
Rajesh Rajaram 2016 年 4 月 5 日
編集済み: Walter Roberson 2016 年 4 月 6 日
I have a signal that I am thinking is a sum of 3 sine waves. The data is both not uniformly spaced and severely undersampled. So I can't use a DFT. Hence I used the following:
Signal = Signal - mean(Signal)
Coef_regress = regress(Signal',[SinWave1; CosWave1; SinWave2; CosWave2; SinWave3; CosWave3]')
Coef_fitlm = fitlm([SinWave1; CosWave1; SinWave2; CosWave2; SinWave3; CosWave3]',Signal')
Coef_regress_ones = regress(Signal',[ones(size(SinWave1)); SinWave1; CosWave1; SinWave2; CosWave2; SinWave3; CosWave3]')
The Coef_regress_ones matches with fitlm output, but with a large intercept value. But I already removed the mean value. I don't understand why.

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

回答 (1 件)

Star Strider
Star Strider 2016 年 4 月 5 日
‘The Coef_regress_ones matches with fitlm output, but with a large intercept value. But I already removed the mean value. I don't understand why.’
We still don’t have your data.
Removing the mean would not remove a trend (linearly-increasing baseline).
  2 件のコメント
Rajesh Rajaram
Rajesh Rajaram 2016 年 4 月 6 日
Star Strider,
I really appreciate your effort to help me and I understand the value in showing the problem with actual data. Unfortunately, the data belongs to my company and I can't post it online. My hands are tied on that front.
As for linear trend, I am not able to follow your argument. I have only provided "ones" as one the input variables, which means its coefficient will only provide an offset to the predicted output. So the fact that I removed the mean should mean that the coefficient for it should've been 0.
I can understand that if I had provided the time stamps for my data as well as one of the input variables, then its coefficient would be the slope against time (signifying a linear trend).
Thanks again. I really do appreciate your help
Star Strider
Star Strider 2016 年 4 月 6 日
My pleasure.
Removing the mean does not necessarily mean that your signal does not have some sort of linear baseline trend.
Adding the ones vector allows the intercept to be estimated uniquely rather than being forced through zero. If you do not specify a ones column, the model forces a zero intercept.

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

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by