BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
olivia123456
Fluorite | Level 6

So my code for this practice question is not running and I cannot figure out how to solve this question. Any help please. Also is my hypothesis correct?

 

 

From 2005 through 2008, the Powerball was drawn from a collection of 42 balls numbered 1 through 42. A total of 350 drawings were held. For the purposes of this exercise, we grouped the numbers into six categories: 1–7, 8–14, and so on. If the lottery is fair, then the winning number is equally likely to occur in any category. Following are the observed frequencies. Source: powerball.com. Test the hypothesis that each of the categories is equally likely. Use the level of significance.

 

 

Ho: Each of the categories are equally likely to be chosen for the power ball

Ha: The categories are not equally likely to be chose for the power ball

 

 

data lottery;

      input category observed @@;

cards;

category 1–7      8–1415–2122–2829–3536–42

obsevation 60     71        68          49          52   50

run;

 

procprint data=lottery;

run;

 

 

procttest data=lottery =data

           alpha=0.05 test=diff sides=2;

   class category;

   var observation;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

For a ttest you would have to specify an expected value. Which seems likely to be 350/7 with 350 trials and 7 categories and the test would be testing if the mean observed is 50.

 

data lottery;
      input category $ observed;
cards;
1-7    60  
8-14   71
15-21     68 
22-28    49
29-35    52
36-42     50
;
run;
/* 350 / seven cateogories would be 50 observation s
   per category
*/
proc ttest data=lottery h0=50;
   var observed;
run;

But I would likely look at the data differently as well before making a decision as to "fairness". You have anywhere from 42 (each value) to 2 (0-21 and 22-42) bins to consider

such as test for equal proportions:

proc freq data=lottery;
   weight observed;
   tables category/chisq;
run;

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

@olivia123456 wrote:

So my code for this practice question is not running and I cannot figure out how to solve this question. Any help please. Also is my hypothesis correct?

 

 

From 2005 through 2008, the Powerball was drawn from a collection of 42 balls numbered 1 through 42. A total of 350 drawings were held. For the purposes of this exercise, we grouped the numbers into six categories: 1–7, 8–14, and so on. If the lottery is fair, then the winning number is equally likely to occur in any category. Following are the observed frequencies. Source: powerball.com. Test the hypothesis that each of the categories is equally likely. Use the level of significance.

 

 

Ho: Each of the categories are equally likely to be chosen for the power ball

Ha: The categories are not equally likely to be chose for the power ball

 

 

data lottery;

      input category observed @@;

cards;

category 1–7      8–1415–2122–2829–3536–42

obsevation 60     71        68          49          52   50

run;

 

procprint data=lottery;

run;

 

 

procttest data=lottery =data

           alpha=0.05 test=diff sides=2;

   class category;

   var observation;

run;


 

Is this just an example, where you have only a single observation in your data set?

 

You have several problems. First, your can't read the data into a SAS data set the way you have it presented, your code will fail. Reading data into SAS is a fundamental concept in SAS, and so you might want to spend some time reading on this topic.

 

It might look something like this (UNTESTED CODE)

 

data lottery;
      input Bucket $ number_observed;
cards;
1-7 60
8-14 71
;    /* <= you type the rest of the data, I'm too lazy */
run;

But, this is not a t-test, it might be a chi-squared test. So there is a disconnect there as well. Please see this for an example of doing a Chi-squared goodness of fit test:

https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_freq_sect02...

--
Paige Miller
ballardw
Super User

For a ttest you would have to specify an expected value. Which seems likely to be 350/7 with 350 trials and 7 categories and the test would be testing if the mean observed is 50.

 

data lottery;
      input category $ observed;
cards;
1-7    60  
8-14   71
15-21     68 
22-28    49
29-35    52
36-42     50
;
run;
/* 350 / seven cateogories would be 50 observation s
   per category
*/
proc ttest data=lottery h0=50;
   var observed;
run;

But I would likely look at the data differently as well before making a decision as to "fairness". You have anywhere from 42 (each value) to 2 (0-21 and 22-42) bins to consider

such as test for equal proportions:

proc freq data=lottery;
   weight observed;
   tables category/chisq;
run;
PaigeMiller
Diamond | Level 26

I still wouldn't use a t-test here. Testing if the mean is some specific value is not the same as testing if the results are equally likely to fall in each category, which to me is a Chi-squared goodness of fit test.

--
Paige Miller
ballardw
Super User

@PaigeMiller wrote:

I still wouldn't use a t-test here. Testing if the mean is some specific value is not the same as testing if the results are equally likely to fall in each category, which to me is a Chi-squared goodness of fit test.


Agree absolutely.

 

My response was in the "homework requires TTest" type of answer.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1165 views
  • 2 likes
  • 3 in conversation