| Title: | Generalized Fisher Transformation of Correlation Matrices |
|---|---|
| Description: | Forward and inverse generalized Fisher transformation (GFT) of correlation matrices, gamma = vecl(log C), which maps the positive definite correlation matrices one-to-one onto the Euclidean space of dimension n(n-1)/2, see Archakov and Hansen (2021) <doi:10.3982/ECTA16910>. The inverse is computed from a variational characterization by the GFT-FP+N algorithm: matrix-free inexact Newton steps for the log-diagonal residual, solved by preconditioned conjugate gradients, with fixed-point safeguards that guarantee global convergence. Sequential inversion with a tangent predictor, a certified quadrature preconditioner, and comparison solvers (the plain fixed point, Broyden's method, full Newton, Anderson acceleration, and limited-memory BFGS) are included. Uses base R only. |
| Authors: | Ilya Archakov [aut], Peter Reinhard Hansen [aut, cre] |
| Maintainer: | Peter Reinhard Hansen <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.2.0 |
| Built: | 2026-09-22 19:22:15 UTC |
| Source: | https://github.com/reinhardhansen/gft |
Forward and inverse generalized Fisher transformation (GFT) of
correlation matrices. The GFT maps a non-singular
correlation matrix to the real vector
of
below-diagonal elements of the matrix logarithm of . The map is
a bijection between the set of positive definite correlation matrices
and with (Archakov and Hansen, 2021), and
generalizes Fisher's -transformation, to which it reduces for
.
The forward map is computed by gft. The inverse is
computed from the variational characterization
where is symmetric with off-diagonal elements and
diagonal , by the following solvers:
inv_gftGFT-FP+N (recommended): matrix-free inexact Newton steps for the log-diagonal residual via preconditioned conjugate gradients, with fixed-point safeguards and exact normalization; optional certified quadrature preconditioner.
inv_gft_pathSequential inversion with warm
starts and the tangent predictor gft_predict.
inv_gft_fpThe Archakov-Hansen fixed point.
inv_gft_broydenBroyden's method as in Chen, Fei and Yu (2025).
inv_gft_newtonFull Newton with the exact
Hessian.
inv_gft_andersonAnderson acceleration of the fixed point, plain or guarded.
inv_gft_lbfgsLimited-memory BFGS on the objective.
The implementation is a line-faithful port of version 1.2.0 of the Julia reference implementation by the same authors (https://github.com/reinhardhansen/GFT) and uses base R only.
Ilya Archakov and Peter Reinhard Hansen.
Maintainer: Peter Reinhard Hansen [email protected]
Archakov, I. and Hansen, P. R. (2021). A new parametrization of correlation matrices. Econometrica, 89, 1699–1715. doi:10.3982/ECTA16910
Archakov, I. and Hansen, P. R. (2026). Fast inversion of the generalized Fisher transformation of correlation matrices. Working paper, arXiv:2609.19028.
Chen, H., Fei, Y. and Yu, J. (2025). Multivariate stochastic volatility models based on generalized Fisher transformation. Journal of Econometrics, 251, 106041.
C <- 0.9^abs(outer(1:5, 1:5, "-")) # Toeplitz correlation matrix z <- gft(C) # forward transformation r <- inv_gft(z) # inverse transformation max(abs(r$C - C)) # round trip at machine precisionC <- 0.9^abs(outer(1:5, 1:5, "-")) # Toeplitz correlation matrix z <- gft(C) # forward transformation r <- inv_gft(z) # inverse transformation max(abs(r$C - C)) # round trip at machine precision
Computes the generalized Fisher transformation
: the
below-diagonal elements, stacked column by column, of the matrix
logarithm of a positive definite correlation matrix .
gft(C)gft(C)
C |
a positive definite correlation matrix (square, symmetric,
numeric). The symmetric part |
The matrix logarithm is computed from the eigendecomposition of
. For the transformation reduces to Fisher's
classical -transformation . The map is a bijection between the positive definite
correlation matrices and ; its inverse is computed
by inv_gft.
A numeric vector of length containing
.
Archakov, I. and Hansen, P. R. (2021). A new parametrization of correlation matrices. Econometrica, 89(4), 1699–1715. doi:10.3982/ECTA16910
# n = 2: reduces to Fisher's z-transformation C <- matrix(c(1, 0.5, 0.5, 1), 2, 2) all.equal(gft(C), atanh(0.5)) C <- 0.9^abs(outer(1:5, 1:5, "-")) z <- gft(C) max(abs(inv_gft(z)$C - C))# n = 2: reduces to Fisher's z-transformation C <- matrix(c(1, 0.5, 0.5, 1), 2, 2) all.equal(gft(C), atanh(0.5)) C <- 0.9^abs(outer(1:5, 1:5, "-")) z <- gft(C) max(abs(inv_gft(z)$C - C))
Reconstructs the unique positive definite correlation matrix
with by the GFT-FP+N
algorithm (recommended solver).
inv_gft(z, x0 = NULL, tol = 1e-13, maxit = 500, delta = 1, exact_hess = FALSE, residual = c("log", "gradient"), forcing = c("quad", "sqrt"), normalize = TRUE, phase = FALSE, adaptive = TRUE, preconditioner = c("diagonal", "quadrature", "auto"), kappa = 2, rmin = 2, rmax = 8, nmin = 0)inv_gft(z, x0 = NULL, tol = 1e-13, maxit = 500, delta = 1, exact_hess = FALSE, residual = c("log", "gradient"), forcing = c("quad", "sqrt"), normalize = TRUE, phase = FALSE, adaptive = TRUE, preconditioner = c("diagonal", "quadrature", "auto"), kappa = 2, rmin = 2, rmax = 8, nmin = 0)
z |
numeric vector of length |
x0 |
optional numeric vector of length |
tol |
convergence tolerance on
|
maxit |
maximum number of iterations. |
delta |
threshold of the optional initial fixed-point phase
( |
exact_hess |
if |
residual |
|
forcing |
inexact-Newton forcing tolerance:
|
normalize |
if |
phase |
if |
adaptive |
if |
preconditioner |
preconditioner of the conjugate-gradient solve:
the diagonal |
kappa, rmin, rmax, nmin
|
parameters of the quadrature
preconditioner and its selection rule; see |
The solution solves the strictly convex problem
where is symmetric with off-diagonal elements and
diagonal . Every evaluated point is normalized by the exact
minimization of along the vector of ones. Fixed-point steps
,
, are
taken while some ; otherwise an
inexact Newton step for the equation is computed:
the system ,
, is solved
matrix-free by conjugate gradients with preconditioner , exact
Hessian-vector products (two matrix multiplications each), and
forcing tolerance
on the preconditioned residual (locally quadratic; Dembo, Eisenstat
and Steihaug, 1982), capped at products. A non-finite or
non-descent direction is replaced by a fixed-point step; the full step
is taken untested when its predicted decrease is below the
floating-point resolution of and
; otherwise
Armijo backtracking on , with a fixed-point step substituted if
the search fails. Near the rounding floor the computation is finished
by fixed-point steps. Every fixed-point step and every tested Newton
step decreases , which gives global convergence.
The options residual, forcing, normalize,
phase and adaptive reproduce the variants of the
ablation in the paper; residual = "gradient", forcing = "sqrt",
normalize = FALSE, phase = TRUE, adaptive = FALSE is the version of
GFT-FP+N in package versions 1.0.x.
The quadrature preconditioner replaces by
for the -point Gauss-Legendre rule on , built from
the same eigendecomposition at matrix multiplications and one
Cholesky factorization. It satisfies
with the spectral spread of , so the order is
chosen from the extreme eigenvalues; it pays whenever two or more
nodes are needed, increasingly with .
An object of class "gft_inv": a list with components
x |
the solution: diagonal of |
C |
the reconstructed correlation matrix |
iters |
number of iterations. |
eighs |
number of eigendecompositions, the dominant |
hvs |
number of Hessian-vector products. |
err |
final value of
|
converged |
logical. |
hist |
the error after each iteration. |
Archakov, I. and Hansen, P. R. (2021). A new parametrization of correlation matrices. Econometrica, 89(4), 1699–1715. doi:10.3982/ECTA16910
Archakov, I. and Hansen, P. R. (2026). Fast inversion of the generalized Fisher transformation of correlation matrices. Working paper, arXiv:2609.19028.
Dembo, R. S., Eisenstat, S. C. and Steihaug, T. (1982). Inexact Newton methods. SIAM Journal on Numerical Analysis, 19, 400–408.
Eisenstat, S. C. and Walker, H. F. (1996). Choosing the forcing terms in an inexact Newton method. SIAM Journal on Scientific Computing, 17, 16–32.
gft for the forward map; inv_gft_fp,
inv_gft_broyden, inv_gft_newton,
inv_gft_anderson, inv_gft_lbfgs for the
comparison solvers; inv_gft_path for sequential
inversion with the tangent predictor.
C <- 0.9^abs(outer(1:5, 1:5, "-")) z <- gft(C) r <- inv_gft(z) r max(abs(r$C - C)) # warm start from a nearby solution z2 <- z + 0.01 r2 <- inv_gft(z2, x0 = r$x) # an arbitrary vector in R^d is always a valid input set.seed(1) ra <- inv_gft(rnorm(45, sd = 2)) # n = 10 range(diag(ra$C)) # unit diagonal min(eigen(ra$C)$values) > 0 # positive definite # the quadrature preconditioner halves the Hessian-vector products on # ill-conditioned inputs b <- 0.8 + 0.195 * runif(60) zb <- gft(b %*% t(b) + diag(1 - b^2)) c(diagonal = inv_gft(zb)$hvs, quadrature = inv_gft(zb, preconditioner = "quadrature")$hvs)C <- 0.9^abs(outer(1:5, 1:5, "-")) z <- gft(C) r <- inv_gft(z) r max(abs(r$C - C)) # warm start from a nearby solution z2 <- z + 0.01 r2 <- inv_gft(z2, x0 = r$x) # an arbitrary vector in R^d is always a valid input set.seed(1) ra <- inv_gft(rnorm(45, sd = 2)) # n = 10 range(diag(ra$C)) # unit diagonal min(eigen(ra$C)$values) > 0 # positive definite # the quadrature preconditioner halves the Hessian-vector products on # ill-conditioned inputs b <- 0.8 + 0.195 * runif(60) zb <- gft(b %*% t(b) + diag(1 - b^2)) c(diagonal = inv_gft(zb)$hvs, quadrature = inv_gft(zb, preconditioner = "quadrature")$hvs)
Anderson acceleration (type II, window m) of the fixed-point
map ,
with an optional safeguard that makes it globally convergent. A
Jacobian-free comparator for inv_gft.
inv_gft_anderson(z, x0 = NULL, tol = 1e-13, maxit = 5000, m = 5, guarded = FALSE, theta = 0.25)inv_gft_anderson(z, x0 = NULL, tol = 1e-13, maxit = 5000, m = 5, guarded = FALSE, theta = 0.25)
z, x0, tol, maxit
|
as in |
m |
memory: number of stored differences of iterates and residuals. |
guarded |
if |
theta |
fraction of the fixed-point decrease required by the safeguard. |
In the difference form of Walker and Ni (2011) each iteration costs one
eigendecomposition and a small least-squares solve. The ordinary
scheme has no convergence guarantee and can diverge for large
m; with guarded = TRUE every step decreases by at
least , which implies convergence from
every starting point (Archakov and Hansen, 2026, Section S5).
An object of class "gft_inv"; see inv_gft.
The hvs component is zero.
Walker, H. F. and Ni, P. (2011). Anderson acceleration for fixed-point iterations. SIAM Journal on Numerical Analysis, 49, 1715–1735.
Archakov, I. and Hansen, P. R. (2026). Fast inversion of the generalized Fisher transformation of correlation matrices. Working paper, arXiv:2609.19028.
set.seed(2) z <- rnorm(45, sd = 2) # n = 10 r <- inv_gft_anderson(z, guarded = TRUE) r max(abs(r$x - inv_gft(z)$x)) < 1e-9set.seed(2) z <- rnorm(45, sd = 2) # n = 10 r <- inv_gft_anderson(z, guarded = TRUE) r max(abs(r$x - inv_gft(z)$x)) < 1e-9
Reconstructs the correlation matrix with
by Broyden's method
applied to the residual
,
as in Chen, Fei and Yu (2025). Reference implementation for
benchmarking against inv_gft.
inv_gft_broyden(z, x0 = NULL, tol = 1e-13, maxit = 500, warm = 1, globalized = FALSE)inv_gft_broyden(z, x0 = NULL, tol = 1e-13, maxit = 500, warm = 1, globalized = FALSE)
z |
numeric vector of length |
x0 |
optional starting value of length |
tol |
convergence tolerance on
|
maxit |
maximum number of iterations. |
warm |
number of initial fixed-point steps before the Jacobian is
formed (ignored when |
globalized |
if |
The exact Jacobian is computed once (an Hessian), then
updated by rank-one Sherman-Morrison updates of its inverse, with one
eigendecomposition per iteration and no line search. Without
globalization the method can diverge for large ;
divergence is reported gracefully via converged = FALSE.
An object of class "gft_inv"; see inv_gft for the
components. On divergence the result has converged = FALSE and
err = Inf.
Chen, H., Fei, Y. and Yu, J. (2025). Multivariate stochastic volatility models based on generalized Fisher transformation. Journal of Econometrics, 251, 106041.
z <- gft(0.9^abs(outer(1:5, 1:5, "-"))) r <- inv_gft_broyden(z) r$convergedz <- gft(0.9^abs(outer(1:5, 1:5, "-"))) r <- inv_gft_broyden(z) r$converged
Reconstructs the correlation matrix with
by the fixed-point
iteration of Archakov and Hansen (2021),
, evaluated in the log domain throughout.
inv_gft_fp(z, x0 = NULL, tol = 1e-13, maxit = 5000)inv_gft_fp(z, x0 = NULL, tol = 1e-13, maxit = 5000)
z |
numeric vector of length |
x0 |
optional starting value of length |
tol |
convergence tolerance on
|
maxit |
maximum number of iterations. |
Globally convergent, with one eigendecomposition per iteration. The
local linear rate degrades as the spectrum of spreads;
inv_gft switches to an inexact Newton phase precisely to
avoid this slowdown while retaining the fixed point's robustness.
An object of class "gft_inv"; see inv_gft for the
components.
Archakov, I. and Hansen, P. R. (2021). A new parametrization of correlation matrices. Econometrica, 89(4), 1699–1715. doi:10.3982/ECTA16910
z <- gft(0.9^abs(outer(1:5, 1:5, "-"))) r <- inv_gft_fp(z) r$eighsz <- gft(0.9^abs(outer(1:5, 1:5, "-"))) r <- inv_gft_fp(z) r$eighs
Limited-memory BFGS on the objective
,
with two-loop recursion, Armijo backtracking on and the
untested-step rule of inv_gft near the rounding floor.
A general-purpose comparator.
inv_gft_lbfgs(z, x0 = NULL, tol = 1e-13, maxit = 500, m = 10, globalized = FALSE)inv_gft_lbfgs(z, x0 = NULL, tol = 1e-13, maxit = 500, m = 10, globalized = FALSE)
z, x0, tol, maxit
|
as in |
m |
memory of the quasi-Newton update. |
globalized |
if |
An object of class "gft_inv"; see inv_gft.
Liu, D. C. and Nocedal, J. (1989). On the limited memory BFGS method for large scale optimization. Mathematical Programming, 45, 503–528.
set.seed(3) z <- rnorm(45, sd = 2) r <- inv_gft_lbfgs(z, globalized = TRUE) c(lbfgs = r$eighs, gft_fpn = inv_gft(z)$eighs)set.seed(3) z <- rnorm(45, sd = 2) r <- inv_gft_lbfgs(z, globalized = TRUE) c(lbfgs = r$eighs, gft_fpn = inv_gft(z)$eighs)
Reconstructs the correlation matrix with
by a full Newton
method with the exact Hessian recomputed at every
iteration, Armijo backtracking on the objective, and an optional
fixed-point warm start. Reference implementation for benchmarking
against inv_gft.
inv_gft_newton(z, x0 = NULL, tol = 1e-13, maxit = 500, warm = 1, safeguard = TRUE)inv_gft_newton(z, x0 = NULL, tol = 1e-13, maxit = 500, warm = 1, safeguard = TRUE)
z |
numeric vector of length |
x0 |
optional starting value of length |
tol |
convergence tolerance on
|
maxit |
maximum number of iterations. |
warm |
number of initial fixed-point steps. |
safeguard |
logical. If |
Each iteration forms the exact Hessian in time and solves
the Newton system by Cholesky factorization; if the factorization
fails or the line search cannot make progress, a fixed-point step is
substituted. inv_gft obtains the same fast local
convergence at cost per iteration by solving the Newton
system inexactly and matrix-free.
Near the solution the objective is flat to within cancellation, so the Armijo
condition carries no information: the line search exhausts all of its
halvings, the fixed-point fallback is taken, and the iteration can lock
at an error several orders of magnitude above the attainable floor.
With safeguard = TRUE two further rules prevent this. The full
Newton step is taken untested once the predicted decrease falls below
the floating-point resolution of , and a persistent lack of
progress below hands the iteration to the
contractive fixed point.
safeguard = FALSE disables both and reproduces the comparator
benchmarked in the reference below, namely the method of Chen, Fei and
Yu (2025) with only the Armijo line search added. In that mode
converged can be FALSE on a small fraction of otherwise
well conditioned problems; this is the documented behaviour of that
variant, not a defect of the implementation.
An object of class "gft_inv"; see inv_gft for the
components.
Archakov, I. and Hansen, P. R. (2026). Fast inversion of the generalized Fisher transformation of correlation matrices. Working paper, arXiv:2609.19028.
z <- gft(0.9^abs(outer(1:5, 1:5, "-"))) r <- inv_gft_newton(z) r$convergedz <- gft(0.9^abs(outer(1:5, 1:5, "-"))) r <- inv_gft_newton(z) r$converged
inv_gft_path inverts a sequence of GFT vectors, starting each
solve from the previous solution or from its first-order (tangent)
prediction; gft_predict computes that prediction.
inv_gft_path(zs, predictor = TRUE, rtol = 1e-3, tol = 1e-13, ...) gft_predict(z_prev, x_prev, lam, Q, z_new, rtol = 1e-3)inv_gft_path(zs, predictor = TRUE, rtol = 1e-3, tol = 1e-13, ...) gft_predict(z_prev, x_prev, lam, Q, z_new, rtol = 1e-3)
zs |
a list of numeric vectors of length |
predictor |
if |
rtol |
relative residual to which the predictor's linear system is solved. |
tol, ...
|
passed to |
z_prev, x_prev
|
the previous input and its solution. |
lam, Q
|
eigenvalues and eigenvectors of |
z_new |
the new input. |
Differentiating gives the prediction
with
, where
is the derivative of
in the direction of the off-diagonal change (three matrix
multiplications) and corrects for the residual left
by the previous solve. The system is solved by preconditioned
conjugate gradients with the stored eigendecomposition, so the
prediction costs no eigendecomposition. The prediction error is
in the step size. The predictor pays at moderate step
sizes; for very small steps warm starts alone are nearly as good, and
for large steps its linear solve can cost more than the
eigendecomposition it saves.
inv_gft_path: a list of "gft_inv" objects, one per input,
whose hvs components include the predictor's Hessian-vector
products, with attribute "nbdz" counting the predictor
evaluations. gft_predict: a list with the predicted diagonal
x and the number hvs of products used.
set.seed(4) b <- 0.85 + 0.149 * runif(30) z0 <- gft(b %*% t(b) + diag(1 - b^2)) zs <- lapply(0:5, function(k) z0 + 0.02 * k * rnorm(length(z0)) / sqrt(length(z0))) out <- inv_gft_path(zs) sapply(out, `[[`, "eighs")set.seed(4) b <- 0.85 + 0.149 * runif(30) z0 <- gft(b %*% t(b) + diag(1 - b^2)) zs <- lapply(0:5, function(k) z0 + 0.02 * k * rnorm(length(z0)) / sqrt(length(z0))) out <- inv_gft_path(zs) sapply(out, `[[`, "eighs")
Compact display of an object of class "gft_inv" as returned by
inv_gft and the other inverse-GFT solvers.
## S3 method for class 'gft_inv' print(x, ...)## S3 method for class 'gft_inv' print(x, ...)
x |
an object of class |
... |
ignored. |
x, invisibly.
r <- inv_gft(gft(0.9^abs(outer(1:5, 1:5, "-")))) print(r)r <- inv_gft(gft(0.9^abs(outer(1:5, 1:5, "-")))) print(r)
vecl stacks the below-diagonal elements of a square matrix
column by column. unvecl is its right inverse on symmetric
matrices with zero diagonal: it forms the symmetric matrix with zero
diagonal and below-diagonal elements z.
vecl(M) unvecl(z)vecl(M) unvecl(z)
M |
a square matrix. |
z |
a numeric vector of length |
vecl returns a numeric vector of length .
unvecl returns an symmetric numeric
matrix with zero diagonal.
M <- matrix(1:9, 3, 3) vecl(M) # c(2, 3, 6) unvecl(c(0.1, 0.2, 0.3))M <- matrix(1:9, 3, 3) vecl(M) # c(2, 3, 6) unvecl(c(0.1, 0.2, 0.3))