Pearson Correlation
This week I ran a Pearson Correlation for the depth and
diameter variables. Running a scatter plot to determine whether there was a
positive relationship between crater
diameter and depth was not as clear as I'd like when done for all ejecta
types. I limited the variables to the "MLER" top layer ejecta type and
produced the following plot.
Definitely positive and fairly linear. But is it
significant? Here's the Pearson Correlation for the plot above.
Squaring the coefficient gives a value of .611852 and so it
can be assumed that 61 % of the variability of crater depth can be predicted.
Here is the SAS code used.
/* opens library containing data */
LIBNAME mydata "/courses/d1406ae5ba27fe300 "
access=readonly;
/*pulls specific dataset from library */
data new;
set
mydata.marscrater_pds;
/* Group
ejecta variable by top layer */
if
index(MORPHOLOGY_EJECTA_1, '/')> 0 then
Ejecta_1=substr(MORPHOLOGY_EJECTA_1,
1, index(MORPHOLOGY_EJECTA_1, '/')-1);
else
Ejecta_1=MORPHOLOGY_EJECTA_1;
Ejecta=compress(substr(upcase(Ejecta_1),
1, 4));
/*Recode
crater depth to meters from kilometers*/
depth_m=depth_rimfloor_topog*1000;
/*Limit to
top layer ejecta type "MLER"*/
if
ejecta='MLER';
/*Limit to
craters 50 km or less in diameter.*/
if
diam_circle_image LE 50;
proc sort ;
by
crater_id;
/*Produce
scatter plot to asses linearity.*/
PROC GPLOT ;
PLOT
depth_m*diam_circle_image;
/* Generate
correlation coefficient. */
PROC CORR ;
VAR depth_m
diam_circle_image;
RUN;
No comments:
Post a Comment