数学建模社区-数学中国

标题: 讨论:用lingo解决回归分析的最小二乘法 [打印本页]

作者: liwenhui    时间: 2009-10-29 17:36
标题: 讨论:用lingo解决回归分析的最小二乘法
曾经看到有人在此发了一个贴,上面是求解回归分析中最小二乘估计量的Lingo程序,但我现在好不到这个帖子了。谁能不能帮忙,知道的话把此程序再放上来我看看?
作者: 675442656    时间: 2009-10-30 14:49
不知道!我刚来,你可以找一下管理员。
作者: mrx    时间: 2009-11-1 00:58
我就说论坛的搜索功能实在是垃圾
作者: liwenhui    时间: 2009-11-18 17:16
诸位,就没人见过这个经典的帖子吗?
作者: gw873402096    时间: 2010-2-5 22:03
收下了,呵呵~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
作者: 08008103    时间: 2010-5-12 17:27
tongqiu!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
作者: yujinshuxue    时间: 2011-9-20 16:11
严重需要

作者: shengshengchina    时间: 2011-10-16 14:08
标题: lingo最小二乘拟合
本帖最后由 shengshengchina 于 2011-10-16 14:08 编辑

lingo最小二乘拟合实例

问题:如下拟合系数a,b
minz(a,b)=∑(a*n(i)^2+b-t(i))^2

程序:

model :
sets :
recorder/r1..r19/:n ,t ;
endsets
data :
n = 0 , 617 , 1141 , 1601 , 2019 , 2403 , 2760 , 3096 ,
3413 ,3715 ,4004 ,4280 ,4545 ,4803 ,5051 ,5291 ,5525 ,
5752 ,6061 ;
t = 0 ,10 ,20 ,30 ,40 ,50 ,60 ,70 ,80 ,90 ,100 ,110 ,
120 ,130 ,140 ,150 ,160 ,170 ,184 ;
enddata
min = @sum(recorder : (a*(n^2) + b*n-t)^2) ;
end

  Global optimal solution found.
  Objective value:                             0.1000818E-01
  Objective bound:                             0.1000818E-01
  Infeasibilities:                              0.000000
  Extended solver steps:                               2
  Total solver iterations:                          3259

                       Variable           Value        Reduced Cost
                              A       0.2611393E-05       0.4752936E-05
                              B       0.1452963E-01        0.000000
                         N( R1)        0.000000            0.000000
                         N( R2)        617.0000            0.000000
                         N( R3)        1141.000            0.000000
                         N( R4)        1601.000            0.000000

用matlab画图检验:
n = [ 0 617,1141 ,1601 ,2019 ,2403 ,2760 ,3096 , ...
3413 ,3715 ,4004 ,4280 ,4545 ,4803 ,5051 ,5291 ,5525 ,...
5752 ,6061 ] ;
t = [ 0 ,10 ,20 ,30 ,40 ,50 ,60 ,70 ,80 ,90 ,100 ,110 ,...
120 ,130 ,140 ,150 ,160 ,170 ,184 ] ;
plot (n ,t ,'o' ) ;
hold on;
xlabel ('n') ;
n = linspace (0 ,6061 ,20) ;
t1 = 0.000002611393*n.^2 + 0.01452963*n ;
plot (n ,t1 ,'r-' ) ;

作者: zhipenglv    时间: 2011-10-27 16:09

作者: 龙卷残云    时间: 2011-11-1 19:56
shengshengchina 发表于 2011-10-16 14:08
lingo最小二乘拟合实例

问题:如下拟合系数a,b

hao..........
作者: 小楫轻舟    时间: 2013-2-28 21:16
同求,呵呵~~~~~~~~~~~~~~~~~




欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5