Skip to contents

Each 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
)

Arguments

D

Symmetric dissimilarity matrix.

n_dims

Dimensions.

n_samples

Retained draws.

burn_in

Sweeps discarded first.

sigma_init

Starting value of \(\sigma\).

seed

RNG seed.

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.

References

Bakker, R. and Poole, K. T. (2013). Bayesian metric multidimensional scaling. Political Analysis 21(1), 125-140.

Examples

set.seed(1)
X <- matrix(rnorm(16), 8, 2)
D <- as.matrix(dist(X))
fit <- morie_spatial_voting_bayesian_mds(D, n_samples = 150L,
                                         burn_in = 100L)
# posterior mean distances against the true ones
cor(fit$distance_mean[upper.tri(D)], D[upper.tri(D)])
#> [1] 0.9930962