<?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: How to test one-sided non-zero null hypothesis in proc ttest in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727210#M35270</link>
    <description>Ah, that makes sense. If I construct a new variable of the absolute differences as I did above, it should be one-sided though, correct?&lt;BR /&gt;&lt;BR /&gt;Conversely, how would I set it up to do a two sided test where the differences fall between -7 and 7? Is my original code then sufficient?</description>
    <pubDate>Wed, 17 Mar 2021 18:15:13 GMT</pubDate>
    <dc:creator>stats_novice_44</dc:creator>
    <dc:date>2021-03-17T18:15:13Z</dc:date>
    <item>
      <title>How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727157#M35264</link>
      <description>&lt;P&gt;Hey Everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New SAS user here and I'm hoping you can help me solve a problem. In brief, I have a dataset where I need to compare the mean weight of two species of mouse. Moreover, I'm not simply testing whether or not they're different but rather, does the difference of their mean weight exceed 7 grams? Symbolically, my hypotheses may be stated as:&lt;/P&gt;&lt;P&gt;Ho: |µ1 - µ2| ≤ 7 or µD ≤ 7&lt;/P&gt;&lt;P&gt;Ha: |µ1 - µ2| &amp;gt; 7 or µD &amp;gt; 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is, how do I translate this into SAS code? I found some documentation about the H0 option in proc ttest but I'm unsure about whether I've implemented it correctly for a two-sided test and I'm definitely unsure on how to ask a 1-sided question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At present my code looks something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data weight;
input species_1 species_2;
cards;
22 36
18 24
23 34
22 24
14 37
15 34
;
run;

data weight2;
set weight;
weight = species_1;
species = 1;
output;
weight = species_2;
species = 2;
output;
drop species_1 species_2;
run;

proc sort data=weight2;
by species;
run;

proc ttest data=weight2 H0 = 7;
class species;
var weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any advice you all can offer would be much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 16:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727157#M35264</guid>
      <dc:creator>stats_novice_44</dc:creator>
      <dc:date>2021-03-17T16:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727159#M35265</link>
      <description>You're missing the SIDES option from the PROC TTEST statement to tell SAS it's a one sided test.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_ttest_syntax01.htm&amp;amp;locale=en#statug.ttest.tteprocsides" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_ttest_syntax01.htm&amp;amp;locale=en#statug.ttest.tteprocsides&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;SIDE=2 | L | U&lt;BR /&gt;specifies the number of sides (or tails) and direction of the statistical tests and test-based confidence intervals. The values are interpreted as follows:&lt;BR /&gt;&lt;BR /&gt;2&lt;BR /&gt;specifies two-sided tests and confidence intervals.&lt;BR /&gt;&lt;BR /&gt;L&lt;BR /&gt;specifies lower one-sided tests (in which the alternative hypothesis indicates a parameter value less than the null value) and lower one-sided confidence intervals between minus infinity and the upper confidence limit.&lt;BR /&gt;&lt;BR /&gt;U&lt;BR /&gt;specifies upper one-sided tests (in which the alternative hypothesis indicates a parameter value greater than the null value) and upper one-sided confidence intervals between the lower confidence limit and infinity.&lt;BR /&gt;&lt;BR /&gt;By default, SIDES=2.</description>
      <pubDate>Wed, 17 Mar 2021 16:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727159#M35265</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-17T16:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727188#M35266</link>
      <description>&lt;P&gt;Hey, thank you for the quick reply! Seems like SIDES should do the trick but I do still have one concern.&lt;/P&gt;&lt;P&gt;My hypotheses concern the absolute difference between groups. The sample of my data above yields a mean difference of -12.5 if the default is µ1 - µ2 is used. If µ2-µ1 is used, this flips and becomes 12.5. How do I account for my case where I'm seeking to look at the absolute difference?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just tried an alternative method. Does this look like it should adequately address my hypothesis?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data weight;
input species_1 species_2;
cards;
22 36
18 24
23 34
22 24
14 37
15 34
;
run;

data weight2;
set weight;
weight = species_1;
species = 1;
output;
weight = species_2;
species = 2;
output;
drop species_1 species_2;
run;

data weight_diff;
	set weight;
	weight_diff = abs(species_1 - species_2);
run;

proc ttest data=weight_diff H0 = 7 SIDES=U;
	var weight_diff;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Mar 2021 17:11:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727188#M35266</guid>
      <dc:creator>stats_novice_44</dc:creator>
      <dc:date>2021-03-17T17:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727190#M35267</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/374302"&gt;@stats_novice_44&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;My hypotheses concern the absolute difference between groups.&amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then that doesn't sound like a one sided test to me.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 17:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727190#M35267</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-17T17:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727191#M35268</link>
      <description>&lt;P&gt;Well it's one-sided in that I'm trying to determine if the difference between means exceeds my value of interest, in this case 7.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does |µ1 - µ2| exceed 7?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 17:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727191#M35268</guid>
      <dc:creator>stats_novice_44</dc:creator>
      <dc:date>2021-03-17T17:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727195#M35269</link>
      <description>Remove the absolute values signs and that becomes:&lt;BR /&gt;&lt;BR /&gt; -7&amp;lt;= U1-U2 &amp;lt;=7&lt;BR /&gt;&lt;BR /&gt;Which is a two sided test. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Mar 2021 17:22:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727195#M35269</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-17T17:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727210#M35270</link>
      <description>Ah, that makes sense. If I construct a new variable of the absolute differences as I did above, it should be one-sided though, correct?&lt;BR /&gt;&lt;BR /&gt;Conversely, how would I set it up to do a two sided test where the differences fall between -7 and 7? Is my original code then sufficient?</description>
      <pubDate>Wed, 17 Mar 2021 18:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/727210#M35270</guid>
      <dc:creator>stats_novice_44</dc:creator>
      <dc:date>2021-03-17T18:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/728019#M35293</link>
      <description>&lt;P&gt;From your interest in the differences, I assume that your data is paired data, and your hypothesis sounds like an equivalence sort of test is desired. You probably need to use the TOST option in the PROC TTEST statement and the PAIRED statement with your original data arrangement with two response variables. See the example titled "Equivalence Testing with Lognormal Data" in the TTEST documentation - it involved lognormal data, but that is not required.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Mar 2021 19:14:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/728019#M35293</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2021-03-21T19:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to test one-sided non-zero null hypothesis in proc ttest</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/728514#M35325</link>
      <description>&lt;P&gt;If you think of this as a non-inferiority test, I think the following may be of interest:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ttest data=weight2 h0=-7 sides=L;
class species;
var weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This uses your 'long' dataset.&amp;nbsp; The output shows that the difference is significantly less than -7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SteveDenham&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 18:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-test-one-sided-non-zero-null-hypothesis-in-proc-ttest/m-p/728514#M35325</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2021-03-23T18:09:28Z</dc:date>
    </item>
  </channel>
</rss>

