7.5717 16.0204 -0.7145 6.1189 2.1447 12.1791 -3.7311 -13.6412
rint =-22.7953 23.4680 -37.2950 -1.1347 -30.9881 16.8492 -16.7413 31.8846 -5.7896 37.8305 -26.2054 24.7763 -18.9682 31.2061 -23.0862 27.3756 -10.0894 34.4475 -26.4931 19.0310 -31.5901 4.3077
s = 0.9362 132.0614 0.0000 124.9076
,b2?0.3120,b1的置信水平为0.95的置信区间为(23.0712,88.6342),因此b1?55.8527b2的置信水平为0.95的置信区间为?3.0296,3.0296?
??R2?0.9362,F?132.0614,P?0.0000?0.05,s2?124.9076.
由以上计算结果可知,回归模型y?55.8527?0.3120x成立.
>> z=inline('-143.4531+3.0296*x','x');
>> x=800; z(x) ans =305.4527
2.现对具有统计关系的两个变量的取值情况进行13次试验得到如下数据 xi yi 2 0.9397 11 0.9042 3 0.9242 14 0.9042 ?4 0.9126 15 0.9017 5 0.9132 16 0.9029 7 0.9091 18 0.9009 8 0.9097 19 0.8993 10 0.9051 xi yi 求回归曲线方程
1??a?b.
xy???1解:令y1??,x1?,则回归曲线方程为:y1?a?bx1,编程求解:
xy1>> x=[2 3 4 5 7 8 10 11 14 15 16 18 19];
>> y=[0.9397 0.9242 0.9126 0.9132 0.9091 0.9097 0.9051 0.9042 0.9042 0.9017 0.9029 0.9009 0.8993];
>> X=[ones(13,1),x']; >> b=regress((1./y)',1./X)
b = 1.1149 -0.0983
因此,a?1.1149,b??0.0983,即回归曲线方程为:
??1y??1.1149?0.0983 x3、一种合金在某种添加剂的不同浓度下,各做三次试验,得到数据如下表: 浓度x 抗压强度Y 抗压强度Y 抗压强度Y 10 25.2 27.3 28.7 15 29.8 31.1 27.8 20 31.2 32.6 29.7 25 31.7 30.1 32.3 30 29.4 30.8 32.8 (1)作散点图;(2)以模型Y?b0?b1x?b2x2??,?~N0,?2拟合数据,其中
??????(3)求回归方程y?b?bx?bx2并作回归分析. b0,b1,b2,?2与x无关;012解:编程:>> x1=[10 15 20 25 30];
>> y1=[25.2 29.8 31.2 31.7 29.4]; >> y2=[27.3 31.1 32.6 30.1 30.8]; >> y3=[28.7 27.8 29.7 32.3 32.8]; >> plot(x1,y1,'+',x1,y2,'o',x1,y3,'*') 图像:
3332313029282726251015202530
编程拟合:建立M文件:fun.m unction f=fun(c,x)
f=c(1)+c(2)*x+c(3)*x^2; 在命令窗口输入: >> x=10:5:30;
>> y1=[25.2 29.8 31.2 31.7 29.4]; >> y2=[27.3 31.1 32.6 30.1 30.8]; >> y3=[28.7 27.8 29.7 32.3 32.8]; >> c0=[0.2 0.05 0.05];
>> [c,fval]=lsqcurvefit('fun',c0,x,y1,y2,y3) c = 0.2000 0.0500 0.0500 fval = []
?即b0?0.2000,b1?0.0500,b2?0.0500,故y?0.2?0.05x?0.05x2