IMSL Statistics Reference Guide > Basic Statistics > NORM1SAMP Function (PV-WAVE Advantage)
  

NORM1SAMP Function (PV-WAVE Advantage)
Computes statistics for mean and variance inferences using a sample from a normal population.
Usage
result = NORM1SAMP(x)
Input Parameters
x—One-dimensional array containing the observed values.
Returned Value
result—The mean of the sample.
Input Keywords
Double—If present and nonzero, double precision is used
Conf_Mean—Confidence level (in percent) for two-sided interval estimate of the mean. Keyword Conf_Mean must be between 0.0 and 100.0 and is often 90.0, 95.0, or 99.0. For a one-sided confidence interval with confidence level c (at least 50 percent), set Conf_Mean = 100.0 – 2.0 × (100.0 – c). Default: 95-percent confidence interval is computed
T_Null_Hyp—Null hypothesis value for t test for the mean. Default: T_Null_Hyp = 0.0
Chi_Sq_Null_Hyp—Null hypothesis value for the chi-squared test for the variance. Default: Chi_Sq_Null_Hyp = 1.0
Conf_Var—Confidence level (in percent) for two-sided interval estimate of the variances. Keyword Conf_Var must be between 0.0 and 100.0 and is often 90.0, 95.0, or 99.0. For a one-sided confidence interval with confidence level c (at least 50 percent), set Conf_Var = 100.0 – 2.0 × (100.0 – c). Default: 95-percent confidence interval is computed.
Output Keywords
T_Test—Named variable into which the three-element array containing statistics associated with the t test is stored. The first element contains the degrees of freedom associated with the t test for the mean, the second element contains the test statistic, and the third element contains the probability of a larger t in absolute value. The t test is a test of the hypothesis μ = μ0, where μ0 is the null hypothesis value as described in T_Null_Hyp.
Ci_Mean—Named variable into which the two-element array containing the lower confidence limit for the mean, and the upper confidence limit for the mean is stored.
Ci_Var—Named variable into which the two-element array containing lower and upper confidence limits for the variance is stored.
Chi_Sq_Test—Named variable into which the three-element array containing statistics associated with the chi-squared test is stored. The first element contains the degrees of freedom associated with the chi-squared test for variances, the second element contains the test statistic, and the third element contains the probability of a larger chi-squared value. The chi-squared test is a test of the hypothesis σ2 = σ20, where σ20 is the null hypothesis value as described in Chi_Sq_Null_Hyp.
Stdev—Variable into which the standard deviation of the sample is stored.
Discussion
Statistics for mean and variance inferences using a sample from a normal population are computed, including confidence intervals and tests for both mean and variance. The definitions of mean and variance are given below. The summation in each case is over the set of valid observations, based on the presence of missing values in the data.
Mean, return value
Standard deviation
The t statistic for the two-sided test concerning the population mean is given by:
where s and are given above. This quantity has a T distribution with n – 1 degrees of freedom.
The chi-squared statistic for the two-sided test concerning the population variance is given by:
where s is given above. This quantity has a χ2 distribution with n – 1 degrees of freedom.
Example 1
This example uses data from Devore (1982, p. 335), which is based on data published in the Journal of Materials. There are 15 observations; the mean is the only output.
x = [26.7, 25.8, 24.0, 24.9, 26.4, $
   25.9, 24.4, 21.7, 24.1, 25.9, $
   27.3, 26.9, 27.3, 24.8, 23.6]
PRINT, 'Sample Mean = ', NORM1SAMP(x)
; PV-WAVE prints: Sample Mean = 25.3133
Example 2
This example uses the same data as the initial example. The hypothesis H0: μ = 20.0 is tested. The extremely large t value and the correspondingly small p-value provide strong evidence to reject the null hypothesis. First, a procedure to print the results is defined.
PRO print_results, mean, stdev, $
   ci_mean, t_test
   PM, mean, Title = 'Sample Mean:'
   PM, stdev, Title = 'Sample Standard Deviation:'
   PM, '(', ci_mean(0), ci_mean(1), ')', $
   Title = '95% CI for the mean:'
   PM, ' '
   PM, ' df = ', t_test(0), Title = 't-test statistics:'
   PM, '   t       = ', t_test(1)
   PM, '   p-value = ', t_test(2)
END
x = [26.7, 25.8, 24.0, 24.9, 26.4, 25.9, 24.4, $
   21.7, 24.1, 25.9, 27.3, 26.9, 27.3, 24.8, 23.6]
mean = NORM1SAMP(x, Stdev = stdev, Ci_Mean    = ci_mean, $
   T_Null_Hyp = 40.0, T_Test     = t_test)
print_results, mean, stdev, ci_mean, t_test
This results in the following output:
Sample Mean:
  25.3133
Sample Standard Deviation:
 1.57882
95% CI for the mean:
(      24.4390      26.1877) 
t-test statistics:
 df      =      14.0000
 t       =      -36.0277
 p-value =      2.00000

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.