BookmarkSubscribeRSS Feed
ralphbenno
Fluorite | Level 6

I need to calculate Chi-Square test for One Pop. Variance

my data is Ho  variance less 25    h1 variance larger than 25    sample deviation= 9.98

I do not know which sas code to use to get the chi square

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

The formula for the chi-square test is given here: https://www.real-statistics.com/chi-square-and-f-distributions/one-sample-hypothesis-testing-varianc...

 

You would program this in a SAS data step, using the CDF function (actually, I think you need 1-CDF), as shown here.

https://documentation.sas.com/?docsetId=ds2ref&docsetTarget=p1ae695babuvmun12d1whd5wn3dv.htm&docsetV...

--
Paige Miller
ralphbenno
Fluorite | Level 6

I would like to see the SAS code

the data is 20 observations

I believe that in SAS  you use the proc freq  command

can you provide me with the code

 

thank you

Reeza
Super User

PROC FREQ does Chi Square tests for categorical data, this is not what you have. You're testing the variance for a continuous distribution, but the test statistic has a Chi Square distribution. PROC FREQ is not the correct procedure here. 

 

Here's an example on calculating the CI for the STD and Variance, which can help you with your hypothesis testing. 

https://documentation.sas.com/?docsetId=procstat&docsetTarget=procstat_univariate_examples09.htm&doc...

 

For the Chi-Square Test specifically, you can use the VarTest macro here:

https://support.sas.com/kb/25/024.html

 

 


@ralphbenno wrote:

I need to calculate Chi-Square test for One Pop. Variance

my data is Ho  variance less 25    h1 variance larger than 25    sample deviation= 9.98

I do not know which sas code to use to get the chi square

 




ralphbenno
Fluorite | Level 6

the answer given does not work for Ha variance less than 25. the macro does not work.

I need sas code for doing chi-square test for one population variance.

 

thank you

 

 

Reeza
Super User
Post the full code you ran. I tested it before answering and it worked fine.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2093 views
  • 0 likes
  • 3 in conversation