LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 1998, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 21 Dec 1998 23:31:46 GMT
Reply-To:     Steve Gregorich <gregorich@PSG.UCSF.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Steve Gregorich <gregorich@PSG.UCSF.EDU>
Organization: University of California, San Francisco
Subject:      Re: Still have problem with Chi Square...
Content-Type: Text/Plain; charset=US-ASCII

The SAS syntax to generate the probability of a chi-square statistic should be:

pvalue= 1 - probchi(chi, df);

where for this application, df=3.

NOT: > pvalue=probchi(N-1,chi);

The latter syntax, swaps the position of the chi-sqaure varaite and the model df and does not subtract the obtained quantity from unity.

A chi-square of 6.35 judged against 3 df has a p-value of 0.0955--not 0.1605. Still, the null should be rejected at conventional levels of statistical significance.

Steve Gregorich

>data one; >input obs expec; >cards; >439 9 >168 3 >133 3 >60 1 >; >data two;set one nobs=N; >retain chi 0; >expec=expec*800/16;put obs= expec=; >chi=chi+((obs-expec)**2)/expec; >if _n_=N then do; > put chi=; > pvalue=probchi(N-1,chi); > put pvalue=; > end; >run; > >In Log, you have: >OBS=439 EXPEC=450 >OBS=168 EXPEC=150 >OBS=133 EXPEC=150 >OBS=60 EXPEC=50 >CHI=6.3555555556 >PVALUE=0.1605662382 >So you should accept the null hypotheses >Javier


Back to: Top of message | Previous page | Main SAS-L page