Week 3 asks to generate a correlation coefficient to asses the degree of relationship between two or more quantitative variables.
In this program I run a test of the Pearson correlation coefficient on the gapminder dataset on the incomeperperson, armedforcesrate and the oil consumption per country.
Program
In this program I run a test of the Pearson correlation coefficient on the gapminder dataset on the incomeperperson, armedforcesrate and the oil consumption per country.
Program
LIBNAME mydata "/courses/d1406ae5ba27fe300 " access=readonly;
DATA new; set mydata.gapminder;
proc sgplot data=new;
scatter x=incomeperperson y=armedforcesrate;
xaxis grid;
yaxis grid;
title 'Scatter plot of response variable (Armed forces rate) versus explanatory variable (incomeperperson)';
run;
proc sgplot data=new;
scatter x=incomeperperson y=oilperperson;
xaxis grid;
yaxis grid;
title 'Scatter plot of response variable (oilperperson) versus explanatory variable (incomeperperson)';
run;
proc sgplot data=new;
scatter x=armedforcesrate y=oilperperson;
xaxis grid;
yaxis grid;
title 'Scatter plot of response variable (oilperperson) versus explanatory variable (Armed forces rate)';
run;
title 'Correlation table';
PROC CORR; VAR armedforcesrate incomeperperson oilperperson;
Run;
title;
Pearson correlation
Interpretation
Two of the variables show a 52% correlation i.e. income per person and oil consumption.
As seen before on income per person versus armed forces rate there is no correlation.
Comments
Post a Comment