Skip to content

Commit

Permalink
modified some text
Browse files Browse the repository at this point in the history
  • Loading branch information
qddyy committed Jun 30, 2024
1 parent 46d41c4 commit 4e60d38
Show file tree
Hide file tree
Showing 18 changed files with 460 additions and 44 deletions.
23 changes: 13 additions & 10 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# LearnNonparam 1.2.2

- R side
- Changed the default value of `n_permu` to `1e4`.
- Added support for test statistics defined using Rcpp in `define_pmt`.
- Added support for `null_value` other than zero in two-sample location tests.
- Added the `LearnNonparam.pmt_progress` option.
- Replaced `KSampleF` and `RCBDF` with `OneWay` and `RCBDOneWay`.
- Stopped exporting abstract classes (`TwoSampleTest`, `KSampleTest`, etc.).
- Improved the efficiency of `ChiSquare`, `Difference`, `JonckheereTerpstra`, `KruskalWallis`, `RatioMeanDeviance` and `Studentized`.
- Fixed many bugs.
- Changed the default value of `n_permu` to `1e4`
- Added support for test statistics defined using Rcpp in `define_pmt`
- Added support for `null_value` other than zero in two-sample location tests
- Added support for `scoring` in `TwoSampleAssociationTest`
- Added the `LearnNonparam.pmt_progress` option
- Added `attr(t$n_permu, "n_used")`
- Replaced `KSampleF` and `RCBDF` with `OneWay` and `RCBDOneWay`
- Replaced `multicomp.*` with `multcomp.*`
- Stopped exporting abstract classes (`TwoSampleTest`, `KSampleTest`, etc.)
- Improved the efficiency of `ChiSquare`, `Difference`, `JonckheereTerpstra`, `KruskalWallis`, `RatioMeanDeviance` and `Studentized`
- Fixed many bugs

- C++ side:
- Introduced a new progress bar, which is built at compile time to minimize runtime overhead.
- C++ side
- Introduced a new progress bar, which is built at compile time to minimize runtime overhead

# LearnNonparam 1.2.1

Expand Down
16 changes: 8 additions & 8 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ output:
```{r, setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE, comment = "#>",
fig.path = "man/figures/README",
fig.path = "man/figures/README", fig.align = "center",
asciicast_theme = if (Sys.getenv("IN_PKGDOWN") == "true") "pkgdown" else "readme"
)
asciicast::init_knitr_engine(
Expand Down Expand Up @@ -98,11 +98,11 @@ options(LearnNonparam.pmt_progress = TRUE)
```
```{asciicast, save_plot, include = FALSE}
ggplot2::ggsave("./man/figures/README/ggplot.svg", device = "svg")
ggplot2::ggsave("./man/figures/README/histogram.svg", device = "svg")
```
```{r, include_plot, echo = FALSE, out.width = "100%", out.height = "75%"}
knitr::include_graphics("./man/figures/README/ggplot.svg")
```{r, include_plot, echo = FALSE, out.width = "100%"}
knitr::include_graphics("./man/figures/README/histogram.svg")
```
- Modify some active bindings and see how the results change
Expand All @@ -118,7 +118,7 @@ LearnNonparam::pmts()
```
</details>

The `define_pmt` function allows users to define new permutation tests. Take Cramér-von Mises test as an example:
The `define_pmt` function allows users to define new permutation tests. Take Cramér-Von Mises test as an example:

```{asciicast, define}
t <- define_pmt(
Expand All @@ -132,8 +132,8 @@ t <- define_pmt(
G_y <- seq_len(n_y) / n_y
# return a closure to calculate the test statistic
function(x, y) {
x <- sort(x)
y <- sort(y)
x <- sort.int(x)
y <- sort.int(y)
F <- approxfun(x, F_x, "constant", 0, 1, ties = "ordered")
G <- approxfun(y, G_y, "constant", 0, 1, ties = "ordered")
sum(c(F_x - G(x), G_y - F(y))^2)
Expand All @@ -142,7 +142,7 @@ t <- define_pmt(
# reject the null hypothesis when the test statistic is large
rejection = "r",
scoring = "none", n_permu = 1e4,
name = "Cramér-von Mises Test",
name = "Two-Sample Cramér-Von Mises Test",
alternative = "samples are from different distributions"
)
Expand Down
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ options(LearnNonparam.pmt_progress = TRUE)

<picture>
<source media="(prefers-color-scheme: dark)" srcset="man/figures/README/test-dark.svg">
<img src="man/figures/README/test.svg" /> </picture>
<img src="man/figures/README/test.svg" style="display: block; margin: auto;" />
</picture>

- Check the results

Expand All @@ -77,33 +78,37 @@ options(LearnNonparam.pmt_progress = TRUE)

<picture>
<source media="(prefers-color-scheme: dark)" srcset="man/figures/README/statistic-dark.svg">
<img src="man/figures/README/statistic.svg" /> </picture>
<img src="man/figures/README/statistic.svg" style="display: block; margin: auto;" />
</picture>

``` r
t$p_value
```

<picture>
<source media="(prefers-color-scheme: dark)" srcset="man/figures/README/p_value-dark.svg">
<img src="man/figures/README/p_value.svg" /> </picture>
<img src="man/figures/README/p_value.svg" style="display: block; margin: auto;" />
</picture>

``` r
t$print()
```

<picture>
<source media="(prefers-color-scheme: dark)" srcset="man/figures/README/print-dark.svg">
<img src="man/figures/README/print.svg" /> </picture>
<img src="man/figures/README/print.svg" style="display: block; margin: auto;" />
</picture>

``` r
t$plot(style = "ggplot2", binwidth = 1)
```

<picture>
<source media="(prefers-color-scheme: dark)" srcset="man/figures/README/plot-dark.svg">
<img src="man/figures/README/plot.svg" /> </picture>
<img src="man/figures/README/plot.svg" style="display: block; margin: auto;" />
</picture>

<img src="./man/figures/README/ggplot.svg" width="100%" height="75%" />
<img src="./man/figures/README/histogram.svg" width="100%" style="display: block; margin: auto;" />

- Modify some active bindings and see how the results change

Expand All @@ -114,7 +119,8 @@ options(LearnNonparam.pmt_progress = TRUE)

<picture>
<source media="(prefers-color-scheme: dark)" srcset="man/figures/README/modify-dark.svg">
<img src="man/figures/README/modify.svg" /> </picture>
<img src="man/figures/README/modify.svg" style="display: block; margin: auto;" />
</picture>

<details>
<summary>
Expand Down Expand Up @@ -151,7 +157,7 @@ See <code>pmts()</code> for tests implemented in this package.
</details>

The `define_pmt` function allows users to define new permutation tests.
Take Cramér-von Mises test as an example:
Take Cramér-Von Mises test as an example:

``` r
t <- define_pmt(
Expand All @@ -165,8 +171,8 @@ t <- define_pmt(
G_y <- seq_len(n_y) / n_y
# return a closure to calculate the test statistic
function(x, y) {
x <- sort(x)
y <- sort(y)
x <- sort.int(x)
y <- sort.int(y)
F <- approxfun(x, F_x, "constant", 0, 1, ties = "ordered")
G <- approxfun(y, G_y, "constant", 0, 1, ties = "ordered")
sum(c(F_x - G(x), G_y - F(y))^2)
Expand All @@ -175,7 +181,7 @@ t <- define_pmt(
# reject the null hypothesis when the test statistic is large
rejection = "r",
scoring = "none", n_permu = 1e4,
name = "Cramér-von Mises Test",
name = "Two-Sample Cramér-Von Mises Test",
alternative = "samples are from different distributions"
)

Expand All @@ -184,7 +190,8 @@ t$test(rnorm(20, 1), rnorm(20, 0))$print()

<picture>
<source media="(prefers-color-scheme: dark)" srcset="man/figures/README/define-dark.svg">
<img src="man/figures/README/define.svg" /> </picture>
<img src="man/figures/README/define.svg" style="display: block; margin: auto;" />
</picture>

## References

Expand Down
2 changes: 1 addition & 1 deletion man/figures/README/define-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion man/figures/README/define.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4e60d38

Please sign in to comment.