stratifiedsampling
Different methods for stratified populations.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.5%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Different methods for stratified populations.
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 0
Created almost 6 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Changelog
README.Rmd
---
output: github_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# StratifiedSampling package
In this R package, different functions are implemented for selecting samples .
* If the population of interest is stratified. Different functions are implemented, for more details see .
* If two datasets are available for statistical matching. A method based on optimal transport is implemented, for more details see .
* If you are interested in the Sequential Spatially Balanced method.
The package contains also some useful functions. Look at the manual of the package for more information.
## Installation
### CRAN version
```
install.packages("StratifiedSampling")
```
### Latest version
You can install the latest version of the package `StratifiedSampling` with the following command:
``` r
# install.packages("devtools")
devtools::install_github("Rjauslin/StratifiedSampling")
```
## Optimal transport matching
The package proposes a method to do statistical matching using optimal transport and balanced sampling. For more details see Raphaël Jauslin and Yves Tillé (2021) . A complete example on how to use the package to make an optimal statistical transport match can be found in the following vignette:
```
vignette("ot_matching", package = "StratifiedSampling")
```
## Sequential spatially balanced sampling
The package proposes a method to select a well-spread sample balanced on some auxiliary variables. For more details see Raphaël Jauslin and Yves Tillé (2022) . A complete example on how to use the different functions to select a well-spread and balanced sample can be found in the following vignette:
```
vignette("sequential_balanced", package = "StratifiedSampling")
```
## Simple example on stratified population
Integrating a stratified structure in the population in a sampling design can considerably reduce the variance of the Horvitz-Thompson estimator. We propose in this package different methods to handle the selection of a balanced sample in stratified population. For more details see Raphaël Jauslin, Esther Eustache and Yves Tillé (2021) .
This basic example shows you how to set up a stratified sampling design. The example is done on the `swissmunicipalities` dataset from the package `sampling`.
```{r}
library(sampling)
library(StratifiedSampling)
data(swissmunicipalities)
swiss <- swissmunicipalities
X <- cbind(swiss$HApoly,
swiss$Surfacesbois,
swiss$P00BMTOT,
swiss$P00BWTOT,
swiss$POPTOT,
swiss$Pop020,
swiss$Pop2040,
swiss$Pop4065,
swiss$Pop65P,
swiss$H00PTOT )
X <- X[order(swiss$REG),]
strata <- swiss$REG[order(swiss$REG)]
```
Strata are NUTS region of the Switzerland. Inclusion probabilities `pik` is set up equal within strata and such that the sum of the inclusion probabilities within strata is equal to 80.
```{r}
pik <- sampling::inclusionprobastrata(strata,rep(80,7))
```
It remains to use the function `stratifiedcube()`.
```{r}
s <- stratifiedcube(X,strata,pik)
```
We can check that we have correctly selected the sample. It is balanced and have the right number of units selected in each stratum.
```{r}
head(s)
sum(s)
t(X/pik)%*%s
t(X/pik)%*%pik
Xcat <- disj(strata)
t(Xcat)%*%s
t(Xcat)%*%pik
```
Owner
- Name: Raphaël Jauslin
- Login: RJauslin
- Kind: user
- Location: Neuchâtel
- Company: Université de Neuchâtel
- Repositories: 4
- Profile: https://github.com/RJauslin
GitHub Events
Total
- Push event: 3
Last Year
- Push event: 3
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| JAUSLIN Raphaël | r****n@u****h | 75 |
| Rjauslin | j****l@g****m | 17 |
| Raphaël Jauslin | 4****n | 1 |
Committer Domains (Top 20 + Academic)
unine.ch: 1
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 1
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rsbivand (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 241 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 6
- Total maintainers: 1
cran.r-project.org: StratifiedSampling
Different Methods for Stratified Sampling
- Homepage: https://github.com/RJauslin/StratifiedSampling
- Documentation: http://cran.r-project.org/web/packages/StratifiedSampling/StratifiedSampling.pdf
- License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
-
Latest release: 0.4.2
published over 1 year ago
Rankings
Forks count: 28.8%
Dependent packages count: 29.8%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Average: 36.1%
Downloads: 51.5%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- Matrix * depends
- R >= 3.5.0 depends
- MASS * imports
- Rcpp * imports
- Rglpk * imports
- proxy * imports
- sampling * imports
- transport * imports
- BalancedSampling * suggests
- StatMatch * suggests
- geojsonio * suggests
- ggplot2 * suggests
- knitr * suggests
- laeken * suggests
- prettydoc * suggests
- rgeos * suggests
- rmapshaper * suggests
- rmarkdown * suggests
- sf * suggests
- stats * suggests
- testthat * suggests
- viridis * suggests
.github/workflows/rhub.yaml
actions
- r-hub/actions/checkout v1 composite
- r-hub/actions/platform-info v1 composite
- r-hub/actions/run-check v1 composite
- r-hub/actions/setup v1 composite
- r-hub/actions/setup-deps v1 composite
- r-hub/actions/setup-r v1 composite