资源描述:
《第十章直线回归和相关的stata实现》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、第十章直线回归和相关的Stata实现本章使用的Stata命令为:直线回归regress应变量自变量残差计算在执行regress命令后,执行下列命令:predict变量名,residualPearson相关pwcorr变量1…变量n,sigSpearman相关spearman变量1变量2例10-1为了研究血清胆固醇含量与舒张压之间是否存在依存关系,2006年在郑州某大学随机抽取10名成年男性,测得他们的血清胆固醇(mg/dL)含量和舒张压(mmHg)如表10-1,请作统计分析。表10-110名成人的血清胆固醇(mg/dL)含量和舒张压(mmHg)指标编号12345678910胆固醇30725
2、9341237254416267320374316舒张压807590707510570858878:总体回归方程不成立():总体回归方程成立()=0.05Stata数据:xy13078022597533419042377052547564161057267708320859374881031678Stata命令为:regyx结果:Source
3、SSdfMSNumberofobs=10-------------+------------------------------F(1,8)=65.11Model
4、928.3431321928.343132Prob>F=0.0000Residual
5、
6、114.056868814.2571086R-squared=0.8906-------------+------------------------------AdjR-squared=0.8769Total
7、1042.49115.822222RootMSE=3.7759------------------------------------------------------------------------------y
8、Coef.Std.Err.tP>
9、t
10、[95%Conf.Interval]-------------+------------------------------
11、----------------------------------x
12、.177864.02204198.070.000.1270352.2286927_cons
13、26.622256.9169953.850.00510.6716342.57287------------------------------------------------------------------------------t=8.07,P值<0.001(Stata输出值0.000),构建直线回归方程将和代入式(10-2),可知,本例中,的统计学意义为:血清胆固醇含量每增加1mg/dL,总体中舒张压平均增加0.17
14、8mmHg。总体均数的区间估计给定时,的总体均数的点估计,例10-1中,当自变量取值为307mg/dL时。个体值的容许区间估计给定值时,估计总体中个体值的波动范围,以例10-1中第一个样本点的数据(307,80)为例。Stata命令:predictyhatpredictstdp,stdppredictstdf,stdfgenerateclm1=yhat-invttail(7,0.025)*stdpgenerateclm2=yhat+invttail(7,0.025)*stdpgenerateclp1=yhat-invttail(7,0.025)*stdfgenerateclp2=yhat+
15、invttail(7,0.025)*stdftwoway(lfitciyx,level(95))(scatteryx)(lineclm1clm2clp1clp2x,pstyle(p2p2p3p3)sort)结果:xyyhatstdpstdfclm1clm2clp1clp23078081.231.193.9678.484.0571.8690.592597572.691.634.1168.8476.5362.9782.413419087.271.394.028490.5577.7696.782377068.781.994.2764.0873.4858.6978.872547571.81.74.
16、1467.7775.836281.59416105100.612.644.6194.37106.8689.72111.512677074.111.514.0770.5477.6964.4983.733208583.541.223.9780.6686.4274.1692.923748893.141.864.2188.7497.5583.19103.13167882.831.23.9679.9885.6773.4692.2例