diff --git a/CRAN-RELEASE b/CRAN-RELEASE index da27ddacd..97914f3d3 100644 --- a/CRAN-RELEASE +++ b/CRAN-RELEASE @@ -1,2 +1,2 @@ This package was submitted to CRAN on 2021-04-12. -Once it is accepted, delete this file and tag the release (commit 312f97bc). +Once it is accepted, delete this file and tag the release (commit 76c332ca). diff --git a/README.Rmd b/README.Rmd index 2e2d2c346..7650ac5af 100644 --- a/README.Rmd +++ b/README.Rmd @@ -18,7 +18,7 @@ options( knitr::opts_chunk$set( collapse = TRUE, - dpi = 300, + dpi = 150, # change to 300 once on CRAN warning = FALSE, message = FALSE, out.width = "100%", @@ -232,43 +232,17 @@ ggbetweenstats( `r emo::ji("check")` Bayesian estimation
A number of other arguments can be specified to make this plot even more -informative or change some of the default options. +informative or change some of the default options. Additionally, there is also a +`grouped_` variant of this function that makes it easy to repeat the same +operation across a **single** grouping variable: -```{r ggbetweenstats2} -# for reproducibility -set.seed(123) -library(ggplot2) - -# plot -ggbetweenstats( - data = ToothGrowth, - x = supp, - y = len, - type = "r", # robust statistics - k = 3, # number of decimal places for statistical results - xlab = "Supplement type", # label for the x-axis variable - ylab = "Tooth length", # label for the y-axis variable - title = "The Effect of Vitamin C on Tooth Growth", # title text for the plot - ggtheme = ggthemes::theme_fivethirtyeight(), # choosing a different theme - ggstatsplot.layer = FALSE, # turn off `ggstatsplot` theme layer - package = "wesanderson", # package from which color palette is to be taken - palette = "Darjeeling1" # choosing a different color palette -) -``` - -Additionally, there is also a `grouped_` variant of this function that makes it -easy to repeat the same operation across a **single** grouping variable: - -```{r ggbetweenstats3, fig.height = 14, fig.width = 12} +```{r ggbetweenstats2, fig.height = 8, fig.width = 12} # for reproducibility set.seed(123) # plot grouped_ggbetweenstats( - data = dplyr::filter( - .data = movies_long, - genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy") - ), + data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")), x = mpaa, y = length, grouping.var = genre, # grouping variable @@ -282,7 +256,7 @@ grouped_ggbetweenstats( caption = substitute(paste(italic("Source"), ": IMDb (Internet Movie Database)")), palette = "default_jama", package = "ggsci", - plotgrid.args = list(nrow = 2), + plotgrid.args = list(nrow = 1), annotation.args = list(title = "Differences in movie length by mpaa ratings for different genres") ) ``` @@ -503,16 +477,13 @@ gghistostats( There is also a `grouped_` variant of this function that makes it easy to repeat the same operation across a **single** grouping variable: -```{r gghistostats2, fig.height = 10, fig.width = 10} +```{r gghistostats2, fig.height = 6, fig.width = 10} # for reproducibility set.seed(123) # plot grouped_gghistostats( - data = dplyr::filter( - .data = movies_long, - genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy") - ), + data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")), x = budget, test.value = 50, type = "nonparametric", @@ -523,7 +494,7 @@ grouped_gghistostats( ggtheme = ggthemes::theme_tufte(), # modify the defaults from `ggstatsplot` for each plot ggplot.component = ggplot2::labs(caption = "Source: IMDB.com"), - plotgrid.args = list(nrow = 2), + plotgrid.args = list(nrow = 1), annotation.args = list(title = "Movies budgets for different genres") ) ``` @@ -601,7 +572,7 @@ As with the rest of the functions in this package, there is also a `grouped_` variant of this function to facilitate looping the same operation for all levels of a single grouping variable. -```{r ggdotplotstats2, fig.height = 8, fig.width = 12} +```{r ggdotplotstats2, fig.height = 6, fig.width = 12} # for reproducibility set.seed(123) @@ -660,13 +631,13 @@ The available marginal distributions are- Number of other arguments can be specified to modify this basic plot- -```{r ggscatterstats2, fig.width=8} +```{r ggscatterstats2, fig.width=10} # for reproducibility set.seed(123) # plot ggscatterstats( - data = dplyr::filter(.data = movies_long, genre == "Action"), + data = dplyr::filter(movies_long, genre == "Action"), x = budget, y = rating, type = "robust", # type of test that needs to be run @@ -691,16 +662,13 @@ note that, as opposed to the other functions, this function does not return a using `ggplot.component` argument (available for all functions, but especially useful here): -```{r ggscatterstats3, fig.height = 12, fig.width = 14} +```{r ggscatterstats3, fig.height = 6, fig.width = 14} # for reproducibility set.seed(123) # plot grouped_ggscatterstats( - data = dplyr::filter( - .data = movies_long, - genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy") - ), + data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")), x = rating, y = length, grouping.var = genre, # grouping variable @@ -711,8 +679,8 @@ grouped_ggscatterstats( ggplot.component = list( ggplot2::scale_x_continuous(breaks = seq(2, 9, 1), limits = (c(2, 9))) ), - plotgrid.args = list(nrow = 2), - annotation.args = list(title = "Relationship between movie length by IMDB ratings for different genres") + plotgrid.args = list(nrow = 1), + annotation.args = list(title = "Relationship between movie length and IMDB ratings") ) ``` @@ -765,16 +733,13 @@ minimum, median, and maximum number of pairs used for correlation tests. There is also a `grouped_` variant of this function that makes it easy to repeat the same operation across a **single** grouping variable: -```{r ggcorrmat2, fig.height = 10, fig.width = 10} +```{r ggcorrmat2, fig.height = 6, fig.width = 10} # for reproducibility set.seed(123) # plot grouped_ggcorrmat( - data = dplyr::filter( - .data = movies_long, - genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy") - ), + data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")), type = "robust", # correlation method colors = c("#cbac43", "white", "#550000"), grouping.var = genre, # grouping variable @@ -844,6 +809,8 @@ ggpiestats( data = mtcars, x = am, y = cyl, + package = "wesanderson", + palette = "Royal1", title = "Dataset: Motor Trend Car Road Tests", # title for the plot legend.title = "Transmission", # title for the legend caption = substitute(paste(italic("Source"), ": 1974 Motor Trend US magazine")) @@ -859,55 +826,23 @@ ggpiestats( `r emo::ji("check")` Bayesian hypothesis-testing
`r emo::ji("check")` Bayesian estimation
-In case of repeated measures designs, setting `paired = TRUE` will produce -results from McNemar's chi-squared test- - -```{r ggpiestats2, fig.height=4} -# for reproducibility -set.seed(123) - -# data -df_paired <- - data.frame( - "before" = c("Approve", "Approve", "Disapprove", "Disapprove"), - "after" = c("Approve", "Disapprove", "Approve", "Disapprove"), - counts = c(794, 150, 86, 570), - check.names = FALSE - ) - -# plot -ggpiestats( - data = df_paired, - x = before, - y = after, - counts = counts, - title = "Survey results before and after the intervention", - label = "both", - paired = TRUE, # within-subjects design - package = "wesanderson", - palette = "Royal1" -) -``` - -Additionally, there is also a `grouped_` variant of this function that makes it +There is also a `grouped_` variant of this function that makes it easy to repeat the same operation across a **single** grouping variable. Following example is a case where the theoretical question is about proportions for different levels of a single nominal variable: -```{r ggpiestats3, fig.height = 10, fig.width = 10} +```{r ggpiestats2, fig.height = 6, fig.width = 10} # for reproducibility set.seed(123) # plot grouped_ggpiestats( - data = movies_long, - x = genre, - grouping.var = mpaa, # grouping variable + data = mtcars, + x = cyl, + grouping.var = am, # grouping variable label.repel = TRUE, # repel labels (helpful for overlapping labels) package = "ggsci", # package from which color palette is to be taken - palette = "default_ucscgb", # choosing a different color palette - annotation.args = list(title = "Composition of MPAA ratings for different genres"), - plotgrid.args = list(nrow = 2) + palette = "default_ucscgb" # choosing a different color palette ) ``` @@ -972,33 +907,20 @@ ggbarstats( And, needless to say, there is also a `grouped_` variant of this function- -```{r ggbarstats2, fig.height = 12, fig.width = 10} +```{r ggbarstats2, fig.height = 6, fig.width = 12} # setup set.seed(123) -# smaller dataset -df <- - dplyr::filter( - .data = forcats::gss_cat, - race %in% c("Black", "White"), - relig %in% c("Protestant", "Catholic", "None"), - !partyid %in% c("No answer", "Don't know", "Other party") - ) - # plot grouped_ggbarstats( - data = df, - x = relig, - y = partyid, - grouping.var = race, - label = "both", - xlab = "Party affiliation", + data = mtcars, + x = am, + y = cyl, + grouping.var = vs, package = "wesanderson", palette = "Darjeeling2", ggtheme = ggthemes::theme_tufte(base_size = 12), - ggstatsplot.layer = FALSE, - annotation.args = list(title = "Race, religion, and political affiliation"), - plotgrid.args = list(nrow = 2) + ggstatsplot.layer = FALSE ) ``` @@ -1241,8 +1163,7 @@ the following packages that manage different aspects of statistical analyses: ## `statsExpressions` The `statsExpressions` package forms the statistical backend that processes data -and creates expressions containing results from statistical tests and are by -default displayed in as plot **subtitle** and **caption**. +and creates expressions containing results from statistical tests. For more exhaustive documentation for this package, see: @@ -1258,8 +1179,8 @@ For more exhaustive documentation for this package, see: ## `ipmisc` -The `ipmisc` package contains some of the data wrangling/cleaning functions and -a few other miscellaneous functions. +The `ipmisc` package contains the data wrangling/cleaning functions and a few +other miscellaneous functions. For more exhaustive documentation for this package, see: @@ -1282,7 +1203,7 @@ package. The hexsticker was generously designed by Sarah Otterstetter (Max Planck Institute for Human Development, Berlin). This package has also benefited from -the larger `rstats` community on Twitter and StackOverflow. +the larger `rstats` community on Twitter and `StackOverflow`. Thanks are also due to my postdoc advisers (Mina Cikara and Fiery Cushman at Harvard University; Iyad Rahwan at Max Planck Institute for Human Development) diff --git a/README.md b/README.md index 16075ab26..dda921afa 100644 --- a/README.md +++ b/README.md @@ -225,35 +225,9 @@ comparisons
✅ Bayesian hypothesis-testing
✅ Bayesian estimation
A number of other arguments can be specified to make this plot even more -informative or change some of the default options. - -``` r -# for reproducibility -set.seed(123) -library(ggplot2) - -# plot -ggbetweenstats( - data = ToothGrowth, - x = supp, - y = len, - type = "r", # robust statistics - k = 3, # number of decimal places for statistical results - xlab = "Supplement type", # label for the x-axis variable - ylab = "Tooth length", # label for the y-axis variable - title = "The Effect of Vitamin C on Tooth Growth", # title text for the plot - ggtheme = ggthemes::theme_fivethirtyeight(), # choosing a different theme - ggstatsplot.layer = FALSE, # turn off `ggstatsplot` theme layer - package = "wesanderson", # package from which color palette is to be taken - palette = "Darjeeling1" # choosing a different color palette -) -``` - - - -Additionally, there is also a `grouped_` variant of this function that -makes it easy to repeat the same operation across a **single** grouping -variable: +informative or change some of the default options. Additionally, there +is also a `grouped_` variant of this function that makes it easy to +repeat the same operation across a **single** grouping variable: ``` r # for reproducibility @@ -261,10 +235,7 @@ set.seed(123) # plot grouped_ggbetweenstats( - data = dplyr::filter( - .data = movies_long, - genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy") - ), + data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")), x = mpaa, y = length, grouping.var = genre, # grouping variable @@ -278,12 +249,12 @@ grouped_ggbetweenstats( caption = substitute(paste(italic("Source"), ": IMDb (Internet Movie Database)")), palette = "default_jama", package = "ggsci", - plotgrid.args = list(nrow = 2), + plotgrid.args = list(nrow = 1), annotation.args = list(title = "Differences in movie length by mpaa ratings for different genres") ) ``` - + Note here that the function can be used to tag outliers! @@ -510,10 +481,7 @@ set.seed(123) # plot grouped_gghistostats( - data = dplyr::filter( - .data = movies_long, - genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy") - ), + data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")), x = budget, test.value = 50, type = "nonparametric", @@ -524,7 +492,7 @@ grouped_gghistostats( ggtheme = ggthemes::theme_tufte(), # modify the defaults from `ggstatsplot` for each plot ggplot.component = ggplot2::labs(caption = "Source: IMDB.com"), - plotgrid.args = list(nrow = 2), + plotgrid.args = list(nrow = 1), annotation.args = list(title = "Movies budgets for different genres") ) ``` @@ -670,7 +638,7 @@ set.seed(123) # plot ggscatterstats( - data = dplyr::filter(.data = movies_long, genre == "Action"), + data = dplyr::filter(movies_long, genre == "Action"), x = budget, y = rating, type = "robust", # type of test that needs to be run @@ -703,10 +671,7 @@ set.seed(123) # plot grouped_ggscatterstats( - data = dplyr::filter( - .data = movies_long, - genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy") - ), + data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")), x = rating, y = length, grouping.var = genre, # grouping variable @@ -717,8 +682,8 @@ grouped_ggscatterstats( ggplot.component = list( ggplot2::scale_x_continuous(breaks = seq(2, 9, 1), limits = (c(2, 9))) ), - plotgrid.args = list(nrow = 2), - annotation.args = list(title = "Relationship between movie length by IMDB ratings for different genres") + plotgrid.args = list(nrow = 1), + annotation.args = list(title = "Relationship between movie length and IMDB ratings") ) ``` @@ -781,10 +746,7 @@ set.seed(123) # plot grouped_ggcorrmat( - data = dplyr::filter( - .data = movies_long, - genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy") - ), + data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")), type = "robust", # correlation method colors = c("#cbac43", "white", "#550000"), grouping.var = genre, # grouping variable @@ -961,6 +923,8 @@ ggpiestats( data = mtcars, x = am, y = cyl, + package = "wesanderson", + palette = "Royal1", title = "Dataset: Motor Trend Car Road Tests", # title for the plot legend.title = "Transmission", # title for the legend caption = substitute(paste(italic("Source"), ": 1974 Motor Trend US magazine")) @@ -975,42 +939,10 @@ ggpiestats( effect size + CIs
✅ Goodness-of-fit tests
✅ Bayesian hypothesis-testing
✅ Bayesian estimation
-In case of repeated measures designs, setting `paired = TRUE` will -produce results from McNemar’s chi-squared test- - -``` r -# for reproducibility -set.seed(123) - -# data -df_paired <- - data.frame( - "before" = c("Approve", "Approve", "Disapprove", "Disapprove"), - "after" = c("Approve", "Disapprove", "Approve", "Disapprove"), - counts = c(794, 150, 86, 570), - check.names = FALSE - ) - -# plot -ggpiestats( - data = df_paired, - x = before, - y = after, - counts = counts, - title = "Survey results before and after the intervention", - label = "both", - paired = TRUE, # within-subjects design - package = "wesanderson", - palette = "Royal1" -) -``` - - - -Additionally, there is also a `grouped_` variant of this function that -makes it easy to repeat the same operation across a **single** grouping -variable. Following example is a case where the theoretical question is -about proportions for different levels of a single nominal variable: +There is also a `grouped_` variant of this function that makes it easy +to repeat the same operation across a **single** grouping variable. +Following example is a case where the theoretical question is about +proportions for different levels of a single nominal variable: ``` r # for reproducibility @@ -1018,18 +950,16 @@ set.seed(123) # plot grouped_ggpiestats( - data = movies_long, - x = genre, - grouping.var = mpaa, # grouping variable + data = mtcars, + x = cyl, + grouping.var = am, # grouping variable label.repel = TRUE, # repel labels (helpful for overlapping labels) package = "ggsci", # package from which color palette is to be taken - palette = "default_ucscgb", # choosing a different color palette - annotation.args = list(title = "Composition of MPAA ratings for different genres"), - plotgrid.args = list(nrow = 2) + palette = "default_ucscgb" # choosing a different color palette ) ``` - + ### Summary of tests @@ -1095,29 +1025,16 @@ function- # setup set.seed(123) -# smaller dataset -df <- - dplyr::filter( - .data = forcats::gss_cat, - race %in% c("Black", "White"), - relig %in% c("Protestant", "Catholic", "None"), - !partyid %in% c("No answer", "Don't know", "Other party") - ) - # plot grouped_ggbarstats( - data = df, - x = relig, - y = partyid, - grouping.var = race, - label = "both", - xlab = "Party affiliation", + data = mtcars, + x = am, + y = cyl, + grouping.var = vs, package = "wesanderson", palette = "Darjeeling2", ggtheme = ggthemes::theme_tufte(base_size = 12), - ggstatsplot.layer = FALSE, - annotation.args = list(title = "Race, religion, and political affiliation"), - plotgrid.args = list(nrow = 2) + ggstatsplot.layer = FALSE ) ``` @@ -1381,8 +1298,7 @@ different aspects of statistical analyses: The `statsExpressions` package forms the statistical backend that processes data and creates expressions containing results from -statistical tests and are by default displayed in as plot **subtitle** -and **caption**. +statistical tests. For more exhaustive documentation for this package, see: @@ -1398,8 +1314,8 @@ For more exhaustive documentation for this package, see: ## `ipmisc` -The `ipmisc` package contains some of the data wrangling/cleaning -functions and a few other miscellaneous functions. +The `ipmisc` package contains the data wrangling/cleaning functions and +a few other miscellaneous functions. For more exhaustive documentation for this package, see: @@ -1425,7 +1341,7 @@ package. The hexsticker was generously designed by Sarah Otterstetter (Max Planck Institute for Human Development, Berlin). This package has also benefited from the larger `rstats` community on Twitter and -StackOverflow. +`StackOverflow`. Thanks are also due to my postdoc advisers (Mina Cikara and Fiery Cushman at Harvard University; Iyad Rahwan at Max Planck Institute for diff --git a/docs/index.html b/docs/index.html index de28614f6..7369ae0da 100644 --- a/docs/index.html +++ b/docs/index.html @@ -538,39 +538,14 @@

📝 Defaults return

✅ raw data + distributions
✅ descriptive statistics
✅ inferential statistics
✅ effect size + CIs
✅ pairwise comparisons
✅ Bayesian hypothesis-testing
✅ Bayesian estimation

-

A number of other arguments can be specified to make this plot even more informative or change some of the default options.

+

A number of other arguments can be specified to make this plot even more informative or change some of the default options. Additionally, there is also a grouped_ variant of this function that makes it easy to repeat the same operation across a single grouping variable:

 # for reproducibility
 set.seed(123)
-library(ggplot2)
-
-# plot
-ggbetweenstats(
-  data = ToothGrowth,
-  x = supp,
-  y = len,
-  type = "r", # robust statistics
-  k = 3, # number of decimal places for statistical results
-  xlab = "Supplement type", # label for the x-axis variable
-  ylab = "Tooth length", # label for the y-axis variable
-  title = "The Effect of Vitamin C on Tooth Growth", # title text for the plot
-  ggtheme = ggthemes::theme_fivethirtyeight(), # choosing a different theme
-  ggstatsplot.layer = FALSE, # turn off `ggstatsplot` theme layer
-  package = "wesanderson", # package from which color palette is to be taken
-  palette = "Darjeeling1" # choosing a different color palette
-)
-

-

Additionally, there is also a grouped_ variant of this function that makes it easy to repeat the same operation across a single grouping variable:

-
-# for reproducibility
-set.seed(123)
 
 # plot
 grouped_ggbetweenstats(
-  data = dplyr::filter(
-    .data = movies_long,
-    genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy")
-  ),
+  data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")),
   x = mpaa,
   y = length,
   grouping.var = genre, # grouping variable
@@ -584,10 +559,10 @@ 

caption = substitute(paste(italic("Source"), ": IMDb (Internet Movie Database)")), palette = "default_jama", package = "ggsci", - plotgrid.args = list(nrow = 2), + plotgrid.args = list(nrow = 1), annotation.args = list(title = "Differences in movie length by mpaa ratings for different genres") )

-

+

Note here that the function can be used to tag outliers!

@@ -823,7 +798,7 @@

ggwithinstats

ggbetweenstats function has an identical twin function ggwithinstats for repeated measures designs that behaves in the same fashion with a few minor tweaks introduced to properly visualize the repeated measures design. As can be seen from an example below, the only difference between the plot structure is that now the group means are connected by paths to highlight the fact that these data are paired with each other.

-
+
 # for reproducibility and data
 set.seed(123)
 library(WRS2) # for data
@@ -873,7 +848,7 @@ 

As with the ggbetweenstats, this function also has a grouped_ variant that makes repeating the same analysis across a single grouping variable quicker. We will see an example with only repeated measurements-

-
+
 # common setup
 set.seed(123)
 
@@ -1124,7 +1099,7 @@ 

gghistostats

To visualize the distribution of a single variable and check if its mean is significantly different from a specified value with a one-sample test, gghistostats can be used.

-
+
 # for reproducibility
 set.seed(123)
 
@@ -1143,16 +1118,13 @@ 

📝 Defaults return

✅ counts + proportion for bins
✅ descriptive statistics
✅ inferential statistics
✅ effect size + CIs
✅ Bayesian hypothesis-testing
✅ Bayesian estimation

There is also a grouped_ variant of this function that makes it easy to repeat the same operation across a single grouping variable:

-
+
 # for reproducibility
 set.seed(123)
 
 # plot
 grouped_gghistostats(
-  data = dplyr::filter(
-    .data = movies_long,
-    genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy")
-  ),
+  data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")),
   x = budget,
   test.value = 50,
   type = "nonparametric",
@@ -1163,7 +1135,7 @@ 

ggtheme = ggthemes::theme_tufte(), # modify the defaults from `ggstatsplot` for each plot ggplot.component = ggplot2::labs(caption = "Source: IMDB.com"), - plotgrid.args = list(nrow = 2), + plotgrid.args = list(nrow = 1), annotation.args = list(title = "Movies budgets for different genres") )

@@ -1285,7 +1257,7 @@

ggdotplotstats

This function is similar to gghistostats, but is intended to be used when the numeric variable also has a label.

-
+
 # for reproducibility
 set.seed(123)
 
@@ -1309,7 +1281,7 @@ 

📝 Defaults return

✅ descriptives (mean + sample size)
✅ inferential statistics
✅ effect size + CIs
✅ Bayesian hypothesis-testing
✅ Bayesian estimation

As with the rest of the functions in this package, there is also a grouped_ variant of this function to facilitate looping the same operation for all levels of a single grouping variable.

-
+
 # for reproducibility
 set.seed(123)
 
@@ -1338,7 +1310,7 @@ 

ggscatterstats

This function creates a scatterplot with marginal distributions overlaid on the axes (from ggExtra::ggMarginal) and results from statistical tests in the subtitle:

-
+
 ggscatterstats(
   data = ggplot2::msleep,
   x = sleep_rem,
@@ -1359,13 +1331,13 @@ 

  • densigram (density + histogram)
  • Number of other arguments can be specified to modify this basic plot-

    -
    +
     # for reproducibility
     set.seed(123)
     
     # plot
     ggscatterstats(
    -  data = dplyr::filter(.data = movies_long, genre == "Action"),
    +  data = dplyr::filter(movies_long, genre == "Action"),
       x = budget,
       y = rating,
       type = "robust", # type of test that needs to be run
    @@ -1383,16 +1355,13 @@ 

    )

    Additionally, there is also a grouped_ variant of this function that makes it easy to repeat the same operation across a single grouping variable. Also, note that, as opposed to the other functions, this function does not return a ggplot object and any modification you want to make can be made in advance using ggplot.component argument (available for all functions, but especially useful here):

    -
    +
     # for reproducibility
     set.seed(123)
     
     # plot
     grouped_ggscatterstats(
    -  data = dplyr::filter(
    -    .data = movies_long,
    -    genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy")
    -  ),
    +  data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")),
       x = rating,
       y = length,
       grouping.var = genre, # grouping variable
    @@ -1403,8 +1372,8 @@ 

    ggplot.component = list( ggplot2::scale_x_continuous(breaks = seq(2, 9, 1), limits = (c(2, 9))) ), - plotgrid.args = list(nrow = 2), - annotation.args = list(title = "Relationship between movie length by IMDB ratings for different genres") + plotgrid.args = list(nrow = 1), + annotation.args = list(title = "Relationship between movie length and IMDB ratings") )

    @@ -1459,7 +1428,7 @@

    ggcorrmat

    ggcorrmat makes a correlalogram (a matrix of correlation coefficients) with minimal amount of code. Just sticking to the defaults itself produces publication-ready correlation matrices. But, for the sake of exploring the available options, let’s change some of the defaults. For example, multiple aesthetics-related arguments can be modified to change the appearance of the correlation matrix.

    -
    +
     # for reproducibility
     set.seed(123)
     
    @@ -1475,16 +1444,13 @@ 

    ✅ effect size + significance
    ✅ careful handling of NAs

    If there are NAs present in the selected variables, the legend will display minimum, median, and maximum number of pairs used for correlation tests.

    There is also a grouped_ variant of this function that makes it easy to repeat the same operation across a single grouping variable:

    -
    +
     # for reproducibility
     set.seed(123)
     
     # plot
     grouped_ggcorrmat(
    -  data = dplyr::filter(
    -    .data = movies_long,
    -    genre %in% c("Action", "Action Comedy", "Action Drama", "Comedy")
    -  ),
    +  data = dplyr::filter(movies_long, genre %in% c("Action", "Comedy")),
       type = "robust", # correlation method
       colors = c("#cbac43", "white", "#550000"),
       grouping.var = genre, # grouping variable
    @@ -1492,7 +1458,7 @@ 

    )

    You can also get a dataframe containing all relevant details from the statistical tests:

    -
    +
     # setup
     set.seed(123)
     
    @@ -1555,7 +1521,7 @@ 

    #> 14 Bayesian Pearson correlation 83 #> 15 Bayesian Pearson correlation 56

    Additionally, partial correlation are also supported:

    -
    +
     # setup
     set.seed(123)
     
    @@ -1676,7 +1642,7 @@ 

    This function creates a pie chart for categorical or nominal variables with results from contingency table analysis (Pearson’s chi-squared test for between-subjects design and McNemar’s chi-squared test for within-subjects design) included in the subtitle of the plot. If only one categorical variable is entered, results from one-sample proportion test (i.e., a chi-squared goodness of fit test) will be displayed as a subtitle.

    To study an interaction between two categorical variables:

    -
    +
     # for reproducibility
     set.seed(123)
     
    @@ -1685,6 +1651,8 @@ 

    data = mtcars, x = am, y = cyl, + package = "wesanderson", + palette = "Royal1", title = "Dataset: Motor Trend Car Road Tests", # title for the plot legend.title = "Transmission", # title for the legend caption = substitute(paste(italic("Source"), ": 1974 Motor Trend US magazine")) @@ -1692,50 +1660,21 @@

    📝 Defaults return

    ✅ descriptives (frequency + %s)
    ✅ inferential statistics
    ✅ effect size + CIs
    ✅ Goodness-of-fit tests
    ✅ Bayesian hypothesis-testing
    ✅ Bayesian estimation

    -

    In case of repeated measures designs, setting paired = TRUE will produce results from McNemar’s chi-squared test-

    -
    -# for reproducibility
    -set.seed(123)
    -
    -# data
    -df_paired <-
    -  data.frame(
    -    "before" = c("Approve", "Approve", "Disapprove", "Disapprove"),
    -    "after" = c("Approve", "Disapprove", "Approve", "Disapprove"),
    -    counts = c(794, 150, 86, 570),
    -    check.names = FALSE
    -  )
    -
    -# plot
    -ggpiestats(
    -  data = df_paired,
    -  x = before,
    -  y = after,
    -  counts = counts,
    -  title = "Survey results before and after the intervention",
    -  label = "both",
    -  paired = TRUE, # within-subjects design
    -  package = "wesanderson",
    -  palette = "Royal1"
    -)
    -

    -

    Additionally, there is also a grouped_ variant of this function that makes it easy to repeat the same operation across a single grouping variable. Following example is a case where the theoretical question is about proportions for different levels of a single nominal variable:

    -
    +

    There is also a grouped_ variant of this function that makes it easy to repeat the same operation across a single grouping variable. Following example is a case where the theoretical question is about proportions for different levels of a single nominal variable:

    +
     # for reproducibility
     set.seed(123)
     
     # plot
     grouped_ggpiestats(
    -  data = movies_long,
    -  x = genre,
    -  grouping.var = mpaa, # grouping variable
    +  data = mtcars,
    +  x = cyl,
    +  grouping.var = am, # grouping variable
       label.repel = TRUE, # repel labels (helpful for overlapping labels)
       package = "ggsci", # package from which color palette is to be taken
    -  palette = "default_ucscgb", # choosing a different color palette
    -  annotation.args = list(title = "Composition of MPAA ratings for different genres"),
    -  plotgrid.args = list(nrow = 2)
    +  palette = "default_ucscgb" # choosing a different color palette
     )
    -

    +

    Summary of tests

    @@ -1818,7 +1757,7 @@

    In case you are not a fan of pie charts (for very good reasons), you can alternatively use ggbarstats function which has a similar syntax.

    N.B. The p-values from one-sample proportion test are displayed on top of each bar.

    -
    +
     # for reproducibility
     set.seed(123)
     library(ggplot2)
    @@ -1839,33 +1778,20 @@ 

    📝 Defaults return

    ✅ descriptives (frequency + %s)
    ✅ inferential statistics
    ✅ effect size + CIs
    ✅ Goodness-of-fit tests
    ✅ Bayesian hypothesis-testing
    ✅ Bayesian estimation

    And, needless to say, there is also a grouped_ variant of this function-

    -
    +
     # setup
     set.seed(123)
     
    -# smaller dataset
    -df <-
    -  dplyr::filter(
    -    .data = forcats::gss_cat,
    -    race %in% c("Black", "White"),
    -    relig %in% c("Protestant", "Catholic", "None"),
    -    !partyid %in% c("No answer", "Don't know", "Other party")
    -  )
    -
     # plot
     grouped_ggbarstats(
    -  data = df,
    -  x = relig,
    -  y = partyid,
    -  grouping.var = race,
    -  label = "both",
    -  xlab = "Party affiliation",
    +  data = mtcars,
    +  x = am,
    +  y = cyl,
    +  grouping.var = vs,
       package = "wesanderson",
       palette = "Darjeeling2",
       ggtheme = ggthemes::theme_tufte(base_size = 12),
    -  ggstatsplot.layer = FALSE,
    -  annotation.args = list(title = "Race, religion, and political affiliation"),
    -  plotgrid.args = list(nrow = 2)
    +  ggstatsplot.layer = FALSE
     )

    @@ -1886,7 +1812,7 @@

  • The caption will contain diagnostic information, if available, about models that can be useful for model selection: The smaller the Akaike’s Information Criterion (AIC) and the Bayesian Information Criterion (BIC) values, the “better” the model is.

  • The output of this function will be a ggplot2 object and, thus, it can be further modified (e.g., change themes, etc.) with ggplot2 functions.

  • -
    +
     # for reproducibility
     set.seed(123)
     
    @@ -1899,7 +1825,7 @@ 

    📝 Defaults return

    ✅ inferential statistics
    ✅ estimate + CIs
    ✅ model summary (AIC + BIC)

    This default plot can be further modified to one’s liking with additional arguments (also, let’s use a different model now):

    -
    +
     # for reproducibility
     set.seed(123)
     
    @@ -1985,7 +1911,7 @@ 

    Using ggstatsplot statistical details with custom plots

    Sometimes you may not like the default plots produced by ggstatsplot. In such cases, you can use other custom plots (from ggplot2 or other plotting packages) and still use ggstatsplot functions to display results from relevant statistical test.

    For example, in the following chunk, we will create plot (ridgeplot) using ggridges package and use ggstatsplot function for extracting results.

    -
    +
     # loading the needed libraries
     set.seed(123)
     library(ggridges)
    @@ -2063,7 +1989,7 @@ 

    statsExpressions

    -

    The statsExpressions package forms the statistical backend that processes data and creates expressions containing results from statistical tests and are by default displayed in as plot subtitle and caption.

    +

    The statsExpressions package forms the statistical backend that processes data and creates expressions containing results from statistical tests.

    For more exhaustive documentation for this package, see: https://indrajeetpatil.github.io/statsExpressions/

    @@ -2077,7 +2003,7 @@

    ipmisc

    -

    The ipmisc package contains some of the data wrangling/cleaning functions and a few other miscellaneous functions.

    +

    The ipmisc package contains the data wrangling/cleaning functions and a few other miscellaneous functions.

    For more exhaustive documentation for this package, see: https://indrajeetpatil.github.io/ipmisc/

    @@ -2090,7 +2016,7 @@

    Acknowledgments

    I would like to thank all the contributors to ggstatsplot who pointed out bugs or requested features I hadn’t considered. I would especially like to thank other package developers (especially Daniel Lüdecke, Dominique Makowski, Mattan S. Ben-Shachar, Patrick Mair, Salvatore Mangiafico, etc.) who have patiently and diligently answered my relentless number of questions and added feature requests I wanted. I also want to thank Chuck Powell for his initial contributions to the package.

    -

    The hexsticker was generously designed by Sarah Otterstetter (Max Planck Institute for Human Development, Berlin). This package has also benefited from the larger rstats community on Twitter and StackOverflow.

    +

    The hexsticker was generously designed by Sarah Otterstetter (Max Planck Institute for Human Development, Berlin). This package has also benefited from the larger rstats community on Twitter and StackOverflow.

    Thanks are also due to my postdoc advisers (Mina Cikara and Fiery Cushman at Harvard University; Iyad Rahwan at Max Planck Institute for Human Development) who patiently supported me spending hundreds of hours working on this package rather than what I was paid to do. 😄

    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 8243d066f..7a35d21d8 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,6 +1,6 @@ -pandoc: '2.13' +pandoc: 2.11.4 pkgdown: 1.6.1.9001 -pkgdown_sha: ddafb4ac3eff2ec4e5988b6b13bc4585e9df186c +pkgdown_sha: 3dd1a1ad7740977491241c89eee15d9b58e75866 articles: additional: additional.html web_only/benchmarking: benchmarking.html @@ -21,7 +21,7 @@ articles: web_only/purrr_examples: purrr_examples.html web_only/session_info: session_info.html web_only/theme_ggstatsplot: theme_ggstatsplot.html -last_built: 2021-04-06T11:38Z +last_built: 2021-04-12T17:40Z urls: reference: https://indrajeetpatil.github.io/ggstatsplot/reference article: https://indrajeetpatil.github.io/ggstatsplot/articles diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png index a0cb562b9..17a358060 100644 Binary files a/docs/reference/Rplot001.png and b/docs/reference/Rplot001.png differ diff --git a/docs/reference/Titanic_full.html b/docs/reference/Titanic_full.html index a849332f1..074a2e613 100644 --- a/docs/reference/Titanic_full.html +++ b/docs/reference/Titanic_full.html @@ -255,11 +255,11 @@

    Examp #> 6 6 3rd Male Child No

    dplyr::glimpse(Titanic_full)
    #> Rows: 2,201 #> Columns: 5 -#> $ id <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18~ -#> $ Class <fct> 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3~ -#> $ Sex <fct> Male, Male, Male, Male, Male, Male, Male, Male, Male, Male, M~ -#> $ Age <fct> Child, Child, Child, Child, Child, Child, Child, Child, Child~ -#> $ Survived <fct> No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, N~
    +#> $ id <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18… +#> $ Class <fct> 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3rd, 3… +#> $ Sex <fct> Male, Male, Male, Male, Male, Male, Male, Male, Male, Male, M… +#> $ Age <fct> Child, Child, Child, Child, Child, Child, Child, Child, Child… +#> $ Survived <fct> No, No, No, No, No, No, No, No, No, No, No, No, No, No, No, N…

    dplyr::glimpse(VR_dilemma)
    #> Rows: 68 #> Columns: 4 -#> $ id <dbl> 1, 6, 7, 8, 9, 10, 12, 14, 15, 17, 20, 22, 28, 31, 34, 35, 36~ -#> $ order <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "~ -#> $ modality <chr> "text", "text", "text", "text", "text", "text", "text", "text~ -#> $ score <dbl> 0.25, 1.00, 1.00, 1.00, 0.50, 0.75, 1.00, 1.00, 0.75, 0.00, 0~
    +#> $ id <dbl> 1, 6, 7, 8, 9, 10, 12, 14, 15, 17, 20, 22, 28, 31, 34, 35, 36… +#> $ order <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "… +#> $ modality <chr> "text", "text", "text", "text", "text", "text", "text", "text… +#> $ score <dbl> 0.25, 1.00, 1.00, 1.00, 0.50, 0.75, 1.00, 1.00, 0.75, 0.00, 0…

    dplyr::glimpse(bugs_long)
    #> Rows: 372 #> Columns: 6 -#> $ subject <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1~ -#> $ gender <fct> Female, Female, Female, Female, Female, Female, Female, Fema~ -#> $ region <fct> North America, North America, Europe, North America, North A~ -#> $ education <fct> some, advance, college, college, some, some, some, high, hig~ -#> $ condition <chr> "LDLF", "LDLF", "LDLF", "LDLF", "LDLF", "LDLF", "LDLF", "LDL~ -#> $ desire <dbl> 6.0, 10.0, 5.0, 6.0, 3.0, 2.0, 10.0, 10.0, 9.5, 8.5, 0.0, 9.~

    +#> $ subject <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1… +#> $ gender <fct> Female, Female, Female, Female, Female, Female, Female, Fema… +#> $ region <fct> North America, North America, Europe, North America, North A… +#> $ education <fct> some, advance, college, college, some, some, some, high, hig… +#> $ condition <chr> "LDLF", "LDLF", "LDLF", "LDLF", "LDLF", "LDLF", "LDLF", "LDL… +#> $ desire <dbl> 6.0, 10.0, 5.0, 6.0, 3.0, 2.0, 10.0, 10.0, 9.5, 8.5, 0.0, 9.…
    dplyr::glimpse(bugs_wide)
    #> Rows: 93 #> Columns: 8 -#> $ subject <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1~ -#> $ gender <fct> Female, Female, Female, Female, Female, Female, Female, Fema~ -#> $ region <fct> North America, North America, Europe, North America, North A~ -#> $ education <fct> some, advance, college, college, some, some, some, high, hig~ -#> $ ldlf <dbl> 6.0, 10.0, 5.0, 6.0, 3.0, 2.0, 10.0, 10.0, 9.5, 8.5, 0.0, 9.~ -#> $ ldhf <dbl> 6.0, NA, 10.0, 9.0, 6.5, 0.5, 10.0, 10.0, 9.5, 10.0, 2.5, 7.~ -#> $ hdlf <dbl> 9.0, 10.0, 10.0, 6.0, 5.5, 7.5, 10.0, 9.0, 6.0, 7.0, 0.0, 8.~ -#> $ hdhf <dbl> 10.0, 10.0, 10.0, 9.0, 8.5, 3.0, 10.0, 10.0, 10.0, NA, 0.0, ~
    +#> $ subject <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1… +#> $ gender <fct> Female, Female, Female, Female, Female, Female, Female, Fema… +#> $ region <fct> North America, North America, Europe, North America, North A… +#> $ education <fct> some, advance, college, college, some, some, some, high, hig… +#> $ ldlf <dbl> 6.0, 10.0, 5.0, 6.0, 3.0, 2.0, 10.0, 10.0, 9.5, 8.5, 0.0, 9.… +#> $ ldhf <dbl> 6.0, NA, 10.0, 9.0, 6.5, 0.5, 10.0, 10.0, 9.5, 10.0, 2.5, 7.… +#> $ hdlf <dbl> 9.0, 10.0, 10.0, 6.0, 5.5, 7.5, 10.0, 9.0, 6.0, 7.0, 0.0, 8.… +#> $ hdhf <dbl> 10.0, 10.0, 10.0, 9.0, 8.5, 3.0, 10.0, 10.0, 10.0, NA, 0.0, …

    #> # A tibble: 15 x 11 -#> parameter1 parameter2 estimate conf.level conf.low conf.high statistic +#> parameter1 parameter2 estimate conf.level conf.low conf.high statistic #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 sleep_total sleep_rem 0.314 0.95 -0.0520 0.606 1.75 -#> 2 sleep_total sleep_cycle -0.0225 0.95 -0.380 0.341 -0.119 -#> 3 sleep_total awake -1 0.95 -1 -1 -Inf -#> 4 sleep_total brainwt -0.0970 0.95 -0.442 0.273 -0.516 -#> 5 sleep_total bodywt -0.179 0.95 -0.506 0.194 -0.961 -#> 6 sleep_rem sleep_cycle -0.0766 0.95 -0.425 0.292 -0.407 -#> 7 sleep_rem awake 0.0560 0.95 -0.311 0.408 0.297 -#> 8 sleep_rem brainwt 0.0857 0.95 -0.283 0.433 0.455 -#> 9 sleep_rem bodywt -0.0341 0.95 -0.390 0.330 -0.181 -#> 10 sleep_cycle awake -0.00479 0.95 -0.364 0.356 -0.0253 -#> 11 sleep_cycle brainwt 0.801 0.95 0.620 0.901 7.08 -#> 12 sleep_cycle bodywt -0.0949 0.95 -0.440 0.275 -0.505 -#> 13 awake brainwt -0.0957 0.95 -0.441 0.274 -0.509 -#> 14 awake bodywt -0.448 0.95 -0.696 -0.104 -2.65 -#> 15 brainwt bodywt 0.252 0.95 -0.119 0.561 1.38 -#> # … with 4 more variables: df.error <int>, p.value <dbl>, method <chr>, -#> # n.obs <int>
    # } +#> 1 sleep_total sleep_rem 0.314 0.95 -0.0520 0.606 1.75 +#> 2 sleep_total sleep_cycle -0.0225 0.95 -0.380 0.341 -0.119 +#> 3 sleep_total awake -1 0.95 -1 -1 -Inf +#> 4 sleep_total brainwt -0.0970 0.95 -0.442 0.273 -0.516 +#> 5 sleep_total bodywt -0.179 0.95 -0.506 0.194 -0.961 +#> 6 sleep_rem sleep_cycle -0.0766 0.95 -0.425 0.292 -0.407 +#> 7 sleep_rem awake 0.0560 0.95 -0.311 0.408 0.297 +#> 8 sleep_rem brainwt 0.0857 0.95 -0.283 0.433 0.455 +#> 9 sleep_rem bodywt -0.0341 0.95 -0.390 0.330 -0.181 +#> 10 sleep_cycle awake -0.00479 0.95 -0.364 0.356 -0.0253 +#> 11 sleep_cycle brainwt 0.801 0.95 0.620 0.901 7.08 +#> 12 sleep_cycle bodywt -0.0949 0.95 -0.440 0.275 -0.505 +#> 13 awake brainwt -0.0957 0.95 -0.441 0.274 -0.509 +#> 14 awake bodywt -0.448 0.95 -0.696 -0.104 -2.65 +#> 15 brainwt bodywt 0.252 0.95 -0.119 0.561 1.38 +#> df.error p.value method n.obs +#> <int> <dbl> <chr> <int> +#> 1 28 1 Pearson correlation 30 +#> 2 28 1 Pearson correlation 30 +#> 3 28 0 Pearson correlation 30 +#> 4 28 1 Pearson correlation 30 +#> 5 28 1 Pearson correlation 30 +#> 6 28 1 Pearson correlation 30 +#> 7 28 1 Pearson correlation 30 +#> 8 28 1 Pearson correlation 30 +#> 9 28 1 Pearson correlation 30 +#> 10 28 1 Pearson correlation 30 +#> 11 28 0.00000148 Pearson correlation 30 +#> 12 28 1 Pearson correlation 30 +#> 13 28 1 Pearson correlation 30 +#> 14 28 0.170 Pearson correlation 30 +#> 15 28 1 Pearson correlation 30
    # }
    #> Loading required package: ggExtra
    +
    #> Loading required package: ggExtra
    #> +#> Attaching package: ‘ggExtra’
    #> The following object is masked from ‘package:shiny’: +#> +#> runExample
    #> Warning: Series not converged.
    #> Warning: Series not converged.
    #> Warning: Series not converged.
    #> Warning: Series not converged.
    #> # A tibble: 60 x 15 -#> vore parameter1 parameter2 estimate conf.level conf.low conf.high pd +#> vore parameter1 parameter2 estimate conf.level conf.low conf.high pd #> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 carni sleep_total sleep_rem 0.845 0.95 0.641 0.961 1 -#> 2 carni sleep_total sleep_cycle 0.204 0.95 -0.351 0.764 0.698 -#> 3 carni sleep_total awake -1.00 0.95 -1.00 -1.00 1 -#> 4 carni sleep_total brainwt -0.382 0.95 -0.759 0.0549 0.895 -#> 5 carni sleep_total bodywt -0.379 0.95 -0.662 -0.0654 0.960 -#> 6 carni sleep_rem sleep_cycle 0.0548 0.95 -0.534 0.587 0.562 -#> 7 carni sleep_rem awake -0.848 0.95 -0.962 -0.678 1 -#> 8 carni sleep_rem brainwt -0.308 0.95 -0.760 0.252 0.804 -#> 9 carni sleep_rem bodywt -0.371 0.95 -0.716 0.0694 0.899 -#> 10 carni sleep_cycle awake -0.205 0.95 -0.754 0.373 0.690 -#> # … with 50 more rows, and 7 more variables: rope.percentage <dbl>, -#> # prior.distribution <chr>, prior.location <dbl>, prior.scale <dbl>, -#> # bayes.factor <dbl>, method <chr>, n.obs <int>
    # } +#> 1 carni sleep_total sleep_rem 0.845 0.95 0.641 0.961 1 +#> 2 carni sleep_total sleep_cycle 0.204 0.95 -0.351 0.764 0.698 +#> 3 carni sleep_total awake -1.00 0.95 -1.00 -1.00 1 +#> 4 carni sleep_total brainwt -0.382 0.95 -0.759 0.0549 0.895 +#> 5 carni sleep_total bodywt -0.379 0.95 -0.662 -0.0654 0.960 +#> 6 carni sleep_rem sleep_cycle 0.0548 0.95 -0.534 0.587 0.562 +#> 7 carni sleep_rem awake -0.848 0.95 -0.962 -0.678 1 +#> 8 carni sleep_rem brainwt -0.308 0.95 -0.760 0.252 0.804 +#> 9 carni sleep_rem bodywt -0.371 0.95 -0.716 0.0694 0.899 +#> 10 carni sleep_cycle awake -0.205 0.95 -0.754 0.373 0.690 +#> rope.percentage prior.distribution prior.location prior.scale bayes.factor +#> <dbl> <chr> <dbl> <dbl> <dbl> +#> 1 0 beta 1.41 1.41 112. +#> 2 0.168 beta 1.41 1.41 0.714 +#> 3 0 beta 1.41 1.41 NA +#> 4 0.116 beta 1.41 1.41 1.13 +#> 5 0.078 beta 1.41 1.41 1.72 +#> 6 0.206 beta 1.41 1.41 0.621 +#> 7 0.0118 beta 1.41 1.41 112. +#> 8 0.136 beta 1.41 1.41 0.848 +#> 9 0.124 beta 1.41 1.41 1.03 +#> 10 0.165 beta 1.41 1.41 0.714 +#> method n.obs +#> <chr> <int> +#> 1 Bayesian Pearson correlation 10 +#> 2 Bayesian Pearson correlation 5 +#> 3 Bayesian Pearson correlation 19 +#> 4 Bayesian Pearson correlation 9 +#> 5 Bayesian Pearson correlation 19 +#> 6 Bayesian Pearson correlation 5 +#> 7 Bayesian Pearson correlation 10 +#> 8 Bayesian Pearson correlation 6 +#> 9 Bayesian Pearson correlation 10 +#> 10 Bayesian Pearson correlation 5 +#> # … with 50 more rows
    # }
    dplyr::glimpse(iris_long)
    #> Rows: 600 #> Columns: 6 -#> $ id <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1~ -#> $ Species <fct> setosa, setosa, setosa, setosa, setosa, setosa, setosa, seto~ -#> $ condition <fct> Sepal.Length, Sepal.Length, Sepal.Length, Sepal.Length, Sepa~ -#> $ attribute <fct> Sepal, Sepal, Sepal, Sepal, Sepal, Sepal, Sepal, Sepal, Sepa~ -#> $ measure <fct> Length, Length, Length, Length, Length, Length, Length, Leng~ -#> $ value <dbl> 5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.6, 5.0, 4.4, 4.9, 5.4, 4.8, ~
    +#> $ id <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1… +#> $ Species <fct> setosa, setosa, setosa, setosa, setosa, setosa, setosa, seto… +#> $ condition <fct> Sepal.Length, Sepal.Length, Sepal.Length, Sepal.Length, Sepa… +#> $ attribute <fct> Sepal, Sepal, Sepal, Sepal, Sepal, Sepal, Sepal, Sepal, Sepa… +#> $ measure <fct> Length, Length, Length, Length, Length, Length, Length, Leng… +#> $ value <dbl> 5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.6, 5.0, 4.4, 4.9, 5.4, 4.8, …

    dplyr::glimpse(movies_long)
    #> Rows: 1,579 #> Columns: 8 -#> $ title <chr> "Shawshank Redemption, The", "Lord of the Rings: The Return of ~ -#> $ year <int> 1994, 2003, 2001, 2002, 1994, 1993, 1977, 1980, 1968, 2002, 196~ -#> $ length <int> 142, 251, 208, 223, 168, 195, 125, 129, 158, 135, 93, 113, 108,~ -#> $ budget <dbl> 25.0, 94.0, 93.0, 94.0, 8.0, 25.0, 11.0, 18.0, 5.0, 3.3, 1.8, 5~ -#> $ rating <dbl> 9.1, 9.0, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.7, 8.7, 8.7, 8.7, 8.6~ -#> $ votes <int> 149494, 103631, 157608, 114797, 132745, 97667, 134640, 103706, ~ -#> $ mpaa <fct> R, PG-13, PG-13, PG-13, R, R, PG, PG, PG-13, R, PG, R, R, R, R,~ -#> $ genre <fct> Drama, Action, Action, Action, Drama, Drama, Action, Action, Dr~
    +#> $ title <chr> "Shawshank Redemption, The", "Lord of the Rings: The Return of … +#> $ year <int> 1994, 2003, 2001, 2002, 1994, 1993, 1977, 1980, 1968, 2002, 196… +#> $ length <int> 142, 251, 208, 223, 168, 195, 125, 129, 158, 135, 93, 113, 108,… +#> $ budget <dbl> 25.0, 94.0, 93.0, 94.0, 8.0, 25.0, 11.0, 18.0, 5.0, 3.3, 1.8, 5… +#> $ rating <dbl> 9.1, 9.0, 8.8, 8.8, 8.8, 8.8, 8.8, 8.8, 8.7, 8.7, 8.7, 8.7, 8.6… +#> $ votes <int> 149494, 103631, 157608, 114797, 132745, 97667, 134640, 103706, … +#> $ mpaa <fct> R, PG-13, PG-13, PG-13, R, R, PG, PG, PG-13, R, PG, R, R, R, R,… +#> $ genre <fct> Drama, Action, Action, Action, Drama, Drama, Action, Action, Dr…
    dplyr::glimpse(movies_wide)
    #> Rows: 1,579 #> Columns: 13 -#> $ title <chr> "'Til There Was You", "10 Things I Hate About You", "100 Mil~ -#> $ year <int> 1997, 1999, 2002, 2004, 1999, 2001, 1972, 2003, 1999, 2000, ~ -#> $ length <int> 113, 97, 98, 98, 102, 120, 180, 107, 101, 99, 129, 124, 93, ~ -#> $ budget <dbl> 23.0, 16.0, 1.1, 37.0, 85.0, 42.0, 4.0, 76.0, 6.0, 26.0, 12.~ -#> $ rating <dbl> 4.8, 6.7, 5.6, 6.4, 6.1, 6.1, 7.3, 5.1, 5.4, 2.5, 7.6, 8.0, ~ -#> $ votes <int> 799, 19095, 181, 7859, 14344, 10866, 1754, 9556, 4514, 2023,~ -#> $ mpaa <fct> PG-13, PG-13, R, PG-13, R, R, PG, PG-13, R, R, R, R, R, R, P~ -#> $ Action <int> 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, ~ -#> $ Animation <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ~ -#> $ Comedy <int> 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, ~ -#> $ Drama <int> 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, ~ -#> $ Romance <int> 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, ~ -#> $ NumGenre <int> 2, 2, 1, 3, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 3, 2, 2, 1, ~
    +#> $ title <chr> "'Til There Was You", "10 Things I Hate About You", "100 Mil… +#> $ year <int> 1997, 1999, 2002, 2004, 1999, 2001, 1972, 2003, 1999, 2000, … +#> $ length <int> 113, 97, 98, 98, 102, 120, 180, 107, 101, 99, 129, 124, 93, … +#> $ budget <dbl> 23.0, 16.0, 1.1, 37.0, 85.0, 42.0, 4.0, 76.0, 6.0, 26.0, 12.… +#> $ rating <dbl> 4.8, 6.7, 5.6, 6.4, 6.1, 6.1, 7.3, 5.1, 5.4, 2.5, 7.6, 8.0, … +#> $ votes <int> 799, 19095, 181, 7859, 14344, 10866, 1754, 9556, 4514, 2023,… +#> $ mpaa <fct> PG-13, PG-13, R, PG-13, R, R, PG, PG-13, R, R, R, R, R, R, P… +#> $ Action <int> 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, … +#> $ Animation <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … +#> $ Comedy <int> 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, … +#> $ Drama <int> 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, … +#> $ Romance <int> 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, … +#> $ NumGenre <int> 2, 2, 1, 3, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 3, 2, 2, 1, …