Creating Scatter Diagrams And Correlation Matrix Using Stata
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
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:
Economic growth and Gross capital formation (% of GDP) (A measure of Investment)
Economic growth and General government final consumption expenditure (% of GDP)
Economic growth and Trade (% of GDP)
Economic growth and Inflation, consumer prices (annual %)
Economic growth and Foreign direct investment, net inflows (% of GDP)
Economic growth and Population, total
Economic growth and Total natural resources rents (% of 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.
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
Why twoway -Because a scatter diagram plots two variables or shows the relationship
between two variables.
Ifit- Fit a line in the scatter plot
Note that your dependent variable comes before the 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.
STEP 4: COPY YOUR GRAPHS INTO WORD
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
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
Column (1) is Economic Growth
Column (2) is Investment
Column (3) is Government Expenditure
The 0.154 shows the strength of the relationship between Economic growth and Investment
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***