These helpers turn raw two-component representations or relation matrices
into the n x 3 Lorentz hyperboloid coordinate matrix Z used by
lhwr() and bw.lhwr(). The coordinates are not required to be longitude
and latitude. They may come from geographic coordinates, economic scores,
clinical variables, functional or shape summaries, similarity matrices,
trade networks, social networks, transportation networks, or graph
embeddings.
Usage
check_lhwr_Z(Z, tol = 1e-06)
make_lhwr_Z_features(X, scale = TRUE, tol = 1e-06)
make_lhwr_Z_network(
A,
method = c("shortest_path_mds", "spectral"),
scale = TRUE,
disconnected = c("stop", "impute"),
symmetrize = TRUE,
tol = 1e-06
)
make_lhwr_Z(x, method = c("features", "network"), ...)
check_lorentz_Z(Z, tol = 1e-06)
make_lorentz_Z_features(X, scale = TRUE, tol = 1e-06)
make_lorentz_Z_network(
A,
method = c("shortest_path_mds", "spectral"),
scale = TRUE,
disconnected = c("stop", "impute"),
symmetrize = TRUE,
tol = 1e-06
)
make_lorentz_Z(x, method = c("features", "network"), ...)Arguments
- Z
An
n x 3Lorentz hyperboloid coordinate matrix to validate.- tol
Numerical tolerance for checking the hyperboloid constraint.
- X
An
n x 2numeric matrix or data frame containing a two-component representation of the observations.- scale
If
TRUE, standardize the two input components before constructingZ. A constant component has undefined sample standard deviation; it is mapped to zero with an explicit warning.- A
An
n x nnumeric adjacency, similarity, or relation matrix.- method
Construction or network embedding method. In
make_lhwr_Z(), use"features"for a two-component feature map or"network"for a relation matrix. Inmake_lhwr_Z_network(), use"shortest_path_mds"or"spectral".- disconnected
Handling of disconnected graphs for
"shortest_path_mds"."stop"reports an error;"impute"replaces infinite graph distances by a large finite distance before MDS.- symmetrize
If
TRUE, non-symmetric relation matrices are replaced by(A + t(A)) / 2with a warning.- x
Input object passed to the generic constructor. Use an
n x 2feature matrix whenmethod = "features", or ann x nrelation matrix whenmethod = "network".- ...
Arguments passed from
make_lhwr_Z()to the selected construction helper.
Details
Let x_i denote observation i. Suppose a two-component representation
maps each observation to (z_i1, z_i2). LHWR embeds this pair into the
upper Lorentz hyperboloid by
$$ z_i = \left(\sqrt{1 + z_{i1}^2 + z_{i2}^2}, z_{i1}, z_{i2}\right). $$
The resulting point satisfies
$$-z_{i0}^2 + z_{i1}^2 + z_{i2}^2 = -1,\quad z_{i0} > 0.$$
For non-geographic data, LHWR should be interpreted as locally weighted regression over a latent hyperbolic geometry. The validity of the model depends on whether the chosen representation captures meaningful neighborhood relations among observations.