* Author: William D. MacMillan, updated by Robert J. Franzese, Jr. * Prepared for ICPSR time-series and cross-section data analysis * 5/19/09 original * 6/30/10 update * 7/6/10 update * 7/4/11 update RJFjr * NOTE: whitetst needs to be installed for this file. findit whitetst more cd "C:\Users\franzese\Documents\Work\WPDOCS\Syllabi\TSCS Workshops\TAMU - Models for TSCS - July 2011\Lab Materials" capture log close log using "TAMU.TSCSwrkshp.Lab1.log", replace text set matsize 800 use http://www-personal.umich.edu/~franzese/garmit_esspanel1.dta, clear more * this is a loop, this is so that I don't have to type 18 generate commands in by hand * the "i" is a macro, a short term storage device. To reference it you put the goofy quotes around it (`i') forvalues i = 1/18 { generate _cc`i' = 1 if cc == `i' replace _cc`i' = 0 if _cc`i'== . } more reg spend unem growthpc depratio left cdem trade lowwage _cc* more * lets get rid of NZ, its just making our results messy. Also, lets try * another solution. Let's use the xi system for creating dummies. xi: reg spend unem growthpc depratio left cdem trade lowwage i.cc more xi, noomit: reg spend unem growthpc depratio left cdem trade lowwage i.cc, nocons more * We need to rerun our preferred model. * We'll do it quietly though, we don't need to see the output again drop if cc == 13 qui xi: reg spend unem growthpc depratio left cdem trade lowwage i.cc more * testing a smaller combination of coefficients is as easy--just use either test, or testparm * testparm allows shortcuts in naming the coefficients to test testparm _Icc* more * this command is not part of the base package--to install it, you type "findit whitetst" (ommitting the quotes) whitetst * New syntax for 'estat imtest, wh' allows white's test as first of imtests estat imtest, wh more * here's another way to do this test, using loops * note that you need to run the regression again--whitetst ran one and it removed your results qui xi: reg spend unem growthpc depratio left cdem trade lowwage i.cc predict res, resid gen res2 = res^2 more local varnames unem growthpc depratio left cdem trade lowwage more foreach var of local varnames { foreach othervar of local varnames { gen `var'times`othervar' = `var'*`othervar' } } * I'm using a lot of shorthand here so its not as messy reg res2 `varnames' *times* _I* more log close * to end do files, you need a blank line at the end--any command on the very end of the file is not used.