Compare a sample mean to a population mean

single_mean(
  dataset,
  var,
  comp_value = 0,
  alternative = "two.sided",
  conf_lev = 0.95,
  data_filter = "",
  envir = parent.frame()
)

Arguments

dataset

Dataset

var

The variable selected for the mean comparison

comp_value

Population value to compare to the sample mean

alternative

The alternative hypothesis ("two.sided", "greater", or "less")

conf_lev

Span for the confidence interval

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

Value

A list of variables defined in single_mean as an object of class single_mean

Details

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

See also

summary.single_mean to summarize results

plot.single_mean to plot results

Examples

single_mean(diamonds, "price") %>% str()
#> List of 9 #> $ dat_summary: tibble [1 × 7] (S3: tbl_df/tbl/data.frame) #> ..$ diff : num 3907 #> ..$ mean : num 3907 #> ..$ n : int 3000 #> ..$ n_missing: int 0 #> ..$ sd : num 3957 #> ..$ se : num 72.2 #> ..$ me : num 142 #> $ res : tibble [1 × 8] (S3: tbl_df/tbl/data.frame) #> ..$ estimate : Named num 3907 #> .. ..- attr(*, "names")= chr "mean of x" #> ..$ statistic : Named num 54.1 #> .. ..- attr(*, "names")= chr "t" #> ..$ p.value : num 0 #> ..$ parameter : Named num 2999 #> .. ..- attr(*, "names")= chr "df" #> ..$ conf.low : num 3766 #> ..$ conf.high : num 4049 #> ..$ method : chr "One Sample t-test" #> ..$ alternative: chr "two.sided" #> $ df_name : chr "diamonds" #> $ dataset : tibble [3,000 × 1] (S3: tbl_df/tbl/data.frame) #> ..$ price: int [1:3000] 580 650 630 706 1080 3082 3328 4229 1895 3546 ... #> ..- attr(*, "description")= chr "## Diamond prices\n\nPrices of 3,000 round cut diamonds\n\n### Description\n\nA dataset containing the prices a"| __truncated__ #> $ var : chr "price" #> $ comp_value : num 0 #> $ alternative: chr "two.sided" #> $ conf_lev : num 0.95 #> $ data_filter: chr "" #> - attr(*, "class")= chr [1:2] "single_mean" "list"