Skip to content

Commit

Permalink
Change package name to flipr.
Browse files Browse the repository at this point in the history
  • Loading branch information
astamm committed Feb 13, 2021
1 parent 2f7faef commit 2e265d1
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
^psi\.Rproj$
^flipr\.Rproj$
^\.Rproj\.user$
^README\.Rmd$
^vignettes/articles$
Expand Down
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: psi
Title: Permutations for Statistical Inference
Package: flipr
Title: Flexible Inference via Permutations in R
Version: 0.1.0
Authors@R: c(
person(given = "Alessia",
Expand All @@ -16,7 +16,7 @@ Authors@R: c(
role = "aut",
email = "[email protected]"))
Description: A flexible permutation framework for hypothesis
testing, ANOVA and regression anlaysis of complex data.
testing, ANOVA and regression analysis of complex data.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Expand All @@ -34,3 +34,5 @@ Suggests:
plotly,
widgetframe
VignetteBuilder: knitr
URL: https://astamm.github.io/flipr/, https://github.com/astamm/flipr/
BugReports: https://github.com/astamm/flipr/issues/
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# psi 0.1.0
# flipr 0.1.0

* Initial release.
* Added a `NEWS.md` file to track changes to the package.
2 changes: 1 addition & 1 deletion R/two-sample-test.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' These can be \code{\link{stat_hotelling}} or user-specified functions that
#' define desired statistics. See the section *User-supplied statistic
#' function* for more information on how these user-supplied functions should
#' be structured for compatibility with the PSI framwork. Default is
#' be structured for compatibility with the **flipr** framwork. Default is
#' \code{\link{stat_hotelling}}.
#' @param B The number of sampled permutation. Default is `1000L`.
#' @param test A string specifying if performing an exact test through the use
Expand Down
35 changes: 20 additions & 15 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,34 @@ knitr::opts_chunk$set(
)
```

# Overview <a href='https://astamm.github.io/psi'><img src='man/figures/logo.png' align="right" height="139" /></a>
# Overview <a href='https://astamm.github.io/flipr/'><img src='man/figures/logo.png' align="right" height="139" /></a>

<!-- badges: start -->
[![check-standard](https://github.com/astamm/psi/workflows/R-CMD-check/badge.svg)](https://github.com/astamm/psi/actions)
[![test-coverage](https://github.com/astamm/psi/workflows/test-coverage/badge.svg)](https://github.com/astamm/psi/actions)
[![Codecov test coverage](https://codecov.io/gh/astamm/psi/branch/master/graph/badge.svg)](https://codecov.io/gh/astamm/psi?branch=master)
[![pkgdown](https://github.com/astamm/psi/workflows/pkgdown/badge.svg)](https://github.com/astamm/psi/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/psi)](https://CRAN.R-project.org/package=psi)
[![check-standard](https://github.com/astamm/flipr/workflows/R-CMD-check/badge.svg)](https://github.com/astamm/flipr/actions)
[![test-coverage](https://github.com/astamm/flipr/workflows/test-coverage/badge.svg)](https://github.com/astamm/flipr/actions)
[![Codecov test coverage](https://codecov.io/gh/astamm/flipr/branch/master/graph/badge.svg)](https://codecov.io/gh/astamm/flipr?branch=master)
[![pkgdown](https://github.com/astamm/flipr/workflows/pkgdown/badge.svg)](https://github.com/astamm/flipr/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/flipr)](https://CRAN.R-project.org/package=flipr)
<!-- badges: end -->

The goal of the **psi** package is to provide a flexible framework for making inference via permutation. The idea is to promote the permutation framework as an incredibly well-suited tool for hypothesis testing on complex data. You supply your data, as complex as it might be, in the form of lists in which each entry stores one data point in a representation that suits you and **psi** takes care of the permutation magic and provides you with the result of the permutation test. Permutation tests are especially appealing because they are exact no matter how small or big your sample sizes are. You can also use the so-called *non-parametric combination* approach in this setting to combine several statistics to better target the alternative hypothesis you are testing against. Asymptotic consistency is also guaranteed under mild conditions on the statistic you use. Currently, you can do two-sample tests. We plan on adding very soon one-sample tests, ANOVA and regression to the list as well.
The goal of the **flipr** package is to provide a flexible framework for making inference via permutation. The idea is to promote the permutation framework as an incredibly well-suited tool for hypothesis testing on complex data. You supply your data, as complex as it might be, in the form of lists in which each entry stores one data point in a representation that suits you and **flipr** takes care of the permutation magic and provides you with the result of the permutation test. Permutation tests are especially appealing because they are exact no matter how small or big your sample sizes are. You can also use the so-called *non-parametric combination* approach in this setting to combine several statistics to better target the alternative hypothesis you are testing against. Asymptotic consistency is also guaranteed under mild conditions on the statistic you use. Currently, you can do two-sample tests. We plan on adding very soon one-sample tests, ANOVA and regression to the list as well.

## Installation

You can install the development version from [GitHub](https://github.com/) with:
You can install the latest stable version of **flipr** on CRAN with:
``` r
install.packages("flipr")
```

Or you can install the development version from [GitHub](https://github.com/) with:

``` r
# install.packages("remotes")
remotes::install_github("astamm/psi")
remotes::install_github("astamm/flipr")
```
## Example

We hereby use the very simple t-test for comparing the means of two univariate samples to show how easy it is to carry out a permutation test with **psi**.
We hereby use the very simple t-test for comparing the means of two univariate samples to show how easy it is to carry out a permutation test with **flipr**.

Let us first generate a first sample of size 10 governed by a Gaussian distribution of mean 0 and unit variance:
```{r sample1}
Expand All @@ -49,8 +54,8 @@ set.seed(1234)
x2 <- rnorm(n = 10, mean = 3, sd = 1)
```

We can implement the squared $t$-statistic as a function that plays well with **psi** as follows:
```{r tstat-psi}
We can implement the squared $t$-statistic as a function that plays well with **flipr** as follows:
```{r tstat-flipr}
stat_t2 <- function(data, indices) {
n <- length(data)
n1 <- length(indices)
Expand All @@ -64,9 +69,9 @@ stat_t2 <- function(data, indices) {

Note that the square is needed as permutation tests look for large values of the test statistic to find evidence against the null hypothesis.

Now we can simply use the function `psi::two_sample_test()` to get the result of the test:
```{r ttest-psi}
test_t2 <- psi::two_sample_test(
Now we can simply use the function `flipr::two_sample_test()` to get the result of the test:
```{r ttest-flipr}
test_t2 <- flipr::two_sample_test(
x = x1,
y = x2,
statistic = stat_t2,
Expand Down
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# Overview <a href='https://astamm.github.io/psi'><img src='man/figures/logo.png' align="right" height="139" /></a>
# Overview <a href='https://astamm.github.io/flipr/'><img src='man/figures/logo.png' align="right" height="139" /></a>

<!-- badges: start -->

[![check-standard](https://github.com/astamm/psi/workflows/R-CMD-check/badge.svg)](https://github.com/astamm/psi/actions)
[![test-coverage](https://github.com/astamm/psi/workflows/test-coverage/badge.svg)](https://github.com/astamm/psi/actions)
[![check-standard](https://github.com/astamm/flipr/workflows/R-CMD-check/badge.svg)](https://github.com/astamm/flipr/actions)
[![test-coverage](https://github.com/astamm/flipr/workflows/test-coverage/badge.svg)](https://github.com/astamm/flipr/actions)
[![Codecov test
coverage](https://codecov.io/gh/astamm/psi/branch/master/graph/badge.svg)](https://codecov.io/gh/astamm/psi?branch=master)
[![pkgdown](https://github.com/astamm/psi/workflows/pkgdown/badge.svg)](https://github.com/astamm/psi/actions)
coverage](https://codecov.io/gh/astamm/flipr/branch/master/graph/badge.svg)](https://codecov.io/gh/astamm/flipr?branch=master)
[![pkgdown](https://github.com/astamm/flipr/workflows/pkgdown/badge.svg)](https://github.com/astamm/flipr/actions)
[![CRAN
status](https://www.r-pkg.org/badges/version/psi)](https://CRAN.R-project.org/package=psi)
status](https://www.r-pkg.org/badges/version/flipr)](https://CRAN.R-project.org/package=flipr)
<!-- badges: end -->

The goal of the **psi** package is to provide a flexible framework for
The goal of the **flipr** package is to provide a flexible framework for
making inference via permutation. The idea is to promote the permutation
framework as an incredibly well-suited tool for hypothesis testing on
complex data. You supply your data, as complex as it might be, in the
form of lists in which each entry stores one data point in a
representation that suits you and **psi** takes care of the permutation
magic and provides you with the result of the permutation test.
Permutation tests are especially appealing because they are exact no
matter how small or big your sample sizes are. You can also use the
representation that suits you and **flipr** takes care of the
permutation magic and provides you with the result of the permutation
test. Permutation tests are especially appealing because they are exact
no matter how small or big your sample sizes are. You can also use the
so-called *non-parametric combination* approach in this setting to
combine several statistics to better target the alternative hypothesis
you are testing against. Asymptotic consistency is also guaranteed under
Expand All @@ -32,19 +32,25 @@ and regression to the list as well.

## Installation

You can install the development version from
You can install the latest stable version of **flipr** on CRAN with:

``` r
install.packages("flipr")
```

Or you can install the development version from
[GitHub](https://github.com/) with:

``` r
# install.packages("remotes")
remotes::install_github("astamm/psi")
remotes::install_github("astamm/flipr")
```

## Example

We hereby use the very simple t-test for comparing the means of two
univariate samples to show how easy it is to carry out a permutation
test with **psi**.
test with **flipr**.

Let us first generate a first sample of size 10 governed by a Gaussian
distribution of mean 0 and unit variance:
Expand All @@ -63,7 +69,7 @@ x2 <- rnorm(n = 10, mean = 3, sd = 1)
```

We can implement the squared *t*-statistic as a function that plays well
with **psi** as follows:
with **flipr** as follows:

``` r
stat_t2 <- function(data, indices) {
Expand All @@ -81,11 +87,11 @@ Note that the square is needed as permutation tests look for large
values of the test statistic to find evidence against the null
hypothesis.

Now we can simply use the function `psi::two_sample_test()` to get the
Now we can simply use the function `flipr::two_sample_test()` to get the
result of the test:

``` r
test_t2 <- psi::two_sample_test(
test_t2 <- flipr::two_sample_test(
x = x1,
y = x2,
statistic = stat_t2,
Expand Down
File renamed without changes.
Binary file modified man/figures/logo.png
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/two_sample_test.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vignettes/alternative.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ knitr::opts_chunk$set(
)
```

```{r setup}
library(psi)
```{r setup, include=FALSE}
library(flipr)
```

In this article, we discuss a key difference between the traditional
Expand Down Expand Up @@ -98,7 +98,7 @@ same scale even though they might look at very different features of the
distributions. They can therefore be combined in various ways to provide
a single test statistic value to be used in the testing procedure. There
are several possible **combining functions** to do this fusion of
p-values. The package **psi** currently implements:
p-values. The package **flipr** currently implements:

- Tippett's combining function:
$\mathrm{Tippett}(p_1, …, p_L) = 1 - \min_{\ell \in 1, \dots, L} p_\ell$;
Expand Down
4 changes: 2 additions & 2 deletions vignettes/exactness.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ knitr::opts_chunk$set(
comment = "#>"
)
library(tidyverse)
library(psi)
library(flipr)
```

In this article, we discuss the exactness property of permutation tests,
Expand Down Expand Up @@ -202,7 +202,7 @@ $$ p_e \approx \frac{b+1}{m+1} - \int_0^{\frac{0.5}{m_t+1}} F_B (b; m, p_t) dp_t

## Comparison by empirical evidence

In **psi**, you perform a permutation test using the estimator
In **flipr**, you perform a permutation test using the estimator
$\widehat{p_\infty}$ of the p-value $p_\infty$ by setting
`test == "approximate"`. This provides a non-exact test but an unbiased
estimate of $p_\infty$. You perform a permutation test using the
Expand Down

0 comments on commit 2e265d1

Please sign in to comment.