FNLStat : Sampling : SMPST
SMPST
Computes statistics for inferences regarding the population mean and total given continuous data from a two‑stage sample with equisized primary units.
Required Arguments
NUNSAM — Number of primary units into which the sample is divided. (Input)
NELSAM — Number of elements in the sample in each sampled primary unit. (Input)
Y — Vector of length NOBS containing the elements of the two‑stage sample. (Input)
The elements from each primary unit must occur contiguously within Y. Since there must be an equal number from each primary unit, Y must contain no missing values.
NUNPOP — Number of primary units in the sampled population. (Input)
NELPOP — Number of elements in each primary unit in the population. (Input)
PUMEAN — Vector of length NUNSAM containing the means of the primary units in the sample. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3)
The estimates are ordered in correspondence with the ordering of primary units in Y.
PUVAR — Vector of length NUNSAM containing the sample variances of the primary units in the sample. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3)
The estimates are ordered in correspondence with the ordering of primary units in Y.
STAT — Vector of length 9 containing the resulting statistics. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3)
I
STAT(I)
1
Estimate of the mean.
2
Estimate of the total.
3
Variance of the mean estimate.
4
Variance estimate of the total estimate.
5
Lower confidence limit for the mean.
6
Upper confidence limit for the mean.
7
Lower confidence limit for the total.
8
Upper confidence limit for the total.
9
Estimate (expressed as a percentage) of the coefficient of variation of the mean and total estimates.
Optional Arguments
IDO — Processing option. (Input)
Default: IDO = 0.
IDO
Action
0
This is the only invocation of SMPST for this data set, and all the data are input at once.
1
This is the first invocation, and additional calls to SMPST will be made. Initialization and updating for the data in Y are performed.
2
This is an intermediate invocation of SMPST, and updating for the data in Y is performed.
3
This is the final invocation of this routine. Updating for the data in Y and wrap‑up computations are performed.
NOBS — The number of observations currently input in Y. (Input)
NOBS may be positive or zero. If NOBS = 0, IDO must equal 3, and only wrap‑up computations are performed.
Default: NOBS = size (Y,1).
CONPER — Confidence level for two‑sided interval estimate, in percent. (Input)
A CONPER percent confidence interval is computed; hence, CONPER must be greater than or equal to 0.0 and less than 100.0. CONPER is often 90.0, 95.0, or 99.0. For a one‑sided confidence interval with confidence level ONECL, set CONPER = 100.0  2.0 * (100.0  ONECL).
Default: CONPER = 95.0.
FORTRAN 90 Interface
Generic: CALL SMPST (NUNSAM, NELSAM, Y, NUNPOP, NELPOP, PUMEAN, PUVAR, STAT [])
Specific: The specific interface names are S_SMPST and D_SMPST.
FORTRAN 77 Interface
Single: CALL SMPST (IDO, NUNSAM, NELSAM, NOBS, Y, NUNPOP, NELPOP, CONPER, PUMEAN, PUVAR, STAT)
Double: The double precision name is DSMPST.
Description
Routine SMPST computes point and interval estimates for the population mean and total from a two‑stage sample with primary units that are all equal in size. A two‑stage sample might be taken if each unit (“primary unit”) in the population can be divided into smaller units. Primary units are selected first, and then those selected are subsampled. The routine uses the standard methods discussed in Chapter 10 of Cochran (1977). The sample means for the individual primary units are accumulated in PUMEAN, and the corrected sums of squares are accumulated in PUVAR. In the postprocessing phase, the quantities in STAT are computed using the primary unit statistics. The parameters IDO and NOBS allow either all or part of the data to be brought in at one time.
Following the notation of Cochran (1977), let n (NUMSAM) be the number of primary units in the sample, let m (NELSAM) be the number of elements (subunits) subsampled from each primary unit, let N (NUMPOP) be the total number of primary units in the population, let M (NELPOP) be the total number of elements in each primary unit (in the population), and let yij be the j‑th element in the i‑th primary unit. The sample mean per subunit in the i‑th primary unit is
The estimate of the population mean is
The estimate of the variance of
Example
In this example, we have a sample of two primary units, with five subunits from each. The population consists of 10 primary units with 15 elements each.
 
USE SMPST_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NELPOP, NELSAM, NOBS, NOUT, NUNPOP, NUNSAM
REAL PUMEAN(2), PUVAR(2), STAT(9), Y(10)
!
DATA Y/2.7, 5.1, 4.3, 2.8, 1.9, 6.2, 4.8, 5.1, 7.2, 6.5/
!
NUNSAM = 2
NELSAM = 5
NOBS = 10
NUNPOP = 10
NELPOP = 15
! All data are input at once.
CALL SMPST (NUNSAM, NELSAM, Y, NUNPOP, NELPOP, &
PUMEAN, PUVAR, STAT)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) STAT
99999 FORMAT (' Mean estimate = ', F8.3, ' Total estimate = ', &
F8.1, /, ' Vhat of mean = ', F8.3, ' Vhat of total ' &
, ' = ', F8.1, /, ' Confidence limits for mean ', F8.3, &
',', F8.3, /, ' Confidence limits for total ', F8.1, &
',', F8.1, /, ' C. V. = ', F8.1, '%')
END
Output
 
Mean estimate = 4.660 Total estimate = 699.0
Vhat of mean = 1.370 Vhat of total = 30823.7
Confidence limits for mean 2.366, 6.954
Confidence limits for total 354.9, 1043.1
C. V. = 25.1%