STATA学习系列-ppt课件.ppt
- 【下载声明】
1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
3. 本页资料《STATA学习系列-ppt课件.ppt》由用户(三亚风情)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- STATA 学习 系列 ppt 课件
- 资源描述:
-
1、 STATA学习系列学习系列 医学资料1STATA学习系列 Regress部分部分(续续)-回归诊断分析回归诊断分析 1.Census数据实际操作处理(分析模型) 2.Auto数据回归诊断分析(图象分析方法) 3.Exdata数据分析实际应用医学资料2基本的数据转换:excel stata1.将excel数据导入stata 第一步:将excel文件另存为用制表符隔开制表符隔开的txt 文件; 第二步:用命令: insheet using d:stata/name.txt;2.将stata数据导出用excel打开 第一步:outsheet using d:/stataname .out(生成文件
2、位置) 第二步:用excel打开.out文件即可.医学资料31.Census数据实际操作处理Use d:/stata/census1.数据说明:. describeContains data from d:stata/census.dta obs: 50 1980 Census data by state vars: 12 6 Jul 2000 17:06 size: 3,000 (99.4% of memory free)- storage display valuevariable name type format label variable label-state str14 %-14
3、s Stateregion int %-8.0g cenreg Census regionpop long %12.0gc Populationpoplt5 long %12.0gc Pop, F = 0.0000 Residual | .000027249 46 5.9236e-07 R-squared = 0.6724-+- Adj R-squared = 0.6510 Total | .000083179 49 1.6975e-06 Root MSE = .00077- drate | Coef. Std. Err. t P|t| 95% Conf. Interval-+- medage
4、 | .0004851 .001207 0.40 0.690 -.0019446 .0029147 medagesq | 2.37e-06 .0000206 0.12 0.909 -.000039 .0000437 pcturban | -.0035348 .0008293 -4.26 0.000 -.0052042 -.0018655 _cons | -.005598 .0178979 -0.31 0.756 -.0416246 .0304286-医学资料71.Census数据,对模型分析注意medage和medagesq的系数. test medage medagesq ( 1) meda
5、ge = 0.0 ( 2) medagesq = 0.0F( 2, 46) = 44.03 Prob F = 0.0000. test medage=2*medagesq ( 1) medage - 2.0 medagesq = 0.0 F( 1, 46) = 0.15 Prob F = 0.7021. test medage=200*medagesq ( 1) medage - 200.0 medagesq = 0.0 F( 1, 46) = 0.00 Prob F = 0.9982医学资料81.Census数据,对模型分析. vce | medage medagesq pcturban _
6、cons-+- medage | 1.5e-06 medagesq | -2.5e-08 4.2e-10 pcturban | 3.2e-07 -5.7e-09 6.9e-07 _cons | -.000022 3.7e-07 -5.0e-06 .00032. vce,rho | medage medagesq pcturban _cons-+- medage | 1.0000 medagesq | -0.9985 1.0000 pcturban | 0.3235 -0.3352 1.0000 _cons | -0.9984 0.9942 -0.3385 1.0000 医学资料91.Censu
7、s数据,对模型分析. regress drate medage pcturban Source | SS df MS Number of obs = 50-+- F( 2, 47) = 48.22 Model | .000055922 2 .000027961 Prob F = 0.0000 Residual | .000027256 47 5.7993e-07 R-squared = 0.6723-+- Adj R-squared = 0.6584 Total | .000083179 49 1.6975e-06 Root MSE = .00076- drate | Coef. Std. E
8、rr. t P|t| 95% Conf. Interval-+- medage | .0006238 .0000658 9.48 0.000 .0004915 .0007562 pcturban | -.0035028 .0007731 -4.53 0.000 -.0050581 -.0019476 _cons | -.0076466 .0019034 -4.02 0.000 -.0114756 -.0038175-医学资料101.Census数据,对模型分析 对回归模型进行估计:. predict dhat (option xb assumed; fitted values) . summa
9、rize drate dhat Variable | Obs Mean Std. Dev. Min Max -+- drate | 50 .008436 .0013029 .0039915 .0106902 dhat | 50 .008436 .0010683 .0044936 .0110485医学资料111.Census数据,对模型分析影响因素分析:. predict influs,cooksd(cooksd用来衡量每个收集到的数值对回归系数的影响强度。)用来衡量每个收集到的数值对回归系数的影响强度。). summarize influs,detail Cooks D- Percentile
10、s Smallest 1% 1.35e-08 1.35e-08 5% 6.25e-06 4.54e-0610% .0000502 6.25e-06 Obs 5025% .0010358 .0000109 Sum of Wgt. 5050% .0043872 Mean .0639731 Largest Std. Dev. .256015875% .0200719 .191429190% .0610564 .3090287 Variance .065544195% .3090287 .5059252 Skewness 5.85796599% 1.735909 1.735909 Kurtosis 3
11、8.08436医学资料121.Census数据,对模型分析 list state if influ 4/50(4/n) state 2. Alaska 9. Florida 11. Hawaii 44. Utah . lvr2plot,s(state) trim (12) border (图象) 医学资料13LeverageNormalized residual squared1.7e-08.212856.025145.618882AlabamaAlaskaArizonaArkansasCaliforniaColoradoConnecticutDelawareFloridaGeorgiaHaw
12、aiiIdahoIllinoisIndianaIowaKansasKentuckyLouisianaMaineMarylandMassachusettMichiganMinnesotaMississippiMissouriMontanaNebraskaNevadaNew HampshirNew JerseyNew MexicoNew YorkN. CarolinaN. DakotaOhioOklahomaOregonPennsylvaniaRhode IslandS. CarolinaS. DakotaTennesseeTexasUtahVermontVirginiaWashingtonW.
13、VirginiaWisconsinWyoming医学资料141.Census数据,对模型分析. regress drate medage medagesq pcturban if influs F = 0.0000 Residual | .000024651 45 5.4780e-07 R-squared = 0.6698-+- Adj R-squared = 0.6478 Total | .000074657 48 1.5553e-06 Root MSE = .00074- drate | Coef. Std. Err. t P|t| 95% Conf. Interval-+- medage
14、 | .0028685 .0015954 1.80 0.079 -.0003448 .0060817 medagesq | -.0000364 .0000266 -1.37 0.178 -.0000899 .0000172 pcturban | -.0037377 .0008029 -4.66 0.000 -.0053549 -.0021205 _cons | -.0420036 .023994 -1.75 0.087 -.0903301 .0063229-医学资料152.Auto数据回归诊断分析(图象分析)Three key issues in identifying model sensi
15、tivity to dindividual observations.1.Residual2.Leverage:small residual,but if u delete the point,the estimates would change markedly,such a point is said to have high leverage.3.influential:we might ask which points in our data have a large effect on our estimated a or b etc.医学资料162.Auto数据回归诊断分析(图象分
16、析). use d:/stataauto. describeContains data from d:/stataauto.dta obs: 74 1978 Automobile Data vars: 12 7 Jul 2000 13:51 size: 3,478 (99.4% of memory free)- storage display valuevariable name type format label variable label-make str18 %-18s Make and Modelprice int %8.0gc Pricempg int %8.0g Mileage
17、(mpg)rep78 int %8.0g Repair Record 1978headroom float %6.1f Headroom (in.)trunk int %8.0g Trunk space (cu. ft.)weight int %8.0gc Weight (lbs.)length int %8.0g Length (in.)turn int %8.0g Turn Circle (ft.) displacement int %8.0g Displacement (cu. in.)gear_ratio float %6.2f Gear Ratioforeign byte %8.0g
18、 origin Car type-Sorted by: foreign 医学资料172.Auto数据回归诊断分析(图象分析) 分析目的: 汽车价格price与汽车里程mpg,重量weight,产地foreign以及产地和里程相互关系forxmpg之间的关系医学资料182.Auto数据回归诊断分析(图象分析). gen forxmpg= foreign* mpg. regress price weight mpg forxmpg foreign Source | SS df MS Number of obs = 74-+- F( 4, 69) = 21.22 Model | 350319665
19、4 87579916.3 Prob F = 0.0000 Residual | 284745731 69 4126749.72 R-squared = 0.5516-+- Adj R-squared = 0.5256 Total | 635065396 73 8699525.97 Root MSE = 2031.4- price | Coef. Std. Err. t P|t| 95% Conf. Interval-+- weight | 4.613589 .7254961 6.36 0.000 3.166264 6.060914 mpg | 263.1875 110.7961 2.38 0.
20、020 42.15527 484.2197 forxmpg | -307.2166 108.5307 -2.83 0.006 -523.7294 -90.70369 foreign | 11240.33 751.681 4.08 0.000 5750.878 16729.78 _cons | -14449.58 4425.72 -3.26 0.002 -23278.65 -5620.51-医学资料192.Auto数据回归诊断分析(图象分析) . vce,rho _cons | weight mpg forxmpg foreign -+- weight | 1.0000 mpg | 0.8408
21、 1.0000 forxmpg | -0.5594 -0.7695 1.0000 foreign | 0.6431 0.7747 -0.9715 1.0000 _cons | -0.9611 -0.9536 0.6861 -0.7407 1.0000医学资料202.Auto数据回归诊断分析(图象分析) Rvfplot: graphs a residual-versus-fitted plot, a graph of the residuals versus the fitted values.医学资料21rvfplot,border yline(0)ResidualsFitted values
22、1224.1311952.8-3312.977271.96医学资料222.Auto数据回归诊断分析(图象分析) 图象分析: 1.price 和自变量之间存在线性关系 2.residuals表现出一定的增加或者减少的特征-异方差(heteroskedasticity):the increasing or decreasing variation in the residuals with fitted values(拟合值).医学资料23对图象检验分析 ovtest:检查是否忽略掉了变量 ovtest Ramsey RESET test using powers of the fitted va
23、lues of price Ho: model has no omitted variables F(3, 66) = 7.77 Prob F = 0.0002 说明存在忽略变量医学资料242.Auto数据回归诊断分析(图象分析) . hettest Cook-Weisberg test for heteroskedasticity using fitted values of price Ho: Constant variance chi2(1) = 6.50 Prob chi2 = 0.0108 说明存在异方差医学资料252.Auto数据回归诊断分析(图象分析) lvr2plot :gra
24、phs a leverage-versus-squared residual plot,a graph of leverage against the (normalized) redisuals squared.医学资料26. lvr2plot,borderLeverageNormalized residual squared1.4e-06.185714.019285.358152医学资料27. lvr2plot,s(make) trim (12) borderLeverageNormalized residual squared1.4e-06.185714.019285.358152AMC
25、 ConcordAMC PacerAMC SpiritBuick CenturBuick ElectrBuick LeSabrBuick OpelBuick RegalBuick RivierBuick SkylarCad. DevilleCad. EldoradCad. SevilleChev. ChevetChev. ImpalaChev. MalibuChev. Monte Chev. MonzaChev. NovaDodge ColtDodge DiplomDodge MagnumDodge St. ReFord FiestaFord MustangLinc. ContinLinc.
展开阅读全文