
Bayesian metric multidimensional scaling (Bakker and Poole 2013)
Source:R/spatial_voting.R
morie_spatial_voting_bayesian_mds.RdEach observed dissimilarity is lognormal about the distance between the
two objects' coordinates,
$$\log \delta_{ij} \sim N(\log d_{ij}, 1 / \tau), \quad
d_{ij} = \lVert x_i - x_j \rVert,$$
with \(x_{ik} \sim N(0, 10^2)\) and \(\tau \sim U(0, 10)\), the
priors of the authors' JAGS code (asmcjr::BMDS). The upper
bound on \(\tau\) keeps \(\sigma = \tau^{-1/2}\) at or above 0.316,
so dissimilarities measured more precisely than that are fitted with
\(\sigma\) near the bound. Zero, negative or missing
dissimilarities are left out of the likelihood.
Usage
morie_spatial_voting_bayesian_mds(
D,
n_dims = 2L,
n_samples = 1000L,
burn_in = 200L,
sigma_init = 1,
seed = 42L
)Value
List: positions (aligned posterior mean),
positions_sd, distance_mean (posterior mean of every
pairwise distance, invariant to the alignment), sigma,
tau, draws (aligned draws, draw index first),
n_samples, engine.
Details
Coordinates are slice sampled one at a time (Neal 2003) and \(\tau\) is drawn exactly from its truncated gamma full conditional. The likelihood is invariant to translation, rotation and reflection, so the chain runs unconstrained and every draw is then aligned (translation and rotation, no rescaling) onto the posterior mean configuration. The JAGS code instead pins one object at the origin and a second to an axis; pinning that second object adds an implicit \(1/d\) prior on its distance to the first, so distances involving those two objects differ slightly between the two programs. On a simulated set of 12 objects the posterior mean distances among the other ten agree with JAGS to within 0.05 (mean distance 2.0), the size of the Monte Carlo error.