Skip to content

Commit 2c782ac

Browse files
committed
build readme
1 parent c847e09 commit 2c782ac

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

README.md

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,21 @@ version](https://img.shields.io/badge/R%3E%3D-3.5.0-6666ff.svg)](https://cran.r-
2222
<!-- badges: end -->
2323

2424
The InPlotSampling package provides a way for researchers to easily
25-
implement Ranked Set Sampling in practice.
25+
implement these sampling methods in practice.
26+
27+
- Judgment post-stratified (JPS) sampling
28+
- Ranked set sampling (RSS)
29+
- Porbability-proportional to size (PPS) sampling
30+
- Spatially balanced sampling (SBS)
31+
- Two-stage cluster sampling
2632

2733
## Table of Contents
2834

2935
<!-- vim-markdown-toc GFM -->
3036

3137
- [Sampling Methods](#sampling-methods)
3238
- [JPS Sampling](#jps-sampling)
33-
- [RSS Sampling](#rss-sampling)
39+
- [RSS](#rss-sampling)
3440
- [Installation](#installation)
3541
- [Examples](#examples)
3642
- [JPS Sample and Estimator](#jps-sample-and-estimator)
@@ -52,14 +58,13 @@ alt="JPS sampling diagram" />
5258
<figcaption aria-hidden="true">JPS sampling diagram</figcaption>
5359
</figure>
5460

55-
### RSS Sampling
61+
### RSS
5662

5763
Sampling is made following the diagram below.
5864

5965
<figure>
60-
<img src="man/figures/rss-diagram.drawio.svg"
61-
alt="RSS sampling diagram" />
62-
<figcaption aria-hidden="true">RSS sampling diagram</figcaption>
66+
<img src="man/figures/rss-diagram.drawio.svg" alt="RSS diagram" />
67+
<figcaption aria-hidden="true">RSS diagram</figcaption>
6368
</figure>
6469

6570
## Installation
@@ -128,33 +133,33 @@ SBS PPS sample and estimator
128133
</summary>
129134

130135
``` r
131-
set.seed(112)
132-
133-
# SBS sample size, PPS sample size
134-
sample_sizes <- c(5, 5)
135-
136-
n_population <- 233
137-
k <- 0:(n_population - 1)
138-
x1 <- sample(1:13, n_population, replace = TRUE) / 13
139-
x2 <- sample(1:8, n_population, replace = TRUE) / 8
140-
y <- (x1 + x2) * runif(n = n_population, min = 1, max = 2) + 1
141-
measured_sizes <- y * runif(n = n_population, min = 0, max = 4)
142-
143-
population <- matrix(cbind(k, x1, x2, measured_sizes), ncol = 4)
144-
sample_result <- sbs_pps_sample(population, sample_sizes)
145-
146-
# estimate the population mean and construct a confidence interval
147-
df_sample <- sample_result$sample
148-
sample_id <- df_sample[, 1]
149-
y_sample <- y[sample_id]
150-
151-
sbs_pps_estimates <- sbs_pps_estimate(
152-
population, sample_sizes, y_sample, df_sample,
153-
n_bootstrap = 100, alpha = 0.05
154-
)
155-
print(sbs_pps_estimates)
156-
#> n1 n2 Estimate St.error 95% Confidence intervals
157-
#> 1 5 5 2.849 0.1760682 2.451,3.247
136+
set.seed(112)
137+
138+
# SBS sample size, PPS sample size
139+
sample_sizes <- c(5, 5)
140+
141+
n_population <- 233
142+
k <- 0:(n_population - 1)
143+
x1 <- sample(1:13, n_population, replace = TRUE) / 13
144+
x2 <- sample(1:8, n_population, replace = TRUE) / 8
145+
y <- (x1 + x2) * runif(n = n_population, min = 1, max = 2) + 1
146+
measured_sizes <- y * runif(n = n_population, min = 0, max = 4)
147+
148+
population <- matrix(cbind(k, x1, x2, measured_sizes), ncol = 4)
149+
sample_result <- sbs_pps_sample(population, sample_sizes)
150+
151+
# estimate the population mean and construct a confidence interval
152+
df_sample <- sample_result$sample
153+
sample_id <- df_sample[, 1]
154+
y_sample <- y[sample_id]
155+
156+
sbs_pps_estimates <- sbs_pps_estimate(
157+
population, sample_sizes, y_sample, df_sample,
158+
n_bootstrap = 100, alpha = 0.05
159+
)
160+
print(sbs_pps_estimates)
161+
#> n1 n2 Estimate St.error 95% Confidence intervals
162+
#> 1 5 5 2.849 0.1760682 2.451,3.247
158163
```
159164

160165
</details>

0 commit comments

Comments
 (0)