STAT 344 Sample Surveys LAB 4 Chao Xiong January 31, 2011

STAT 344 Sample Surveys
LAB 4
Chao Xiong
January 31, 2011
Chao Xiong
STAT 344 Sample Surveys LAB 4
Outline
1
Linear combination of two characteristics
2
Assignment 1
3
Questions?
Slides will be available on the website:
http://www.stat.ubc.ca/~alex.xio/
My email address: [email protected]
Chao Xiong
STAT 344 Sample Surveys LAB 4
Linear combination of two characteristics
For each of the N population units, consider a linear combination
of xi and yi . Let
gi = axi + byi + c
The population total is
G = aX + bY + c
and the mean of gi is
¯ = aX
¯ + b Y¯ + c
G
For the probability theory, the variance of Gi is
Sg2 = V (axi + byi + c) = a2 Sx2 + b 2 Sy2 + 2abSxy
Chao Xiong
STAT 344 Sample Surveys LAB 4
Linear combination of two characteristics
For a sample (xi , yi ), i = 1, · · · , n, the sample mean is given by
g¯ = a¯
x + b¯
y +c
and the sample variance is given by
sg2 = V (axi + byi + c) = a2 sx2 + b 2 sy2 + 2absxy
¯ and Sg2 , equaling
Since g¯ and sg2 are unbiased estimators of G
2
2
E (sg ) = Sg , we have
E(sxy ) = Sxy
Sample covariance is an unbiased estimator of population
covariance.
Chao Xiong
STAT 344 Sample Surveys LAB 4
Linear combination of two characteristics
Further,
V (¯
g ) = (1 −
n
n Sg2
)
= (1 − )(a2 Sx2 + b 2 Sy2 + 2abSxy )/n
N n
N
On the other hand,
V (¯
g ) = a2 V (¯
x ) + b 2 V (¯
y ) + 2abCov (¯
x , y¯ )
n
= (1 − )(a2 Sx2 + b 2 Sy2 )/n + 2abCov (¯
x , y¯ )
N
We obtain
Cov (¯
x , y¯ ) = (1 −
Chao Xiong
2
n Sxy
)
N n
STAT 344 Sample Surveys LAB 4
Simulations
2
n Sxy
)
N n
Using the same data set in the Lab 3: homeprice
Cov (¯
x , y¯ ) = (1 −
>
,
>
>
homeprice <- read.table(’F:/Courses/STAT 344/homeprice.txt’
header=T)
x <- homeprice$PRICE
y <- homeprice$SQFT
N=117
Chao Xiong
STAT 344 Sample Surveys LAB 4
Simulation
Cov (¯
x , y¯ ):
xmean <- rep(NA, 10000)
ymean <- rep(NA, 10000)
for (i in 1:10000) {
id = sample(1:117, 50);
xmean[i] = mean(x[id]);
ymean[i] = mean(y[id]);
}
cov(xmean, ymean)
[1] 1980.319
(1 −
n
2
N )Sxy /n:
> (1-50/117)*cov(x,y)/50
[1] 1927.767
Chao Xiong
STAT 344 Sample Surveys LAB 4
Assignment 1
2.11 & 2.12
Chao Xiong
STAT 344 Sample Surveys LAB 4
Questions?
Chao Xiong
STAT 344 Sample Surveys LAB 4