Sunday, October 9, 2016

Data Analysis Tools - Anova - Assignment 1

This week I'm using Anova to look at the relationship between crater ejecta types and both diameter and depth. I want to know if diameter or depth will affect my hypothesis that ejecta type has a relationship to location. To eliminate error I want to know if there is a relationship between ejecta type , diameter and depth that will influence the relationship between ejecta type and crater location.

This week I ran two Anova procedures. One comparing ejecta type to depth and one comparing ejecta type to diameter. I am showing the results for the diameter procedure. I chose a subset of the data covering diameters between 3 and 6 km. The SAS code is at the end of the post.



And here are the results for Diameter:

 

The results are significant and I had more than two variables so I ran a post hoc comparison.


 As you can see the MLEP ejecta type had a significant variance from DLEP and RD but no others. DLEP and RD Ejecta types showed a significant variance from all other types but not each other. MLER, SLER, DLER, SLEP and DLEP crater types show no significant variance. I can conclude from this that there is relationship between diameter and some crater ejecta types but not all.

Here is the code used in SAS:

/* 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;

    /* Recode top ejecta layer to roll up types.  */
    Ejecta=compress(substr(upcase(Ejecta_1), 1, 4));
   
        /* Recode diameter to group variables. */   
    if DIAM_CIRCLE_IMAGE >= 0 and DIAM_CIRCLE_IMAGE le 3 then
        diameter = 'a. 0-3km  ';
    else if DIAM_CIRCLE_IMAGE > 3 and DIAM_CIRCLE_IMAGE le 4 then
        diameter = 'b. 3-4km  ';
    else if DIAM_CIRCLE_IMAGE > 4 and DIAM_CIRCLE_IMAGE le 6 then
        diameter = 'c. 4-6km  ';   
    else if DIAM_CIRCLE_IMAGE > 6 and DIAM_CIRCLE_IMAGE le 10 then
        diameter = 'd. 6-10km  ';   
    else if DIAM_CIRCLE_IMAGE > 10 and diameter_1 le 50 then
        diameter = 'e. 10-50km';   

    /* Recode depth to group variables. */
    if DEPTH_RIMFLOOR_TOPOG <= .1 then
        Depth = 'a. 0 to 100 m  ';
    else if DEPTH_RIMFLOOR_TOPOG >.1 and DEPTH_RIMFLOOR_TOPOG <= .35 then
        Depth = 'b. 100 to 350 m';
    else if DEPTH_RIMFLOOR_TOPOG >.35 and DEPTH_RIMFLOOR_TOPOG <= .6 then
        Depth = 'c. 350 to 600 m';
    else if DEPTH_RIMFLOOR_TOPOG > .6 then
        Depth = 'f. > 600 m     ';
       
    Depth_Meter = DEPTH_RIMFLOOR_TOPOG*1000;
       
    /* Create labels for result tables */
    label Ejecta = "Ejecta Group"
          Diam_Circle_Image = "Crater Diameter"
          Depth_Meter = "Crater Depth";

    /* Limit to craters between 3 and 6 km in diameter. */
    if diam_circle_image > 3 and diam_circle_image le 6;
    /*only include craters with a depth value*/
    if depth_rimfloor_topog >0;
    /*Limit to craters described by MORPHOLOGY_EJECTA_1 variable. */
    if morphology_ejecta_1 ne ' ';
    /*Exclude the lone PD Ejecta type*/
    if ejecta not in ('PD  ');

proc sort ;
    by crater_id;   

/* Analysis of Variance of Ejecta Types by Crater Diameter*/
PROC ANOVA plots(maxpoints=none); CLASS Ejecta;
MODEL DIAM_CIRCLE_IMAGE=Ejecta;
MEANS Ejecta/DUNCAN;   
Title 'Distribution of Diameter by Ejecta Type';
run;
/* Analysis of Variance of Ejecta Types by Crater Depth*/
PROC ANOVA plots(maxpoints = none); CLASS Ejecta;
MODEL Depth_Meter=Ejecta;
MEANS Ejecta/DUNCAN;   
Title 'Distribution of Diameter by Ejecta Type';
run;

 


 

No comments: