Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
1
ASSIGNMENT 7 C – MERGING DATA FILES IN STATA
Download the world development data covering the years 2000-
2016 from the website
“http://databank.worldbank.org/data/reports.aspx?source=World
-Governance-Indicators” for the
following upper-middle-income countries.
Countries of Interest:
Albania Ecuador Montenegro
Algeria Equatorial Guinea Namibia
American Samoa Fiji Nauru
Argentina Gabon Panama
Azerbaijan Grenada Paraguay
Belarus Guyana Peru
Belize Iran, Islamic Rep. Romania
Bosnia and Herzegovina Iraq Russian Federation
Botswana Jamaica Samoa
Brazil Kazakhstan Serbia
Bulgaria Lebanon South Africa
China Libya St. Lucia
Colombia Macedonia, FYR St. Vincent and the Grenadines
Costa Rica Malaysia Suriname
Croatia Maldives Thailand
Cuba Marshall Islands Tonga
Dominica Mauritius Turkey
Dominican Republic Mexico Turkmenistan
Tuvalu
Venezuela, RB
Variables of Interest
Control of Corruption: Estimate
Government Effectiveness: Estimate
Political Stability and Absence of Violence/Terrorism:
Estimate
Regulatory Quality: Estimate
Rule of Law: Estimate
Voice and Accountability: Estimate
2
STEP 1 - Download the data from the World-Governance-
Indicators database as shown below
STEP 2 - Check the variables of interest
3
Please make sure you are checking the variables with
“Estimates”.
TO VIEW THE DEFINITIONS OF THE VARIABLES
4
Step 3 – Select countries of interest
5
Step 4 – Click on “Time” and select the “year range” you are
interested in (2000-2016)
6
Step 5 – Click on the “Layout” as shown below
Change the time layout to “Row,” series to “Column” and
Country to “Row.”
Next, click on the “apply changes.”
Step 6 – Click on the “Download option” and select “Excel” as
shown below
7
STEP 7: Using Excel, Replace the Missing Values With “.” (See
previous assignments)
STEP 8: SAVE THE EXCEL DATA FILE ON YOUR
COMPUTER PREFERABLY IN A
FOLDER
STEP 9: IMPORT YOUR DATA INTO STATA AND NAME
YOUR DATA SET
“WORLD_GOVERNANCE_INDICATORS.” (See previous
assignments for steps)
8
STEP 10; RENAME THE VARIABLES AS SHOWN BELOW
(See previous assignments for
steps)
Using stata, merge the data set from “ASSIGNMENT 3B” with
this dataset
VERY IMPORTANT Note: Merging two datasets requires that
both have at least one variable in
common (either string or numeric).
This statement requires that the variable name for “Time” and
“Country” should be the same in the two
data set
MERGING THE DATASET FROM “ASSIGNMENT 3” WITH
THE DATA FROM THE
WORLD GOVERNANCE INDICATORS
Merging data files in stata
https://www.youtube.com/watch?v=EV-5PztbHs0
https://www.youtube.com/watch?v=Uh7C0mlhB3g&t=54s
https://www.youtube.com/watch?v=2etG_34ODoc
I will strongly encourage you to watch these videos before
merging
I will also strongly recommend you read the notes in the link
below before you start
merging
https://www.princeton.edu/~otorres/Merge101.pdf
Original Variable Name Afte r Re naming
Control of Corruption: Estimate Corruption
Government Effectiveness: Estimate Gov't_Effectiveness
Political Stability and Absence of Violence/Terrorism: Estimate
Political_Stability
Regulatory Quality: Estimate Reg't_Quality
Rule of Law: Estimate Rule_of_Law
Voice and Accountability: Estimate Voice_Accountability
https://www.youtube.com/watch?v=EV-5PztbHs0
https://www.youtube.com/watch?v=Uh7C0mlhB3g&t=54s
https://www.youtube.com/watch?v=2etG_34ODoc
https://www.princeton.edu/~otorres/Merge101.pdf
9
STEP 1 – Open “Assignment 3” dataset in Stata as shown below
10
Remember, the way you have named “Time” and “Country” in
Assignment 3 B should be
the same as you have in the “World Governance Indicators”
STEP 2 – Merge “Assignment 3” dataset with the one from the
World Governance Indicators
11
Note: Very Important
Key variables; Time Country_id
The key variables must be the same in the two datasets
regarding naming.
If “Time” and “Country_id” are named differently in the two
dataset, your data will not
merge
12
STEP 3 – Save your new data set and send it to me via
blackboard
Answer Format
1. Send me your new data file via blackboard
1
BADM 735 - Comparative Economics – Assignment Five (C)
Creating Scatter Diagrams and Correlation Matrix Using Stata
A scatter diagram plots two variables taken from the same point
in time for different countries
to show relationship between the two variables.
For better understanding of scatter plots watch the video
contained in the link below
https://www.youtube.com/watch?v=30LcZqRfPRY
According to the text, economic outcomes measured by
economic growth is affected by a number
of factors. Also, hundreds of empirical studies on economic
growth across countries have
highlighted the correlation between economic growth and a
variety of variables.
a) Using your data from Assignment 3 B: Construct a
scatterplot, in stata, that shows the
relationship between:
measure of Investment)
expenditure (% of GDP)
c growth and Inflation, consumer prices (annual %)
(% of GDP)
GDP)
**Economic growth is our dependent variable; all the other
variables are independent**
The graphs below should serve as a guide.
According to the graph, there appears to be a
positive correlation between Economic
Growth and Investment. The Correlation
coefficient is about 0.154 which confirms a
weak positive correlation between the two
variables.
https://www.youtube.com/watch?v=30LcZqRfPRY
2
STATA COMMANDS FOR SCATTER PLOTS
STEP 1: USING THE COMMAND WINDOW INSTALL
“asdoc” AS SHOWN BELOW
“asdoc” is an add-on to stata that allows you to produce nicely
formatted tables tables in stata
STEP 2: USING THE YOUR DO-FILE YOU CAN CREATE
SCATTER PLOTS AS
SHOWN BELOW
-Because a scatter diagram plots two variables
or shows the relationship
between two variables.
- Fit a line in the scatter plot
independent variable ( as you can see
economic growth comes before trade)
Please note also that you have to run the same command for all
the other relationships; for
example to show the relationship between economic growth and
inflation you run:
twoway (scatter Economic_Growth Inflation) (lfit
Economic_Growth Inflation)
STEP 3: EDITING, FORMATTING AND SAVING YOUR
GRAPH
It is important you edit your graph to conform to the scatter
plot shown above. The video
contained in the link below should help you edit and format
your graph.
https://www.youtube.com/watch?v=PWFZ_-eQd8I&t=296s
STEP 4: COPY YOUR GRAPHS INTO WORD
https://www.youtube.com/watch?v=PWFZ_-eQd8I&t=296s
3
b) Create a correlation matrix table that shows pairwise
correlation coefficients between the
following variables (without significance test): GDP growth
(annual %), Gross capital
formation (% of GDP), General government final consumption
expenditure (% of GDP),
Trade (% of GDP), Inflation, consumer prices (annual %),
Foreign direct investment, net
inflows (% of GDP), Population, total, and Total natural
resources rents (% of GDP)
For better understanding of correlations watch the video
contained in the link below
https://www.youtube.com/watch?v=jf-SIOFUuEo
STATA COMMANDS FOR CORRELATION MATRIX
USING THE YOUR DO-FILE YOU CAN GENERATE THE
CORRELATION MATRIX
AS SHOWN BELOW
A sample shot of a correlation matrix
The 0.154 shows the strength of the relationship between
Economic growth and Investment
https://www.youtube.com/watch?v=jf-SIOFUuEo
4
c) Compare the correlation matrix with the scatter graphs. See
the example below
According to the graph, there appears to be a
positive correlation between Economic
Growth and Investment. The Correlation
coefficient is about 0.154 which confirms a
weak positive correlation between the two
variables.
***Please do not hesitate to call or email if you need
assistance***
1  ASSIGNMENT 7 C – MERGING DATA FILES IN STATA Do.docx

More Related Content

1 ASSIGNMENT 7 C – MERGING DATA FILES IN STATA Do.docx

  • 1. 1 ASSIGNMENT 7 C – MERGING DATA FILES IN STATA Download the world development data covering the years 2000- 2016 from the website “http://databank.worldbank.org/data/reports.aspx?source=World -Governance-Indicators” for the following upper-middle-income countries. Countries of Interest: Albania Ecuador Montenegro Algeria Equatorial Guinea Namibia American Samoa Fiji Nauru Argentina Gabon Panama Azerbaijan Grenada Paraguay Belarus Guyana Peru Belize Iran, Islamic Rep. Romania Bosnia and Herzegovina Iraq Russian Federation
  • 2. Botswana Jamaica Samoa Brazil Kazakhstan Serbia Bulgaria Lebanon South Africa China Libya St. Lucia Colombia Macedonia, FYR St. Vincent and the Grenadines Costa Rica Malaysia Suriname Croatia Maldives Thailand Cuba Marshall Islands Tonga Dominica Mauritius Turkey Dominican Republic Mexico Turkmenistan Tuvalu Venezuela, RB Variables of Interest Control of Corruption: Estimate Government Effectiveness: Estimate Political Stability and Absence of Violence/Terrorism: Estimate
  • 3. Regulatory Quality: Estimate Rule of Law: Estimate Voice and Accountability: Estimate 2 STEP 1 - Download the data from the World-Governance- Indicators database as shown below STEP 2 - Check the variables of interest 3 Please make sure you are checking the variables with “Estimates”.
  • 4. TO VIEW THE DEFINITIONS OF THE VARIABLES 4 Step 3 – Select countries of interest 5 Step 4 – Click on “Time” and select the “year range” you are interested in (2000-2016) 6
  • 5. Step 5 – Click on the “Layout” as shown below Change the time layout to “Row,” series to “Column” and Country to “Row.” Next, click on the “apply changes.” Step 6 – Click on the “Download option” and select “Excel” as shown below 7 STEP 7: Using Excel, Replace the Missing Values With “.” (See previous assignments) STEP 8: SAVE THE EXCEL DATA FILE ON YOUR COMPUTER PREFERABLY IN A FOLDER STEP 9: IMPORT YOUR DATA INTO STATA AND NAME YOUR DATA SET “WORLD_GOVERNANCE_INDICATORS.” (See previous
  • 6. assignments for steps) 8 STEP 10; RENAME THE VARIABLES AS SHOWN BELOW (See previous assignments for steps) Using stata, merge the data set from “ASSIGNMENT 3B” with this dataset VERY IMPORTANT Note: Merging two datasets requires that both have at least one variable in common (either string or numeric). This statement requires that the variable name for “Time” and “Country” should be the same in the two data set MERGING THE DATASET FROM “ASSIGNMENT 3” WITH THE DATA FROM THE
  • 7. WORLD GOVERNANCE INDICATORS Merging data files in stata https://www.youtube.com/watch?v=EV-5PztbHs0 https://www.youtube.com/watch?v=Uh7C0mlhB3g&t=54s https://www.youtube.com/watch?v=2etG_34ODoc I will strongly encourage you to watch these videos before merging I will also strongly recommend you read the notes in the link below before you start merging https://www.princeton.edu/~otorres/Merge101.pdf Original Variable Name Afte r Re naming Control of Corruption: Estimate Corruption Government Effectiveness: Estimate Gov't_Effectiveness Political Stability and Absence of Violence/Terrorism: Estimate Political_Stability Regulatory Quality: Estimate Reg't_Quality
  • 8. Rule of Law: Estimate Rule_of_Law Voice and Accountability: Estimate Voice_Accountability https://www.youtube.com/watch?v=EV-5PztbHs0 https://www.youtube.com/watch?v=Uh7C0mlhB3g&t=54s https://www.youtube.com/watch?v=2etG_34ODoc https://www.princeton.edu/~otorres/Merge101.pdf 9 STEP 1 – Open “Assignment 3” dataset in Stata as shown below 10 Remember, the way you have named “Time” and “Country” in Assignment 3 B should be the same as you have in the “World Governance Indicators” STEP 2 – Merge “Assignment 3” dataset with the one from the World Governance Indicators
  • 9. 11 Note: Very Important Key variables; Time Country_id The key variables must be the same in the two datasets regarding naming. If “Time” and “Country_id” are named differently in the two dataset, your data will not merge 12 STEP 3 – Save your new data set and send it to me via blackboard
  • 10. Answer Format 1. Send me your new data file via blackboard 1 BADM 735 - Comparative Economics – Assignment Five (C) Creating Scatter Diagrams and Correlation Matrix Using Stata A scatter diagram plots two variables taken from the same point in time for different countries to show relationship between the two variables. For better understanding of scatter plots watch the video contained in the link below https://www.youtube.com/watch?v=30LcZqRfPRY
  • 11. According to the text, economic outcomes measured by economic growth is affected by a number of factors. Also, hundreds of empirical studies on economic growth across countries have highlighted the correlation between economic growth and a variety of variables. a) Using your data from Assignment 3 B: Construct a scatterplot, in stata, that shows the relationship between: measure of Investment) expenditure (% of GDP) c growth and Inflation, consumer prices (annual %) (% of GDP) GDP) **Economic growth is our dependent variable; all the other variables are independent**
  • 12. The graphs below should serve as a guide. According to the graph, there appears to be a positive correlation between Economic Growth and Investment. The Correlation coefficient is about 0.154 which confirms a weak positive correlation between the two variables. https://www.youtube.com/watch?v=30LcZqRfPRY 2 STATA COMMANDS FOR SCATTER PLOTS STEP 1: USING THE COMMAND WINDOW INSTALL “asdoc” AS SHOWN BELOW “asdoc” is an add-on to stata that allows you to produce nicely
  • 13. formatted tables tables in stata STEP 2: USING THE YOUR DO-FILE YOU CAN CREATE SCATTER PLOTS AS SHOWN BELOW -Because a scatter diagram plots two variables or shows the relationship between two variables. - Fit a line in the scatter plot independent variable ( as you can see economic growth comes before trade) Please note also that you have to run the same command for all the other relationships; for example to show the relationship between economic growth and inflation you run: twoway (scatter Economic_Growth Inflation) (lfit Economic_Growth Inflation) STEP 3: EDITING, FORMATTING AND SAVING YOUR GRAPH It is important you edit your graph to conform to the scatter plot shown above. The video
  • 14. contained in the link below should help you edit and format your graph. https://www.youtube.com/watch?v=PWFZ_-eQd8I&t=296s STEP 4: COPY YOUR GRAPHS INTO WORD https://www.youtube.com/watch?v=PWFZ_-eQd8I&t=296s 3 b) Create a correlation matrix table that shows pairwise correlation coefficients between the following variables (without significance test): GDP growth (annual %), Gross capital formation (% of GDP), General government final consumption expenditure (% of GDP), Trade (% of GDP), Inflation, consumer prices (annual %), Foreign direct investment, net inflows (% of GDP), Population, total, and Total natural resources rents (% of GDP) For better understanding of correlations watch the video contained in the link below https://www.youtube.com/watch?v=jf-SIOFUuEo
  • 15. STATA COMMANDS FOR CORRELATION MATRIX USING THE YOUR DO-FILE YOU CAN GENERATE THE CORRELATION MATRIX AS SHOWN BELOW A sample shot of a correlation matrix The 0.154 shows the strength of the relationship between Economic growth and Investment https://www.youtube.com/watch?v=jf-SIOFUuEo 4
  • 16. c) Compare the correlation matrix with the scatter graphs. See the example below According to the graph, there appears to be a positive correlation between Economic Growth and Investment. The Correlation coefficient is about 0.154 which confirms a weak positive correlation between the two variables. ***Please do not hesitate to call or email if you need assistance***