用matlab求一元多項式回歸,並求出方差,置信區間,相關係數,F值,怎麼求,
題目:
用matlab求一元多項式回歸,並求出方差,置信區間,相關係數,F值,怎麼求,
方程形式爲c = β0+β1 t + β2 t^2 + u
數據爲
t=[0 4 8 9 10 18 21 23 24 25 29 37 38 39 40 41 44 46]';
c=[85.90 133.54\x05152.33 173.28 149.00 160.00 170.40 206.85 181.79 172.48 184.67 267.67 167.50 213.76 196.24 182.59 164.60 101.33];
解答:
程序如下:
t0=ones(18,1);
t1=[0 4 8 9 10 18 21 23 24 25 29 37 38 39 40 41 44 46]';
t2=t1.*t1;
c=[85.90 133.54 152.33 173.28 149.00 160.00 170.40 206.85 181.79 172.48 184.67 267.67 167.50 213.76 196.24 182.59 164.60 101.33]';
T=[t0 t1 t2];
[b,bint,r,rint,s]=regress(c,T,0.05);
disp(['c =' num2str(b(3)) '+' num2str(b(2)) 't+' num2str(b(1)) 't^2'])%輸出方程
b%方程係數
bint%b的置信區間
r%殘差
rint%r的置信區間
s%檢驗回歸模型的統計量(對應4個參數值:相關係數r^2,F值,與F對應的概率P,誤差估計)
結果:
c =-0.13113+7.4041t+93.8463t^2
b =
93.8463
7.4041
-0.1311
bint =
49.0695 138.6230
3.0080 11.8003
-0.2206 -0.0417
r =
-7.9463
12.1753
7.6430
23.4181
-5.7745
-24.6342
-21.1042
12.0771
-14.2239
-24.5126
-13.6148
79.3895
-18.3498
30.6032
16.0385
5.6060
-1.1579
-55.6326
rint =
-56.6714 40.7788
-46.0597 70.4102
-54.7131 69.9992
-38.1024 84.9386
-68.9365 57.3874
-86.0124 36.7440
-82.5767 40.3683
-50.1051 74.2593
-76.2751 47.8273
-85.5679 36.5427
-76.3083 49.0788
33.9153 124.8637
-81.4707 44.7712
-30.6668 91.8733
-46.5710 78.6479
-56.9761 68.1881
-60.5541 58.2383
-101.2318 -10.0333
s =
0.5007 7.5203 0.0055 933.2755
添加新評論