Learn R Programming

statsExpressions (version 1.3.2)

centrality_description: Dataframe and expression for distribution properties

Description

The table below provides summary about:

  • statistical test carried out for inferential statistics

  • type of effect size estimate and a measure of uncertainty for this estimate

  • functions used internally to compute these details

TypeMeasureFunction used
Parametricmeanparameters::describe_distribution()
Non-parametricmedianparameters::describe_distribution()
Robusttrimmed meanparameters::describe_distribution()
BayesianMAP (maximum a posteriori probability) estimateparameters::describe_distribution()

Usage

centrality_description(data, x, y, type = "parametric", tr = 0.2, k = 2L, ...)

Arguments

data

A data frame (or a tibble) from which variables specified are to be taken. Other data types (e.g., matrix,table, array, etc.) will not be accepted. Additionally, grouped data frames from {dplyr} should be ungrouped before they are entered as data.

x

The grouping (or independent) variable in data.

y

The response (or outcome or dependent) variable from data.

type

A character specifying the type of statistical approach:

  • "parametric"

  • "nonparametric"

  • "robust"

  • "bayes"

You can specify just the initial letter.

tr

Trim level for the mean when carrying out robust tests. In case of an error, try reducing the value of tr, which is by default set to 0.2. Lowering the value might help.

k

Number of digits after decimal point (should be an integer) (Default: k = 2L).

...

Currently ignored.

Details

This function describes a distribution for y variable for each level of the grouping variable in x by a set of indices (e.g., measures of centrality, dispersion, range, skewness, kurtosis, etc.). It additionally returns an expression containing a specified centrality measure. The function internally relies on datawizard::describe_distribution() function.

Examples

Run this code

set.seed(123)

# parametric -----------------------
centrality_description(iris, Species, Sepal.Length)

# non-parametric -------------------
centrality_description(mtcars, am, wt, type = "n")

# robust ---------------------------
centrality_description(ToothGrowth, supp, len, type = "r")

# Bayesian -------------------------
centrality_description(sleep, group, extra, type = "b")

Run the code above in your browser using DataLab