| 10 | 1/1 | 返回列表 |
| 查看: 6309 | 回復: 9 | ||||
[求助]
求助 用matlab擬合三元線性回歸方程及分析
|
|
用matlab擬合三元線性回歸方程,我自己弄了一個如下 x1=[23.00 23.00 23.00 23.00 23.00 28.00 28.00 28.00 28.00 28.00]'; x2=[0.30 0.30 0.30 0.30 0.30 0.10 0.10 0.10 0.10 0.10]'; x3=[0.00 0.69 1.09 1.38 1.61 0.00 0.69 1.09 1.38 1.61]'; y=[-0.91 -0.35 -0.05 0.15 0.29 -0.58 -0.04 0.23 0.41 0.54]; x=[ones(10,1) x1 x2 x3]; >> [b,bint,r,rint,stats]=regress(y,x); ??? Error using ==> or Matrix dimensions must agree. Error in ==> regress at 70 wasnan = (isnan(y) | any(isnan(X),2)); >> b,bint,stats,rcoplot(r,rint) b = 0 -0.0115 -1.7878 0.6751 bint = 0 0 -0.0168 -0.0062 -2.2782 -1.2973 0.5701 0.7800 stats = 0.9747 134.6812 0.0000 0.0059 問題: 1.我編寫的程序對嗎? 2.輸入程序中,總是會出現(xiàn)warning的那段文字,不知道怎么修改? |
榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |

|
請問y寫成列向量后又出現(xiàn)問題了,這是怎么回事?? >> x1=[23.00 23.00 23.00 23.00 23.00 28.00 28.00 28.00 28.00 28.00]'; x2=[0.30 0.30 0.30 0.30 0.30 0.10 0.10 0.10 0.10 0.10]'; x3=[0.00 0.69 1.09 1.38 1.61 0.00 0.69 1.09 1.38 1.61]'; >> y=[-0.91 -0.35 -0.05 0.15 0.29 -0.58 -0.04 0.23 0.41 0.54]; >> x=[ones(10,1) x1 x2 x3]; >> [b,bint,r,rint,stats]=regress(y,x); Warning: X is rank deficient to within machine precision. > In regress at 82 >> b,bint,stats,rcoplot(r,rint) |
榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |
|
Most likely you have too many predictor variables, and too few observations. As an alaogy, imagine trying to fit a cubic polynomial regression with only two observations. REGRESS will make a choise about which coefficients to set to zero, but it can't possibly know what you really want. 變量太多,你可以試一下,分別使用x(:,1:2), x(:,1:3), x(:,2:3)算一下,使用3列時總會出現(xiàn)一個b=0。 |

榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |

|
本帖內(nèi)容被屏蔽 |
金蟲 (小有名氣)
|
迭代數(shù): 33 計算用時(時:分:秒:微秒): 00:00:00:241 優(yōu)化算法: 麥夸特法(Levenberg-Marquardt) + 通用全局優(yōu)化法 計算結束原因: 達到收斂判斷標準 均方差(RMSE): 0.0274286872091944 殘差平方和(SSE): 0.00752332882019822 相關系數(shù)(R): 0.998018933040592 相關系數(shù)之平方(R^2): 0.996041790707481 決定系數(shù)(DC): 0.996041790707481 卡方系數(shù)(Chi-Square): -0.0155244265746169 F統(tǒng)計(F-Statistic): 2013.11596653563 參數(shù) 最佳估算 ---------- ------------- a -37.3038021226221 b -934.025053065556 c 0.724150995543315 d 1137.33012469023 ====== 結果輸出 ===== No 實測值y 計算值y 1 -0.91 -0.8648400 2 -0.35 -0.3651759 3 -0.05 -0.0755155 4 0.15 0.1344883 5 0.29 0.3010431 6 -0.58 -0.5788400 7 -0.04 -0.0791759 8 0.23 0.2104845 9 0.41 0.4204883 10 0.54 0.5870431 |
| 10 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 334分 一志愿武理 材料求調(diào)劑 +14 | 李李不服輸 2026-03-26 | 14/700 |
|
|---|---|---|---|---|
|
[考研] 291求調(diào)劑 +7 | HanBeiNingZC 2026-03-24 | 7/350 |
|
|
[考研] 求調(diào)劑323材料與化工 +10 | 1124361 2026-03-24 | 10/500 |
|
|
[考研] 329求調(diào)劑 +8 | 星野? 2026-03-26 | 8/400 |
|
|
[考研] 085602 化學工程專碩 340分求調(diào)劑 +4 | qianbai11 2026-03-29 | 4/200 |
|
|
[考研] 332求調(diào)劑 +6 | Lyy930824@ 2026-03-29 | 6/300 |
|
|
[考研] 285求調(diào)劑 +5 | AZMK 2026-03-29 | 8/400 |
|
|
[考研] 282求調(diào)劑 +4 | wcq131415 2026-03-24 | 4/200 |
|
|
[考研] 337求調(diào)劑 +6 | 《樹》 2026-03-29 | 6/300 |
|
|
[考研] 一志愿211,335分,0856,求調(diào)劑院校和導師 +7 | 傾____蕭 2026-03-27 | 8/400 |
|
|
[考研] 299求調(diào)劑 +10 | 15188958825 2026-03-25 | 10/500 |
|
|
[考研] 289求調(diào)劑 +5 | BrightLL 2026-03-29 | 5/250 |
|
|
[考研] 349求調(diào)劑 +6 | 李木子啊哈哈 2026-03-25 | 6/300 |
|
|
[考研] 315求調(diào)劑 +4 | akie... 2026-03-28 | 5/250 |
|
|
[考研] 340求調(diào)劑 +5 | jhx777 2026-03-27 | 5/250 |
|
|
[考研] 化學調(diào)劑 +4 | 愛吃番茄的旭 2026-03-24 | 5/250 |
|
|
[考研] 281求調(diào)劑 +6 | Koxui 2026-03-24 | 7/350 |
|
|
[考研] 一志愿河工大 081700 276求調(diào)劑 +4 | 地球繞著太陽轉 2026-03-23 | 4/200 |
|
|
[考研] 材料專碩 335 分求調(diào)劑 +4 | 拒絕冷暴力 2026-03-25 | 4/200 |
|
|
[考研] 一志愿武理085500機械專業(yè)總分300求調(diào)劑 +3 | an10101 2026-03-24 | 7/350 |
|