goodness: Evaluate if sample data for a categorical variable is...

View source: R/goodness.R

goodnessR Documentation

Evaluate if sample data for a categorical variable is consistent with a hypothesized distribution

Description

Evaluate if sample data for a categorical variable is consistent with a hypothesized distribution

Usage

goodness(
  dataset,
  var,
  p = NULL,
  tab = NULL,
  data_filter = "",
  envir = parent.frame()
)

Arguments

dataset

Dataset

var

A categorical variable

p

Hypothesized distribution as a number, fraction, or numeric vector. If unspecified, defaults to an even distribution

tab

Table with frequencies as alternative to dataset

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000")

envir

Environment to extract data from

Details

See https://radiant-rstats.github.io/docs/basics/goodness.html for an example in Radiant

Value

A list of all variables used in goodness as an object of class goodness

See Also

summary.goodness to summarize results

plot.goodness to plot results

Examples

goodness(newspaper, "Income") %>% str()
goodness(newspaper, "Income", p = c(3 / 4, 1 / 4)) %>% str()
table(select(newspaper, Income)) %>% goodness(tab = .)


radiant-rstats/radiant.basic documentation built on Jan. 19, 2024, 12:07 p.m.