FNLStat : Sampling : SMPRS
SMPRS
Computes statistics for inferences regarding the population mean and total using ratio or regression estimation given continuous data from a stratified random sample.
Required Arguments
NROWS — Vector of length NSTRAT in which NROWS(I) is the number of items from the I‑th stratum currently input in X and Y. (Input)
Each element of NROWS may be positive, zero, or negative. A negative value for NROWS(I) means delete the ‑NROWS(I) elements of the I‑th stratum in X and Y from the analysis.
X — Vector containing the data for the auxiliary variable in the stratified random sample. (Input)
The observations within any one stratum must appear contiguously in X. The first NROWS(1) elements of X are from the first stratum, and so on.
Y — Vector containing the data for the variable of interest in the stratified random sample. (Input)
The observations within any one stratum must appear contiguously in Y. The first NROWS(1) elements of Y are from the first stratum, and so on. The value of Y(I) corresponds to that of X(I).
NPOPS — Vector of length NSTRAT containing the sizes of the population in the strata. (Input)
The entries in NSTRAT must be ordered in correspondence with the ordering of strata in the other vectors. If the population strata sizes are not known, estimates must be entered in their place.
XMEANS — Vector of length NSTRAT containing, for each stratum, the population mean of the auxiliary variate, provided ITOPT = 0. (Input)
If ITOPT = 1, only XMEANS(1) is defined and it must contain the population mean of the auxiliary variate.
COEFS — Vector of length NSTRAT containing the ratio estimates or the regression coefficients. (Input, if IOPT = 1; Output, if IOPT = 0 or 2 and IDO = 0 or 1; Input/Output, if IOPT = 0 or 2 and IDO = 2 or 3)
If IOPT = 0, COEFS contains ratio estimates. When ITOPT = 0, COEFS contains the estimate of the ratio for each stratum. When ITOPT = 1, only COEFS(1) is defined and contains the combined estimate of the ratio. If IOPT = 1, COEFS contains preassigned regression coefficients. When ITOPT = 0, COEFS contains the preassigned regression coefficient for each stratum. When ITOPT = 1, only COEFS(1) is defined and contains the preassigned regression coefficient common to all strata. If IOPT = 2, COEFS contains estimated regression coefficients. When ITOPT = 0, COEFS contains the estimated regression coefficient for each stratum. When ITOPT = 1, only COEFS(1) is defined and contains the estimated regression coefficient common to all strata.
XBARS — Vector of length NSTRAT containing the strata means for the auxiliary variable. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3.)
XVARS — Vector of length NSTRAT containing the within‑strata variances of the auxiliary variable. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3.)
XCVS — Vector of length NSTRAT containing the within‑strata coefficients of variation for the auxiliary variable. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3.)
YBARS — Vector of length NSTRAT containing the strata means for the variable of interest. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3.)
YVARS — Vector of length NSTRAT containing the within‑strata variances of the variable of interest. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3.)
YCVS — Vector of length NSTRAT containing the within‑strata coefficients of variation for the variable of interest. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3.)
XYCOVS — Vector of length NSTRAT containing the within‑strata covariances of the auxiliary variable and the variable of interest. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3.)
NSAMPS — Vector of length NSTRAT containing the number of nonmissing observations from each stratum. (Output, if IDO = 0 or 1; Input/Output, if IDO = 2 or 3.)
STAT — Vector of length 12 containing the resulting statistics. (Output)
These are:
I
STAT(I)
1
Estimate of the mean.
2
Estimate of the total.
3
Variance estimate 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 of the coefficient of variation for the mean and total estimate.
10
Unstratified mean of the auxiliary variate.
11
Unstratified mean of the variable of interest.
12
The number of pairs in the sample that had one or both values missing.
Optional Arguments
IDO — Processing option. (Input)
Default: IDO = 0.
IDO
Action
0
This is the only invocation of SMPRS for this data set, and all the data are input at once.
1
This is the first invocation, and additional calls to SMPRS will be made. Initialization and updating for the data in X and Y are performed.
2
This is an intermediate invocation of SMPRS, and updating for the data in X and Y is performed.
3
This is the final invocation of this routine. Updating for the data in X and Y and wrap‑up computations are performed.
NSTRAT — Number of strata into which the population is divided. (Input)
In the vectors of length NSTRAT, the elements are all ordered in the same way. That is, the first stratum is always the first, the second is always the second, and so on.
Default: NSTRAT = size (NROWS,1).
IOPT — Estimation option. (Input)
Default: IOPT = 0.
IOPT
Action
0
Ratio estimation used for inference about the population mean and total.
1
Regression estimation used with the preassigned regression coefficient(s) contained in COEFS.
2
Regression estimation used with the regression coefficient(s) estimated from the data.
ITOPT — Estimation technique option. (Input)
Default: ITOPT = 0.
ITOPT
Action
0
Separate ratio or regression estimation.
1
Combined ratio or regression estimation.
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 SMPRS (NROWS, X, Y, NPOPS, XMEANS, COEFS, XBARS, XVARS, XCVS, YBARS, YVARS, YCVS, XYCOVS, NSAMPS, STAT [])
Specific: The specific interface names are S_SMPRS and D_SMPRS.
FORTRAN 77 Interface
Single: CALL SMPRS (IDO, NSTRAT, NROWS, X, Y, NPOPS, IOPT, ITOPT, XMEANS, CONPER, COEFS, XBARS, XVARS, XCVS, YBARS, YVARS, YCVS, XYCOVS, NSAMPS, STAT)
Double: The double precision name is DSMPRS.
Description
Routine SMPRS computes point and interval estimates for the population mean and total from a stratified random sample of a variable of interest and an auxiliary variable. Routine SMPRS allows for either ratio estimation, regression estimation with preassigned coefficients, or regression estimation with estimated coefficients.
This routine follows the standard methods discussed in Chapters 6 and 7 of Cochran (1977). The statistics are similar to those discussed in the documentation for routine SMPRR, except that they are computed from stratified data. The option parameter IOPT allows selection of either ratio or regression estimation, and the parameter ITOPT allows selection of separate or combined estimators. “Separate” estimators means that each stratum is allowed to have different ratios or regression coefficients, while “combined” means these are assumed to be the same over all strata.
The confidence limits for the mean and for the total are computed using the normal approximation. If the coefficient of variation of either variable exceeds 10%, then this approximation may not be very accurate.
The parameters IDO and NROW allow either all or part of the data to be brought in at one time.
Examples
Example 1
In the following example, we use a stratified sample from the data in Table 5.1 of Cochran (1977), which consists of the 1920 and the 1930 population (in 1000’s) of 64 cities in the United States. The objective is to estimate the mean and total 1930 population of the 64 cities, using a sample of size 24 of the 1920 and 1930 populations. There are two strata: the largest 16 cities and the remaining cities. We use stratified sampling with equal sample sizes. The same example is also used to illustrate routine SMPSS, except here we have an auxiliary variable.
In this example, separate ratio estimation is used.
 
USE SMPRS_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NSTRAT
PARAMETER (NSTRAT=2)
!
INTEGER I, NOUT, NPOPS(NSTRAT), NROWS(NSTRAT), NSAMPS(NSTRAT)
REAL COEFS(NSTRAT), STAT(12), X(24), &
XBARS(NSTRAT), XCVS(NSTRAT), XMEANS(NSTRAT), &
XVARS(NSTRAT), XYCOVS(NSTRAT), Y(24), YBARS(NSTRAT), &
YCVS(NSTRAT), YVARS(NSTRAT)
!
DATA X/773., 748., 734., 577., 507., 438., 415., 401., 387., &
381., 324., 315., 258., 237., 235., 216., 201., 179., 136., &
132., 118., 118., 106., 104./
DATA Y/822., 781., 805., 1238., 634., 487., 442., 451., 459., &
464., 400., 366., 302., 291., 272., 284., 270., 260., 139., &
170., 154., 140., 163., 116./
!
NPOPS(1) = 16
NPOPS(2) = 48
! All data are input at once.
NROWS(1) = 12
NROWS(2) = 12
! Use separate ratio estimation.
XMEANS(1) = 521.8
XMEANS(2) = 165.4
!
CALL SMPRS (NROWS, X, Y, NPOPS, XMEANS, COEFS, XBARS, XVARS, &
XCVS, YBARS, YVARS, YCVS, XYCOVS, NSAMPS, STAT)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) (STAT(I),I=1,9), STAT(12), COEFS
99999 FORMAT (' Mean estimate = ', F8.3, ' Total estimate = ', &
F8.1, /, ' Vhat of mean = ', F8.5, ' Vhat of total ' &
, ' = ', F8.1, /, ' Confidence limits for mean ', F8.3, &
',', F8.3, /, ' Confidence limits for total ', F8.1, &
',', F8.1, /, ' C. V. = ', F8.2, ' Number ', &
'missing = ', F8.1, /, ' Estimated ratios = ', 2F10.3)
END
Output
 
Mean estimate = 315.511 Total estimate = 20192.7
Vhat of mean = 55.56254 Vhat of total = 227584.2
Confidence limits for mean 300.901, 330.120
Confidence limits for total 19257.7, 21127.7
C. V. = 2.36 Number missing = 0.0
Estimated ratios = 1.225 1.255
Example 2
In the following example, we use a stratified sample from the data in Table 5.1 of Cochran (1977), which consists of the 1920 and the 1930 population (in 1000’s) of 64 cities in the United States. The objective is to estimate the mean and total 1930 population of the 64 cities, using a sample of size 24 of the 1920 and 1930 populations. There are two strata: the largest 16 cities and the remaining cities. We use stratified sampling with equal sample sizes. The same example is also used to illustrate routine SMPSS, except here we have an auxiliary variable.
In this example, regression estimation is used, and it is assumed that the regression equation is the same in the two strata.
 
USE SMPRS_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NSTRAT
PARAMETER (NSTRAT=2)
!
INTEGER I, IDO, IOPT, ITOPT, NOUT, NPOPS(NSTRAT), &
NROWS(NSTRAT), NSAMPS(NSTRAT)
REAL COEFS(NSTRAT), STAT(12), X(24), &
XBARS(NSTRAT), XCVS(NSTRAT), XMEANS(1), &
XVARS(NSTRAT), XYCOVS(NSTRAT), Y(24), YBARS(NSTRAT), &
YCVS(NSTRAT), YVARS(NSTRAT)
!
DATA X/773., 748., 734., 577., 507., 438., 415., 401., 387., &
381., 324., 315., 258., 237., 235., 216., 201., 179., 136., &
132., 118., 118., 106., 104./
DATA Y/822., 781., 805., 1238., 634., 487., 442., 451., 459., &
464., 400., 366., 302., 291., 272., 284., 270., 260., 139., &
170., 154., 140., 163., 116./
!
NPOPS(1) = 16
NPOPS(2) = 48
! All data are input at once.
NROWS(1) = 12
NROWS(2) = 12
! Use combined regression estimation.
IOPT = 2
ITOPT = 1
XMEANS(1) = 254.5
!
CALL SMPRS (NROWS, X, Y, NPOPS, XMEANS, COEFS, XBARS, XVARS, &
XCVS, YBARS, YVARS, YCVS, XYCOVS, NSAMPS, STAT, &
IOPT=IOPT, ITOPT=ITOPT)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) (STAT(I),I=1,9), STAT(12), COEFS(1)
99999 FORMAT (' Mean estimate = ', F8.3, ' Total estimate = ', &
F8.1, /, ' Vhat of mean = ', F8.5, ' 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, ' Number ', &
'missing = ', F8.1, /, ' Estimated combined regression ', &
'coefficient = ', F8.3)
END
Output
 
Mean estimate = 315.517 Total estimate = 20193.1
Vhat of mean = 54.84098 Vhat of total = 224628.6
Confidence limits for mean 301.003, 330.031
Confidence limits for total 19264.2, 21122.0
C. V. = 2.3 Number missing = 0.0
Estimated combined regression coefficient = 1.175