Sample
Sample
• Note: I will use SRS to denote a simple random sample and SR as an abbreviation of
‘simple random’.
U and t are design unbiased. That is, the average values of y and N y taken over all
• yc b
possible SRSs equal y U and t, respectively.
N= t= yU = S2 = S≈
5
Suppose a SRS of size n = 2 is selected. Then P (S) = 1/ 2
= 1/10 for each of the 10 possible
SRSs.
22
All Possible Samples and Statistics from Example Population
t = N y Sb2 = s2
P
Sample Units y-values yi ycU = y
b Sb = s
S1 1,2 0,2 2 1 5 2 1.4142
S2 1,3 0,3 3 1.5 7.5 4.5 2.1213
S3 1,4 0,4 4 2 10 8 2.8284
S4 1,5 0,7 7 3.5 17.5 24.5 4.9497
S5 2,3 2,3 5 2.5 12.5 .5 0.7071
S6 2,4 2,4 6 3 15 2 1.4142
S7 2,5 2,7 9 4.5 22.5 12.5 3.5355
S8 3,4 3,4 7 3.5 17.5 .5 0.7071
S9 3,5 3,7 10 5 25 8 2.8284
S10 4,5 4,7 11 5.5 27.5 4.5 2.1213
Column Sum 32 160 67 22.6274
32 160 67 22.6274
Expected value 10
= 3.2 10 = 16 10 = 6.7 10
= 2.26274
= E(estimator) = yU =t = S2 6= S
The average for estimator Sb = s does not equal the parameter S. This implies that s is a
biased estimator of S. Notation: E(S) b 6= S or E(s) 6= S.
U = y and t = N y.
• The next problem is to study the variances of yc b
• Taking a square root of a variance in (11) yields the standard deviation of the estimator.
• Taking a square root of an estimated variance in (12) yields the standard error of the
estimate.
23
S2
N −n 3 6.7
• Thus, V (y) = = = and
N n 5 2
S2 6.7
V (bt) = N 2 V (y) = N (N − n) = (5)(3) = .
n 2
• Like yc U and t, the variances V (y U ) and V (t) are design unbiased. That is the average
b b c b b
of Vb (yc
U ) and V (t) taken over all possible SRSs equal V (y U ) = 2.01 and V (t) = 50.25,
b b c b
respectively.
N − n s2 3 s2
• For the estimated variances we have V (y U ) =
b c = = and
N n 5 2
s2 s2
Vb (b
t) = N (N − n) = (5)(3) = where s2 is a particular sample variance.
n 2
Example: We will use our population from the previous example:
Unit, i 1 2 3 4 5
yi 0 2 3 4 7
which have the following parameters
N =5 t = 16 y U = 3.2 S 2 = 6.7 S ≈ 2.588
Estimated Variances of yc
U and t for All Samples
b
24
2.3.2 SRS With Replacement
• Consider a sampling procedure in which a sampling unit is randomly selected from the
population, its y-value recorded, and is then returned to the population. This process of
randomly selecting units with replacement after each stage is repeated n times. Thus, a
sampling unit may be sampled multiple times. A sample of n units selected by such a
procedure is called a simple random sample with replacement.
s2
• The estimators for SRS with replacement are: U = y
yc Vb (yc
U ) = V
b (by ) =
n
• Suppose we have two estimators θb1 and θb2 of some parameter θ.
θb1 is less efficient than θb2 for estimating θ if V (θb1 ) > V (θb2 ).
θb1 is more efficient than θb2 for estimating θ if V (θb1 ) < V (θb2 ).
• For most situations, the estimator for a SRS with replacement is less efficient than the
estimator for a SRS without replacement.
• There will be circumstances (such as sampling proportional to size) where we will consider
sampling with replacement. Unless otherwise stated, we assume that sampling is done
without replacement.
25
• For smaller samples, approximate 100(1 − α)% confidence intervals for y U and t are
where t∗ is the upper α/2 critical value from the t(n − 1) distribution.
U = y or t = N y in the confidence
• The quantity being added and subtracted from yc b
interval is known as the margin of error.
Example: Use the small population data again. For n = 2, t∗ ≈ 6.314 for a nominal 90%
confidence level.
All Possible Samples and Confidence Intervals from Example Population
t = N y Sb2 = s2 Sb = s Vb (yc
P
Sample y-values yi yc
U =y
b U) Vb (b
t) 90% ci for t
1 0,2 2 1 5 2 1.4142 0.6 15 (-19.45, 29.45)
2 0,3 3 1.5 7.5 4.5 2.1213 1.35 33.75 (-29.18, 44.18)
3 0,4 4 2 10 8 2.8284 2.4 60 (-38.91, 58.91)
4 0,7 7 3.5 17.5 24.5 4.9497 7.35 183.75 (-68.09, 103.09)
5 2,3 5 2.5 12.5 .5 0.7071 0.15 3.75 (0.27, 24.73)
6 2,4 6 3 15 2 1.4142 0.6 15 (-9.45, 39.45)
7 2,7 9 4.5 22.5 12.5 3.5355 3.75 93.75 (-38.63, 83.63)
8 3,4 7 3.5 17.5 .5 0.7071 0.15 3.75 (5.27, 29.73)
9 3,7 10 5 25 8 2.8284 2.4 60 (-23.91, 73.91)
10 4,7 11 5.5 27.5 4.5 2.1213 1.35 33.75 (-9.18, 64.18)
• Approximate upper and lower 100(1 − α)% confidence intervals for y U and t are:
For y U : For t :
s !
N − n p
y − t∗ s /n , ∞ N y − t∗ s N (N − n)/n , ∞ upper
N
s !
N − n p
−∞ , y + t∗ s /n −∞ , N y + t∗ s N (N − n)/n lower
N
• If the y-values cannot be negative, replace −∞ with 0 in the lower confidence interval
formulas. If the y-values cannot be positive, replace ∞ with 0 in the upper confidence
interval formulas.
26
• Later, we will discuss another method of generating a confidence interval called boot-
strapping. This will be useful when the sample size may be small and the central limit
theorem cannot be applied.
• To illustrate the application of simple random sampling to population mean per unit µ
estimation, consider the abundance data in Figure 1. The abundance counts are artificial
but show a strong diagonal spatial correlation.
• The region has been gridded into a 20×20 grid of 10×10 m quadrats. The total abundance
t = 13354 and the mean per unit is y U = 33.385. The population variance S 2 = 75.601.
• This data will be used to compare estimation properties of various sampling designs when
data are spatially correlated.
Figure 1
18 20 15 20 20 15 19 18 24 23 20 26 29 28 28 31 31 34 28 32
13 20 16 20 15 23 19 26 21 21 24 30 23 26 25 33 31 28 32 38
16 18 20 24 25 26 22 23 26 26 22 27 25 25 34 28 37 36 38 31
17 17 16 22 21 23 22 27 27 24 28 32 29 33 27 37 37 38 35 33
15 19 23 17 21 23 21 23 24 25 31 26 32 34 32 33 31 31 36 37
21 24 20 21 28 26 30 22 31 25 29 29 27 30 29 37 35 32 38 43
23 17 24 25 24 27 31 29 31 34 27 36 29 29 34 39 37 37 40 36
18 24 21 25 27 22 32 32 31 26 28 34 34 37 35 34 38 38 37 40
22 26 28 26 24 29 33 26 27 27 34 31 39 32 36 38 37 40 44 43
23 27 28 29 26 32 25 31 35 34 32 33 37 32 42 40 40 37 42 44
23 21 31 23 30 27 31 30 32 35 30 40 32 37 37 36 40 44 44 40
26 29 31 26 30 31 34 36 30 38 36 32 38 38 37 42 42 41 40 49
28 24 28 27 26 31 32 29 32 33 38 34 39 38 40 37 41 43 42 43
32 25 31 32 29 29 35 38 38 32 36 35 39 42 39 40 44 42 41 45
27 29 35 28 35 35 31 40 35 37 38 44 40 40 47 39 49 48 51 49
30 29 32 32 33 30 36 38 42 36 35 38 44 47 45 49 41 43 44 51
28 35 35 34 34 33 41 33 34 35 39 44 44 48 44 50 49 48 53 54
29 33 32 36 39 33 33 34 35 42 46 47 48 47 46 45 44 52 54 55
28 37 38 37 33 33 34 37 45 40 39 42 42 46 47 48 52 47 46 53
38 39 39 37 34 38 39 45 39 42 45 41 44 51 46 50 52 51 51 53
27
SRS taken from Figure 1 (n = 10, t = 13354, y U = 33.385, y = 34.1, s2 = 18.32)
18 20 15 20 20 15 19 18 24 23 20 26 29 28 28 31 31 34 28 32
13 20 16 20 15 23 19 26 21 21 24 30 23 26 25 (33) 31 28 32 38
16 18 20 24 25 26 22 23 26 26 22 27 25 25 34 28 37 36 38 31
17 17 16 22 21 23 22 27 27 24 28 32 29 (33) 27 37 37 38 35 33
15 19 23 17 21 23 21 23 24 25 31 26 32 34 32 33 31 31 36 37
21 24 20 21 28 26 (30) 22 31 25 29 29 27 30 29 37 35 32 38 43
23 17 24 25 24 27 31 29 31 34 27 36 29 29 34 39 37 37 40 36
18 24 21 25 27 22 32 32 31 26 28 34 34 37 35 (34) 38 38 37 40
22 26 28 26 24 29 33 26 27 27 34 31 (39) 32 36 38 37 40 44 43
23 27 28 29 26 32 25 31 35 34 32 33 37 32 42 40 40 37 42 44
23 21 31 23 30 27 31 30 32 35 30 40 32 37 37 36 40 44 44 40
26 29 31 26 30 31 34 36 30 38 36 32 38 38 37 42 42 41 40 49
28 24 28 (27) 26 31 32 29 32 33 38 34 39 38 40 37 41 43 42 43
32 25 31 (32) 29 29 35 38 38 32 (36) 35 39 42 39 40 44 42 41 45
27 29 35 28 35 35 31 40 35 37 38 44 40 40 47 39 49 48 51 49
30 29 32 32 33 30 36 38 42 36 35 38 44 47 45 49 41 43 44 51
28 (35) 35 34 34 33 41 33 34 35 39 44 44 48 44 50 49 48 53 54
29 33 32 36 39 33 33 34 35 42 46 47 48 47 46 45 44 52 54 55
28 37 38 37 33 33 34 37 45 40 39 42 (42) 46 47 48 52 47 46 53
38 39 39 37 34 38 39 45 39 42 45 41 44 51 46 50 52 51 51 53
28
29
SRS Example using Rathbun and Cressie (1994) Data
• To illustrate the application of simple random sampling to population total t estimation, consider
the abundance data in Figure 2. The abundance counts correspond to the census data studied
by Rathbun and Cressie (1994).
• This 200 × 200 m study region is located in an old-growth forest in Thomas County, Georgia.
This data represents the number of longleaf pine trees located in each quadrat. The coordinates
of the 584 tree locations are given in Cressie (1991).
• I have gridded the region into a 20 × 20 grid of 10 × 10 m quadrats. The total abundance
t = 584 and the mean abundance per quadrat y U = 584/400 = 1.435. The population variance
S 2 = 3.853.
• There is only a weak spatial correlation of tree counts within the study region.
• The pineleaf census data will be used to compare estimation properties of various sampling
designs.
• Note the two relatively large boldfaced values (14 and 16).
Figure 2
1 1 1 1 1 2 1 0 0 0 4 5 0 1 0 1 2 1 0 1
3 2 1 0 1 0 0 0 1 2 2 2 0 2 2 2 0 2 0 1
7 4 1 1 1 1 0 0 0 2 2 0 4 3 2 4 2 1 2 2
0 1 2 0 0 0 0 0 4 6 5 1 5 0 0 0 2 1 2 0
1 1 0 2 3 2 0 0 2 1 3 1 4 1 1 1 2 2 1 1
2 0 0 0 4 3 3 0 1 16 5 0 1 3 8 0 0 1 3 3
0 0 1 14 3 3 1 2 0 8 0 2 0 3 9 0 4 2 1 0
0 0 5 1 8 7 6 6 6 1 0 4 0 0 1 2 2 0 1 2
0 0 2 2 3 2 2 3 1 1 1 3 0 0 2 2 0 3 4 0
0 0 0 0 1 0 3 1 1 1 2 0 2 0 2 0 2 1 1 0
1 8 7 7 8 0 5 0 1 0 1 2 0 0 2 4 2 2 2 4
0 9 1 0 0 1 1 1 0 0 0 1 2 4 0 2 1 3 3 1
0 0 0 1 0 2 4 3 1 2 2 0 0 1 1 2 2 0 2 4
0 1 0 0 1 2 0 2 3 5 2 0 0 2 1 1 2 0 1 3
1 0 0 1 1 0 0 0 2 2 2 1 1 1 0 0 2 0 0 0
0 2 0 2 2 0 1 1 0 2 0 0 1 0 0 1 1 1 5 3
0 0 0 3 2 1 0 0 0 0 0 2 1 0 1 1 1 3 1 2
1 0 0 1 0 3 0 1 0 0 2 1 2 0 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 1 0 1 0 3 0 2 0 1 1 0
2 0 0 0 0 0 0 0 1 2 0 1 3 0 0 1 0 1 2 4
Cressie, Noel (1991) Statistics for Spatial Data. Wiley, New York.
Rathbun, S.L. and Cressie, N. (1994) A space-time survival point process for a longleaf pine forest in
southern Georgia. Journal of the American Statistical Association, 89, 1164-1174.
29
29
SRS taken from Figure 2 (n = 20, t = 584, y U = 1.435, y = 1.55, s2 = 10.9974)
1 1 1 1 1 2 1 0 0 0 4 5 0 1 0 1 2 1 0 1
3 2 1 0 1 0 0 0 1 2 2 2 0 2 2 2 0 2 0 1
7 4 1 1 1 1 0 0 0 2 2 0 4 3 2 4 2 1 2 2
0 1 2 0 0 (0) 0 0 4 6 5 1 5 0 0 0 2 1 2 0
1 (1) 0 2 3 2 (0) 0 2 1 3 1 4 1 1 1 2 2 1 1
2 0 0 0 4 3 3 0 1 16 5 0 1 (3) 8 0 0 1 3 3
0 (0) 1 (14) 3 (3) 1 2 0 8 (0) 2 0 3 9 0 4 2 1 0
0 0 5 (1) 8 7 (6) 6 6 1 0 4 0 0 1 2 2 0 1 2
0 0 2 2 3 2 2 3 1 1 1 3 0 0 2 2 0 3 4 (0)
0 0 0 0 1 0 3 1 1 1 2 0 2 0 2 (0) 2 1 1 0
1 8 7 7 8 0 5 0 1 (0) 1 2 0 (0) 2 4 2 2 2 4
0 9 1 0 (0) 1 1 1 0 0 0 1 2 4 0 2 1 3 3 1
0 0 0 1 0 2 4 3 1 2 2 0 0 1 1 2 2 0 2 4
0 1 0 0 1 2 0 2 3 5 2 0 0 2 1 1 2 0 1 3
1 0 0 1 1 0 0 0 2 2 2 (1) 1 1 0 0 (2) 0 0 0
0 2 0 2 2 0 1 1 0 2 0 0 1 0 0 1 1 1 5 3
0 0 0 3 2 1 0 0 0 0 0 2 1 0 1 1 1 3 1 2
1 (0) 0 1 0 3 (0) 1 0 0 2 1 2 0 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 1 0 1 0 3 0 2 0 1 1 0
2 0 0 0 0 0 0 0 1 2 0 1 3 (0) 0 1 0 1 2 4
30
2.4.2 Using the R Survey Package for a SRS
R Code and Output for Figure 1 SRS Analysis
"count" "fpc" <- This is the contents of the data file fig1.txt
33 400 <- The first column are the recorded responses
33 400 <- The second column is the population size N
30 400
34 400
39 400
27 400
32 400
36 400
35 400
42 400
R Code
source("c:/courses/st446/rcode/confintt.r")
library(survey)
srsdat <- read.table("c:/courses/st446/rcode/fig1.txt", header=T)
srsdat
> srsdat
count fpc
1 33 400
2 33 400
3 30 400
4 34 400
5 39 400
6 27 400
7 32 400
8 36 400
9 35 400
10 42 400
31
Independent Sampling design
total SE
count 13640 534.63
-------------------------------------------------------------------
mean( count ) = 13640.00000
SE( count ) = 534.62760
Two-Tailed CI for count where alpha = 0.05 with 9 df
2.5 % 97.5 %
12430.58835 14849.41165
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( count ) = 13640.00000
SE( count ) = 534.62760
One-Tailed (Lower) CI for count where alpha = 0.05 with 9 df
5 % upper
12659.96724 infinity
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( count ) = 13640.00000
SE( count ) = 534.62760
One-Tailed (upper) CI for count where alpha = 0.05 with 9 df
lower 95 %
-infinity 14620.03276
-------------------------------------------------------------------
mean SE
count 34.1 1.3366
-------------------------------------------------------------------
mean( count ) = 34.10000
SE( count ) = 1.33657
Two-Tailed CI for count where alpha = 0.05 with 9 df
2.5 % 97.5 %
31.07647 37.12353
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( count ) = 34.10000
SE( count ) = 1.33657
One-Tailed (Lower) CI for count where alpha = 0.05 with 9 df
5 % upper
31.64992 infinity
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( count ) = 34.10000
SE( count ) = 1.33657
One-Tailed (upper) CI for count where alpha = 0.05 with 9 df
lower 95 %
-infinity 36.55008
-------------------------------------------------------------------
32
R Code and Output for Figure 2 SRS Analysis
source("c:/courses/st446/rcode/confintt.r")
library(survey)
srsdat <- read.table("c:/courses/st446/rcode/fig2.txt", header=T)
srsdat
total SE
count 620 289.1
33
-------------------------------------------------------------------
mean( count ) = 620.00000
SE( count ) = 289.10206
Two-Tailed CI for count where alpha = 0.05 with 19 df
2.5 % 97.5 %
14.90244 1225.09756
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( count ) = 620.00000
SE( count ) = 289.10206
One-Tailed (Lower) CI for count where alpha = 0.05 with 19 df
5 % upper
120.10415 infinity
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( count ) = 620.00000
SE( count ) = 289.10206
One-Tailed (upper) CI for count where alpha = 0.05 with 19 df
lower 95 %
-infinity 1119.89585
-------------------------------------------------------------------
mean SE
count 1.55 0.7228
-------------------------------------------------------------------
mean( count ) = 1.55000
SE( count ) = 0.72276
-------------------------------------------------------------------
mean( count ) = 1.55000
SE( count ) = 0.72276
One-Tailed (Lower) CI for count where alpha = 0.05 with 19 df
5 % upper
0.30026 infinity
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( count ) = 1.55000
SE( count ) = 0.72276
One-Tailed (upper) CI for count where alpha = 0.05 with 19 df
lower 95 %
-infinity 2.79974
-------------------------------------------------------------------
34
2.4.3 Using SAS PROC Surveymeans for a SRS
DM ’LOG;CLEAR;OUT;CLEAR’; *** I recommend putting these two lines of code;
OPTIONS NODATE NONUMBER; *** at the beginning of every SAS program ;
data SRS_Fig1;
wgt= 400/10; * wgt = N/n ;
input count @@;
datalines;
33 33 30 34 39 27 32 36 35 42
;
proc surveymeans data=SRS_Fig1 total=400 mean clm sum clsum;
var count;
weight wgt;
title1 ’Simple Random Sample -- Example 1’;
title2 ’Estimating the population mean and total from the data in Figure 1’;
run;
===========================================================================
Data Summary
Number of Observations 10
Sum of Weights 400
Statistics
Std Error
Variable Mean of Mean 95% CL for Mean
--------------------------------------------------------------
count 34.100000 1.336569 31.0764709 37.1235291
--------------------------------------------------------------
35
DM ’LOG;CLEAR;OUT;CLEAR’;
OPTIONS NODATE NONUMBER LS=80 PS=400;
data SRS_Fig2;
wgt= 400/20; * wgt = N/n ;
input trees @@;
datalines;
1 0 0 14 1 0 0 3 0 6 0 0 0 1 3 0 0 0 2 0
;
proc surveymeans data=SRS_Fig2 total=400 mean clm sum clsum;
var trees;
weight wgt;
title1 ’Simple Random Sample -- Example 2’;
title2 ’Estimating the population mean and total from the data in Figure 2’;
run;
============================================================================
Data Summary
Number of Observations 20
Sum of Weights 400
Statistics
Std Error
Variable Mean of Mean 95% CL for Mean
--------------------------------------------------------------
trees 1.550000 0.722755 0.03725610 3.06274390
--------------------------------------------------------------
36
2.5 Attribute Proportion Estimation
• Suppose we are interested in an attribute (characteristic) associated with the sampling
units. The population proportion p is the proportion of population units having that
attribute.
• Statistically, the goal is to estimate proportion p.
• Examples: the proportion of females (or males) in an animal population, the proportion of
consumers who own motorcycles, the proportion of married couples with at least 1 child. . .
• Statistically, we use an indicator function that assigns a yi value to unit i as follows:
1 if unit i possesses the attribute
yi =
0 otherwise
N N
X 1 X
Then t = yi and yU = yi = p. The population proportion p can be
i=1
N i=1
expressed as a population mean y U . Therefore, we will, under certain conditions, be able
to apply the SRS methods for estimating y U .
• By taking a SRS of size n, we can
Pnestimate p with the sample proportion pb of units that
i=1 yi
possess that attribute: pb = = y. The sample proportion pb is unbiased for p.
n
• For a finite population of 0 and 1 values, the population variance
N
1 X
S2 = (yi − p)2 =
N − 1 i=1
• The effects of omitting the finite population correction (f.p.c.) from the formulas for large
and small samples apply here as they did earlier.
37
Figure 3: The Presence/Absence of Longleaf Pine
Rathbun/Cressie data (t = 249 N = 400 p = .6225)
1 1 1 1 1 1 1 0 0 0 1 1 0 1 0 1 1 1 0 1
1 1 1 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 0 1
1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 1 1 1
0 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 1 1 1 0
1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 1
0 0 1 1 1 1 1 1 0 1 0 1 0 1 1 0 1 1 1 0
0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 1 1
0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0
0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 0 1 1 1 0
1 1 1 1 1 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1
0 1 1 0 0 1 1 1 0 0 0 1 1 1 0 1 1 1 1 1
0 0 0 1 0 1 1 1 1 1 1 0 0 1 1 1 1 0 1 1
0 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1 0 1 1
1 0 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 0 0 0
0 1 0 1 1 0 1 1 0 1 0 0 1 0 0 1 1 1 1 1
0 0 0 1 1 1 0 0 0 0 0 1 1 0 1 1 1 1 1 1
1 0 0 1 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 1 0 1 0 1 0 1 0 1 1 0
1 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0 1 1 1
1 1 1 1 1 1 1 0 0 0 1 1 0 1 0 1 1 (1) 0 1
(1) 1 1 0 1 0 0 0 1 (1) 1 (1) 0 1 1 1 0 1 0 1
1 1 1 1 1 1 0 0 0 1 1 0 1 (1) 1 1 1 (1) 1 1
0 (1) 1 0 0 0 0 (0) 1 1 1 1 1 0 0 (0) 1 1 1 0
1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 (1)
1 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 1
0 0 1 1 (1) 1 1 1 0 1 0 1 0 1 1 (0) 1 1 1 0
0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 1 1
0 0 1 1 1 1 1 1 1 1 1 1 0 0 (1) 1 0 1 1 0
0 0 0 0 1 0 1 1 (1) 1 1 0 1 0 1 0 1 1 1 0
1 1 1 1 1 0 1 0 1 0 1 1 0 0 (1) 1 1 1 1 1
0 1 1 0 0 1 1 1 0 0 0 (1) 1 1 0 1 1 1 1 1
0 0 0 1 0 1 1 1 1 1 1 0 (0) 1 1 (1) (1) 0 1 1
0 1 0 0 1 1 0 (1) 1 1 1 0 0 1 1 1 1 0 1 1
1 0 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 0 0 0
(0) 1 0 (1) 1 0 1 1 0 1 0 0 1 0 0 1 1 1 1 1
0 0 0 1 1 1 0 0 0 0 0 1 1 0 (1) 1 1 1 1 1
1 0 0 1 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 0
0 0 (0) 0 0 0 (0) 1 1 1 0 1 0 1 0 1 0 1 1 0
1 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0 1 1 1
38
2.5.1 Confidence Intervals for p
• Let the random variable Y = the number of units in a SRS of size n that possess the
attribute of interest. We know (in theory) that the sampling distribution of Y follows a
hypergeometric distribution.
• Hypergeometric distribution for a SRS: The probability that a SRS of size n will have
exactly j sampling units possessing the attribute is
t N −t
j n−j
Pr(Y = j) = N
n
= the probability that a SRS will consist of j ones and n − j zeroes selected from the
population containing t ones (1’s) and N − t zeroes (0’s).
• Remember there are t ones and N − t zeros in the population. However, t is unknown.
If we can assume that n is small relative to both t and N − t, we can use the binomial
approximation to the hypergeometric distribution. That is, Y ∼ ˙ BIN(n, p).
• Although the problem no longer depends on t, it still depends on the unknown proportion
parameter p.
• What is commonly done is to apply the normal approximation to the binomial distribution:
pb ∼
˙ N (p, V (b
p)) .
where z ∗ is the upper α/2 critical value from the standard normal distribution. Sample
sizes are typically large enough to use z ∗ instead of t∗ .
39
R Code and Output for Figure 3 Example
source("c:/courses/st446/rcode/confintt.r")
library(survey)
srsdat <- read.table("c:/courses/st446/rcode/fig3.txt", header=T)
srsdat
mean SE
presence 0.72 0.0887
-------------------------------------------------------------------
mean( presence ) = 0.72000
SE( presence ) = 0.08874
Two-Tailed CI for presence where alpha = 0.1 with 24 df
5 % 95 %
0.56817 0.87183
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( presence ) = 0.72000
SE( presence ) = 0.08874
One-Tailed (Lower) CI for presence where alpha = 0.1 with 24 df
10 % upper
0.60305 infinity
-------------------------------------------------------------------
-------------------------------------------------------------------
mean( presence ) = 0.72000
SE( presence ) = 0.08874
One-Tailed (upper) CI for presence where alpha = 0.1 with 24 df
lower 90 %
-infinity 0.83695
-------------------------------------------------------------------
40
SAS Code and Output for Figure 3 Example
DM ’LOG;CLEAR;OUT;CLEAR’;
OPTIONS NODATE NONUMBER LS=72 PS=54;
DATA SRS_Fig3;
INPUT ind @@;
DATALINES;
1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1 1 0 0
;
DATA SRS_Fig3; set SRS_Fig3;
IF ind = 0 then pa = ’absent ’;
IF ind = 1 then pa = ’present’;
Data Summary
Number of Observations 25
Class
Variable Levels Values
pa 2 absent present
Statistics
Std Error
Variable Level N Mean of Mean 90% CL for Mean
-------------------------------------------------------------------------
pa absent 7 0.280000 0.088741 0.12817428 0.43182572
present 18 0.720000 0.088741 0.56817428 0.87182572
-------------------------------------------------------------------------
41
2.6 Sample Size Determination with Simple Random Sampling
• It is well known that an increase in sample size n will lead to a more precise estimator
of y U or t. It is also obvious that an increase in the sample size n will make the sample
more expensive to collect. There will, however, be a limited amount of resources available
(allocated, budgeted) for data collection.
• When designing a sampling plan, the researcher wants to achieve a desired degree of
reliability at the lowest possible cost while satisfying the resource limitations for data
collection. That is, the goal is to get the most information given resources and constraints.
• To do this, the researcher tries to achieve a balance to avoid the following mistakes:
– Oversampling: The sampling plan may provide more precision than is needed. Over-
sampling will lead to increased sampling effort, time, and cost.
– Undersampling: The sampling plan may yield insufficient precision resulting in pro-
ducing overly-wide confidence intervals. Undersampling will lead to wasted time and
money.
– Estimate the sample size n required so that the probability of the difference be-
tween the estimator θb and the parameter being estimated θ exceeds some maximum
allowable difference d = |θb − θ| is at most α. Or, equivalently, find n such that
Pr(|θb − θ| > d) < α.
• Assuming y is approximately
s normally distributed, this is equivalent to finding n so that
2
N −n S
the margin of error zα/2 ≤ d. Solving this inequality for n yields
N n
1
n = d2 1
= (21)
z2 S 2
+ N
• Rounding-up the value of n in (21) yields the desired sample size. If this value is < 30, I
recommend adding 2 or 3 to this value to account for the use of the large sample z ∗ in the
previous formulas instead of a smaller sample t∗ .
42
– For example, consider the spatially correlated population in Figure 1. How large a
sample would be required so that ycU = y is within 1 of y U with probability at least
.95 (α = .05)? (Assume S 2 ≈ 18.3)
• If the population size N is very large, then 1/N ≈ 0. In this case, n ≈ n0 . This is the
formula given in introductory statistics books.
• There remains one major problem. This sample size formula assumes that you know the
population variance S 2 . Therefore, to estimate the sample size n, we need a prior estimate
of S 2 . Barnett (1997, pages 33-34) describes 4 ways to do this:
1. A Pilot Study: A small sample size pilot study can be conducted prior to the primary
study to provide an estimate of S 2 .
2. Previous Studies: Other similar studies may have been conducted elsewhere and
appear in the professional journals. Measures of variability from earlier studies may
provide an estimate of S 2 .
3. Double Sampling: A preliminary SRS of size n1 is taken and the sample variance s21
is used to estimate S 2 . Using s21 in (21) will approximate an adequate sample size n.
Then, a further SRS of size n − n1 is taken from the remaining unsampled N − n1
sampling units. This is an example of double sampling.
4. Exploiting the structure of the population: Sometimes we may have some knowledge
of the structure of the population which can provide information about S 2 .
– A common case is when you have count data and it is reasonable to assume the
distribution of counts follows a Poisson distribution. Because the mean and the
variance of a Poisson distribution are the same, all we need is a prior estimate of
the population mean.
– A second case occurs with estimation of a proportion p for a binomial distribution.
If we have a prior estimate of p, we also have a prior estimate of the variance
which is a function of p.
43
• Rounding-up the value of n in (22) yields the desired sample size. If this value is < 30, I
recommend adding 2 or 3 to this value.
– For example, consider the longleaf pine population in Figure 2. How large a sample
would be required so that b
t is within 15 of t with probability at least .95 (α = .05)?
2
(Assume S ≈ 4)
• If the population size N is very large, then 1/N ≈ 0. In this case, n ≈ n0 .
44