Title: | Hypothesis Tests and Statistical Distributions for 'SciViews::R' |
---|---|
Description: | Statistical distributions (including their visual representation) and hypothesis tests with rich-formatted tabular outputs for the 'SciViews::R' dialect. |
Authors: | Philippe Grosjean [aut, cre] , Guyliann Engels [aut] |
Maintainer: | Philippe Grosjean <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.1 |
Built: | 2024-10-27 04:57:00 UTC |
Source: | https://github.com/SciViews/inferit |
Statistical distributions and hypothesis tests objects with rich-formatted charts and tables.
tabularise()
methods for htest objects.
stddev()
for distribution objects.
chart()
method for distribution objects.
geom_funfill()
fills a part of a distribution density function.
The distribution objects represent one or more statistical distributions.
The functions dfun()
and geom_funfill()
, together with chart()
allow to
plot them.
dfun(object, i = 1) cdfun(object, i = 1) ## S3 method for class 'distribution' autoplot( object, n = 500, xlim = NULL, size = 99.5, xlab = "Quantile", ylab = if (type == "density") "Probability density" else "Cumulative probability density", plot.it = TRUE, use.chart = FALSE, ..., type = "density", theme = NULL ) ## S3 method for class 'distribution' chart(data, ..., type = "density", env = parent.frame()) geom_funfill( mapping = NULL, data = NULL, fun, from, to, geom = "area", fill = "salmon", alpha = 0.5, ... )
dfun(object, i = 1) cdfun(object, i = 1) ## S3 method for class 'distribution' autoplot( object, n = 500, xlim = NULL, size = 99.5, xlab = "Quantile", ylab = if (type == "density") "Probability density" else "Cumulative probability density", plot.it = TRUE, use.chart = FALSE, ..., type = "density", theme = NULL ) ## S3 method for class 'distribution' chart(data, ..., type = "density", env = parent.frame()) geom_funfill( mapping = NULL, data = NULL, fun, from, to, geom = "area", fill = "salmon", alpha = 0.5, ... )
object |
A distribution object, as from the {distributional} package. |
i |
The distribution to use from the list (first one by default) |
n |
The number of points to use to draw the density functions (500 by default) of continuous distributions. |
xlim |
Two numbers that limit the X axis. |
size |
If |
xlab |
The label of the X axis ("Quantile" by default). |
ylab |
The label of the Y axis ("Probability density" or "Cumulative probability density" by default). |
plot.it |
Should the densities be plotted for all the distributions
( |
use.chart |
Should |
... |
Further arguments to |
type |
The type of plot ("density" by default, or "cumulative"). |
theme |
The theme for the plot (ignored for now). |
data |
The data frame to use ( |
env |
The environment to use to evaluate expressions. |
mapping |
the mapping to use ( |
fun |
The function to use (could be |
from |
The first quantile to delimit the filled area. |
to |
The second quantile to delimit the filled area. |
geom |
The geom to use ( |
fill |
The color to fill the area ( |
alpha |
The alpha transparency to apply, 0.5 by default. |
Either a function or a ggplot object.
library(distributional) library(chart) di1 <- dist_normal(mu = 1, sigma = 1.5) chart(di1) + geom_funfill(fun = dfun(di1), from = -5, to = 1) # With two distributions di2 <- c(dist_normal(10, 1), dist_student_t(df = 3, 13, 1)) chart(di2) + geom_funfill(fun = dfun(di2, 1), from = -5, to = 0) + geom_funfill(fun = dfun(di2, 2), from = 2, to = 6, fill = "turquoise3") chart$cumulative(di2) # A discrete distribution di3 <- dist_binomial(size = 7, prob = 0.5) chart(di3) chart$cumulative(di3) # A continuous together with a discrete distribution di4 <- c(dist_normal(mu = 4, sigma = 2), dist_binomial(size = 8, prob = 0.5)) chart(di4) chart$cumulative(di4)
library(distributional) library(chart) di1 <- dist_normal(mu = 1, sigma = 1.5) chart(di1) + geom_funfill(fun = dfun(di1), from = -5, to = 1) # With two distributions di2 <- c(dist_normal(10, 1), dist_student_t(df = 3, 13, 1)) chart(di2) + geom_funfill(fun = dfun(di2, 1), from = -5, to = 0) + geom_funfill(fun = dfun(di2, 2), from = 2, to = 6, fill = "turquoise3") chart$cumulative(di2) # A discrete distribution di3 <- dist_binomial(size = 7, prob = 0.5) chart(di3) chart$cumulative(di3) # A continuous together with a discrete distribution di4 <- c(dist_normal(mu = 4, sigma = 2), dist_binomial(size = 8, prob = 0.5)) chart(di4) chart$cumulative(di4)
The distribution objects represent one or more statistical distributions.
The generic functions stddev()
returns the standard deviation for these
distributions.
stddev(x, ...) ## Default S3 method: stddev(x, ...) ## S3 method for class 'distribution' stddev(x, ...)
stddev(x, ...) ## Default S3 method: stddev(x, ...) ## S3 method for class 'distribution' stddev(x, ...)
x |
A distribution object, as from the {distributional} package. |
... |
Further arguments (not used yet). |
A numeric vector with one or more standard deviations.
library(distributional) n1 <- dist_normal(mu = 1, sigma = 1.5) n1 class(n1) family(n1) mean(n1) variance(n1) stddev(n1)
library(distributional) n1 <- dist_normal(mu = 1, sigma = 1.5) n1 class(n1) family(n1) mean(n1) variance(n1) stddev(n1)
tabularise()
an htest object (into a a flextable) that can be
further post-edited..
## S3 method for class 'htest' tabularise_default( data, header = TRUE, title = NULL, lang = getOption("data.io_lang", "en"), show.signif.stars = getOption("show.signif.stars", TRUE), ..., kind = "ft", env = parent.frame() )
## S3 method for class 'htest' tabularise_default( data, header = TRUE, title = NULL, lang = getOption("data.io_lang", "en"), show.signif.stars = getOption("show.signif.stars", TRUE), ..., kind = "ft", env = parent.frame() )
data |
An htest object |
header |
If |
title |
If |
lang |
The natural language to use. The default value can be set with,
e.g., |
show.signif.stars |
If |
... |
Additional arguments (unused for now). |
kind |
The kind of table to produce: "tt" for tinytable, or "ft" for flextable (default). |
env |
The environment where to evaluate lazyeval expressions (unused for now). |
A flextable object you can print in different forms or rearrange with the {flextable} functions.
data(iris) iris_cor <- cor.test(iris$Sepal.Length, iris$Sepal.Width) tabularise::tabularise(iris_cor) tabularise::tabularise(t.test(x = 1:10, y = 7:20), lang = "fr")
data(iris) iris_cor <- cor.test(iris$Sepal.Length, iris$Sepal.Width) tabularise::tabularise(iris_cor) tabularise::tabularise(t.test(x = 1:10, y = 7:20), lang = "fr")