Skip to contents

The raw covariance is smoothed by a sandwich \(S \hat C S'\), which keeps the result symmetric by construction and never assembles the two-dimensional problem.

Usage

morie_face_smooth(
  Y,
  argvals = NULL,
  n_basis = 12L,
  degree = 3L,
  lambdas = NULL,
  pve = 0.99,
  penalty_order = 2L
)

Arguments

Y

Curves, one row per subject, on a common grid.

argvals

Grid points; defaults to an equally spaced grid.

n_basis, degree, penalty_order

Spline controls.

lambdas

Smoothing parameters to search.

pve

Proportion of variance explained.

Value

A list with covariance, eigenvalues, eigenfunctions, noise_variance, npc, lambda, mean_function.

Details

THE DIAGONAL MUST BE HELD OUT, and that is the whole method. With white measurement error the raw diagonal sits a constant \(\sigma^2\) above the surface while the off-diagonal is unbiased, so smoothing through it drags that ridge outwards and inflates the leading eigenvalue. The diagonal is instead imputed from the smoothed surface and iterated to a fixed point. Filling it with the mean of the rest of the row – the obvious first choice – is badly wrong: on a two-component Karhunen-Loeve design with sigma^2 = 0.09 it returned 0.334 and left 13 per cent of the eigenvalue mass negative.

References

Xiao L, Zipunnikov V, Ruppert D, Crainiceanu C (2016) Stat Comput 26:409-421, doi:10.1007/s11222-014-9485-x .

Examples

set.seed(1)
tt <- seq(0, 1, length.out = 30)
Y <- t(replicate(8, sin(2 * pi * tt) + rnorm(30, 0, 0.2)))
r <- morie_face_smooth(Y, argvals = tt, n_basis = 8L)
str(r, max.level = 1)
#> List of 17
#>  $ covariance              : num [1:30, 1:30] -0.00111 -0.00114 -0.00117 -0.00119 -0.00121 ...
#>  $ raw_covariance          : num [1:30, 1:30] 0.0507 -0.0177 0.0087 0.00279 -0.03053 ...
#>  $ eigenvalues             : num [1:30] 3.61e-02 3.21e-11 1.13e-17 5.43e-19 1.89e-19 ...
#>  $ eigenfunctions          : num [1:30, 1:30] 0.799 0.603 0.438 0.3 0.183 ...
#>  $ mean_function           : num [1:30] 0.0285 0.3144 0.4371 0.5633 0.7551 ...
#>  $ noise_variance          : num 0.0338
#>  $ negative_eigenvalue_mass: num 0.0138
#>  $ npc                     : int 1
#>  $ pve_cumulative          : num [1:30] 1 1 1 1 1 ...
#>  $ total_variance          : num 0.0361
#>  $ lambda                  : num 10000
#>  $ gcv                     : num 0.158
#>  $ n_basis                 : int 8
#>  $ argvals                 : num [1:30] 0 0.0345 0.069 0.1034 0.1379 ...
#>  $ n                       : int 8
#>  $ warnings                : chr "The smoothed covariance had negative eigenvalues carrying 0.01377 of mass, truncated to zero. A covariance oper"| __truncated__
#>  $ method                  : chr "FACE sandwich-smoothed covariance with FPCA"