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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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