Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Re: Variance Testing Problem

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-17-2010 10:25 AM
(1850 views)

HI

Whick PROC step can I use to directly verify the variance of a sample is equal or not equal to a specify value?(I just don't want to build the statistics by myself).Thanks for your answer.

Whick PROC step can I use to directly verify the variance of a sample is equal or not equal to a specify value?(I just don't want to build the statistics by myself).Thanks for your answer.

11 REPLIES 11

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

> HI

> Whick PROC step can I use to directly verify the

> variance of a sample is equal or not equal to a

> specify value?(I just don't want to build the

> statistics by myself).Thanks for your answer.

I think you have to create the test statistic yourself, using the computed variance, the hypothesized value, and the F-distribution.

> Whick PROC step can I use to directly verify the

> variance of a sample is equal or not equal to a

> specify value?(I just don't want to build the

> statistics by myself).Thanks for your answer.

I think you have to create the test statistic yourself, using the computed variance, the hypothesized value, and the F-distribution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

HI

Thanks!

I just want to know if there is a PROC step to solve it.

Thanks!

I just want to know if there is a PROC step to solve it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

This test is available using the COVTEST statement in the GLIMMIX procedure. I know this approach works for Version 9.2 (TS2M3); I don't know about earlier versions or previous maintenance releases.

HTH,

Susan

HTH,

Susan

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

In addition to the COVTEST statement of the GLIMMIX procedure (which does not seem to function when the only variance parameter is a residual variance), the UNIVARIATE procedure will construct 1-tailed and 2-tailed confidence limits for the variance of a response which is assumed to be normally distributed. That does not directly test a null hypothesis about the variance being a specified value. However, if you construct an alpha=0.05 CI and the CI includes the value under the null hypothesis, then you would not reject the null hypothesis at alpha=0.05.

If your null hypothesis has a two-tailed alternative (and you can assume that the response is normally distributed), then you can download from SAS a macro which will compute the p-value for the specified null. See http://support.sas.com/kb/25/024.html. The macro will not test a null hypothesis with a 1-sided alternative.

If your null hypothesis has a two-tailed alternative (and you can assume that the response is normally distributed), then you can download from SAS a macro which will compute the p-value for the specified null. See http://support.sas.com/kb/25/024.html. The macro will not test a null hypothesis with a 1-sided alternative.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

The COVTEST option seems to work if the residual (which is the scale parameter) is not profiled:

data sample;

do id=1 to 30;

y=rannor(0);

output;

end;

run;

proc glimmix data=sample noprofile;

model y= ;

random _residual_ / subject=id;

/* Test whether sample variance = 1 */

covtest 1 / cl(type=elr);

/* Test whether sample variance = 2 */

covtest 2;

run;

The COVTEST option appears to be quite useful, but I haven't spent much time studying the documentation yet. Robin High has posted some nice examples on SAS-L recently.

Susan

data sample;

do id=1 to 30;

y=rannor(0);

output;

end;

run;

proc glimmix data=sample noprofile;

model y= ;

random _residual_ / subject=id;

/* Test whether sample variance = 1 */

covtest 1 / cl(type=elr);

/* Test whether sample variance = 2 */

covtest 2;

run;

The COVTEST option appears to be quite useful, but I haven't spent much time studying the documentation yet. Robin High has posted some nice examples on SAS-L recently.

Susan

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Susan,

Thanks for posting the example. I had tried using the NOPROFILE option previously without success. What I did not have is the RANDOM statement specifying the residual with a unique subject specification. It is nice to know that it is possible to obtain a test of the residual variance using the COVTEST statement. However, it is not the most convenient syntax.

Thanks for posting the example. I had tried using the NOPROFILE option previously without success. What I did not have is the RANDOM statement specifying the residual with a unique subject specification. It is nice to know that it is possible to obtain a test of the residual variance using the COVTEST statement. However, it is not the most convenient syntax.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Dale,

It is rather convoluted, isn't it?! The more I learn about GLIMMIX the more I know I don't know.

I'm pleased you found it useful. I certainly have benefited from your postings on SAS-L.

Susan

It is rather convoluted, isn't it?! The more I learn about GLIMMIX the more I know I don't know.

I'm pleased you found it useful. I certainly have benefited from your postings on SAS-L.

Susan

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

THX Susan DALE and Paige.I am going to try it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

One can use different methods to get confidence intervals for a variance in GLIMMIX. I prefer the Profile-Likelihood method (type=profile), but the elr method is fine also. A simpler approach is to use Wald-type confidence intervals, as shown below. This is the approach used by PROC TTEST to give the confidence interval for the standard deviation. That is, if you take the square-root of the point estimate of the variance and square-root of the limits of the confidence interval from PROC GLIMMIX (with the Wald method), one gets the standard deviation estimate (and the confidence limits) in TTEST. Of course, the TTEST approach only works for a single variance in a model, but GLIMMIX allows for any number of variance-covariance estimates.

data sample;

do id=1 to 30;

y=rannor(0);

output;

end;

run;

proc glimmix data=sample noprofile;

model y= ;

random _residual_ / subject=id;

*covtest / cl(type=elr);

*covtest / cl(type=profile);

covtest / cl(type=Wald);

run;

proc ttest data=sample;

var y;

run;

data sample;

do id=1 to 30;

y=rannor(0);

output;

end;

run;

proc glimmix data=sample noprofile;

model y= ;

random _residual_ / subject=id;

*covtest / cl(type=elr);

*covtest / cl(type=profile);

covtest / cl(type=Wald);

run;

proc ttest data=sample;

var y;

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

...and to continue... you can, of course, use the confidence interval for the variance to test the H0.

One can also use PROC MIXED to get the WALD confidence interval for the variance. Using the previous generated, one uses:

proc mixed data=sample covtest cl noprofile;

model y= ;

run;

One can also use PROC MIXED to get the WALD confidence interval for the variance. Using the previous generated, one uses:

proc mixed data=sample covtest cl noprofile;

model y= ;

run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Proc ttest will give you a test for equality of variances for two sample.

SD Message was edited by: sivaji

SD Message was edited by: sivaji

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

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.