Programming the statistical procedures from SAS

Variance Testing Problem

Reply
Occasional Contributor
Posts: 5

Variance Testing Problem

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.
Super Contributor
Posts: 281

Re: Variance Testing Problem

> 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.
Occasional Contributor
Posts: 5

Re: Variance Testing Problem

HI
Thanks!
I just want to know if there is a PROC step to solve it.
Contributor
Posts: 31

Re: Variance Testing Problem

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
Regular Contributor
Posts: 169

Re: Variance Testing Problem

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.
Contributor
Posts: 31

Re: Variance Testing Problem

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
Regular Contributor
Posts: 169

Re: Variance Testing Problem

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.
Contributor
Posts: 31

Re: Variance Testing Problem

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
Occasional Contributor
Posts: 5

Re: Variance Testing Problem

THX Susan DALE and Paige.I am going to try it.
Valued Guide
Valued Guide
Posts: 684

Re: Variance Testing Problem

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;
Valued Guide
Valued Guide
Posts: 684

Re: Variance Testing Problem

...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;
Occasional Contributor
Posts: 17

Re: Variance Testing Problem

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

SD Message was edited by: sivaji
Ask a Question
Discussion stats
  • 11 replies
  • 178 views
  • 0 likes
  • 6 in conversation