用SPSS进行非线性回归分析实例

2010-12-18 MedSci原创 MedSci原创

非线性回归分析 在回归分析中,当自变量和因变量间的关系不能简单地表示为线性方程,或者不能表示为可化为线性方程的时侯,可采用非线性估计来建立回归模型。 SPSS提供了非线性回归“Nonlinear”过程,下面就以实例来介绍非线性拟合“Nonlinear”过程的基本步骤和使用方法。 应用实例 研究了南美斑潜蝇幼虫在不同温度条件下的发育速率,得到试验数据如下: 表5-1 南美斑潜蝇幼虫在不同

非线性回归分析

在回归分析中,当自变量和因变量间的关系不能简单地表示为线性方程,或者不能表示为可化为线性方程的时侯,可采用非线性估计来建立回归模型。

SPSS提供了非线性回归“Nonlinear”过程,下面就以实例来介绍非线性拟合“Nonlinear”过程的基本步骤和使用方法。

应用实例

研究了南美斑潜蝇幼虫在不同温度条件下的发育速率,得到试验数据如下:

表5-1 南美斑潜蝇幼虫在不同温度条件下的发育速率

温度℃

17.5

20

22.5

25

27.5

30

35

发育速率

0.0638

0.0826

0.1100

0.1327

0.1667

0.1859

0.1572

根据以上数据拟合逻辑斯蒂模型:

本例子数据保存在DATA6-4.SAV

 

1)准备分析数据

在SPSS数据编辑窗口建立变量“t”和“v”两个变量,把表6-14中的数据分别输入“温度”和“发育速率”对应的变量中。

或者打开已经存在的数据文件(DATA6-4.SAV)。

 

2)启动线性回归过程

单击SPSS主菜单的“Analyze”下的“Regression”中“Nonlinear”项,将打开如图5-1所示的线回归对话窗口。


图5-1 Nonlinear非线性回归对话窗口

 

3) 设置分析变量

设置因变量:从左侧的变量列表框中选择一个因变量进入“Dependent(s)”框。本例子选“发育速率[v]”变量为因变量。

 

4) 设置参数变量和初始值

单击“Parameters”按钮,将打开如图6-14所示的对话框。该对话框用于设置参数的初始值。


图5-2 设置参数初始值

Name”框用于输入参数名称。

Starting”框用于输入参数的初始值。

输入完参数名和初始值后,单击“Add”按钮,则定义的变量及其初始值将显示在下方的参数框中。需要修改已经定义的参数变量,先用将其选中,然后在“Name”和“Starting”栏里进行修改,完成后点击“Change”按钮确认修改。要删除已经定义的参数变量,先用将其选中,然后点击“Bemove”按钮删除。

在本例逻辑斯蒂模型中估计的参数有“K”、“a”和“b”三个参数变量。设置初始值为:K=0.1;a=3;b=0.1。

参数的初始值可根据给定模型中参数定义范围情况而定。输入后的“Nonlinear”对话窗口如下图。


图5-3 设置参数初始值后的对话框

完成后点击“Continue”按钮。

 

5)输入方程式

在“Model Expression”框中输入需要拟合的方程式,在该方程中包含自变量、参数变量和常数等。自变量和参数变量可以从左边的列表框和“Parameters”框里选入。

方程中的函数可以从“Function”框里选入;运算符号和常数可以用鼠标从窗口“数字符号”显示区中点击输入。

本例输入的逻辑斯蒂模型是: K/(1+EXP(a-b*t))。输入后的窗口显示如下图。


图5-4 设置后的非线性回归对话窗口

 

6) 迭代条件

在主对话框中单击“Loss”按钮,将打开如图5-5所示的对话框。


图5-5 Loss 对话框

        Sum of squared residuals”项,残差平方和最小值,系统默认。本例选该项。
        User-defined loss function”自定义选项。设置其他统计量为迭代条件,在下边输入框中输入相应的统计
               量的表达式,称为损失函数。在左上角的变量列表框中,“RESID”代表所选变量的残差;“PRED_”代表预测
               值。可以从左下角框中选择已定义的参数进入损失函。

 

7)参数取值范围

在主对话框中单击“Constraints”按钮,将打开如图5-6所示的对话框。在该对话框中设置回归方程中参数的取值范围。

选中“Define parameter constraint”项,即可对选定的参数变量设置取值范围。参数的取值范围,用不等式“=,<=,>=”来定义。

例如,在本例逻辑斯蒂模型中K参数应该小于1。应该定义如下:k<=0.9999

定义后会提示:是否复制现有的变量名,回答“确定”。


图5-6 参数取值范围对话框

 

8) 保存分析数据

在主对话框中单击“Save”按钮将打开如图5-7所示的对话框,选择要保存到数据文件中的统计量。


图 5-7 Save对话框

其中各项分别为:

       “Predicted values”因变量的预测值。
       “Residuals”因变量的残差。
       “Derivatives”派生数。
       “Loss function values”损失函数值。

 

9) 迭代方法

主对话框中单击“Options”按钮,将打开如图5-8所示的对话框。


图5-8 迭代方法对话框

Bootstrap estimates of standard error”项,将采用样本重复法计算标准误。样本重复法需要顺序二次规划算法的支持。当选中该项时,SPSS将自动选中“Sequential quadratic Programming”项。

Estimation Method”框中列出了参数的两种估计方法:

    Sequential Quadratic Programming”项为顺序二次规划算法。该方法要求输入的参数为:

    “Maximum”最大迭代步数。
    “Step Iimit”最大步长。
    “Optimality”目标函数的迭代误差限。
    “Function”函数精度,应比目标函数的迭代误差限小。
    “Infinite step”当一次迭代中参数值的变化大于设置值,则迭代停止。

    Levenberg-Marquardt”项,采用麦夸尔迭代法),系统缺省设置。该法要求输入的参数为:

    “Maximum iterations”最大迭代步数。
    “Sum-of-squares convergence”在一步迭代中目标函数残差平方和的变化比例小于设置的值时,
                            迭代停止。
    “Parameter convergence”在一步迭代中参数的变化比例小于设置值时,迭代停止。

    本例选“Levenberg-Marquardt”项,最大迭代步数100,残差平方和的变化比例小于1E-8,参数的变化比例小于1E-8。

     

10)提交执行

所有的设置完成后,在主对话框中点击“OK”按钮提交所有设置,SPSS执行过程后输出结果显示在输出窗口中。

 

11) 结果分析

结果:

文本框: All the derivatives will be calculated numerically.     Iteration  Residual SS           K           A           B       1      .0625076405  .100000000  3.00000000  .100000000       1.1     2.564768220  -.47546915  3.69314164  .675071407       1.2    .0050867657  .157709706  1.90159327  .141778778       2      .0050867657  .157709706  1.90159327  .141778778  		:			:			:			:	      16      .0009331870  .177359068  5.70621767  .281983521      16.1    .0009331870  .177360878  5.70599385  .281971271    Run stopped after 33 model evaluations and 16 derivative evaluations.  Iterations have been stopped because the relative reduction between successive  residual sums of squares is at most SSCON = 1.000E-08    Nonlinear Regression Summary Statistics     Dependent Variable V      Source                 DF  Sum of Squares  Mean Square      Regression              3         .12673         .04224    Residual                4   9.331870E-04   2.332968E-04    Uncorrected Total       7         .12766      (Corrected Total)       6         .01223      R squared = 1 - Residual SS / Corrected SS =     .92370                                             Asymptotic 95 %                            Asymptotic     Confidence Interval    Parameter   Estimate    Std. Error     Lower         Upper    (参数名     估计参数        标准误         95%置信限       )    K           .177360878   .015726528   .133697035   .221024720    A          5.705993848  1.793759786   .725718271 10.686269425    B           .281971271   .092934086   .023944884   .539997658      Asymptotic Correlation Matrix of the Parameter Estimates   (参数相关矩阵)                     K         A         B    K           1.0000    -.6624    -.7401    A           -.6624    1.0000     .9889    B           -.7401     .9889    1.0000

根据以上输出结果得到K的参数估计值是0.177360878;a的参数估计值是5.705993848;b的参数估计值是0.281971271。其拟合的逻辑斯蒂发育速率模型为:

         

残差平方和(Q)为0.0009331870;拟合优度系数(R2)为0.92370。

版权声明:
本网站所有内容来源注明为“梅斯医学”或“MedSci原创”的文字、图片和音视频资料,版权均属于梅斯医学所有。非经授权,任何媒体、网站或个人不得转载,授权转载时须注明来源为“梅斯医学”。其它来源的文章系转载文章,或“梅斯号”自媒体发布的文章,仅系出于传递更多信息之目的,本站仅负责审核内容合规,其内容不代表本站立场,本站不负责内容的准确性和版权。如果存在侵权、或不希望被转载的媒体或个人可与我们联系,我们将立即进行删除处理。
在此留言
评论区 (4)
#插入话题
  1. [GetPortalCommentsPageByObjectIdResponse(id=343720, encodeId=0cd8343e2061, content=同样的方法,运行出来,迭代次数为0,请问是什么原因啊?, beContent=null, objectType=article, channel=null, level=null, likeNumber=63, replyNumber=0, topicName=null, topicId=null, topicList=[], attachment=null, authenticateStatus=null, createdAvatar=, createdBy=c4c22438493, createdName=123cd399m67暂无昵称, createdTime=Sat Sep 08 13:08:02 CST 2018, time=2018-09-08, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=10220, encodeId=a0b7102202e, content=对我帮助很大,谢谢, beContent=null, objectType=article, channel=null, level=null, likeNumber=100, replyNumber=0, topicName=null, topicId=null, topicList=[], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=f0620, createdName=210.77.67.123, createdTime=Thu Jul 03 17:47:00 CST 2014, time=2014-07-03, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=1671676, encodeId=4fe416e167674, content=<a href='/topic/show?id=c56c4051902' target=_blank style='color:#2F92EE;'>#回归分析#</a>, beContent=null, objectType=article, channel=null, level=null, likeNumber=26, replyNumber=0, topicName=null, topicId=null, topicList=[TopicDto(id=40519, encryptionId=c56c4051902, topicName=回归分析)], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=a46f26833520, createdName=cenghis, createdTime=Wed Jun 22 18:00:00 CST 2011, time=2011-06-22, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=1701372, encodeId=05eb1e01372d6, content=<a href='/topic/show?id=214ee756845' target=_blank style='color:#2F92EE;'>#线性回归#</a>, beContent=null, objectType=article, channel=null, level=null, likeNumber=27, replyNumber=0, topicName=null, topicId=null, topicList=[TopicDto(id=77568, encryptionId=214ee756845, topicName=线性回归)], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=748630348850, createdName=天堂的云, createdTime=Wed Mar 02 14:00:00 CST 2011, time=2011-03-02, status=1, ipAttribution=)]
    2018-09-08 123cd399m67暂无昵称

    同样的方法,运行出来,迭代次数为0,请问是什么原因啊?

    0

  2. [GetPortalCommentsPageByObjectIdResponse(id=343720, encodeId=0cd8343e2061, content=同样的方法,运行出来,迭代次数为0,请问是什么原因啊?, beContent=null, objectType=article, channel=null, level=null, likeNumber=63, replyNumber=0, topicName=null, topicId=null, topicList=[], attachment=null, authenticateStatus=null, createdAvatar=, createdBy=c4c22438493, createdName=123cd399m67暂无昵称, createdTime=Sat Sep 08 13:08:02 CST 2018, time=2018-09-08, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=10220, encodeId=a0b7102202e, content=对我帮助很大,谢谢, beContent=null, objectType=article, channel=null, level=null, likeNumber=100, replyNumber=0, topicName=null, topicId=null, topicList=[], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=f0620, createdName=210.77.67.123, createdTime=Thu Jul 03 17:47:00 CST 2014, time=2014-07-03, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=1671676, encodeId=4fe416e167674, content=<a href='/topic/show?id=c56c4051902' target=_blank style='color:#2F92EE;'>#回归分析#</a>, beContent=null, objectType=article, channel=null, level=null, likeNumber=26, replyNumber=0, topicName=null, topicId=null, topicList=[TopicDto(id=40519, encryptionId=c56c4051902, topicName=回归分析)], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=a46f26833520, createdName=cenghis, createdTime=Wed Jun 22 18:00:00 CST 2011, time=2011-06-22, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=1701372, encodeId=05eb1e01372d6, content=<a href='/topic/show?id=214ee756845' target=_blank style='color:#2F92EE;'>#线性回归#</a>, beContent=null, objectType=article, channel=null, level=null, likeNumber=27, replyNumber=0, topicName=null, topicId=null, topicList=[TopicDto(id=77568, encryptionId=214ee756845, topicName=线性回归)], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=748630348850, createdName=天堂的云, createdTime=Wed Mar 02 14:00:00 CST 2011, time=2011-03-02, status=1, ipAttribution=)]
    2014-07-03 210.77.67.123

    对我帮助很大,谢谢

    0

  3. [GetPortalCommentsPageByObjectIdResponse(id=343720, encodeId=0cd8343e2061, content=同样的方法,运行出来,迭代次数为0,请问是什么原因啊?, beContent=null, objectType=article, channel=null, level=null, likeNumber=63, replyNumber=0, topicName=null, topicId=null, topicList=[], attachment=null, authenticateStatus=null, createdAvatar=, createdBy=c4c22438493, createdName=123cd399m67暂无昵称, createdTime=Sat Sep 08 13:08:02 CST 2018, time=2018-09-08, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=10220, encodeId=a0b7102202e, content=对我帮助很大,谢谢, beContent=null, objectType=article, channel=null, level=null, likeNumber=100, replyNumber=0, topicName=null, topicId=null, topicList=[], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=f0620, createdName=210.77.67.123, createdTime=Thu Jul 03 17:47:00 CST 2014, time=2014-07-03, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=1671676, encodeId=4fe416e167674, content=<a href='/topic/show?id=c56c4051902' target=_blank style='color:#2F92EE;'>#回归分析#</a>, beContent=null, objectType=article, channel=null, level=null, likeNumber=26, replyNumber=0, topicName=null, topicId=null, topicList=[TopicDto(id=40519, encryptionId=c56c4051902, topicName=回归分析)], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=a46f26833520, createdName=cenghis, createdTime=Wed Jun 22 18:00:00 CST 2011, time=2011-06-22, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=1701372, encodeId=05eb1e01372d6, content=<a href='/topic/show?id=214ee756845' target=_blank style='color:#2F92EE;'>#线性回归#</a>, beContent=null, objectType=article, channel=null, level=null, likeNumber=27, replyNumber=0, topicName=null, topicId=null, topicList=[TopicDto(id=77568, encryptionId=214ee756845, topicName=线性回归)], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=748630348850, createdName=天堂的云, createdTime=Wed Mar 02 14:00:00 CST 2011, time=2011-03-02, status=1, ipAttribution=)]
  4. [GetPortalCommentsPageByObjectIdResponse(id=343720, encodeId=0cd8343e2061, content=同样的方法,运行出来,迭代次数为0,请问是什么原因啊?, beContent=null, objectType=article, channel=null, level=null, likeNumber=63, replyNumber=0, topicName=null, topicId=null, topicList=[], attachment=null, authenticateStatus=null, createdAvatar=, createdBy=c4c22438493, createdName=123cd399m67暂无昵称, createdTime=Sat Sep 08 13:08:02 CST 2018, time=2018-09-08, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=10220, encodeId=a0b7102202e, content=对我帮助很大,谢谢, beContent=null, objectType=article, channel=null, level=null, likeNumber=100, replyNumber=0, topicName=null, topicId=null, topicList=[], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=f0620, createdName=210.77.67.123, createdTime=Thu Jul 03 17:47:00 CST 2014, time=2014-07-03, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=1671676, encodeId=4fe416e167674, content=<a href='/topic/show?id=c56c4051902' target=_blank style='color:#2F92EE;'>#回归分析#</a>, beContent=null, objectType=article, channel=null, level=null, likeNumber=26, replyNumber=0, topicName=null, topicId=null, topicList=[TopicDto(id=40519, encryptionId=c56c4051902, topicName=回归分析)], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=a46f26833520, createdName=cenghis, createdTime=Wed Jun 22 18:00:00 CST 2011, time=2011-06-22, status=1, ipAttribution=), GetPortalCommentsPageByObjectIdResponse(id=1701372, encodeId=05eb1e01372d6, content=<a href='/topic/show?id=214ee756845' target=_blank style='color:#2F92EE;'>#线性回归#</a>, beContent=null, objectType=article, channel=null, level=null, likeNumber=27, replyNumber=0, topicName=null, topicId=null, topicList=[TopicDto(id=77568, encryptionId=214ee756845, topicName=线性回归)], attachment=null, authenticateStatus=null, createdAvatar=null, createdBy=748630348850, createdName=天堂的云, createdTime=Wed Mar 02 14:00:00 CST 2011, time=2011-03-02, status=1, ipAttribution=)]

相关资讯

SPSS中多选题的录入及统计分析

多选题,就是说一个题目可以有多个答案。在录入的时候有两种选择。下来举例说明:Q1 你经常使用的搜索引擎是哪几个?     1 百度      2 Google      3 雅虎      4 其他假设有5个被访者,分别选择了A 1

用SPSS进行逐步回归分析实例

逐步回归分析 在自变量很多时,其中有的因素可能对应变量的影响不是很大,而且x之间可能不完全相互独立的,可能有种种互作关系。在这种情况下可用逐步回归分析,进行x因子的筛选,这样建立的多元回归模型预测效果会更较好。 逐步回归分析,首先要建立因变量y与自变量x之间的总回归方程,再对总的方程及每—个自变量进行假设检验。当总的方程不显著时,表明该多元回归方程线性关系不成立;而当某—个自变量对y影响不显著

用SPSS进行多元回归分析实例

多元回归分析 在大多数的实际问题中,影响因变量的因素不是一个而是多个,我们称这类回问题为多元回归分析。可以建立因变量y与各自变量xj(j=1,2,3,…,n)之间的多元线性回归模型: 其中:b0是回归常数;bk(k=1,2,3,…,n)是回归参数;e是随机误差。 多元回归在病虫预报中的应用实例: 某地区病虫测报站用相关系数法选取了以下4个预报因子;x1为最多连续10天诱蛾量(头);x2

用SPSS进行非线性回归分析实例

非线性回归分析 在回归分析中,当自变量和因变量间的关系不能简单地表示为线性方程,或者不能表示为可化为线性方程的时侯,可采用非线性估计来建立回归模型。 SPSS提供了非线性回归“Nonlinear”过程,下面就以实例来介绍非线性拟合“Nonlinear”过程的基本步骤和使用方法。 应用实例 研究了南美斑潜蝇幼虫在不同温度条件下的发育速率,得到试验数据如下: 表5-1 南美斑潜蝇幼虫在不同

用SPSS进行一元线性回归分析

一元回归分析 在数学关系式中只描述了一个变量与另一个变量之间的数量变化关系,则称其为一元回归分析。 其回归模型为                    y 称为因变量,x称为自变量,称为随机误差,a,b

用SPSS进行曲线回归分析实例

曲线回归分析 在一元回归中,若因变量和自变量相关的趋势不是线性分布,呈现曲线关系。这种情况可以利用SPSS提供的曲线估计过程(Curve Estimation)方便地进行线性拟合,选出最佳的回归模型来拟合出相应曲线。 下面以一个实例来介绍曲线拟合的基本步骤和使用方法。 例子 台湾稻螟蚁螟侵入不同叶龄稻茎后的生存率数据(表4-1)。拟合出适合的曲线模型,来表达不同叶龄稻茎对台湾稻螟蚁螟侵入的