フィルターのクリア

Best way to append regression results

1 回表示 (過去 30 日間)
Tatte Berklee
Tatte Berklee 2020 年 7 月 19 日
コメント済み: KSSV 2020 年 7 月 20 日
Hi there!
I am running a linear regression in a finite loop.
Each time, it produces coefficient estimates and 95% confidence interval ranges.
I would like to append these regression results on a separate matrix.
What is the best way to do this?
For example, suppose I run:
%%%
for i = 1:3
N = i; % this is the polynomial degree
[p,S] = polyfit(x, y, N);
%%%
I would like to store the coefficients stored in p.
For the 3rd-degree, I have 1x4 double as class for p.
So what is the best way to append 1x4 double class variable into a clean matrix?
The main issue I am having is the dimensions not matching, something along the line with...
"Unable to perform assignment because
the size of the left side is 1-by-1
and the size of the right side is
1-by-2."
Please help...!! Thank you!

採用された回答

KSSV
KSSV 2020 年 7 月 19 日
編集済み: KSSV 2020 年 7 月 19 日
P = cell(3,1) ;
for i = 1:3
N = i; % this is the polynomial degree
[p,S] = polyfit(x, y, N);
P{i} = p ;
%%%
  3 件のコメント
Tatte Berklee
Tatte Berklee 2020 年 7 月 20 日
Hi KSSV, on a related note, if I want to store 2 by 2 double class (e.g. confidence interval), then how would I go about storing this information on a clean matrix? Is it storable on cell as you suggested? It doesn't seem to work.
KSSV
KSSV 2020 年 7 月 20 日
You can write P which is a cell into excel using xlswrite/ writetable.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by