Skip to content

Latest commit

 

History

History
68 lines (43 loc) · 2.12 KB

README.md

File metadata and controls

68 lines (43 loc) · 2.12 KB

Systematic Sampling in R

An R implementation of Systematic Sampling techniques commonly used in survey sampling and statistical data collection. This repository provides functions for generating systematic samples, enumerating all possible systematic samples, and measuring correlation structures within systematic sampling designs.

Features

  • Generate a systematic sample from a finite population
  • Enumerate all possible systematic samples for a given sampling interval
  • Calculate sample means and variances for each possible sample
  • Compute the population systematic correlation coefficient (Ps)
  • Estimate the systematic correlation coefficient from a sample (rs)
  • Includes several examples and demonstrations using synthetic datasets

Repository Structure

  • Systematic Sampling.r – Main R script containing all functions and example usages.
  • README.md – Project documentation.

Implemented Functions

systematic_sampling()

Selects a systematic sample from a population vector and returns:

  • The selected sample
  • The sample mean

all_posible_systematic_sampling()

Generates all possible systematic samples based on different random starts and displays:

  • Selected observations
  • Sample mean
  • Sample variance
  • Estimated within-sample variance

systematic_correlation()

Computes the population systematic correlation coefficient (Ps) by considering all possible systematic samples.

systematic_correlation_estimate_sample()

Estimates the systematic correlation coefficient (rs) using only an observed sample.

Example

x <- c(3,4,1,8,5,2,4,7,6,12,3,5,10,11,12,18,2,17)

# Generate a systematic sample
systematic_sampling(x, n = 6, r = 2)

# Generate all possible systematic samples
all_posible_systematic_sampling(x, n = 6)

# Compute the systematic correlation coefficient
systematic_correlation(x, n = 6)

Applications

This implementation can be used for:

  • Survey sampling and sample design courses
  • Teaching systematic sampling concepts
  • Demonstrating sampling variance and correlation structures
  • Educational and research purposes in statistics and data analysis