version 9.2 log using C:\Teaching\IGP\log\11.multiple.log, replace * Chapter 11 Multiple regression * modified on Feb. 04, 2007 by Leena Choi use "C:\Teaching\IGP\data\EMS\perulung.dta", clear *************************************************************************************** * Section 11.2 Multiple regression with two exposure variables *************************************************************************************** * regress fev1 on age and height regress fev1 age height * calculate F-value using the MS display 12.8193006/.052479971 * calculate F-value using the SS display (25.6386013/2)/(33.2198218/633) * calculate r-squared using the SS : r-squared = SSmodel/SStotal display 25.6386013/58.858423 *************************************************************************************** * Section 11.3 Multiple regression with categorical exposure variables *************************************************************************************** * regress fev1 on male regress fev1 male * put all label and define values label variable male "Gender" label define sexlab 0 "Girls" 1 "Boys" label values male sexlab * compare with ttest ttest fev1, by(male) * regress fev1 on age and male regress fev1 age male * regress fev1 on age, height and male regress fev1 age height male *************************************************************************************** * Section 11.6 Relationship between multiple regression and ANOVA *************************************************************************************** use "C:\Teaching\IGP\data\hemoANOVA.dta", clear * put informative label label variable hemo "Hemoglobin (g/dL)" label variable type "Type of sickle cell disease" label define typelab 1 "Hb SS" 2 "Hb S/beta" 3 "Hb SC" label values type typelab * generate 2 dummy variable generate type2 = 0 generate type3 = 0 replace type2 = 1 if type==2 replace type3 = 1 if type==3 regress hemo type2 type3 * compare with the result from one-way anova oneway hemo type *************************************************************************************** log close