Assignment 3: Test a Multiple Regression Model

Course 3 Week 3:

RESEARCH QUESTION

In the last week’s assignment, we checked if the CO2 emission of a country is related to its citizens’ average life expectancy or not? And by various tests, we concluded that there is no significant association b/w the two at all. Now the issue is, if not CO2 emission, then what variable might be associated with the Life Expectancy, i.e. was there any confounding variable that we neglected in our analysis. For that purpose, I included more explanatory variables like Alcohol Consumption and Urban Rate of a country.

Now the issue is, if not CO2 emission, then what variable might be associated with the Life Expectancy, i.e. was there any confounding variable that we neglected in our analysis. For that purpose, I included more explanatory variables like Alcohol Consumption and Urban Rate of a country.

VARIABLES

I am using the already available Gapminder dataset for my week 3 analysis.

Quantitative Explanatory Variables: co2emissions

Quantitative Explanatory Variables: co2emissions urbanrate alcconsumption
Quantitative Response Variable: lifeexpectancy

And then I use their centered values by subtracting each value by their mean.

PROGRAM

FILENAME REFFILE ‘/home/amitamoladun0/course/gapminder.csv’;

PROC IMPORT DATAFILE=REFFILE
DBMS=CSV
OUT=WORK.IMPORT;
GETNAMES=YES;
RUN;

proc sgplot ;
reg x=co2emissions y=lifeexpectancy / lineattrs=(color=blue thickness=2) clm;
yaxis label=”Life Expectancy”;
xaxis label=”CO2 Emissions”;
run;

proc sgplot ;
reg x=co2emissions y=lifeexpectancy / lineattrs=(color=blue thickness=2) degree=1 clm;
reg x=co2emissions y=lifeexpectancy / lineattrs=(color=green thickness=2) degree=2 clm;
yaxis label=”Life Expectancy”;
xaxis label=”CO2 Emissions”;
run;

Proc Means Data=work.Import; var co2emissions urbanrate alcconsumption;
run;

* centering quantitative explanatory variables;

Data new; Set import;
if co2emissions ne . and lifeexpectancy ne . and urbanrate ne .;
co2emissions_c= co2emissions-5531075587;
urbanrate_c= urbanrate-56.7693596;
alcconsumption_c=alcconsumption-6.6894118;
run;

Proc means ;var urbanrate_c co2emissions_c alcconsumption_c;
run;

proc sgplot ;
reg x=urbanrate_c y=lifeexpectancy / lineattrs=(color=blue thickness=2) degree=1 clm;
yaxis label=”Life Expectancy”;
xaxis label=”Urban Rate”;
run;

proc sgplot ;
reg x=alcconsumption_c y=lifeexpectancy / lineattrs=(color=green thickness=2) degree=1 clm;
yaxis label=”Life Expectancy”;
xaxis label=”Alcohol Consumption”;
run;

PROC glm ;
model lifeexpectancy= urbanrate_c co2emissions_c alcconsumption_c/solution clparm;
run;

PROC glm PLOTS(unpack)=all;
model lifeexpectancy=urbanrate_c co2emissions_c alcconsumption_c/solution clparm;
output residual=res student=stdres out=results;
run;

OUTPUT FOR CHECKING THE CENTERING

The quantitative explanatory variables were centered by subtracting their mean and respective new variables were created. We can see in the table below the before and after centering variable results.

Capture

Other OUTPUT & RESULTS

The various SGPLOT procedures gave the following graphs:

The following graph was of regression line plot b/w Co2 Emissions and Life Expectancy. We further see that using a degree two polynomial regression plot is still a better fit than a linear regression plot and this is shown very well in the graph below that.

CaptureCapture

On similar lines we check how the relation for other two variables in the consideration act with our response variable and the result is given below:

CaptureCapture

Now with GLM procedure we actually try to see what are the RSquare values for these plots and are they significant enough to reject our Null Hypothesis that there is no association or not:

So the result for all our centralized variables is:

Capture

We clearly see that CO2 Emission yet again like our last week’s assignment isn’t significant enough and shows there is no association b/w the two variables. Moreover, it’s estimate values being 0 and 95% CI too being b/w -0 to 0 shows that keeping CO2 Emission in the model doesn’t affect our model at all. In fact on removing the variable from our analysis, we see no change in the R² value.

On the other hand, Alcohol Consumption and Urban Rate, both variables having p-value <0.05 show a significant association with our response variable Life Expectancy. Moreover, the R² value of 0.41 indicates that the model explains 41% variability of the response data around its mean which is fairly good.

Analyzing other plots and graphs:

Capture

A Q-Q Plot plots the quantiles of the residuals that we would theoretically see if the residuals followed a normal distribution against the quantiles of the residuals estimated from our regression module. We want to see if the points follow a straight line or not, meaning that the model estimated residuals aren’t what we would expect if the residuals were normally distributed. We see above that the residuals deviate a lot than normal. This indicates that our residuals do not follow a perfectly normal distribution. This could mean that the linear association that we observed in our scatter plot may not be a good estimate. I did check for the other polynomial association of the same variable but it didn’t give any significant association. So I can say that there may be other explanatory variables that we might consider including in our model that could improve estimation.

We have another important plot… called Standardized Residual Plot, shown below:

Capture.JPG

If we take a look at this plot, we see that most of the residuals fall within one standard deviation of the mean. So basically, they’re either between -1 and 1.5. Few countries precisely 9 have residuals that are more than two standard deviations above or below the mean of zero. For the standard normal distribution, we would expect 95% of the values of the residuals to fall between two standard deviations of the mean. There are no observations that are three or more standard deviations from the mean. So we do not appear to have any extreme outliers.

And at last a leverage plot:

Capture.JPG

Finally, we can examine a leverage plot to identify observations that have an unusually large influence on the estimation of the predicted value of the response variable. The leverage of an observation can be thought of in terms of how much the predict scores for other observations would differ if the observation in question were not included in the analysis. The leverage always takes on values between zero and one. A point with zero leverage has no effect on the regression model. Outliers are observations with residuals greater than two or less than negative two. SAS shows outliers as red symbols, observations with high leverage values as green symbols, and observations that are both outliers and high leverage as brown symbols. We see in the leverage plot that we have a few outliers, i.e. countries that have a residual that is greater than 2 or less than negative 2. These outliers have small, that is close to zero, leverage values. Meaning that although they are outlying observations, they do not appear to have a strong influence on the estimation of the regression parameters. On the other hand, we see that there are few cases with higher than average leverage, but one, in particular, is more obvious in terms of having an influence on the estimation of the predicted value of Life Expectancy. This observation has high leverage but is not an outlier. We don’t have any observations that are both high leverage and outliers.

That leads me to the conclusion of this week’s assignment. I found out that CO2 Emission didn’t have any association with Life Expectancy at all whereas, I found two such confounded variables i.e. Alcohol Consumption and Urban Rate that affect the Life Expectancy of a country.

See you in next week where I’ll be talking about Logistic Regression.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s