/* 2310-6 */ /* PLEASE BE MINDFUL OF THE FOLLOWING */ /* good news -- most of you are making progress; more work will need to be done starting with the following ... */ /* please compare the sample response and your submission and then ask yourself: they look different so what do I need to include in my do-file in order to avoid missing what's needed? Such debriefing is the most important part in the development of your independent mindset in solving problems with evidence in this course; as each student is unique you have to do this on your own independently to develop your own mindset; the key is to do this as many times as possible, i.e. if possible making a 5.1 submission by the deadline for each class and then debriefing your work based on the corresponding sample response */ /* please make sure the submissions are made by the deadline as stated in the course outline; it would be helpful if you copy yourself your submission email */ /* please make sure your do-file can run on the latest version of the dataset before submitting it */ /* just to be sure, a do-file is a Stata program file that you would need to compile ending with .do so please do not submit a .dta file as your 5.1 submission */ /* please do not use any Stata command that was not taught in this course like "use" and "keep" */ /* as indicated in the Class 1 do-file, please do not include any Stata call for a dataset */ /* please make sure a line of note that starts with /* ends with */; otherwise Stata would treat the rest of your do-file as something like comments to be bypassed */ /* please note that if a Stata command is included within the two brackets Stata would not try to run it */ /* please make sure that no unwarranted character is included in your Stata codes -- for example, a line of note that ends with an extra " will crash the do-file */ /* in using the if condition please make sure the clause is constructed properly -- for example, if OECD=="USA" does not make sense because ... */ /* please make sure that any graph is named as if not the next graph generated will erase the previous graph */ /* please do not throw into a do-file a variety of stuff from previous Class do-files that is not essential in answering the question */ /* please make sure that you are using the latest version of the dataset; as indicated in the Class 5 do-file, dataset 2.0 with the addition of the variable redistribution should be saved; so if your 5.1 submission do-file is set to generate the variable redistribution in Class 5 again with dataset 2.0 your do-file will crash */ /* in tackling a 5.1 submission question, reading the question carefully is a very important part of the assignment -- for example, if the question calls for a graphical comparison between your country assigned on one hand and USA and CAN on the other then any do-file without that graphical comparison is not doing what it is supposed to do */ /* SAMPLE RESPONSE TO 5.1 submission for class 6 using only the Stata commands used up to this point in the course in one new do-file: write up your comments on the linkages between average tax as percent of GDP [TAXA] and poverty rates [WDI1, WDI2, WDI3] as well as the linkages between economic freedom and poverty rates. And then write up your comments on a graphical comparison between your country assigned on one hand and USA and CAN on the other based on the above depending on data availability. */ /* make sure the do-file can be run as an entire file with pressing do only once */ /* use as few lines of codes as possible to generate as much useful information as possible */ /* think about what the most parsimonious approach you can take */ /* as per course outline -- no other attachment other than one do-file please */ /* for submission protocol, see the course outline */ /* for your assigned country, see the end of the do-file for Class 3 */ /* on a country without poverty data */ /* assuming the country assigned is KHM */ /* check data availability */ list ISO TAXA EFW IEF0A WDI1 WDI2 WDI3 if ISO=="KHM" /* no data, no analysis with poverty possible */ /* on a country with poverty data */ /* assuming the country assigned is SLE */ /* check data availability */ list ISO TAXA EFW IEF0A WDI1 WDI2 WDI3 if ISO=="SLE" /* the outputs show ... */ /* on the linkages */ pwcorr TAXA EFW IEF0A WDI1 WDI2 WDI3, print(.05) /* the outputs show ... */ /* focus on the strongest relationship between tax and poverty */ scatter WDI3 TAXA if ISO=="SLE", /* */ mcolor(green) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WDI3 TAXA if ISO=="USA", /* */ mcolor(red) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WDI3 TAXA if ISO=="CAN", /* */ mcolor(blue) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WDI3 TAXA if ISO !="SLE" & ISO !="USA" & ISO !="CAN", /* */ mcolor(gs10) msize(vsmall) || /* */ qfit WDI3 TAXA, /* */ lpattern(solid) lwidth(vthin) lcolor(black) /* */ legend(off) /* */ name(T1, replace) /* the outputs show ... */ /* focus on the strongest relationship between tax and economic freedom */ scatter IEF0A TAXA if ISO=="SLE", /* */ mcolor(green) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter IEF0A TAXA if ISO=="USA", /* */ mcolor(red) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter IEF0A TAXA if ISO=="CAN", /* */ mcolor(blue) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter IEF0A TAXA if ISO !="SLE" & ISO !="USA" & ISO !="CAN", /* */ mcolor(gs10) msize(vsmall) || /* */ qfit IEF0A TAXA, /* */ lpattern(solid) lwidth(vthin) lcolor(black) /* */ legend(off) /* */ name(T2, replace) /* the outputs show ... */ /* on the selected few Stata commands taught in this course likely to be most useful for you to do the work for this course */ /* question -- explore two sets of relationships: one is about the relationships between economic freedom and happiness; another is about the relationships between tax and happiness */ /* get a sense of the variables */ sum TAXA EFW IEF0A WHI2 /* the outputs show ... */ /* look at the correlations among variables */ pwcorr TAXA EFW IEF0A WHI2, print(.05) /* the outputs show ... */ /* plot the strongest relationships */ graph drop _all aaplot WHI2 IEF0A, name(z1, replace) aaplot WHI2 TAXA, name(z2, replace) /* the outputs show ... */ /* a question from a classmate -- what is redistribution? aaplot can help answer that */ /* based on Class 5 do-file red is ginim-ginid so red is the reduction of income inequality as measured by the Gini Index */ aaplot WID1 red, name(z3, replace) /* compare some regression results in an efficient manner */ /* another academic user-developed package is needed */ /* use help to search for the user-produced package eststo ... and install the ado files first */ search eststo /* install the package st0085_2 */ /* now start setting up the comparsions */ eststo clear quietly: reg WHI2 IEF0A eststo WW1 quietly: reg WHI2 TAXA eststo WW2 esttab WW1 WW2, nocon r2 se /* the outputs show ... */ /* assume that your country assigned is CRI; compare the country data with the country group averages */ list ISO OECD Q TAXA EFW IEF0A WHI2 if ISO=="CRI" /* a question from a classmate -- how to figure out the country name that goes with ISO? */ /* your answer ... */ /* get the relevant OECD average */ tabstat TAXA EFW IEF0A WHI2 if OECD=="O", format(%9.2f) tabstat TAXA EFW IEF0A WHI2 if Q==1, format(%9.2f) /* the outputs show ... */ /* as there are too many non-OECD countries and too many countries in the lowest quartile of EFW in the dataset, need to identify some countries with similar WHI2 */ /* start by sorting WHI2 before listing some possible comparables -- use sort to sort from smallest to biggest; use gsort with - as prefix for the variable to do the reverse */ gsort -WHI2 list ISO TAXA EFW IEF0A WHI2 if OECD=="O" & Q==1 /* the outputs show ... */ /* put the comparable countries on scatter plots along with CAN & USA */ scatter WHI2 IEF0A if ISO=="CRI" | ISO=="LUX" | ISO=="LTU", /* */ mcolor(green) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WHI2 IEF0A if ISO=="USA", /* */ mcolor(red) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WHI2 IEF0A if ISO=="CAN", /* */ mcolor(blue) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WHI2 IEF0A if ISO !="CRI" & ISO !="USA" & ISO !="CAN" & ISO !="LUX" & ISO !="LTU", /* */ mcolor(gs10) msize(vsmall) || /* */ qfit WHI2 IEF0A, /* */ lpattern(solid) lwidth(vthin) lcolor(black) /* */ legend(off) /* */ name(t1, replace) scatter WHI2 TAXA if ISO=="CRI" | ISO=="LUX" | ISO=="LTU", /* */ mcolor(green) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WHI2 TAXA if ISO=="USA", /* */ mcolor(red) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WHI2 TAXA if ISO=="CAN", /* */ mcolor(blue) msize(small) mlabel(ISO) mlabsize(tiny) || /* */ scatter WHI2 TAXA if ISO !="CRI" & ISO !="USA" & ISO !="CAN" & ISO !="LUX" & ISO !="LTU", /* */ mcolor(gs10) msize(vsmall) || /* */ qfit WHI2 TAXA, /* */ lpattern(solid) lwidth(vthin) lcolor(black) /* */ legend(off) /* */ name(t2, replace) /* the outputs show ... */ /* 5.1 submission for class 7 using only the Stata commands used up to this point in the course in one new do-file: graph the relationship between Heritage Foundation's economic freedom index (IEFOA) and infant mortality [WHO6] on one hand and that between tax and infant mortality on the other with your country assigned along with the Nordic countries [OECD=="N"] in the graphs. Comment on the graphs based on a comparison of the relevant regression results. */ /* use as few lines of codes as possible to generate as much useful information as possible */ /* for your assigned country, see the end of the do-file for Class 3 */