BookmarkSubscribeRSS Feed
Winsentess
Calcite | Level 5
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.
11 REPLIES 11
Paige
Quartz | Level 8
> 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.
Winsentess
Calcite | Level 5
HI
Thanks!
I just want to know if there is a PROC step to solve it.
Susan
Calcite | Level 5
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
Dale
Pyrite | Level 9
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.
Susan
Calcite | Level 5
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
Dale
Pyrite | Level 9
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.
Susan
Calcite | Level 5
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
Winsentess
Calcite | Level 5
THX Susan DALE and Paige.I am going to try it.
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
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;
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
...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;
sivaji
Fluorite | Level 6
Proc ttest will give you a test for equality of variances for two sample.

SD Message was edited by: sivaji

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

Discussion stats
  • 11 replies
  • 2223 views
  • 0 likes
  • 6 in conversation