<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: question about using/interpreting the chi-squared option in proc freq correctly in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925455#M46014</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302752"&gt;@Geoghegan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I correct in thinking that this will show me if there is a statistically significant difference in the proportions in the age groups comparing the two location options (1 vs 0)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The chi square tests for differences of distribution, i.e. all age groups at once.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Restrict the age groups to two of interest to test them. A WHERE is easy to add. Something like:&lt;/P&gt;
&lt;P&gt;Where agegroup in (1, 3); assumes your agegroups have coding like that if only interested in a couple.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;PRE&gt;proc logistic data=demographics;
class location/ param=ref;
model agegroup= location/ link=glogit;
run;&lt;/PRE&gt;
&lt;P&gt;The tests of the Location parameter estimates are tests comparing the groups (locations) at each level of age group.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Apr 2024 20:46:02 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-04-23T20:46:02Z</dc:date>
    <item>
      <title>question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925448#M46012</link>
      <description>&lt;P&gt;I'm using SAS Studio and trying to compare the proportions of people in seven age groups within two populations (location variable is 1/0) and see if there is a significant different in distribution. Currently my code is:&lt;/P&gt;
&lt;P&gt;proc freq data=demographics;&lt;BR /&gt;table agegroup*location/chisq nocum norow nopercent;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I correct in thinking that this will show me if there is a statistically significant difference in the proportions in the age groups comparing the two location options (1 vs 0)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, is there a reasonable way to compare each age group (for example, to see if there is a significant difference between the proportion in the first age group in the 1 location compared to the first age group in the 0 location, etc for each age group?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 20:02:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925448#M46012</guid>
      <dc:creator>Geoghegan</dc:creator>
      <dc:date>2024-04-23T20:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925454#M46013</link>
      <description>&lt;UL class="lia-list-style-type-square"&gt;
&lt;LI&gt;Usage Note 22561: Testing the equality of two or more proportions from independent samples&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/22/561.html" target="_blank"&gt;https://support.sas.com/kb/22/561.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Test for the equality of two proportions in SAS &lt;BR /&gt;By Rick Wicklin on The DO Loop July 5, 2017&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/07/05/test-equality-two-proportions-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/07/05/test-equality-two-proportions-sas.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Chi-square tests for proportions in one-way tables &lt;BR /&gt;By Rick Wicklin on The DO Loop October 1, 2018&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/10/01/chi-square-tests-for-proportions-one-way.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/10/01/chi-square-tests-for-proportions-one-way.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Simultaneous confidence intervals for multinomial proportions &lt;BR /&gt;By Rick Wicklin on The DO Loop February 15, 2017&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/02/15/confidence-intervals-multinomial-proportions.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/02/15/confidence-intervals-multinomial-proportions.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Funnel plots for proportions&lt;BR /&gt;By Rick Wicklin on The DO Loop November 23, 2011&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2011/11/23/funnel-plots-for-proportions.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2011/11/23/funnel-plots-for-proportions.html&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Should you use the Wald confidence interval for a binomial proportion? &lt;BR /&gt;By Rick Wicklin on The DO Loop April 17, 2023&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2023/04/17/wald-interval-binomial-proportion.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2023/04/17/wald-interval-binomial-proportion.html&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;BR /&gt;You might need to correct for multiple testing (inflation of the type I - error = false positive rate).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 20:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925454#M46013</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-04-23T20:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925455#M46014</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302752"&gt;@Geoghegan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I correct in thinking that this will show me if there is a statistically significant difference in the proportions in the age groups comparing the two location options (1 vs 0)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The chi square tests for differences of distribution, i.e. all age groups at once.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Restrict the age groups to two of interest to test them. A WHERE is easy to add. Something like:&lt;/P&gt;
&lt;P&gt;Where agegroup in (1, 3); assumes your agegroups have coding like that if only interested in a couple.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;PRE&gt;proc logistic data=demographics;
class location/ param=ref;
model agegroup= location/ link=glogit;
run;&lt;/PRE&gt;
&lt;P&gt;The tests of the Location parameter estimates are tests comparing the groups (locations) at each level of age group.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2024 20:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925455#M46014</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-23T20:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925456#M46015</link>
      <description>&lt;P&gt;The chi-square test for your table tests whether the age groups all have the same proportion of location=1 (or of location=0). Equivalently, it tests if the distributions across the age groups are the same for the two locations. If what you then want is to do pairwise comparisons among the age groups on the proportion of location=1 (or 0), then it is easiest to use logistic regression as below. The LSMEANS differences table gives the tests comparing the proportion in each pair of age groups.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=demographics;
class agegroup/param=glm;
model location(event='1')=agegroup;
lsmeans agegroup / ilink cl diff;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But your wording of the question is odd. It sounds like you want to test whether the proportions of the two locations are the same in a given age group. That is equivalent to testing whether the proportion of location=1 in a given age group equals 0.5 since the row proportions must add to 1. If you really want to do that for each age group, you would use a binomial test that the proportion of location=1 (or 0) equals 0.5 in each age group. You would do that like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=demographics; 
by agegroup; 
run;
proc freq;
by agegroup;
table location/binomial;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Apr 2024 20:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925456#M46015</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2024-04-23T20:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925632#M46034</link>
      <description>&lt;P&gt;thank you for the explanation, I think I may be thinking about this wrong. I wanted to compare the distribution of ages between one location and the other, not between age groups within one location. So it seems like I already have that (just comparing all of the age group distribution in one to all of the age group distribution in the other).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One last question - does the chi-squared test comparing these just compare the percentages in each age group between the two locations or does it take into account whether or not the sample size in each age group is enough to determine if the age distribution really was different? For example, if one location only had 2 people in one age group, that could make it difficult to be certain if the age distribution really was different. I'm sorry if that doesn't make sense!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 19:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925632#M46034</guid>
      <dc:creator>Geoghegan</dc:creator>
      <dc:date>2024-04-24T19:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925633#M46035</link>
      <description>&lt;P&gt;Thank you, I'll look through those!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 19:09:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925633#M46035</guid>
      <dc:creator>Geoghegan</dc:creator>
      <dc:date>2024-04-24T19:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925634#M46036</link>
      <description>&lt;P&gt;oh, thank you! I think the proc logistic may be very helpful!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 19:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925634#M46036</guid>
      <dc:creator>Geoghegan</dc:creator>
      <dc:date>2024-04-24T19:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925650#M46039</link>
      <description>&lt;P&gt;The procedure will report warnings for small cell counts at the interpretation needs to be carefully considered if the count is less than 5.&lt;/P&gt;
&lt;P&gt;Whether to consider that a wrong conclusion is part of the art in analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 19:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925650#M46039</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-24T19:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: question about using/interpreting the chi-squared option in proc freq correctly</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925662#M46040</link>
      <description>&lt;P&gt;&amp;gt;you say: "&lt;SPAN&gt;I wanted to compare the distribution of ages between one location and the other, not between age groups within one location."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That sounds to me like it is consistent with my previous statement of one of the ways to interpret the chi-square from PROC FREQ:&amp;nbsp; "it tests if the distributions across the age groups are the same for the two locations."&amp;nbsp; Sample sizes are involved in the test, so if you had the same proportions but very different sample size, the results would differ.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 20:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/question-about-using-interpreting-the-chi-squared-option-in-proc/m-p/925662#M46040</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2024-04-24T20:34:58Z</dc:date>
    </item>
  </channel>
</rss>

