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.
.first_pvalue(x)A numeric scalar with the first p-value found, or
NA_real_ if no p-value can be extracted.
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.
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.