--- title: "Using the samplex package" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Using the samplex package} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```r # Load the package library(samplex) # Launch the Shiny app samplex() ``` ## Overview The `samplex` package offers an interactive Shiny application to calculate sample sizes under various survey designs. It includes methods for: - Simple random sampling - Stratified sampling (with proportional, Neyman, and optimal allocation) - Single-stage cluster sampling Users can set parameters such as confidence level, margin of error, population variance, average cluster size, intra-cluster correlation, and fixed costs, and receive real-time sample size outputs. ## Example use case: Cluster sampling for a proportion Suppose a public health team wants to estimate the proportion of vaccinated students in rural schools. The team can: 1. Open the app using `samplex()`. 2. Go to the *Cluster Sampling* tab. 3. Select "Proportion", and choose: - **Confidence level**: 95% - **Precision**: 0.04 - **Estimated proportion**: 0.8 - **Intra-cluster correlation (ICC)**: 0.01 - **Average cluster size**: 100 The application will calculate the required sample size and number of clusters, and show formulas and summaries accordingly.