tidydelta {tidydelta}R Documentation

Delta Method implementation

Description

Estimates standard errors for transformations of random variables using Delta method.

Usage

tidydelta(
  formula,
  normality_eval = TRUE,
  formula_vars = mean,
  mean_dta = NULL,
  cov_dta = NULL,
  n = NULL,
  conf_lev = 0.95
)

Arguments

formula

A formula object specifying the variables of interest.

normality_eval

Logical value to run normality test in case of being possible.

formula_vars

The function(s) to apply to the variables in the formula.

mean_dta

Vector containing the means of the variables.

cov_dta

Covariance matrix of the variables.

n

Sample size evaluation (in case that we can evaluate the confidence intervals with different hypnotic sample sizes).

conf_lev

Confidence level for confidence intervals.

Value

A tibble with columns for means, standard errors, and optionally, confidence intervals.

Examples

# Equivalent ways to use tidydelta()
library(tidyverse)

x <- rnorm(1000, mean = 5, sd = 2)
y <- rnorm(1000, mean = 15, sd = 3)

bd <- tibble(x, y)

tidydelta(~ y / x,
  conf_lev = .95
)

tidydelta(~ bd$y / bd$x,
  conf_lev = .95
)
bd %>%
  summarise(tidydelta(~ y / x,
    conf_lev = .95
  ))


[Package tidydelta version 0.1.0 Index]