Skip to contents

This function performs a Wald test for hypothesis testing by comparing an estimation to a reference value using the provided standard error. It allows testing for one-tailed alternatives: "greater" - β > reference_value, "less" - β < −reference_value, or two-tailed alternative: "greaterAbs" - |β| > reference_value. If the p-value obtained is greater than 1, it is set to 1 to avoid invalid p-values.

Usage

wald_test(
  estimation,
  std_error,
  reference_value = 0,
  alternative = "greaterAbs"
)

Arguments

estimation

The estimated coefficient value.

std_error

The standard error of the estimation.

reference_value

The reference value for comparison (default is 0).

alternative

The type of alternative hypothesis to test (default is "greaterAbs").

Value

A list containing the test statistic and p-value.

Examples

# Perform a Wald test with the default "greaterAbs" alternative
wald_test(estimation = 0.1, std_error = 0.02, reference_value = 0.2)
#> $statistic
#> [1] -9.9
#> 
#> $p.value
#> [1] 0.9999997
#>