Learn R Programming

bivarhr (version 0.1.5)

.first_pvalue: Extract a p-value from nested test objects

Description

Attempts to extract a single p-value from a variety of test result objects, including nested lists produced by functions in the vars package and related diagnostics.

Usage

.first_pvalue(x)

Value

A numeric scalar with the first p-value found, or NA_real_ if no p-value can be extracted.

Arguments

x

An object potentially containing a p-value, such as:

  • A list with element p.value.

  • A list with nested elements like LMh, LMFh, pt.mul, jb.mul, arch.mul, arch.uni.

  • A numeric value that can be interpreted as a p-value.

Details

The function recursively explores nested list components and attempts to find a scalar p-value. Special handling is included for structures like jb.mul$JB. If nothing suitable is found, NA_real_ is returned.