Week 2 Assignment sas code is showed as below
66.LIBNAME mydata "/courses/d1406ae5ba27fe300 " access=readonly;
DATA new; SET mydata.gapminder;
/*data management for income per person*/
if incomeperperson <=10000 then ipp="1";
if incomeperperson > 10000 and incomeperperson <=20000 then ipp="2";
if incomeperperson >20000 and incomeperperson <=30000 then ipp="3";
if incomeperperson >30000 then ipp="4";
/*data management for female employ rate*/
if femaleemployrate <=50 then fer=0;
if femaleemployrate >50 then fer=1;
PROC SORT; by COUNTRY;
PROC FREQ; TABLES fer*ipp/CHISQ;
RUN;
DATA COMPARISON1; SET NEW;
IF ipp=1 OR ipp=2;
PROC SORT; BY COUNTRY;
PROC FREQ; TABLES fer*ipp/CHISQ;
RUN;
DATA COMPARISON2; SET NEW;
IF ipp=1 OR ipp=3;
PROC SORT; BY COUNTRY;
PROC FREQ; TABLES fer*ipp/CHISQ;
RUN;
DATA COMPARISON3; SET NEW;
IF ipp=1 OR ipp=4;
PROC SORT; BY COUNTRY;
PROC FREQ; TABLES fer*ipp/CHISQ;
RUN;
DATA COMPARISON4; SET NEW;
IF ipp=2 OR ipp=3;
PROC SORT; BY COUNTRY;
PROC FREQ; TABLES fer*ipp/CHISQ;
RUN;
DATA COMPARISON5; SET NEW;
IF ipp=2 OR ipp=4;
PROC SORT; BY COUNTRY;
PROC FREQ; TABLES fer*ipp/CHISQ;
RUN;
DATA COMPARISON6; SET NEW;
IF ipp=3 OR ipp=4;
PROC SORT; BY COUNTRY;
PROC FREQ; TABLES fer*ipp/CHISQ;
RUN;
Since Gapminder dateset is all quantitative explanatory variable, I categorized quantitative explanatory variable to categorical explanatory variable. I also categorized quantitative response variable to categorical response variable. My null hypothesis is income per person(ipp) is not associated with female employ rate(fer). Alter hypothesis is income per person(ipp) is associated with female employ rate(fer).
As showed in the first table,
If fer=0 which means female employ rate <=50%,
ipp(income per person) between 0 to $10,000 is 66.87%.
ipp(income per person) between 0 to $10,000 is 64.71%.Ā
ipp(income per person) between 0 to $10,000 is 57.14%.Ā
ipp(income per person) between 0 to $10,000 is 43.75%.
if fer=1 which means female employ rate >50%,
ipp(income per person) between 0 to $10,000 is 33.13%.
ipp(income per person) between 0 to $10,000 is 35.29%.
ipp(income per person) between 0 to $10,000 is 42.86%.
ipp(income per person) between 0 to $10,000 is 56.25%.
In total, p-value is 0.2916>0.05, fail to reject null hypothesis.
In comparison 1 , p-value is 0.8571/6=0.14285>0.05, fail to reject null hypothesis.
In comparison 2 , p-value is 0.4604/6=0.077>0.05,fail to reject null hypothesis.
In comparison 3 , p-value is 0.0644/6=0.011<0.05,reject null hypothesis.
In comparison 4 , p-value is 0.6670/6=0.111>0.05, fail to reject null hypothesis.
In comparison 5 , p-value is 0.2269/6=0.0378<0.05,reject null hypothesis.
In comparison 6 , p-value is 0.4642/6=0.077>0.05,Ā fail to reject null hypothesis.