proc freq: five secrets* *okay, well, lesser known facts
TRANSCRIPT
![Page 1: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/1.jpg)
Proc freq: Five secrets*
*Okay, well, lesser known facts
![Page 2: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/2.jpg)
They said I wasn’t that interesting
![Page 3: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/3.jpg)
1. Different and similar chi-squares2. Fisher’s Exact Test. How to get one. Why you
want one3. Odds ratios4. When NOT to compare chi-square values
directly5. Tests of binomial proportions
![Page 4: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/4.jpg)
Proc freq
getting the chi-square values & more
![Page 5: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/5.jpg)
Enterprise Guide Method
![Page 6: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/6.jpg)
Enterprise Guide Method
![Page 7: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/7.jpg)
Enterprise Guide Method
![Page 8: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/8.jpg)
Enterprise Guide Method
![Page 9: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/9.jpg)
The Syntax
PROC FREQ DATA = mydata.oldpeople ; TABLES dthflag*nursehome / NOROW NOPERCENT NOCUM
CHISQ MEASURES ;
![Page 10: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/10.jpg)
Nursing home placement by death
Conditionalprobabilities
![Page 11: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/11.jpg)
Being able to find SPSS in the start
menu does not qualify you to perform a multinomial logistic regression
![Page 12: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/12.jpg)
1. Chi-square values
![Page 13: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/13.jpg)
Chi-square results
![Page 14: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/14.jpg)
Chi-square resultsPearson
∑ (fo – fe)2
fe
Pearson
![Page 15: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/15.jpg)
Chi-square results
![Page 16: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/16.jpg)
Chi-square results
![Page 17: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/17.jpg)
2. What is Fisher’s exact test & when do I get one?
![Page 18: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/18.jpg)
“Well, you see, what you really need to do to make this a valid statistical test is to kill off a few more patients”
![Page 19: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/19.jpg)
Fisher’s Exact Test: probability of a table as unusual as the one that you have obtained under the null hypothesis of no relationship.
![Page 20: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/20.jpg)
With 2 x 2 Tables it’s automatic
![Page 21: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/21.jpg)
Recap: Fisher’s Exact Test
• Small sample size OR• Need exact probability
![Page 22: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/22.jpg)
3. Odds ratios
![Page 23: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/23.jpg)
Computing odds ratios
Divide frequency row 1, column 1 by frequency in row 1 column 2 2,846/184 = 13.51 -- odds of a person who lived not being in a nursing
home versus being in a home. Divide frequency in row 2, column 1 by frequency row 2, column 2 2,239/ 1,077 = 2.08 Divide first result by the second 13.51/ 2.08 = 6.49
![Page 24: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/24.jpg)
Measures
![Page 25: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/25.jpg)
4. Mantel-Haeszel chi-square
Tests ordinal relationshipSame as Pearson if only two categories
![Page 26: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/26.jpg)
Ordinal relationship ?
![Page 27: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/27.jpg)
Don’t just compare values
![Page 28: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/28.jpg)
ER visits versus nursing home
![Page 29: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/29.jpg)
Take-away
1. Different types of chi-square values, different types of correlations and other tests like odds ratios do exist.
2. These statistics are very easy to obtain using SAS.
3. While most times, all of these measures will point you in the direction of the same general conclusion, there are times when one is preferable to the others.
![Page 30: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/30.jpg)
Testing hypothesis π = ?
• PROC FREQ DATA = dsname ;TABLES varname / BINOMIAL (EXACT EQUIV P = .333)
ALPHA = .05 ;
![Page 31: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/31.jpg)
BINOMIAL (EXACT EQUIV P = .333) ALPHA = .05 ;
• The binomial (equiv p = .333) will produce a test that the population proportion is .333 for the first category. That is “No” for death. A Z-value will be produced and probabilities for one-tail and two-tailed tests.
• The exact keyword will produce confidence intervals and, since I have specified alpha = .05, these will be the 95% confidence intervals.
![Page 32: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/32.jpg)
Different data I had lying around
![Page 33: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/33.jpg)
Hmmm…. This is interesting
![Page 34: Proc freq: Five secrets* *Okay, well, lesser known facts](https://reader036.vdocuments.us/reader036/viewer/2022070409/56649e975503460f94b9a9bb/html5/thumbnails/34.jpg)
Null rejected !