estimate_proportion: Estimate a proportion.

View source: R/estimate_proportion.R

estimate_proportionR Documentation

Estimate a proportion.

Description

Returns effect sizes appropriate for estimating properties from a nominal variable.

Usage

estimate_proportion(
  data = NULL,
  outcome_variable = NULL,
  cases = NULL,
  case_label = 1,
  outcome_variable_levels = NULL,
  outcome_variable_name = "My outcome variable",
  conf_level = 0.95,
  count_NA = FALSE
)

Arguments

data

For raw data - a dataframe or tibble

outcome_variable

For raw data - The column name of the outcome variable, which must be a factor, or a vector that is a factor

cases

For summary data - A vector of cases

case_label

A numeric or string indicating which level of the factor to estimate. Defaults to 1, meaning first level is analyzed

outcome_variable_levels

For summary data - optional vector of 2 characters indicating name of the count level and name of the not count level. Defaults to "Affected" and "Not Affected"

outcome_variable_name

Optional friendly name for the outcome variable. Defaults to 'My outcome variable' or the outcome variable column name if a data frame is passed.

conf_level

The confidence level for the confidence interval. Given in decimal form. Defaults to 0.95.

count_NA

Logical to count NAs (TRUE) in total N or not (FALSE)

Value

Returnsobject of class esci_estimate

Examples

# From Raw Data ------------------------------------
# Just pass in the data source, grouping column, and outcome column.
# You can pass these in by position, skipping the labels:

# Note... not sure if PlantGrowth dataset meets assumptions for this analysis
estimate_proportion(
 datasets::PlantGrowth,
 group
)


rcalinjageman/esci4 documentation built on May 18, 2023, 4:01 a.m.