Assignment 4_DAT: Testing a Potential Moderator

This week, working on my subsetted Marscrater data, I'm going to use a moderator to further examine my research question in the context of a Pearson Correlation.

Research Questions:

  • Is crater diameter associated with crater depth?
  • Does the location of a crater on Mars (MARS_REGION) moderate the relationship between crater diameter and crater depth?


I will be working with 2 quantitative variables from the Marscrater codebook, 'DEPTH_RIMFLOOR_TOPOG' and 'DIAM_CIRCLE_IMAGE', representing crater depth and crater diameter respectively. The objective is to find out if Crater depth (response variable) is associated with crater diameter (explanatory variable). I will then use a third potential moderator variable, 'LATITUDE_CIRCLE_IMAGE', to further investigate any observed association. Since 'LATITUDE_CIRCLE_IMAGE' (Crater latitude) is a quantitative variable, I have collapsed it into a new categorical moderator variable called MARS_REGION; with 4 categories as defined below.

  • MARS_REGION 1:   North Pole;               45 to 90 degrees Latitude
  • MARS_REGION 2:   Upper Equator;        0 to 45  degrees Latitude
  • MARS_REGION 3:   Lower Equator;      -45 to 0 degrees Latitude
  • MARS_REGION 4:   South Pole;              -90 to -45 degrees Latitude


I performed a Pearson correlation coefficient analysis on both the entire sample dataset and for each moderator category using scipy.stat package in Python. Pearson correlation coefficients, r, and p-values were calculated for each scenario.

Python Code: Correlation Coefficient Using a Potential Moderator

DAT_Code 5DAT_Code 6

Model Interpretation for Correlation Coefficient Using a Moderator

DAT_Code Results 6

Firstly, I evaluated the association between crater depth and crater diameter for the entire sample dataset without a moderator in the context of a Pearson correlation coefficient. The high r value (0.7146) and significant p-value (0.0) indicates a moderately strong positive linear association between depth and diameter of impact craters on Mars.

Secondly, I tried to answer the question - Does a third variable, MARS_REGION, moderate this association between crater depth and crater diameter?

From the model results above, we can see that a small p-value of 0.0 was calculated in all four categories of MARS_REGION moderator. This indicates a significant association between crater depth and crater diameter in every region or location on Mars.

Pearson correlation coefficients also show a positive correlation between crater depth and crater diameter in all regions on Mars. However, this positive correlation is stronger in the Polar Regions than around the Equatorial Regions. Correlation coefficient (r) is 0.8447 at the North Pole, 0.8594 at the South Pole, 0.7771 at the Lower Equator and 0.6835 at the Upper Equator regions.

The scatter plots below show a pictorial representation of the model results and observed association.

Conclusion: Crater depth is significantly and positively associated with crater diameter in all 4 regions on Mars. Therefore, we can conclude that MARS_REGION (crater location on Mars) does not provide a moderating effect on the association between crater diameter and crater depth.  This is due to the fact that there is no significant change in direction and magnitude of the observed association and statistical significance for craters in all the regions on Mars. However, MARS_REGION influences the strength of the association in a subtle way. There is a somewhat stronger positive correlation/association between crater diameter and crater depth in the South and North Poles than in the Upper and Lower Equator Regions.







Posted on January 24, 2016 by Okechukwu Ossai

Posted in Data Analysis Tools Course.


Leave a Reply

Your email address will not be published. Required fields are marked *