Title: | Estimation of Standard Errors using Delta Method |
---|---|
Description: | Delta Method implementation to estimate standard errors with known asymptotic properties within the 'tidyverse' workflow. The Delta Method is a statistical tool that approximates an estimator’s behaviour using a Taylor Expansion. For a comprehensive explanation, please refer to Chapter 3 of van der Vaart (1998, ISBN: 9780511802256). |
Authors: | Javier Martinez-Rodriguez [aut, cre, cph] |
Maintainer: | Javier Martinez-Rodriguez <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-02-14 05:13:03 UTC |
Source: | https://github.com/javiermtzrdz/tidydelta |
Extract variables and their names from the formula
cases_ext(formula, mean_dta = NULL, cov_dta = NULL)
cases_ext(formula, mean_dta = NULL, cov_dta = NULL)
formula |
A formula object specifying the variables of interest. |
mean_dta |
Vector containing the means of the variables. |
cov_dta |
Covariance matrix of the variables. |
list containing objects with variables and formula
Extracts variables from a formula string.
ext_bd_var(formula)
ext_bd_var(formula)
formula |
A formula object or a character string representing a formula. |
A named character vector of extracted variables.
Converts a formula to an expression for further evaluation.
for_to_exp(formula)
for_to_exp(formula)
formula |
A formula object or a character string representing a formula. |
The evaluated expression.
Estimates standard errors for transformations of random variables using Delta method.
tidydelta( formula, normality_eval = TRUE, formula_vars = mean, mean_dta = NULL, cov_dta = NULL, n = NULL, conf_lev = 0.95 )
tidydelta( formula, normality_eval = TRUE, formula_vars = mean, mean_dta = NULL, cov_dta = NULL, n = NULL, conf_lev = 0.95 )
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. |
A tibble with columns for means, standard errors, and optionally, confidence intervals.
# 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 ))
# 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 ))
Recursive search of environment containing object.
where_env(name, env = rlang::caller_env())
where_env(name, env = rlang::caller_env())
name |
Object searched |
env |
Initial environment to search |
A named character vector of extracted variables.