westerlund_test_reg: Formatted Coefficient Table for Westerlund Test Reporting

View source: R/Westerlund.R

westerlund_test_regR Documentation

Formatted Coefficient Table for Westerlund Test Reporting

Description

Internal helper that calculates standard errors, z-statistics, p-values, and confidence intervals for a given coefficient vector and covariance matrix, then prints a Stata-style regression table.

Usage

westerlund_test_reg(b, V, verbose = FALSE)

Arguments

b

A named numeric vector of coefficients.

V

A numeric variance-covariance matrix corresponding to b.

verbose

Logical. If TRUE, prints additional output.

Details

Calculation Logic. The function replicates the behavior of Stata's ereturn post when no degrees of freedom are specified, using the standard normal distribution (Z) for all inference:

  • Standard Errors: Derived as the square root of the diagonal of V.

  • z-statistics: Calculated as z = \hat{\beta} / SE(\hat{\beta}).

  • P-values: Two-tailed probabilities from the standard normal distribution.

  • Confidence Intervals: Calculated as \hat{\beta} \pm 1.96 \times SE(\hat{\beta}).

Formatting. The table is printed using stats::printCoefmat() to ensure clean alignment and decimal consistency. It includes columns for the Coefficient, Standard Error, z-statistic, P-value, and the 95% Confidence Interval.

Intended use. This is an internal utility called by westerlund_test_mg. It provides a standardized way to report results across different parts of the Westerlund cointegration test output.

Value

This function returns a numeric matrix with rows corresponding to the coefficients in b and columns for "Coef.", "Std. Err.", "z", "P>|z|", and the 95% confidence interval bounds.

Reporting Style

This section describes the alignment with econometric software reporting standards.

Stata Compatibility

The output format (column headers and statistical assumptions) is designed to match the output seen in Stata's xtcpmg or xtwest routines. This ensures that users transitioning from or comparing results with Stata find the output familiar.

See Also

westerlund_test_mg, westerlund_test

Examples

## Define simple coefficient vector and VCV
b <- c(alpha = -0.20, beta = 1.05)
V <- diag(c(0.03^2, 0.10^2))
names(b) <- rownames(V) <- colnames(V) <- c("alpha", "beta")

## Print the formatted table
westerlund_test_reg(b, V, verbose = TRUE)

Westerlund documentation built on Feb. 7, 2026, 5:07 p.m.