? ----- PROGRAM c:\racd\racd3p2.lim July 1998 ------ ? This LIMDEP program was \book2\ch3boot.lim ? It does the bootstrap in Table 3.3 of ? A.C. Cameron and Pravin K. Trivedi (1998), ? REGRESSION ANALYSIS OF COUNT DATA, ? Econometric Society Monograph No.30, Cambridge University Press. ? For more details on the data see files racd3.1st and racd3p1.lim ? The program runs on DOS version of Limdep 7. ? It may not be completely backward compatible with Limdep 6, ? but most of the program was originally written for Limdep 6. ? The program is not written as efficiently written as possible, ? partly because it began with Limdep 6. ? It is written in, hopefully, a transparent manner. ? Also in places intermediate output is given to enable checks. ? This program is written to run in batch mode. ? Once in the Limdep directory give command ? limdep c:\racd\racd3p2.lim c:\racd\racd3p2.out ? where you may need to change the directory from \racd ? This assumes data is in file given in READ statement ? +++++++++ Open output file and read in the data OPEN; OUTPUT=c:\racd\racd3p1.out $ READ; NOBS=5190;NVAR=19; FILE=c:\racd\racd3.asc; NAMES = SEX,AGE,AGESQ,INCOME,LEVYPLUS,FREEPOOR,FREEREPA, ILLNESS,ACTDAYS,HSCORE,CHCOND1,CHCOND2, DVISITS,NONDOCCO,HOSPADMI,HOSPDAYS, MEDICINE,PRESCRIB,NONPRESC; FORMAT= (F3.0,F5.2,F7.4,F5.2,15F4.0) $ ? ***** Open output file and read in the data ? OPEN; OUTPUT=c:\racd\racd3p2.out ? --------- Setting up ? Next line defines the regressors. See file racd3.1st for definitions. NAMELIST; X = ONE,SEX,AGE,AGESQ,INCOME,LEVYPLUS,FREEPOOR,FREEREPA, ILLNESS,ACTDAYS,HSCORE,CHCOND1,CHCOND2 $ ? Next line defines dependent variable - number of medicines NAMELIST; Y = DVISITS $ ? Next line defines dependent variable for CREATE which does ? not recognize NAMELISTs so that Y will not do CREATE; YCREATE = DVISITS $ ? --------- Descriptive Statistics TITLE; ***** Descriptive Statistics for Y and X. $ ? Descriptive statistics DSTATS; RHS=Y,X $ ? ?******** USUAL ESTIMATOR WITHOUT BOOTSTRAP ? Usual Poisson output POISSON; LHS=Y; RHS=X $ ?******** BEGIN BOOTSTRAP TITLE; ****** CHAPTER 3. Bootstrap iterations $ ? ? ** Initialize matrices ? Since parameter vector b is k x 1 or nregress x 1 ? simulation results are k x s or nregress x nsims ? calc; nsims=200; nregress=13; nobserv=5190 $ matrix; bpoiss=init(nregress,nsims,0) $ calc; isim=1 $ ? ? Suppress output fast $ silent $ ? ? ** The bootstrap procedure redraws data with replacement ? and estimates Poisson nsims times procedure draw; n=nobserv; rep $ POISSON; LHS=Y; RHS=X $ matrix; bpoiss(*,isim)=b $ calc; isim=isim+1 $ endprocedure exec; silent; n=nsims $ ? ?** Report bootstrap results. ? First need to move results matrix into separate vectors matrix; bone=Part(bpoiss,1,1,1,nsims); bsex=Part(bpoiss,2,2,1,nsims); bage=Part(bpoiss,3,3,1,nsims); bagesq=Part(bpoiss,4,4,1,nsims); bincome=Part(bpoiss,5,5,1,nsims); blevyplu=Part(bpoiss,6,6,1,nsims); bfreepoo=Part(bpoiss,7,7,1,nsims); bfreerep=Part(bpoiss,8,8,1,nsims); billness=Part(bpoiss,9,9,1,nsims); bactdays=Part(bpoiss,10,10,1,nsims); bhscore=Part(bpoiss,11,11,1,nsims); bchcond1=Part(bpoiss,12,12,1,nsims); bchcond2=Part(bpoiss,13,13,1,nsims) $ TITLE; ****** CHAPTER 3. Bootstrap standard errors $ matrix; dsta(bone,bsex,bage,bagesq,bincome,blevyplu,bfreepoo, bfreerep,billness,bactdays,bhscore,bchcond1,bchcond2) $ ? STOP $