1樓:匿名使用者
dw檢驗用於檢驗隨機誤差項具有一階自迴歸形式的序列相關問題,也是就自相關檢驗
d-w= ∑(et-et-1)^2/∑et^2,et是第t期的殘差,et-1是第t-1期的殘差,∑是對t從第2期到第t期求和,^2表示平方.
在d-w小於等於2時,d-w檢驗法則規定:
如d-w>d u,認為ei無自相關;
有自相關.
如4-d-w<dl,認為ei存在負自相關;
如dl<4-d-w<du,不能確定是否
有自相關.例如:資料x,y匯入matlab可以求出殘差,時間序列為【1:
1:20】,再利用excel就可以求出dw,結合上面的dw檢驗判斷ei是否具有自相關性。如果沒有就是普通的線性迴歸,如果有,重新建立新的模型。
x =1.0e+02 *
1.273000000000000
1.300000000000000
1.327000000000000
1.294000000000000
1.350000000000000
1.371000000000000
1.412000000000000
1.428000000000000
1.455000000000000
1.453000000000000
1.483000000000000
1.466000000000000
1.502000000000000
1.531000000000000
1.573000000000000
1.607000000000000
1.642000000000000
1.656000000000000
1.687000000000000
1.717000000000000
>> y
y =20.960000000000001
21.399999999999999
21.960000000000001
21.520000000000000
22.390000000000001
22.760000000000002
23.480000000000000
23.660000000000000
24.100000000000001
24.010000000000002
24.539999999999999
24.300000000000001
25.000000000000000
25.640000000000001
26.359999999999999
26.980000000000000
27.520000000000000
27.780000000000001
28.239999999999998
28.780000000000001
>> k=polyfit(x,y,1);
>> a=k(1);
>> b=k(2);
>> scatter(x,y,'-')
>> hold on
>> a
a =0.176290106553353
>> b
b =-1.457589881004317
>> y1=a*x+b
y120.984140683237555
21.460123970931608
21.936107258625661
21.354349906999598
22.341574503698375
22.711783727460418
23.434573164329166
23.716637334814532
24.192620622508585
24.157362601197917
24.686232920857975
24.386539739717271
25.021184123309343
25.532425432314071
26.272843879838156
26.872230242119553
27.489245615056291
27.736051764230986
28.282551094546381
28.811421414206439
>> x
x =1.0e+02 *
1.273000000000000
1.300000000000000
1.327000000000000
1.294000000000000
1.350000000000000
1.371000000000000
1.412000000000000
1.428000000000000
1.455000000000000
1.453000000000000
1.483000000000000
1.466000000000000
1.502000000000000
1.531000000000000
1.573000000000000
1.607000000000000
1.642000000000000
1.656000000000000
1.687000000000000
1.717000000000000
>> y
y =20.960000000000001
21.399999999999999
21.960000000000001
21.520000000000000
22.390000000000001
22.760000000000002
23.480000000000000
23.660000000000000
24.100000000000001
24.010000000000002
24.539999999999999
24.300000000000001
25.000000000000000
25.640000000000001
26.359999999999999
26.980000000000000
27.520000000000000
27.780000000000001
28.239999999999998
28.780000000000001
>> x=[ones(20,1),x]
x =1.0e+02 *
0.010000000000000 1.273000000000000
0.010000000000000 1.300000000000000
0.010000000000000 1.327000000000000
0.010000000000000 1.294000000000000
0.010000000000000 1.350000000000000
0.010000000000000 1.371000000000000
0.010000000000000 1.412000000000000
0.010000000000000 1.428000000000000
0.010000000000000 1.455000000000000
0.010000000000000 1.453000000000000
0.010000000000000 1.483000000000000
0.010000000000000 1.466000000000000
0.010000000000000 1.502000000000000
0.010000000000000 1.531000000000000
0.010000000000000 1.573000000000000
0.010000000000000 1.607000000000000
0.010000000000000 1.642000000000000
0.010000000000000 1.656000000000000
0.010000000000000 1.687000000000000
0.010000000000000 1.717000000000000
>> [b,bint,r,rint,stats]=regress(y,x,0.05)
b =-1.457589881004317
0.176290106553353
bint =
-1.915783961023543 -0.999395800985091
0.173199098501920 0.179381114604787
r =-0.024140683237555
-0.060123970931610
0.023892741374340
0.165650093000401
0.048425496301626
0.048216272539584
0.045426835670835
-0.056637334814532
-0.092620622508583
-0.147362601197916
-0.146232920857976
-0.086539739717271
-0.021184123309343
0.107574567685930
0.087156120161843
0.107769757880448
0.030754384943709
0.043948235769015
-0.042551094546383
-0.031421414206438
rint =
-0.197380214591832 0.149098848116723
-0.234089240235379 0.113841298372159
-0.154875657364706 0.202661140113385
0.011358385565306 0.319941800435497
-0.130852274009141 0.227703266612392
-0.132455310112963 0.228887855192131
-0.137385784544954 0.228239455886624
-0.239133423038235 0.125858753409171
-0.271758881008546 0.086517635991379
-0.316600686646691 0.021875484250859
-0.315878102151843 0.023412260435891
-0.266571280710952 0.093491801276411
-0.206112831653057 0.163744585034371
-0.068631104926293 0.283780240298153
-0.090160666136194 0.264472906459881
-0.064278724936611 0.279818240697506
-0.146265745654130 0.207774515541547
-0.130937032188002 0.218833503726033
-0.213963196628595 0.128861007535830
-0.199398817443354 0.136555989030478
stats =
1.0e+04 *
columns 1 through 2
0.000099874786001 1.435738949226265
columns 3 through 4
0.000000000000000 0.000000767910880
怎樣在Excel中插入,在excel中,怎樣樣在表格中的 中插入
輸入p 大寫 文字欄選擇wingdings 2字型 也可以右擊語言欄上的軟鍵盤 選擇一類符號 放在字下邊是不太可能了,除非用藝術字的方法移動到想要的位置。你為了表示記號,你可以用其他方法標示出來啊。比如顏色。另外,按住alt鍵加回車可以在單元格內換行,那麼就可以在 租 字下面加 了 alt 4142...
excel怎麼做矩陣,怎樣在Excel中計算矩陣?
0,1 x 1 dx和 0,1 x 1 dx都是發散的 當然不能分開寫。在計算一般的無窮限反常積分,在分部積分一定要注意積分收斂性,主要的判斷方法有 1 非負函式cauchy判別法 f x g x 是比1 x高階的無窮小,積分 0,f x g x dx收斂,若是同階 等價無窮小 或低階的無窮小,積分...
excel計算日期函式,在excel怎樣用excel函式公式計算時間差
datedif a1,today y 從a1的日期值到今天相隔多少年 datedif 1973 4 1 today m 從1973 4 1至今天相隔多少月 datedif a1,b1,m a1至b1相隔多少天 公式中,前的日期放前,後的日期放後 你說的我試了,沒錯是等於1096 你為何會說不對,你試...