Summary method for the goodness function

# S3 method for goodness
summary(object, check = "", dec = 2, ...)

Arguments

object

Return value from goodness

check

Show table(s) for the selected variable (var). "observed" for the observed frequencies table, "expected" for the expected frequencies table (i.e., frequencies that would be expected if the null hypothesis holds), "chi_sq" for the contribution to the overall chi-squared statistic for each cell (i.e., (o - e)^2 / e), "dev_std" for the standardized differences between the observed and expected frequencies (i.e., (o - e) / sqrt(e)), and "dev_perc" for the percentage difference between the observed and expected frequencies (i.e., (o - e) / e)

dec

Number of decimals to show

...

further arguments passed to or from other methods.

Details

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

See also

goodness to calculate results

plot.goodness to plot results

Examples

result <- goodness(newspaper, "Income", c(.3, .7)) summary(result, check = c("observed", "expected", "chi_sq"))
#> Goodness of fit test #> Data : newspaper #> Variable : Income #> Specified: 0.3 0.7 #> Null hyp.: the distribution of Income is consistent with the specified distribution #> Alt. hyp.: the distribution of Income is not consistent with the specified distribution #> #> Observed: #> Low Income High Income Total #> 359 221 580 #> #> Expected: total x p #> Low Income High Income Total #> 174 406 580 #> #> Contribution to chi-squared: (o - e)^2 / e #> Low Income High Income Total #> 196.70 84.30 280.99 #> #> Chi-squared: 280.993 df(1), p.value < .001 #> #> 0.0 % of cells have expected values below 5
goodness(newspaper, "Income", c(1/3, 2/3)) %>% summary("observed")
#> Goodness of fit test #> Data : newspaper #> Variable : Income #> Specified: 0.3333333 0.6666667 #> Null hyp.: the distribution of Income is consistent with the specified distribution #> Alt. hyp.: the distribution of Income is not consistent with the specified distribution #> #> Observed: #> Low Income High Income Total #> 359 221 580 #> #> Chi-squared: 212.939 df(1), p.value < .001 #> #> 0.0 % of cells have expected values below 5