Skip to main content

Posts

Showing posts from November, 2016

Data Analysis tools - Week 3 - Pearson correlation

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 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 ...

Data Analysis tools - Week 2 - Chi Square Test of Independence

Week 2 asks to perform a Chi Square test of independence on two categorical variables. After running on multiple categories in the explanatory variable it asks to perform pair wise post hoc tests of independence and interpret the results. Program LIBNAME mydata "/courses/d1406ae5ba27fe300 " access=readonly; DATA new; set mydata.gapminder; /* Formatting for income and oil */ format oilcategory $35.; format incomecategory $20.; /* Oil categorisation */ if oilperperson le 1 then oilcategory= '<= 1 ton per year'; else if oilperperson gt 1 then oilcategory= '> 1 ton per year'; /* Income per person categorisation */ if incomeperperson le 15000 then incomecategory = '<= $15000'; else if incomeperperson lt 30000 then incomecategory = '$15000 to $30000'; else if incomeperperson gt 30000 then incomecategory = '$30000 and higher'; /* Insert meaningful lables to the variables */ label country = "c...

Data Analysis tools - Week 1 - Running an analysis of variance

The week 1 assignment asks to run an analysis of variance and then analyze and interpret post hoc paired comparisons in instances where the original statistical test was significant, and examining more than two groups (i.e. more than two levels of a categorical, explanatory variable). I have analysed the gapminder dataset. In the analysis I look at the relationship between the income per person (incomecategory) as the explanatory variable and the oil consumption per person (oilperperson) as the response variable. Program LIBNAME mydata "/courses/d1406ae5ba27fe300 " access=readonly; DATA new; set mydata.gapminder; /* Formatting for income, armed forces and oil */ format oilcategory $35.; format incomecategory $20.; format armedforcescategory $20.; /* Oil categorisation */ if /*oilperperson = . then oilcategory='Missing';*/ oilperperson lt 2 then oilcategory= 'Less than 2 tonnes per year'; else if oilperperson lt 4 then oilcategory= '2 to...

Data Visulaization course - Week 4 - Creating graphs for your data

Week 4 assignment asks to prepare univariate and bivariate graphs of the variables in the study and provide a summary of the graphs. Program LIBNAME mydata "/courses/d1406ae5ba27fe300 " access=readonly; DATA new; set mydata.gapminder; /* Formatting for income, armed forces and oil */ format oilcategory $35.; format incomecategory $20.; format armedforcescategory $20.; /* Oil categorisation */ if oilperperson = . then oilcategory='Missing'; else if oilperperson lt 2 then oilcategory= 'Less than 2 tonnes per year'; else if oilperperson lt 4 then oilcategory= '2 to 4 tonnes per year'; else if oilperperson lt 6 then oilcategory= '4 to 6 tonnes per year'; else if oilperperson lt 8 then oilcategory= '6 to 8 tonnes per year'; else if oilperperson gt 8 then oilcategory= 'Greater than 8 tonnes per year'; /* Income per person categorisation */ if incomeperperson = . then incomecategory='Missing...