DATA Step, Macro, Functions and more

Would you be able to conclude the association just based on the three percentages?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Would you be able to conclude the association just based on the three percentages?

Here is a dataset about abalone and its indexes. 

1)how can I calculate the percentage that the infant in the middle ring group by using sas procedure?

2)I have already got the percent of the infant (sex=I) abalones and the percent of the medium ring group(the ring values between 9 and 11, inclusive), but would I be able to conclude whether the ring group and the sex are associated of not based on these three percentages?  (actually the question(2) is not about the sas procedure, it is just a simple statistical question.)

 

THE INUT FORMAT HAS BEEN GIVEN:

 

DATA fn.abalone;
LENGTH GROUP $10;
INFILE 'C:\Users\Administrator\Desktop\SAS\final_takehome\abalone.txt' DLM=',' DSD;
/* change the path please! */
INPUT sex $ length diam height whole shucked viscera shell rings;

 
IF RINGS LT 9 THEN GROUP='SMALL';
ELSE IF RINGS GE 9 AND RINGS LE 11 THEN GROUP='MEDIUM';
ELSE IF RINGS GT 11 THEN GROUP='LARGE';

RUN;

 

 

 

 

thanks a lot!!!


Accepted Solutions
Solution
‎05-01-2017 10:21 AM
Respected Advisor
Posts: 4,920

Re: Would you be able to conclude the association just based on the three percentages?

Posted in reply to Phoebelee

Contingency table tests are based on frequencies, not percentages. Compare:

 

DATA abalone;
LENGTH GROUP $10;
INFILE "&sasforum\datasets\abalone.txt" DSD;
INPUT sex $ length diam height whole shucked viscera shell rings;
IF RINGS LT 9 THEN GROUP='SMALL';
ELSE IF RINGS GE 9 AND RINGS LE 11 THEN GROUP='MEDIUM';
ELSE IF RINGS GT 11 THEN GROUP='LARGE';
RUN;

/* Tests based on frequencies */
proc freq data=abalone;
table sex*group / deviation chisq out=aba_pct;
exact fisher / mc;
run;

/* Check the percentages */
proc print data=aba_pct noobs; run;

/* Tests based on percentages */
proc freq data=aba_pct;
weight percent;
table sex*group / deviation chisq;
exact fisher / mc; /* Will not work because of non-integer frequencies */
run;
PG

View solution in original post


All Replies
Super User
Posts: 19,781

Re: Would you be able to conclude the association just based on the three percentages?

Posted in reply to Phoebelee

For 2, what test are you using? 

Occasional Contributor
Posts: 8

Re: Would you be able to conclude the association just based on the three percentages?

[ Edited ]

 

 

I think what my prof asked is just simply talking about whether would I be abel to conclude the association based on the three percentages and then use chi square test to check if the results match with the former guess.

Thanks!!

Solution
‎05-01-2017 10:21 AM
Respected Advisor
Posts: 4,920

Re: Would you be able to conclude the association just based on the three percentages?

Posted in reply to Phoebelee

Contingency table tests are based on frequencies, not percentages. Compare:

 

DATA abalone;
LENGTH GROUP $10;
INFILE "&sasforum\datasets\abalone.txt" DSD;
INPUT sex $ length diam height whole shucked viscera shell rings;
IF RINGS LT 9 THEN GROUP='SMALL';
ELSE IF RINGS GE 9 AND RINGS LE 11 THEN GROUP='MEDIUM';
ELSE IF RINGS GT 11 THEN GROUP='LARGE';
RUN;

/* Tests based on frequencies */
proc freq data=abalone;
table sex*group / deviation chisq out=aba_pct;
exact fisher / mc;
run;

/* Check the percentages */
proc print data=aba_pct noobs; run;

/* Tests based on percentages */
proc freq data=aba_pct;
weight percent;
table sex*group / deviation chisq;
exact fisher / mc; /* Will not work because of non-integer frequencies */
run;
PG
Respected Advisor
Posts: 4,920

Re: Would you be able to conclude the association just based on the three percentages?

Note: The relationship between rings and maturity is better illustrated with logistic regression:

 

data aba_maturity;
set abalone;
mature = sex in ("M", "F");
run;

proc logistic data=aba_maturity;
model mature(event="1") = rings;
effectplot fit(x=rings) / obs(jitter(y=0.1));
run;

FitPlot1.png

PG
Occasional Contributor
Posts: 8

Re: Would you be able to conclude the association just based on the three percentages?

Thank you, but would I be able to get an intuitive result just from those three percentages?

Respected Advisor
Posts: 4,920

Re: Would you be able to conclude the association just based on the three percentages?

Posted in reply to Phoebelee

You cannot evaluate the relationship between two variables by looking at the proportions for only one variable. I would base my intuition on the deviations in the freq table. Percentages alone can be missleading as they can be based on small numbers. What if the total number of fish was only 20?

PG
Super User
Posts: 19,781

Re: Would you be able to conclude the association just based on the three percentages?

Posted in reply to Phoebelee

Always look at both the raw numbers and percentage. 

Raw to determine if it matters, percentage for comparison. If the percentages show a huge discrepancy it's usually because of the small N. 

 

What is the possibility of a hospital having only baby boys in a week? 

It depends on the number of events - if it only has one or two births a week, it's highly likely this could occur. If it has 1000 births it's really unlikely. 

Occasional Contributor
Posts: 8

Re: Would you be able to conclude the association just based on the three percentages?

Thank you I think I get it!!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 184 views
  • 1 like
  • 3 in conversation