View source: R/pair_align_functions_infHMC.R
| pair_align_functions_infHMC | R Documentation |
This function aligns two functions using a hierarchical Bayesian framework
assuming measurement error. It will align f2 to f1. It is based on
mapping warping functions to a hypersphere, and a subsequent exponential
mapping to a tangent space. In the tangent space, the
\infty-dimensional HMC algorithm is used to explore both local and
global structure in the posterior distribution.
pair_align_functions_infHMC(
f1,
f2,
timet,
iter = 10000,
burnin = NULL,
thin = 50,
nchains = 1,
alpha0 = 0.1,
beta0 = 0.1,
alpha = 1,
beta = 1,
h = 0.01,
L = 4L,
adapt = TRUE,
target_accept = 0.65,
f1propvar = 1e-04,
f2propvar = 1e-04,
L1propvar = 0.3,
L2propvar = 0.3,
vpriorvar = 1,
vpriordecay = 1,
init.coef = rep(0, 20),
basis = c("fourier", "legendre"),
warp_rep = c("shooting", "clr"),
init = c("dp", "coef"),
sampfreq = 5L,
extrainfo = FALSE,
verbose = TRUE
)
f1 |
numeric vector of |
f2 |
numeric vector of |
timet |
time vector of length |
iter |
length of the chain |
burnin |
number of burn-in MCMC iterations; defaults to
|
thin |
thinning of the stored posterior draws |
nchains |
number of MCMC chains to run |
alpha0, beta0 |
inverse gamma prior parameters for the measurement error variances |
alpha, beta |
inverse gamma prior parameters for the SRVF model variance |
h |
the initial HMC step size is |
L |
maximum number of leapfrog steps |
adapt |
whether to adapt the HMC step size during burn-in |
target_accept |
target HMC acceptance rate when adapting |
f1propvar, f2propvar |
proposal variances for |
L1propvar, L2propvar |
proposal standard deviations of the Gaussian
process length scales of |
vpriorvar |
prior variance scale of the warping coefficients |
vpriordecay |
the prior variance of coefficient pair |
init.coef |
initial coefficients of the warping function; length must be even |
basis |
basis for the warping coefficients, either |
warp_rep |
warping function representation, either |
init |
where the first chain starts: |
sampfreq |
subsampling frequency used when fitting the initial
Gaussian process models to |
extrainfo |
whether additional information is returned |
verbose |
whether to show a progress bar |
With warp_rep = "shooting", v = \Phi c is a shooting vector at the
identity of the Hilbert sphere of SRSFs of warping functions and must
satisfy |v| < \pi (draws outside are rejected); with
warp_rep = "clr", h = \Phi c is the centered log-derivative,
\gamma' = \exp(h) / \int \exp(h), which is unconstrained. The
likelihood gradient with respect to c is exact and v is updated
with the preconditioned HMC of Beskos et al. (2011). timet is assumed to
be uniformly sampled.
Returns a list containing
f1 |
posterior draws of |
f2 |
posterior draws of |
gamma |
posterior mean warping function |
v_coef |
posterior draws of the warping coefficients |
psi |
posterior mean psi function |
sigma |
posterior draws of the SRVF model standard deviation |
sigma1, sigma2 |
posterior draws of the measurement error variances |
s1, s2 |
posterior draws of the Gaussian process variances |
L1, L2 |
posterior draws of the Gaussian process length scales |
f2_warped_mu |
|
epsilon |
HMC step size at each iteration |
theta_accept |
acceptance of the warping samples (if |
f1_accept, f2_accept |
acceptance of the |
L1_accept, L2_accept |
acceptance of the length scales (if
|
gamma_mat |
matrix of posterior draws of gamma (if |
gamma_stats |
pointwise 95% credible band of gamma (if |
SSE |
SSE of the level 2 likelihood (if |
logl |
log-likelihood trace (if |
f2_warped |
posterior draws of the aligned |
phasedist |
posterior draws of the phase distance (if |
ampdist |
posterior draws of the amplitude distance (if |
posterior_gamma_modes |
modes of the posterior of gamma, found by
clustering the chains (if |
posterior_gamma_modes_cr |
credible regions of the modes (if
|
Tucker, J. D., Shand, L., and Chowdhary, K. (2021). Multimodal Bayesian registration of noisy functions using Hamiltonian Monte Carlo. Computational Statistics and Data Analysis, 163, 107298.
Beskos, A., Pinski, F. J., Sanz-Serna, J. M., and Stuart, A. M. (2011). Hybrid Monte Carlo on Hilbert spaces. Stochastic Processes and their Applications, 121(10), 2201-2230.
## Not run:
# This is an MCMC algorithm and takes a long time to run
out <- pair_align_functions_infHMC(
f1 = simu_data$f[, 1],
f2 = simu_data$f[, 21],
timet = simu_data$time,
iter = 1000
)
mean(out$theta_accept)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.