Chapter Contents

Previous

Next
The MEANS Procedure

Statistical Computations

PROC MEANS uses single-pass algorithms to compute the moment statistics (such as mean, variance, skewness, and kurtosis). See Keywords and Formulas for the statistical formulas.

The computational details for confidence limits, hypothesis test statistics, and quantile statistics follow.


Confidence Limits
With the keywords CLM, LCLM, and UCLM, you can compute confidence limits for the mean. A confidence limit is a range, constructed around the value of a sample statistic, that contains the corresponding true population value with given probability (ALPHA=) in repeated sampling.

A two-sided [IMAGE]% confidence interval for the mean has upper and lower limits

[IMAGE]

where [IMAGE] is [IMAGE] and [IMAGE] is the ( [IMAGE]) critical value of the Student's t statistics with [IMAGE] degrees of freedom.

A one-sided [IMAGE]% confidence interval is computed as

[IMAGE]

A two-sided [IMAGE]% confidence interval for the standard deviation has lower and upper limits

[IMAGE]

where [IMAGE] and [IMAGE] are the [IMAGE] and [IMAGE] critical values of the chi-square statistic with [IMAGE] degrees of freedom. A one-sided [IMAGE]% confidence interval is computed by replacing [IMAGE] with [IMAGE].

A [IMAGE]% confidence interval for the variance has upper and lower limits that are equal to the squares of the corresponding upper and lower limits for the standard deviation.

When you use the WEIGHT statement or WEIGHT= in a VAR statement and the default value of VARDEF=, which is DF, the [IMAGE]% confidence interval for the weighted mean has upper and lower limits

[IMAGE]

where [IMAGE] is the weighted mean, [IMAGE] is the weighted standard deviation, [IMAGE] is the weight for [IMAGE] observation, and [IMAGE] is the [IMAGE] critical value for the Student's t distribution with [IMAGE] degrees of freedom.


Student's t Test
PROC MEANS calculates the t statistic as

[IMAGE]

where [IMAGE] is the sample mean, [IMAGE] is the number of nonmissing values for a variable, and [IMAGE] is the sample standard deviation. Under the null hypothesis, the population mean equals [IMAGE]. When the data values are approximately normally distributed, the probability under the null hypothesis of a t statistic as extreme, or more extreme, than the observed value (the p-value) is obtained from the t distribution with [IMAGE] degrees of freedom. For large [IMAGE], the t statistic is asymptotically equivalent to a z test.

When you use the WEIGHT statement or WEIGHT= in a VAR statement and the default value of VARDEF=, which is DF, the Student's t statistic is calculated as

[IMAGE]

where [IMAGE] is the weighted mean, [IMAGE] is the weighted standard deviation, and [IMAGE] is the weight for [IMAGE] observation. The [IMAGE] statistic is treated as having a Student's t distribution with [IMAGE] degrees of freedom. If you specify the EXCLNPWGT option in the PROC statement, [IMAGE] is the number of nonmissing observations when the value of the WEIGHT variable is positive. By default, [IMAGE] is the number of nonmissing observations for the WEIGHT variable.


Quantiles
The options QMETHOD=, QNTLDEF=, and QMARKERS= determine how PROC MEANS calculates quantiles. QNTLDEF= deals with the mathematical definition of a quantile. See Calculating Percentiles . QMETHOD= deals with the mechanics of how PROC MEANS handles the input data. The two methods are

OS
reads all data into memory and sorts it by unique value.

P2
accumulates all data into a fixed sample size that is used to approximate the quantile.

If data set A has 100 unique values for a numeric variable X and data set B has 1000 unique values for numeric variable X then OMETHOD=OS for data set B will take 10 times as much memory as it does for data set A. If QMETHOD=P2, both data sets A and B will require the same memory space to generate quantiles.

The QMETHOD=P2 technique is based on the piecewise-parabolic (P²) algorithm invented by Jain and Chlamtac (1985). P² is a one-pass algorithm to determine quantiles for a large data set. It requires a fixed amount of memory for each variable for each level within the type. However, using simulation studies, reliable estimations of some quantiles (P1, P5, P95, P99) may not be possible for some data sets such as those with heavily tailed or skewed distributions.

If the number of observations is less than the QMARKERS= value, QMETHOD=P2 produces the same results as QMETHOD=OS when QNTLDEF=5. To compute weighted quantiles, you must use QMETHOD=OS.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.