covfunc: Estimate the cov function from functional data/snippets.

View source: R/cov.R

covfuncR Documentation

Estimate the cov function from functional data/snippets.

Description

Estimate the cov function from functional data/snippets.

Usage

covfunc(
  t,
  y,
  newt = NULL,
  mu = NULL,
  weig = NULL,
  method = c("FOURIER", "PACE", "SP"),
  ...
)

Arguments

t

a list of vectors (for irregular design) or a vector (for regular design) containing time points of observations for each individual; each vector should be in ascending order.

y

a list of vectors (for irregular design) or a matrix (for regular design) containing the observed values at t; if it is a matrix, the columns correspond to the time points in the vector t.

newt

a list of vectors or a vector containing time points of observations to be evaluated; if NULL, then newt is treated as t.

mu

the known or estimated mean function object; it must be a scalar (viewed as a constant function), a function handle, or an object obtained by calling meanfunc

weig

a vector of length(t) of weight for each subject, or 'OBS' or 'SUBJ' for weighting scheme

method

estimation method, 'PACE' or 'FOURIER' or 'SP' (for semiparametric method)

...

other parameters required depending on the method and tuning; see details

tuning

tuning method to select possible tuning parameters

Details

  • When method='PACE', additional parameters are

    kernel

    kernel type; supported are 'epanechnikov', "rectangular", "triangular", "quartic", "triweight", "tricube", "cosine", "gauss", "logistic", "sigmoid" and "silverman"; see https://en.wikipedia.org/wiki/Kernel_(statistics) for more details.

    deg

    degree of the local polynomial regression; currently only deg=1 is supported.

    bw

    bandwidth

  • When method='FOURIER', additional parameters are

    q

    number of basis functions; if NULL then selected by tuning method

    rho

    roughness penalty parameter; if NULL then selected by tuning method

    ext

    extension margin of Fourier extension; if NULL then selected by tuning method

    domain

    time domain; if NULL then estimated by (min(t),max(t))

  • When method='SP', additional parameters are

    domain

    time domain; if NULL then estimated by (min(t),max(t))

    corf

    function of the form function(theta,x,y) that specifies the correlation structure with parameter theta; If NULL then Matern correlation is used.

    sig2e

    variance of measurement error; if NULL the automatically calculated by the calling sigma2

    sig2x

    variance function; a function or an object generated by varfunc; if NULL then automatically estimated by calling varfunc

    pfunc

    penalty function on the estimation; Not used yet.

    theta0

    Initial value for the parameter theta to be estimated; NULL by default

    lb

    vector of lower bound of theta; if NULL then set to -Inf for all coordinate

    ub

    vector of upper bound of theta; if NULL then set to Inf for all coordinate

    D

    dimension of theta

Value

an object of the class 'covfunc' containing necessary information to predict/evaluate the estimated covariance function and the following output:

  • When method='PACE', additional parameters are

    fitted

    fitted value at the grid spanned by newt

    delta

    the largest span among all subjects; note that it is not normalized by the span of the whole study.

    bw

    selected bandwidth by tuning method if NULL is the input for bw.

    mu

    estimated mean function if NULL is the input.

  • When method='FOURIER', additional parameters are

    fitted

    fitted value at the grid spanned by newt

    q

    selected q if NULL is the input

    rho

    selected rho if NULL is the input

    ext

    selected ext if NULL is the input

    C

    estimated coefficients

    mu

    estimated mean function if NULL is the input.

  • When method='SP', additional parameters are

    fitted

    fitted value at the grid spanned by newt

    domain

    time domain; if NULL then estimated by (min(t),max(t)).

    rho

    estimated function of the form function(x,y) of the correlation structure.

    sig2e

    estiamted variance of measurement error if NULL is the input.

    sig2x

    estiamted variance function if NULL is the input.

    theta

    estimated parameters for the correlation structure.

    mu

    estimated mean function if NULL is the input.

References

\insertRef

Lin2020bmcfda

\insertRef

Lin2020mcfda

\insertRef

Yao2005mcfda

Examples

mu <- function(s) sin(2*pi*s)
D <- synfd::sparse.fd(mu=mu, X=synfd::gaussian.process(), n=100, m=5)
mu.obj <- meanfunc(D$t,D$y,newt=NULL,method='PACE',
                   tuning='cv',weig=NULL,kernel='gauss',deg=1)
cov.obj <- covfunc(D$t,D$y,newt=NULL,mu=mu.obj,method='FOURIER',
                   tuning='cv',weig=NULL,domain=c(0,1))
cov.hat <- predict(cov.obj,regular.grid())

ZhuolinSong/wpe documentation built on Oct. 31, 2022, 7:38 p.m.