pair_align_functions_expomap: Align two functions using geometric properties of warping...

View source: R/pair_align_functions_expomap.R

pair_align_functions_expomapR Documentation

Align two functions using geometric properties of warping functions

Description

This function aligns two functions using Bayesian framework. 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 Z-mixture pCN algorithm is used to explore both local and global structure in the posterior distribution.

Usage

pair_align_functions_expomap(
  f1,
  f2,
  timet,
  iter = 20000,
  burnin = min(5000, iter/2),
  alpha0 = 0.1,
  beta0 = 0.1,
  zpcn = list(betas = c(0.5, 0.05, 0.005, 1e-04), probs = c(0.1, 0.1, 0.7, 0.1)),
  propvar = 1,
  init.coef = rep(0, 2 * 10),
  npoints = 200,
  extrainfo = FALSE
)

Arguments

f1

observed data, numeric vector

f2

observed data, numeric vector

timet

sample points of functions

iter

length of the chain

burnin

number of burnin MCMC iterations

alpha0, beta0

IG parameters for the prior of sigma1

zpcn

list of mixture coefficients and prior probabilities for Z-mixture pCN algorithm of the form list(betas, probs), where betas and probs are numeric vectors of equal length

propvar

variance of proposal distribution

init.coef

initial coefficients of warping function in exponential map; length must be even

npoints

number of sample points to use during alignment

extrainfo

T/F whether additional information is returned

Details

The Z-mixture pCN algorithm uses a mixture distribution for the proposal distribution, controlled by input parameter zpcn. The zpcn$betas must be between 0 and 1, and are the coefficients of the mixture components, with larger coefficients corresponding to larger shifts in parameter space. The zpcn$probs give the probability of each shift size.

Value

Returns a list containing

f2_warped

f2 aligned to f1

gamma

Posterior mean gamma function

g.coef

matrix with iter columns, posterior draws of g.coef

psi

Posterior mean psi function

sigma1

numeric vector of length iter, posterior draws of sigma1

accept

Boolean acceptance for each sample (if extrainfo=TRUE)

betas.ind

Index of zpcn mixture component for each sample (if extrainfo=TRUE)

logl

numeric vector of length iter, posterior loglikelihood (if extrainfo=TRUE)

gamma_mat

Matrix of all posterior draws of gamma (if extrainfo=TRUE)

gamma_q025

Lower 0.025 quantile of gamma (if extrainfo=TRUE)

gamma_q975

Upper 0.975 quantile of gamma (if extrainfo=TRUE)

sigma_eff_size

Effective sample size of sigma (if extrainfo=TRUE)

psi_eff_size

Vector of effective sample sizes of psi (if extrainfo=TRUE)

xdist

Vector of posterior draws from xdist between registered functions (if extrainfo=TRUE)

ydist

Vector of posterior draws from ydist between registered functions (if extrainfo=TRUE)

References

Lu, Y., Herbei, R., and Kurtek, S. (2017). Bayesian registration of functions with a Gaussian process prior. Journal of Computational and Graphical Statistics, DOI: 10.1080/10618600.2017.1336444.

Examples

## Not run: 
  # This is an MCMC algorithm and takes a long time to run
  myzpcn <- list(
    betas = c(0.1, 0.01, 0.005, 0.0001),
    probs = c(0.2, 0.2, 0.4, 0.2)
  )
  out <- pair_align_functions_expomap(
    f1 = simu_data$f[, 1],
    f2 = simu_data$f[, 2],
    timet = simu_data$time,
    zpcn = myzpcn,
    extrainfo = TRUE
  )
  # overall acceptance ratio
  mean(out$accept)
  # acceptance ratio by zpcn coefficient
  with(out, tapply(accept, myzpcn$betas[betas.ind], mean))

## End(Not run)

fdasrvf documentation built on Nov. 19, 2023, 1:09 a.m.