第9章 非线性回归
9.1 在非线性回归线性化时,对因变量作变换应注意什么问题?
答:在对非线性回归模型线性化时,对因变量作变换时不仅要注意回归函数的形式, 还要注意误差项的形式。如:
(1) 乘性误差项,模型形式为
e y AK L αβε
=, (2) 加性误差项,模型形式为
y AK L αβε=+ 。 对乘法误差项模型(1)可通过两边取对数转化成线性模型,(2)不能线性化。 一般总是假定非线性模型误差项的形式就是能够使回归模型线性化的形式,为了方便通常省去误差项,仅考虑回归函数的形式。
9.2为了研究生产率与废料率之间的关系,记录了如表9.14所示的数据,请画出散点图,根据散点图的趋势拟合适当的回归模型。 表9.14
生产率x (单位/周) 1000 2000 3000 3500 4000 4500 5000 废品率y (%)
5.2
6.5
6.8
8.1
10.2 10.3 13.0
解:先画出散点图如下图:
5000.00
4000.003000.002000.001000.00x
12.00
10.00
8.006.00
y
从散点图大致可以判断出x 和y 之间呈抛物线或指数曲线,由此
采用二次方程式和指数函数进行曲线回归。 (1)二次曲线 SPSS 输出结果如下:
Model Summary
.981
.962
.942
.651
R R Square
Adjusted R Square
Std. Error of the Estimate
The independent variable is x.
ANOVA
42.571221.28650.160.001
1.6974.424
44.269
6
Regression Residual Total
Sum of Squares df
Mean Square
F Sig.The independent v ariable is x .
Coefficients
-.001.001-.449-.891.4234.47E-007.000
1.417
2.812.0485.843 1.324
4.414.012
x x ** 2
(Constant)
B Std. E rror Unstandardized Coefficients Beta
Standardized
Coefficients t
Sig.
从上表可以得到回归方程为:72? 5.8430.087 4.4710y
x x -=-+? 由x 的系数检验P 值大于0.05,得到x 的系数未通过显著性检验。 由x 2的系数检验P 值小于0.05,得到x 2的系数通过了显著性检验。 (2)指数曲线
Model Summary
.970
.941
.929
.085
R R Square
Adjusted R Square
Std. Error of the Estimate
The independent variable is x.
ANOVA
.5731.57379.538
.000
.0365.007
.609
6
Regression Residual Total
Sum of Squares
df
Mean Square
F Sig.The independent v ariable is x .
Coefficients
.000.000.970
8.918.0004.003.348
11.514.000
x
(Constant)
B Std. E rror Unstandardized Coefficients Beta
Standardized
Coefficients t
Sig.The dependent variable is ln(y).
从上表可以得到回归方程为:0.0002t ? 4.003y
e 由参数检验P 值≈0<0.05,得到回归方程的参数都非常显著。
从R 2值,σ的估计值和模型检验统计量F 值、t 值及拟合图综合考虑,指数拟合效果更好一些。
9.3 已知变量x与y的样本数据如表9.15,画出散点图,试用αeβ/x来拟合回归模型,假设:
(1)乘性误差项,模型形式为y=αeβ/x eε
(2)加性误差项,模型形式为y=αeβ/x+ε。
表9.15
序号x y 序号x y 序号x y
1 4.20 0.086 6 3.20 0.150 11 2.20 0.350
2 4.06 0.090 7 3.00 0.170 12 2.00 0.440
3 3.80 0.100 8 2.80 0.190 13 1.80 0.620
4 3.60 0.120 9 2.60 0.220 14 1.60 0.940
5 3.40 0.130 10 2.40 0.240 15 1.40 1.620
解:散点图:
(1)乘性误差项,模型形式为y=αeβ/x eε
线性化:lny=lnα+β/x +ε令y1=lny, a=lnα,x1=1/x .
做y1与x1的线性回归,SPSS 输出结果如下:
Model Summary b
.999
a
.997
.997.04783
Model 1
R R S quare
Adjusted R S quare
Std. Error of the Estimate
Predictors: (Constant), x 1a. Dependent Variable: y1
b. ANOVA b
10.930110.9304778.305
.000a
.03013.002
10.960
14
Regression Residual Total
Model 1
Sum of Squares df
Mean Square
F
Sig.Predictors: (Constant), x 1a. Dependent Variable: y 1
b. Coefficients a
-3.856.037-103.830.0006.080.088
.999
69.125.000
(Constant)x 1
Model 1
B Std. Error Unstandardized Coefficients Beta
Standardized
Coefficients t
Sig.Dependent Variable: y 1
a.
从以上结果可以得到回归方程为:y1=-3.856+6.08x1
F 检验和t 检验的P 值≈0<0.05,得到回归方程及其参数都非常显著。
回代为原方程为:y=0.021e
6.08/x
(2)加性误差项,模型形式为y=αe
β
/x
+ε
不能线性化,直接非线性拟合。给初值α=0.021,β=6.08(线性化结果),NLS 结果如下:
Parameter E stimates
.021.001.020.0236.061.044
5.965
6.157
Parameter
a b Estim ate
Std. Error
Lower Bound Upper Bound
95% Confidence Interv al
ANOVA a
4.4582 2.229.00113.000
4.459152.467
14
Source Regression Residual
Uncorrected Total Corrected Total
Sum of Squares
df
Mean Squares
Dependent variable: y
R squared = 1 - (Residual Sum of Squares) /(Corrected Sum of Squares) = 1.000.
a.
从以上结果可以得到回归方程为: y=0.021e 6.061/x
根据R 2≈1,参数的区间估计不包括零点且较短,可知回归方程拟合非常好,且其参数都显著。
9.4 Logistic 回归函数常用于拟合某种消费品的拥有率,表8.17(书上239页,此处略)是北京市每百户家庭平均拥有的照相机数,试针对以下两种情况拟合Logistic 回归函数。
0111
t y b b u
=
+
(1)已知100u =,用线性化方法拟合,
(2)u 未知,用非线性最小二乘法拟合。根据经济学的意义知道,u 是拥有率的上限,初值可取100;b0>0,0 解:(1),100u =时,的线性拟合。对0111 t y b b u = +函数线性化得到: 11ln() 1.8510.264100y -=--0111ln()ln ln 100b t b y -=+,令311ln()100 y y =-,作3 y 关于t 的线性回归分析,SPSS 输出结果如下: Model Summary b .994 a .988 .987.16820 Model 1 R R S quare Adjusted R S quare Std. Error of the Estimate Predictors: (Constant), t a. Dependent Variable: y3 b. ANOVA b 39.839139.8391408.165.000a .48117.028 40.320 18 Regression Residual Total Model 1 Sum of Squares df Mean Square F Sig.Predictors: (Constant), t a. Dependent Variable: y 3 b. Coefficients a -1.851.080-23.039.000-.264.007 -.994 -37.526.000 (Constant)t Model 1 B Std. Error Unstandardized Coefficients Beta Standardized Coefficients t Sig.Dependent Variable: y 3 a.