ppMulti.em: ppMulti with update steps using EM algorithm

View source: R/pp-multi-c.R

ppMulti.emR Documentation

ppMulti with update steps using EM algorithm

Description

This is like ppMulti, but uses steps (default one step) of the EM algorithm to update spline coefficients in the linearized model. More correct reults than ppMulti, but slower and differences are ususally small. Requires spam package

Usage

ppMulti.em(
  y,
  t,
  basis_fct,
  warp_fct,
  amp_cov = NULL,
  warp_cov = NULL,
  iter = c(5, 5),
  w0 = NULL,
  amp_cov_par = NULL,
  use.nlm = c(FALSE, FALSE),
  paramMax = rep(T, length(amp_cov_par)),
  warp_opt = TRUE,
  parallel.lik = c(FALSE, FALSE),
  like_optim_control = list(),
  pr = TRUE,
  design = NULL,
  inner_parallel = c(TRUE, TRUE),
  save_temp = NULL
)

Arguments

y

List of observations in matrix form. NAs allowed

t

List of corresponding time points. NAs not allowed

basis_fct

Basis function for spline

warp_fct

Warp function

amp_cov

Amplitude covariance function. Must be on the form function(t, param)

warp_cov

Warp covariance function. Must be on the form function(t, param)

iter

two or three dimensional integer of maximal number of outer iterations & maximal number of inner iterations per outer iteration and optionally maximal number of em updates (default = 1).

w0

Starting values for warp. Should only be used if you have results from a previous run.

amp_cov_par

Starting values for amplitude covariance parameters. There are no defaults.

use.nlm

Use nlm instead of optim for optimization? First index for outer loop, second index for inner loop.

paramMax

Logical vector. Which amplitude parameters to optimise over? Defaults to all parameters.

warp_opt

If FALSE, warp covariance parameters are kept fixed.

parallel.lik

Calculate likelihoods in parallel?

like_optim_control

List of control options for optimization in outer loop. See details

pr

Printing option.

design

Design for the experiments. Should be given as a list of one-dimensional vectors or as a design matrix.

inner_parallel

Should optimization of warps and matrices for EM algorithm be done in parallel?

save_temp

Save estimates after each outer iteration? NULL or the file path.

Details

There has been less check on this function, so I cannot guarantee that it will behave as well as ppMulti. Requires spam package, used for faster calculations for sparse matrices. Regarding parallellization of EM inner step (matrix stuff): Results are combined in order they are returned by worker threads. Due to numericalities, this might imply that two runs are not sure to return completely identical results. Also note that parallelization doesn't always work on Windows. (Use Linux if possible)

Value

A list of estimates

See Also

ppMulti

Examples

See ppMulti

naolsen/simm.fda documentation built on June 28, 2022, 2:41 a.m.