R/databeta.R

#' @docType data
#' @title Synthetic Data for Small Area Estimation using Spatial Beta Model
#'
#' @description
#' A synthetic dataset generated for testing and tutorial purposes of the \code{saeHB.Spatial.Beta} package.
#' The data is generated under a Spatial Simultaneous Autoregressive (SAR) process with a Beta distribution,
#' accommodating survey design effects (DEFF).
#'
#' This data is generated by these following steps:
#'
#' \enumerate{
#'   \item Generate auxiliary variables \eqn{x1 \sim N(0, 1)} and \eqn{x2 \sim N(0, 1)}.
#'   \item Generate sample sizes \eqn{n_i \sim U(10, 50)} and survey design effects \eqn{deff_i \sim U(1, 2.5)}. Calculate the precision parameter for each area: \eqn{\phi_i = (n_i / deff_i) - 1}.
#'   \item Generate spatial random effects under the SAR model. First, generate independent normal errors \eqn{u \sim N(0, 1)}. Then, calculate the spatial random effect \eqn{v = (I - \rho W)^{-1}u}, where \eqn{I} is an identity matrix, \eqn{W} is the row-standardized proximity matrix (\code{weight_mat}), and the spatial autoregressive parameter \eqn{\rho} is set to 0.70.
#'   \item Calculate the true mean proportions \eqn{\mu = \text{logit}^{-1}(X\beta + v)}, where the regression coefficients are set as \eqn{\beta_0 = \beta_1 = \beta_2 = 1}.
#'   \item Generate the response variable \eqn{y \sim \text{Beta}(\mu \phi, (1 - \mu) \phi)}. Values are strictly bounded between 0 and 1.
#'   \item Area ID \code{domain}, response variable \code{y}, auxiliary variables \code{x1, x2}, sample size \code{n_i}, and design effect \code{deff} are combined into a data frame called \code{databeta}.
#' }
#'
#' @format A data frame with 36 rows and 6 columns:
#' \describe{
#'   \item{domain}{Area ID/name}
#'   \item{y}{Direct estimates of the proportion/variable of interest (0 < y < 1)}
#'   \item{x1}{Auxiliary variable 1 (Normal distribution)}
#'   \item{x2}{Auxiliary variable 2 (Normal distribution)}
#'   \item{n_i}{Sample size for each area}
#'   \item{deff}{Survey design effect for each area}
#' }
#'
#' @usage data(databeta)
"databeta"

Try the saeHB.Spatial.Beta package in your browser

Any scripts or data that you put into this service are public.

saeHB.Spatial.Beta documentation built on July 1, 2026, 5:07 p.m.