FNLStat : Sampling : SMPRR
SMPRR
Computes statistics for inferences regarding the population mean and total using ratio or regression estimation, or inferences regarding the population ratio given a simple random sample.
Required Arguments
NROW — The absolute value of NROW is the number of observations currently input in X and Y. (Input)
NROW may be positive, zero, or negative. Negative ‑NROW means delete the NROW rows of data from the analysis.
X — Vector of length NROW containing the data for the auxiliary variable in the random sample. (Input)
Y — Vector of length NROW containing the data for the variable of interest in the random sample. (Input)
The value of Y(I) corresponds to that of X(I).
NPOP — Size of the population (number of pairs of elements in the sampled population). (Input)
XMEAN — Population mean of the auxiliary variable. (Input)
XMEAN is not used if IOPT = 1.
STAT — Vector of length 20 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 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 ratio.
10
Variance estimate of the estimate of the ratio. The population mean of the auxiliary variable is used in STAT(10) if the mean is known; otherwise, the sample estimate of the population mean is used.
11
Lower confidence limit for the ratio.
12
Upper confidence limit for the ratio.
13
Estimate (expressed as a percentage) of the coefficient of variation of the mean, total, and ratio and regression coefficient estimates that are defined, as controlled by IOPT. The standard deviation in the numerator of this quantity has been divided by the square root of the sample size. The coefficients of variation in STAT(14) and STAT(15) use the sample standard deviations without that divisor.
14
Estimate (expressed as a percentage) of the coefficient of variation of the auxiliary variable.
15
Estimate (expressed as a percentage) of the coefficient of variation of the variable of interest.
16
Sample mean of the auxiliary variable.
17
Sample mean of the variable of interest.
18
Estimate of the regression coefficient.
19
Sample size.
20
Number of pairs in the sample with one or both values missing.
STAT(1) through STAT(8) and STAT(13) are undefined when IOPT = 1. STAT(9) through STAT(12) are undefined when IOPT = 2 or 3. STAT(18) is defined only when IOPT = 3. The elements of STAT that are undefined due to IOPT or an error are set to NaN (not a number).
Optional Arguments
IDO — Processing option. (Input)
Default: IDO = 0.
IDO
Action
0
This is the only invocation of SMPRR for this data set, and all the data are input at once.
1
This is the first invocation, and additional calls to SMPRR will be made. Initialization and updating for the data in X and Y are performed.
2
This is an intermediate invocation of SMPRR 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.
IOPT — Estimation option. (Input)
Default: IOPT = 0.
IOPT
Action
0
Ratio estimation is used for inference about the population mean, total, and ratio.
1
The population mean of the auxiliary variable is not used, and only inference about the population ratio is desired.
2
Regression estimation with preassigned regression coefficient (in COEF) is used for inference about the population mean and total.
3
Regression estimation with estimated regression coefficient (returned in STAT(18)) is used for inference about the population mean and total.
COEF — Reassigned regression coefficient. (Input)
COEF is used only when IOPT = 2.
Default: COEF = 1.0.
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 SMPRR (NROW, X, Y, NPOP, XMEAN, STAT [])
Specific: The specific interface names are S_SMPRR and D_SMPRR.
FORTRAN 77 Interface
Single: CALL SMPRR (IDO, NROW, X, Y, NPOP, IOPT, XMEAN, COEF, CONPER, STAT)
Double: The double precision name is DSMPRR.
Description
Routine SMPRR computes point and interval estimates for the population mean, total, and (optionally) ratio or regression coefficient, using a simple random sample of a variable of interest and an auxiliary variable. Routine SMPRR allows various options for the estimation techniques, which are discussed in Chapters 3, 6, and 7 of Cochran (1977). Let
be the sample means of the auxiliary variable and the variable of interest, respectively. Let
be the population mean of the auxiliary variable. Then, the ratio estimate of the population mean is
The linear regression estimate of the population mean is
where b is the regression coefficient, which can be either preassigned, based on previous knowledge, or estimated from the data using least squares. The least‑squares estimate of b is
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.
Examples
The data for these examples come from Cochran (1977, Table 6.1, page 152). The variable of interest is the population of large U.S. cities in 1930; the auxiliary variable is the 1920 population of the same cities. There are 196 (NPOP) cities that are sampled (that is, that are in the population of interest). (Note that the word “population” is being used in two ways in this discussion.) The total 1920 population of these cities is 22,919 (XMEAN = 116.934). There are 49 cities in the sample. The data can be seen in the DATA statements in the programs below (actual values are 1000 times greater). There are no “missing data”; therefore, the sample size, STAT(19), is 49. Because the coefficient of variation is larger than 10%, SMPRR produces an informational “warning error” message in each example. When the coefficient of variation is larger than 10% (generally speaking), the confidence limits computed using the normal approximation are likely to be shorter than the actual limits at the same confidence level.
Example 1
In this example, ratio estimation is used, as on page 151 of Cochran (1977).
 
USE SMPRR_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NROW
PARAMETER (NROW=49)
!
INTEGER I, NOUT, NPOP
REAL COEF, CONPER, STAT(20), X(NROW), XMEAN, Y(NROW)
!
DATA X/76., 138., 67., 29., 381., 23., 37., 120., 61., 387., &
93., 172., 78., 66., 60., 46., 2., 507., 179., 121., 50., &
44., 77., 64., 64., 56., 40., 40., 38., 136., 116., 46., &
243., 87., 30., 71., 256., 43., 25., 94., 43., 298., 36., &
161., 74., 45., 36., 50., 48./
DATA Y/80., 143., 67., 50., 464., 48., 63., 115., 69., 459., &
104., 183., 106., 86., 57., 65., 50., 634., 260., 113., &
64., 58., 89., 63., 77., 142., 60., 64., 52., 139., 130., &
53., 291., 105., 111., 79., 288., 61., 57., 85., 50., 317., &
46., 232., 93., 53., 54., 58., 75./
DATA NPOP/196/, XMEAN/116.934/
! All data are input at once.
! Ratio estimation.
CALL SMPRR (NROW, X, Y, NPOP, XMEAN, STAT)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) (STAT(I),I=1,17), STAT(19), STAT(20)
99999 FORMAT (/, ' RATIO ESTIMATION', /, &
' Mean estimate = ', F8.1, ' Total estimate = ', &
F8.1, /, ' Vhat of mean = ', F8.1, ' Vhat of total ' &
, ' = ', F8.1, /, ' Confidence limits for mean ', F8.1, &
',', F8.1, /, ' Confidence limits for total ', F8.1, &
',', F8.1, /, ' Ratio estimate = ', F8.3, ' Vhat of ' &
, 'ratio = ', F8.4, /, ' Confidence limits for ratio ', &
F8.3, ',', F8.3, /, ' Coefficient of variation of mean ', &
'estimate = ', F8.1, /, ' CV of X = ', F8.1, &
' CV of Y = ', F8.1, /, ' Mean of X = ', &
F8.1, ' Mean of Y = ', F8.1, /, ' Sample size ' &
, '= ', F8.1, ' Number missing = ', F8.1)
END
Output
 
*** WARNING ERROR 7 from SMPRR. The coefficient of variation of one or
*** both of the variables exceeds 10%. The confidence limits,
*** which are computed using a normal approximation, may not be
*** very accurate.
 
RATIO ESTIMATION
Mean estimate = 144.9 Total estimate = 28397.1
Vhat of mean = 9.5 Vhat of total = 364860.1
Confidence limits for mean 138.8, 150.9
Confidence limits for total 27213.3, 29581.0
Ratio estimate = 1.239 Vhat of ratio = 0.0007
Confidence limits for ratio 1.187, 1.291
Coefficient of variation of mean estimate = 2.1
CV of X = 89.3 CV of Y = 96.3
Mean of X = 103.1 Mean of Y = 127.8
Sample size = 49.0 Number missing = 0.0
Example 2
In this example, regression estimation with an estimated coefficient is used, as in Exercise 7.3 of Cochran (1977).
 
USE SMPRR_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NROW
PARAMETER (NROW=49)
!
INTEGER I, IOPT, NOUT, NPOP
REAL CONPER, STAT(20), X(NROW), XMEAN, Y(NROW)
!
DATA X/76., 138., 67., 29., 381., 23., 37., 120., 61., 387., &
93., 172., 78., 66., 60., 46., 2., 507., 179., 121., 50., &
44., 77., 64., 64., 56., 40., 40., 38., 136., 116., 46., &
243., 87., 30., 71., 256., 43., 25., 94., 43., 298., 36., &
161., 74., 45., 36., 50., 48./
DATA Y/80., 143., 67., 50., 464., 48., 63., 115., 69., 459., &
104., 183., 106., 86., 57., 65., 50., 634., 260., 113., &
64., 58., 89., 63., 77., 142., 60., 64., 52., 139., 130., &
53., 291., 105., 111., 79., 288., 61., 57., 85., 50., 317., &
46., 232., 93., 53., 54., 58., 75./
DATA NPOP/196/, XMEAN/116.934/
! All data are input at once.
! Regression estimation, with estimated
! coefficient (Cochran, Exercise 7.3)
IOPT = 3
CALL SMPRR (NROW, X, Y, NPOP, XMEAN, STAT, IOPT=IOPT)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) (STAT(I),I=1,8), (STAT(I),I=13,20)
99999 FORMAT (/, ' REGRESSION ESTIMATION', /, &
' Mean estimate = ', F8.1, ' Total estimate = ', &
F8.1, /, ' Vhat of mean = ', F8.1, ' Vhat of total ' &
, ' = ', F8.1, /, ' Confidence limits for mean ', F8.1, &
',', F8.1, /, ' Confidence limits for total ', F8.1, &
',', F8.1, /, ' Coefficient of variation of mean ', &
'estimate = ', F8.1, /, ' CV of X = ', F8.1, &
' CV of Y = ', F8.1, /, ' Mean of X = ', &
F8.1, ' Mean of Y = ', F8.1, /, ' Estimated ', &
'regression coefficient = ', F8.1, /, ' Sample size = ', &
F8.1, ' Number missing = ', F8.1)
END
Output
 
*** WARNING ERROR 7 from SMPRR. The coefficient of variation of one or
*** both of the variables exceeds 10%. The confidence limits,
*** which are computed using a normal approximation, may not be
*** very accurate.
 
REGRESSION ESTIMATION
Mean estimate = 143.8 Total estimate = 28177.4
Vhat of mean = 8.6 Vhat of total = 329372.3
Confidence limits for mean 138.0, 149.5
Confidence limits for total 27052.6, 29302.3
Coefficient of variation of mean estimate = 2.0
CV of X = 89.3 CV of Y = 96.3
Mean of X = 103.1 Mean of Y = 127.8
Estimated regression coefficient = 1.2
Sample size = 49.0 Number missing = 0.0
Example 3
In this example, regression estimation with a preassigned coefficient is used, as in Exercise 7.4 of Cochran (1977).
 
USE SMPRR_INT
USE UMACH_INT
 
IMPLICIT NONE
INTEGER NROW
PARAMETER (NROW=49)
!
INTEGER I, IOPT, NOUT, NPOP
REAL COEF, STAT(20), X(NROW), XMEAN, Y(NROW)
!
DATA X/76., 138., 67., 29., 381., 23., 37., 120., 61., 387., &
93., 172., 78., 66., 60., 46., 2., 507., 179., 121., 50., &
44., 77., 64., 64., 56., 40., 40., 38., 136., 116., 46., &
243., 87., 30., 71., 256., 43., 25., 94., 43., 298., 36., &
161., 74., 45., 36., 50., 48./
DATA Y/80., 143., 67., 50., 464., 48., 63., 115., 69., 459., &
104., 183., 106., 86., 57., 65., 50., 634., 260., 113., &
64., 58., 89., 63., 77., 142., 60., 64., 52., 139., 130., &
53., 291., 105., 111., 79., 288., 61., 57., 85., 50., 317., &
46., 232., 93., 53., 54., 58., 75./
DATA NPOP/196/, XMEAN/116.934/
! All data are input at once.
! Regression estimation, with assigned
! coefficient (Cochran, Exercise 7.4)
IOPT = 2
COEF = 1.0
CALL SMPRR (NROW, X, Y, NPOP, XMEAN, STAT, IOPT=IOPT, COEF=COEF)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) (STAT(I),I=1,8), (STAT(I),I=13,17), STAT(19), &
STAT(20)
99999 FORMAT (/, ' REGRESSION ESTIMATION, FIXED ', &
'COEF', /, ' Mean estimate = ', F8.1, ' Total ', &
'estimate = ', F8.1, /, ' Vhat of mean = ', F8.1, &
' Vhat of total = ', F8.1, /, ' Confidence limits ' &
, 'for mean ', F8.1, ',', F8.1, /, ' Confidence limits ' &
, 'for total ', F8.1, ',', F8.1, /, ' Coefficient of ', &
'variation of mean estimate = ', F8.1, /, ' CV of X = ' &
, F8.1, ' CV of Y = ', F8.1, /, ' Mean of ' &
, 'X = ', F8.1, ' Mean of Y = ', F8.1, /, &
' Sample size = ', F8.1, ' Number missing = ', F8.1)
END
Output
 
*** WARNING ERROR 7 from SMPRR. The coefficient of variation of one or
*** both of the variables exceeds 10%. The confidence limits,
*** which are computed using a normal approximation, may not be
*** very accurate.
 
REGRESSION ESTIMATION, FIXED COEF
Mean estimate = 141.6 Total estimate = 27751.1
Vhat of mean = 12.5 Vhat of total = 481977.4
Confidence limits for mean 134.6, 148.5
Confidence limits for total 26390.4, 29111.8
Coefficient of variation of mean estimate = 2.5
CV of X = 89.3 CV of Y = 96.3
Mean of X = 103.1 Mean of Y = 127.8
Sample size = 49.0 Number missing = 0.0
Published date: 03/19/2020
Last modified date: 03/19/2020