knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(BayesSampling)
In a situation where the population can be divided into different and exclusive categories, we can calculate the Bayes Linear Estimator for the proportion of individuals in each category with the BLE_Categorical() function, which receives the following parameters:
Letting $\rho_{ii} \to 1$, that is, assuming prior ignorance, the resulting point estimate will be the same as the one seen in the design-based context for categorical data.\
This can be achieved using the BLE_Categorical() function by omitting either the prior proportions and/or the parameter rho, that is:
If the calculation of matrices R and Vs results in non-positive definite matrices, a warning will be displayed. In general this does not produce incorrect/ inconsistent results for the proportion estimate but for its associated variance. It is suggested to review the prior correlation coefficients (parameter rho).
ys <- c(0.2614, 0.7386) n <- 153 N <- 15288 m <- c(0.7, 0.3) rho <- matrix(0.1, 1) Estimator <- BLE_Categorical(ys,n,N,m,rho) Estimator$est.prop Estimator$Vest.prop
Bellow we can see that the greater the correlation coefficient, the closer our estimation will get to the sample proportions.
ys <- c(0.2614, 0.7386) n <- 153 N <- 15288 m <- c(0.7, 0.3) rho <- matrix(0.5, 1) Estimator <- BLE_Categorical(ys,n,N,m,rho) Estimator$est.prop Estimator$Vest.prop
ys <- c(0.2, 0.5, 0.3) n <- 100 N <- 10000 m <- c(0.4, 0.1, 0.5) mat <- c(0.4, 0.1, 0.1, 0.1, 0.2, 0.1, 0.1, 0.1, 0.6) rho <- matrix(mat, 3, 3) Estimator <- BLE_Categorical(ys,n,N,m,rho) Estimator$est.prop Estimator$Vest.prop
Same example, but with no prior correlation coefficients informed (non-informative prior)
ys <- c(0.2, 0.5, 0.3) n <- 100 N <- 10000 m <- c(0.4, 0.1, 0.5) Estimator <- BLE_Categorical(ys,n,N,m,rho=NULL) Estimator$est.prop
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.