Skip to content

Commit

Permalink
fixed Wilcoxon
Browse files Browse the repository at this point in the history
  • Loading branch information
qddyy committed Dec 10, 2023
1 parent f756e9b commit 1481cf4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions R/Wilcoxon.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ Wilcoxon <- R6Class(
},

.calculate_extra = function() {
x <- private$.raw_data$x
y <- private$.raw_data$y
x <- private$.raw_data[[1]]
y <- private$.raw_data[[2]]

diff <- as.vector(outer(x, y, "-"))

private$.estimate <- median(diff)
Expand Down
5 changes: 4 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ pak::pkg_install("qddyy/LearnNonparam")

## Usage

```{r}
set.seed(2023)
```

- Create a test object (for example, a `Wilcoxon` object)
```{r, eval = FALSE}
t <- Wilcoxon$new(alternative = "greater", type = "permu", n_permu = 1e7)
Expand All @@ -52,7 +56,6 @@ pak::pkg_install("qddyy/LearnNonparam")
- Test some data (`vector` | `data.frame` | `list`)
```{r, test}
set.seed(2023)
t$test(rnorm(20, mean = 1), rnorm(20, mean = 0))
```
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ pak::pkg_install("qddyy/LearnNonparam")

## Usage

``` r
set.seed(2023)
```

- Create a test object (for example, a `Wilcoxon` object)

``` r
Expand All @@ -44,7 +48,6 @@ pak::pkg_install("qddyy/LearnNonparam")
- Test some data (`vector` \| `data.frame` \| `list`)

``` r
set.seed(2023)
t$test(rnorm(20, mean = 1), rnorm(20, mean = 0))
```

Expand All @@ -61,8 +64,8 @@ pak::pkg_install("qddyy/LearnNonparam")
#> scoring: rank type: permu(1e+07) method: default
#> statistic = 475, p_value = 0.041
#> alternative hypothesis: true location shift is greater than 0
#> estimate: NA
#> 95% confidence interval: NA NA
#> estimate: 0.52
#> 95% confidence interval: -0.064 1.284

t$plot(style = "ggplot2", binwidth = 1)
#> Loading required namespace: ggplot2
Expand Down
2 changes: 1 addition & 1 deletion man/figures/README-results-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1481cf4

Please sign in to comment.