Skip to contents

Two tests for the equality of means and covariances of two populations are provided. Both tests are constructed under gaussianity following Horvath & Kokoszka, 2012, Chapter 5.

Usage

fmean.test.fdata(
  X.fdata,
  Y.fdata,
  method = c("X2", "Boot"),
  npc = 5,
  alpha = 0.95,
  B = 1000,
  draw = FALSE
)

cov.test.fdata(
  X.fdata,
  Y.fdata,
  method = c("X2", "Boot"),
  npc = 5,
  alpha = 0.95,
  B = 1000,
  draw = FALSE
)

Arguments

X.fdata

fdata object containing the curves from the first population.

Y.fdata

fdata object containing the curves from the second population.

method

c("X2","Boot"). "X2" includes the asymptotic distribution. "Boot" computes the bootstrap approximation.

npc

The number of principal components employed.
If npc is negative and 0<abs(npc)<1, the number of components are determined for explaining, at least, abs(p)% of variability.

alpha

Confidence level. By default =0.95.

B

Number of bootstrap replicas when method="Boot".

draw

By default, FALSE. Plots the density of the bootstrap replicas jointly with the statistic.

Value

Return a list with:

  • stat: Value of the statistic.

  • pvalue: P-values for the test.

  • vcrit: Critical cutoff for rejecting the null hypothesis.

  • p: Degrees of freedom for X2 statistic.

  • B: Number of bootstrap replicas.

Details

fmean.test.fdata computes the test for equality of means. cov.test.fdata computes the test for equality of covariance operators. Both tests have asymptotic distributions under the null related with chi-square distribution. Also, a parametric bootstrap procedure is implemented in both cases.

References

Inference for Functional Data with Applications. Horvath, L and Kokoszka, P. (2012). Springer.

See also

Author

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.febrero@usc.es

Examples

if (FALSE) { # \dontrun{
tt=seq(0,1,len=51)
bet=0
mu1=fdata(10*tt*(1-tt)^(1+bet),tt)
mu2=fdata(10*tt^(1+bet)*(1-tt),tt) 
fsig=1
X=rproc2fdata(100,tt,mu1,sigma="vexponential",par.list=list(scale=0.2,theta=0.35))
Y=rproc2fdata(100,tt,mu2,sigma="vexponential",par.list=list(scale=0.2*fsig,theta=0.35))
fmean.test.fdata(X,Y,npc=-.98,draw=TRUE)
cov.test.fdata(X,Y,npc=5,draw=TRUE)
bet=0.1
mu1=fdata(10*tt*(1-tt)^(1+bet),tt)
mu2=fdata(10*tt^(1+bet)*(1-tt),tt) 
fsig=1.5
X=rproc2fdata(100,tt,mu1,sigma="vexponential",par.list=list(scale=0.2,theta=0.35))
Y=rproc2fdata(100,tt,mu2,sigma="vexponential",par.list=list(scale=0.2*fsig,theta=0.35))
fmean.test.fdata(X,Y,npc=-.98,draw=TRUE)
cov.test.fdata(X,Y,npc=5,draw=TRUE)
} # }