options ls=80 nocenter nodate; * You should run this program and bring the output to class. *; * I will be referring to the output by page number. *; * Data on weight, tar content, nicotine content, and carbon monoxide (CO) content for 25 brands of cigarettes; data cigdat; input id $ brand $ tar nico weight co; cards; A Alpine 14.1 .86 .9853 13.6 B Benson&Hedges 16.0 1.06 1.0938 16.6 C BullDurham 29.8 2.03 1.1650 23.5 D CamelLights 8.0 .67 .9280 10.2 E Carlton 4.1 .40 .9462 5.4 F Chesterfield 15.0 1.04 .8885 15.0 G GoldenLights 8.8 .76 1.0267 9.0 H Kent 12.4 .95 .9225 12.3 I Kool 16.6 1.12 .9372 16.3 J L&M 14.9 1.02 .8858 15.4 K LarkLights 13.7 1.01 .9643 13.0 L Marlboro 15.1 .90 .9316 14.4 M Merit 7.8 .57 .9705 10.0 N MultiFilter 11.4 .78 1.1240 10.2 O NewportLights 9.0 .74 .8517 9.5 P Now 1.0 .13 .7851 1.5 Q OldGold 17.0 1.26 .9186 18.5 R PallMallLight 12.8 1.08 1.0395 12.6 S Raleigh 15.8 .96 .9573 17.5 T SalemUltra 4.5 .42 .9106 4.9 U Tareyton 14.5 1.01 1.0070 15.9 V True 7.3 .61 .9806 8.5 W ViceroyRichLight 8.6 .69 .9693 10.6 X VirginiaSlims 15.2 1.02 .9496 13.9 Y WinstonLights 12.0 .82 1.1184 14.9 ; * Sort the data by nico and then print out the dataon nico and co. *; proc sort; by nico; proc print; var id brand nico co; * Graph of co vs nico. *; proc plot; plot co*nico=id; run; * Regression of co vs nico. *; * I will explain the options r and influence in class. *; * The ODS command puts certain output results into a new SAS dataset. *; proc reg; model co = nico / r influence; ods output OutputStatistics=outstat1; run; * Univariate statistics on some of the REG output. I will explain this in class. *; proc univariate plot normal; var cooksd dfb_intercept dfb_nico dffits hatdiagonal studentresidual; run; * We change the CO value for data point C by 5 units and rerun the analysis *; data newdat1; set cigdat; if (id = 'C') then co=co-5; proc plot; plot co*nico=id; run; proc reg; model co = nico / r influence; ods output OutputStatistics=outstat2; run; proc univariate plot normal; var cooksd dfb_intercept dfb_nico dffits hatdiagonal studentresidual; run; * We now change the CO value for data point C back to its original value, and instead *; * change the value of data point L by 5 units. We then rerun the analysis again. *; data newdat2; set cigdat; if (id = 'L') then co=co-5; proc plot; plot co*nico=id; run; proc reg; model co = nico / r influence; ods output OutputStatistics=outstat2; run; proc univariate plot normal; var cooksd dfb_intercept dfb_nico dffits hatdiagonal studentresidual; run; * Generate some additional output that I will explain in class. *; proc iml; use cigdat var {nico}; read all; n = nrow(nico); x=j(n,1)||nico; a = x*inv(t(x)*x); create dfzstat from a [colname={'dfbz_int' 'dfbz_nico'}]; append from a; proc print data=zstat; proc univariate plot; var dfbz_int dfbz_nico; run;