| westerlund_test_reg | R Documentation |
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.
westerlund_test_reg(b, V, verbose = FALSE)
b |
A named numeric vector of coefficients. |
V |
A numeric variance-covariance matrix corresponding to |
verbose |
Logical. If |
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.
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.
This section describes the alignment with econometric software reporting standards.
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.
westerlund_test_mg,
westerlund_test
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.