-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
76 lines (54 loc) · 2.63 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# dbsubsampling <a href="https://jieyinstat.github.io/dbsubsampling/"><img src="man/figures/logo.png" align="right" height="139" alt="dbsubsampling website" /></a>
<!-- badges: start -->
[![R-CMD-check](https://github.com/JieYinStat/dbsubsampling/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/JieYinStat/dbsubsampling/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/JieYinStat/dbsubsampling/branch/master/graph/badge.svg)](https://app.codecov.io/gh/JieYinStat/dbsubsampling?branch=master)
[![pkgdown](https://github.com/JieYinStat/dbsubsampling/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/JieYinStat/dbsubsampling/actions/workflows/pkgdown.yaml)
<!-- badges: end -->
Providing a unified interface for IBOSS, Lowcon, OSS and other popular design-based subsampling methods.
## Installation
You can install the development version of dbsubsampling from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("JieYinStat/dbsubsampling")
```
## Example
This is a basic example which shows you how to get subsample index, such as uniform sampling, OSMAC, IBOSS, Leverage, OSS, LowCon, IES and DDS:
```{r example}
library(dbsubsampling)
data_binary <- data_binary_class
data_numeric <- data_numeric_regression
# Uniform sampling
subsampling(y_name = "y", data = data_binary, n = 10, method = "Unif", seed = 123)
# OSMAC-A
subsampling(y_name = "y", data = data_binary, n = 10, pilot_n = 100, method = "OSMAC_A",
seed_1 = 123, seed_2 = 456)
# OSMAC-L
subsampling(y_name = "y", data = data_binary, n = 10, pilot_n = 100, method = "OSMAC_L",
seed_1 = 123, seed_2 = 456)
# IBOSS
subsampling(y_name = "y", data = data_numeric, n = 100, method = "IBOSS")
# Leverage
subsampling(y_name = "y", data = data_numeric, n = 10, method = "Leverage", replace = TRUE,
seed = 123, shrinkage = 0.9)
# OSS
subsampling(y_name = "y", data = data_numeric, n = 30, method = "OSS")
# LowCon
subsampling(y_name = "y", data = data_numeric, n = 10, method = "LowCon", seed = 123, theta = 1)
# IES
subsampling(y_name = "y", data = data_numeric, n = 10, method = "IES", seed = 123, q = 16)
# DDS
subsampling(y_name = "y", data = data_numeric, n = 10, method = "DDS", ratio = 0.85)
```
You can get more detailed examples from the article column on the [website](https://jieyinstat.github.io/dbsubsampling/).