Week 4 asks to test the relationship between two variables with the dependence of a moderator.
In this program I try to see the influence of the moderator variable democracy score over the relationship between the two variables incomeperperson and oil consumption.
Program
In this program I try to see the influence of the moderator variable democracy score over the relationship between the two variables incomeperperson and oil consumption.
Program
LIBNAME mydata "/courses/d1406ae5ba27fe300 " access=readonly;
DATA new; set mydata.gapminder;
format democracycategory $25.;
/*
Democracy score categorisation
*/
if
polityscore le -5 then democracycategory = 'Tyranny\Autocratic';
else if polityscore lt 6 then democracycategory = 'partly democratic';
else if polityscore ge 6 then democracycategory = 'highly democratic';
/*
Insert meaningful lables to the variables
*/
label country="country"
oilperperson="Oil per person"
incomeperperson="Income per person ($)(based on 2010 dollar exchange rate)"
democracycategory="Democracy category"
polityscore="Democracy score"
armedforcesrate="Armed forces personnel";
where polityscore NE .;
proc sort; by country;
proc sort; by democracycategory;
title 'Correlation table';
PROC CORR;
VAR incomeperperson oilperperson; by democracycategory;
Run;
title;
Moderator variable analysis
Interpretation
The results show that there does seem to be an influence of the moderator variable
"democracy score" on the relationship between the income and the oil consumption. It somehow
strengthens the relationship between income and oil consumption as the correlation is highly positive > 70%.
If I only consider the relationship between income and oil consumption without
the moderator variable the correlation is very poor to the degree of 54% as shown below.
If I have to consider the validity of the moderator I would says that since the
variable "democracy score" shows high correlation for all 3 categories I would
not consider this variable as a valid moderator. A valid moderator in my view
should in a way influence the relationship between the explanatory and response variables
in varying degrees. I looked at moderator variable definition pertaining
to high correlation between eating ice-cream and deaths by drowning.
It was then noticed that temperature was the moderating variable where seasons where
the temperature was cooler resulted in a lower relationship between the
ice-cream eating and the deaths by drowning. The temperature therefore is a valid moderator.
Comments
Post a Comment