knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(BayesSampling)
In many practical situations, it is possible to have information about an auxiliary variate $x_i$ (correlated with $y_i$) for all the population units, or at least for each unit in the sample, plus the population mean, $\bar X$. In practice, $x_i$ is often the value of $y_i$ at some previous time when a complete census was taken. This approach is used in situations where the expected value and the variance of $y_i$ is proportional to $x_i$, so in the BLE setup, we replace some hypotheses about the $y$'s with ones about the first two moments of the rate $y_i$/$x_i$. 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 $y_i$/$x_i$ for all $i = 1,..., N$ as described below:
\begin{equation} \tag{3.1}
E \left( \frac{y_i}{x_i} \right) = m, \hspace{0.7cm}
V \left( \frac{y_i}{x_i} \right) = v
\hspace{0.7cm} \text{and} \hspace{0.7cm}
Cov \left( \frac{y_i}{x_i},\frac{y_j}{x_j} \right) = c, \hspace{0.5cm}
i,j = 1,...,N \hspace{0.5cm} \forall i \neq j
\end{equation}
\par
such that: $\sigma^2 = v - c$
We can apply this with the BLE_Ratio() function, which receives the following parameters:
Letting $v \to \infty$ and $v \to \infty$, but keeping $\sigma^2$ fixed, that is, assuming prior ignorance, we recover the ratio type estimator, found in the design-based approach: $\hat{T}_{ra} = N \bar{X} (\bar{y}_s / \bar{x}_s)$.\
This can be achieved using the BLE_SRS() function by omitting either the prior mean or the prior variance, that is:
data(BigCity) end <- dim(BigCity)[1] s <- seq(from = 1, to = end, by = 1) set.seed(5) samp <- sample(s, size = 10000, replace = FALSE) ordered_samp <- sort(samp) BigCity_red <- BigCity[ordered_samp,] Expend <- BigCity_red$Expenditure Income <- BigCity_red$Income sampl <- sample(seq(1,10000),size=10) ys <- Expend[sampl] xs <- Income[sampl]
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)
Our design-based estimator for the mean would be the ratio between sample means:
mean(ys)/mean(xs)
Applying the prior information about the ratio we can get a better estimate, especially in cases when only a small sample is available:
x_nots <- BigCity_red$Income[-sampl] Estimator <- BLE_Ratio(ys, xs, x_nots, m = 0.85, v = 0.24, sigma = sqrt(0.23998)) Estimator$est.beta Estimator$Vest.beta Estimator$est.mean[1:4,] Estimator$Vest.mean[1:5,1:5] Estimator$est.tot
ys <- c(10,8,6) xs <- c(5,4,3.1) x_nots <- c(1,20,13,15,-5) m <- 2.5 v <- 10 sigma <- 2 Estimator <- BLE_Ratio(ys, xs, x_nots, m, v, sigma) Estimator
ys <- mean(c(10,8,6)) xs <- mean(c(5,4,3.1)) n <- 3 x_nots <- c(1,20,13,15,-5) m <- 2.5 v <- 10 sigma <- 2 Estimator <- BLE_Ratio(ys, xs, x_nots, m, v, sigma, n) Estimator
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.