@@ -28,8 +28,8 @@ min.r <- substr(description[, "Depends"], 7, 11)
2828
2929[ ![ Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.] ( http://www.repostatus.org/badges/latest/wip.svg )] ( http://www.repostatus.org/#wip )
3030[ ![ Codecov test coverage] ( https://codecov.io/gh/biometryhub/RankedSetSampling/branch/main/graph/badge.svg )] ( https://codecov.io/gh/biometryhub/RankedSetSampling?branch=main )
31- [ ![ R build status] ( https://github.com/biometryhub /InPlotSampling/workflows/R-CMD-check/badge.svg )] ( https://github.com/biometryhub /InPlotSampling/actions )
32- ![ pkgdown] ( https://github.com/biometryhub /InPlotSampling/workflows/pkgdown/badge.svg )
31+ [ ![ R build status] ( https://github.com/AAGI-AUS /InPlotSampling/workflows/R-CMD-check/badge.svg )] ( https://github.com/AAGI-AUS /InPlotSampling/actions )
32+ ![ pkgdown] ( https://github.com/AAGI-AUS /InPlotSampling/workflows/pkgdown/badge.svg )
3333<br >
3434[ ![ minimal R version] (https://img.shields.io/badge/R%3E%3D-`r min.r`-6666ff.svg)] ( https://cran.r-project.org/ )
3535[ ![ packageversion] (https://img.shields.io/badge/Package%20version-`r gsub('-', '--', version)`-orange.svg?style=flat-square)] ( /commits/main )
@@ -38,15 +38,22 @@ min.r <- substr(description[, "Depends"], 7, 11)
3838
3939<!-- badges: end -->
4040
41- The InPlotSampling package provides a way for researchers to easily implement Ranked Set Sampling in practice.
41+ The InPlotSampling package provides a way for researchers to easily implement these sampling methods in
42+ practice.
43+
44+ - Judgment post-stratified (JPS) sampling
45+ - Ranked set sampling (RSS)
46+ - Porbability-proportional to size (PPS) sampling
47+ - Spatially balanced sampling (SBS)
48+ - Two-stage cluster sampling
4249
4350## Table of Contents
4451
4552<!-- vim-markdown-toc GFM -->
4653
4754* [ Sampling Methods] ( #sampling-methods )
4855 * [ JPS Sampling] ( #jps-sampling )
49- * [ RSS Sampling ] ( #rss-sampling )
56+ * [ RSS] ( #rss-sampling )
5057* [ Installation] ( #installation )
5158* [ Examples] ( #examples )
5259 * [ JPS Sample and Estimator] ( #jps-sample-and-estimator )
@@ -64,101 +71,101 @@ Sampling is made following the diagram below.
6471
6572![ JPS sampling diagram] ( man/figures/jps-diagram.drawio.svg )
6673
67- ### RSS Sampling
74+ ### RSS
6875
6976Sampling is made following the diagram below.
7077
71- ![ RSS sampling diagram] ( man/figures/rss-diagram.drawio.svg )
78+ ![ RSS diagram] ( man/figures/rss-diagram.drawio.svg )
7279
7380## Installation
7481
7582Use the following code to install this package:
7683
77- ``` {r eval=F}
84+ ``` {r, eval=F}
7885if (!require("remotes")) install.packages("remotes")
79- remotes::install_github("biometryhub /InPlotSampling", upgrade = FALSE)
86+ remotes::install_github("AAGI-AUS /InPlotSampling", upgrade = FALSE)
8087```
8188
8289## Examples
8390
8491### JPS Sample and Estimator
8592
8693<details >
87- <summary >JPS sample and estimator</summary >
88-
89- ``` r
90- set.seed(112 )
91- population_size <- 600
92- # the number of samples to be ranked in each set
93- H <- 3
94-
95- with_replacement <- FALSE
96- sigma <- 4
97- mu <- 10
98- n_rankers <- 3
99- # sample size
100- n <- 30
101-
102- rhos <- rep(0.75 , n_rankers )
103- taus <- sigma * sqrt(1 / rhos ^ 2 - 1 )
104- population <- qnorm((1 : population_size ) / (population_size + 1 ), mu , sigma )
105-
106- data <- InPlotSampling :: jps_sample(population , n , H , taus , n_rankers , with_replacement )
107- data <- data [order(data [, 2 ]), ]
108-
109- InPlotSampling :: rss_jps_estimate(
110- data ,
111- set_size = H ,
112- method = " JPS" ,
113- confidence = 0.80 ,
114- replace = with_replacement ,
115- model_based = FALSE ,
116- pop_size = population_size
117- )
118- # > Estimator Estimate Standard Error 80% Confidence intervals
119- # > 1 UnWeighted 9.570 0.526 8.88,10.26
120- # > 2 Sd.Weighted 9.595 0.569 8.849,10.341
121- # > 3 Aggregate Weight 9.542 0.500 8.887,10.198
122- # > 4 JPS Estimate 9.502 0.650 8.651,10.354
123- # > 5 SRS estimate 9.793 0.783 8.766,10.821
124- # > 6 Minimum 9.542 0.500 8.887,10.198
125- ```
94+ <summary >JPS sample and estimator</summary >
95+
96+ ``` r
97+ set.seed(112 )
98+ population_size <- 600
99+ # the number of samples to be ranked in each set
100+ H <- 3
101+
102+ with_replacement <- FALSE
103+ sigma <- 4
104+ mu <- 10
105+ n_rankers <- 3
106+ # sample size
107+ n <- 30
108+
109+ rhos <- rep(0.75 , n_rankers )
110+ taus <- sigma * sqrt(1 / rhos ^ 2 - 1 )
111+ population <- qnorm((1 : population_size ) / (population_size + 1 ), mu , sigma )
112+
113+ data <- InPlotSampling :: jps_sample(population , n , H , taus , n_rankers , with_replacement )
114+ data <- data [order(data [, 2 ]), ]
115+
116+ InPlotSampling :: rss_jps_estimate(
117+ data ,
118+ set_size = H ,
119+ method = " JPS" ,
120+ confidence = 0.80 ,
121+ replace = with_replacement ,
122+ model_based = FALSE ,
123+ pop_size = population_size
124+ )
125+ # > Estimator Estimate Standard Error 80% Confidence intervals
126+ # > 1 UnWeighted 9.570 0.526 8.88,10.26
127+ # > 2 Sd.Weighted 9.595 0.569 8.849,10.341
128+ # > 3 Aggregate Weight 9.542 0.500 8.887,10.198
129+ # > 4 JPS Estimate 9.502 0.650 8.651,10.354
130+ # > 5 SRS estimate 9.793 0.783 8.766,10.821
131+ # > 6 Minimum 9.542 0.500 8.887,10.198
132+ ```
126133</details >
127134
128135### SBS PPS Sample and Estimator
129136
130137<details >
131- <summary >SBS PPS sample and estimator</summary >
132-
133- ``` r
134- set.seed(112 )
135-
136- # SBS sample size, PPS sample size
137- sample_sizes <- c(5 , 5 )
138-
139- n_population <- 233
140- k <- 0 : (n_population - 1 )
141- x1 <- sample(1 : 13 , n_population , replace = TRUE ) / 13
142- x2 <- sample(1 : 8 , n_population , replace = TRUE ) / 8
143- y <- (x1 + x2 ) * runif(n = n_population , min = 1 , max = 2 ) + 1
144- measured_sizes <- y * runif(n = n_population , min = 0 , max = 4 )
145-
146- population <- matrix (cbind(k , x1 , x2 , measured_sizes ), ncol = 4 )
147- sample_result <- sbs_pps_sample(population , sample_sizes )
148-
149- # estimate the population mean and construct a confidence interval
150- df_sample <- sample_result $ sample
151- sample_id <- df_sample [, 1 ]
152- y_sample <- y [sample_id ]
153-
154- sbs_pps_estimates <- sbs_pps_estimate(
155- population , sample_sizes , y_sample , df_sample ,
156- n_bootstrap = 100 , alpha = 0.05
157- )
158- print(sbs_pps_estimates )
159- # > n1 n2 Estimate St.error 95% Confidence intervals
160- # > 1 5 5 2.849 0.1760682 2.451,3.247
161- ```
138+ <summary >SBS PPS sample and estimator</summary >
139+
140+ ``` r
141+ set.seed(112 )
142+
143+ # SBS sample size, PPS sample size
144+ sample_sizes <- c(5 , 5 )
145+
146+ n_population <- 233
147+ k <- 0 : (n_population - 1 )
148+ x1 <- sample(1 : 13 , n_population , replace = TRUE ) / 13
149+ x2 <- sample(1 : 8 , n_population , replace = TRUE ) / 8
150+ y <- (x1 + x2 ) * runif(n = n_population , min = 1 , max = 2 ) + 1
151+ measured_sizes <- y * runif(n = n_population , min = 0 , max = 4 )
152+
153+ population <- matrix (cbind(k , x1 , x2 , measured_sizes ), ncol = 4 )
154+ sample_result <- sbs_pps_sample(population , sample_sizes )
155+
156+ # estimate the population mean and construct a confidence interval
157+ df_sample <- sample_result $ sample
158+ sample_id <- df_sample [, 1 ]
159+ y_sample <- y [sample_id ]
160+
161+ sbs_pps_estimates <- sbs_pps_estimate(
162+ population , sample_sizes , y_sample , df_sample ,
163+ n_bootstrap = 100 , alpha = 0.05
164+ )
165+ print(sbs_pps_estimates )
166+ # > n1 n2 Estimate St.error 95% Confidence intervals
167+ # > 1 5 5 2.849 0.1760682 2.451,3.247
168+ ```
162169</details >
163170
164171# Citing this package
0 commit comments