library(BayesSampling)
In many practical situations, it is possible to have information about an auxiliary variate xi (correlated with yi) for all the population units, or at least for each unit in the sample, plus the population mean, ˉX. In practice, xi is often the value of yi at some previous time when a complete census was taken. This approach is used in situations where the expected value and the variance of yi is proportional to xi, so in the BLE setup, we replace some hypotheses about the y’s with ones about the first two moments of the rate yi/xi. To the best of our knowledge, the new ratio estimator proposed below is a novel contribution in sampling survey theory.
The new ratio estimator is obtained as a particular case of model (2.4) and with the hypothesis of exchangeability, used in Bayes linear approach, applied to the rate yi/xi for all i=1,...,N as described below:
E(yixi)=m,V(yixi)=vandCov(yixi,yjxj)=c,i,j=1,...,N∀i≠jsuch that: σ2=v−c
We can apply this with the BLE_Ratio() function, which receives the following parameters:
Letting v→∞ and v→∞, but keeping σ2 fixed, that is, assuming prior ignorance, we recover the ratio type estimator, found in the design-based approach: ˆTra=NˉX(ˉys/ˉxs).
This can be achieved using the BLE_SRS() function by omitting either the prior mean or the prior variance, that is:
data(BigCity)
dim(BigCity)[1]
end <- seq(from = 1, to = end, by = 1)
s <-
set.seed(5)
sample(s, size = 10000, replace = FALSE)
samp <- sort(samp)
ordered_samp <- BigCity[ordered_samp,]
BigCity_red <-
BigCity_red$Expenditure
Expend <- BigCity_red$Income
Income <-
sample(seq(1,10000),size=10)
sampl <- Expend[sampl]
ys <- Income[sampl] xs <-
The real ratio between expenditure and income will be the value we want to estimate. In this example we know its real value:
mean(Expend/Income)
#> [1] 0.807571
Our design-based estimator for the mean would be the ratio between sample means:
mean(ys)/mean(xs)
#> [1] 0.5978265
Applying the prior information about the ratio we can get a better estimate, especially in cases when only a small sample is available:
BigCity_red$Income[-sampl]
x_nots <-
BLE_Ratio(ys, xs, x_nots, m = 0.85, v = 0.24, sigma = sqrt(0.23998))
Estimator <-
$est.beta
Estimator#> Beta
#> 1 0.7723287
$Vest.beta
Estimator#> V1
#> 1 1.383985e-05
$est.mean[1:4,]
Estimator#> [1] 104.2644 230.4165 826.3917 1241.5184
$Vest.mean[1:5,1:5]
Estimator#> V1 V2 V3 V4 V5
#> 1 32.6495313 0.5574125 1.999167 3.003421 0.5217451
#> 2 0.5574125 72.8274736 4.418010 6.637338 1.1530181
#> 3 1.9991667 4.4180104 272.623847 23.804893 4.1353134
#> 4 3.0034210 6.6373380 23.804893 421.530808 6.2126320
#> 5 0.5217451 1.1530181 4.135313 6.212632 68.0936545
$est.tot
Estimator#> [1] 4466282
c(10,8,6)
ys <- c(5,4,3.1)
xs <- c(1,20,13,15,-5)
x_nots <- 2.5
m <- 10
v <- 2
sigma <-
BLE_Ratio(ys, xs, x_nots, m, v, sigma)
Estimator <-
Estimator#> $est.beta
#> Beta
#> 1 2.010444
#>
#> $Vest.beta
#> V1
#> 1 0.3133159
#>
#> $est.mean
#> y_nots
#> 1 2.010444
#> 2 40.208877
#> 3 26.135770
#> 4 30.156658
#> 5 -10.052219
#>
#> $Vest.mean
#> V1 V2 V3 V4 V5
#> 1 4.313316 6.266319 4.073107 4.699739 -1.56658
#> 2 6.266319 205.326371 81.462141 93.994778 -31.33159
#> 3 4.073107 81.462141 104.950392 61.096606 -20.36554
#> 4 4.699739 93.994778 61.096606 130.496084 -23.49869
#> 5 -1.566580 -31.331593 -20.365535 -23.498695 -12.16710
#>
#> $est.tot
#> [1] 112.4595
#>
#> $Vest.tot
#> [1] 782.5796
mean(c(10,8,6))
ys <- mean(c(5,4,3.1))
xs <- 3
n <- c(1,20,13,15,-5)
x_nots <- 2.5
m <- 10
v <- 2
sigma <-
BLE_Ratio(ys, xs, x_nots, m, v, sigma, n)
Estimator <-#> sample means informed instead of sample observations, parameters 'n' and 'sigma' will be necessary
Estimator#> $est.beta
#> Beta
#> 1 2.010444
#>
#> $Vest.beta
#> V1
#> 1 0.3133159
#>
#> $est.mean
#> y_nots
#> 1 2.010444
#> 2 40.208877
#> 3 26.135770
#> 4 30.156658
#> 5 -10.052219
#>
#> $Vest.mean
#> V1 V2 V3 V4 V5
#> 1 4.313316 6.266319 4.073107 4.699739 -1.56658
#> 2 6.266319 205.326371 81.462141 93.994778 -31.33159
#> 3 4.073107 81.462141 104.950392 61.096606 -20.36554
#> 4 4.699739 93.994778 61.096606 130.496084 -23.49869
#> 5 -1.566580 -31.331593 -20.365535 -23.498695 -12.16710
#>
#> $est.tot
#> [1] 112.4595
#>
#> $Vest.tot
#> [1] 782.5796