fEqDistrib.test: Tests for checking the equality of distributions between two...

View source: R/TestFunctions.R

fEqDistrib.testR Documentation

Tests for checking the equality of distributions between two functional populations.

Description

Three tests for the equality of distributions of two populations are provided. The null hypothesis is that the two populations are the same

Usage

XYRP.test(X.fdata, Y.fdata, nproj = 10, npc = 5, test = c("KS", "AD"))

MMD.test(
  X.fdata,
  Y.fdata,
  metric = "metric.lp",
  B = 1000,
  alpha = 0.95,
  kern = "RBF",
  ops.metric = list(lp = 2),
  draw = FALSE
)

MMDA.test(
  X.fdata,
  Y.fdata,
  metric = "metric.lp",
  B = 1000,
  alpha = 0.95,
  kern = "RBF",
  ops.metric = list(lp = 2),
  draw = FALSE
)

fEqDistrib.test(
  X.fdata,
  Y.fdata,
  metric = "metric.lp",
  method = c("Exch", "WildB"),
  B = 5000,
  ops.metric = list(lp = 2),
  iboot = FALSE
)

Arguments

X.fdata

fdata object containing the curves from the first population.

Y.fdata

fdata object containing the curves from the second population.

nproj

Number of projections for XYRP.test.

npc

The number of principal components employed for generating the random projections.

test

For XYRP.test "KS" and/or "AD" for computing Kolmogorov-Smirnov or Anderson-Darling p-values in the projections.

metric

Character with the metric function for computing distances among curves.

B

Number of bootstrap or Monte Carlo replicas.

alpha

Confidence level for computing the threshold. By default =0.95.

kern

For MMDA.test "RBF" or "metric" for indicating the use of Radial Basis Function or directly, the distances.

ops.metric

List of parameters to be used with metric.

draw

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

method

In fEqDistrib.test a character indicating the bootstrap method for computing the distribution under H0. "Exch" for Exchangeable bootstrap and "WildB" for Wild Bootstrap. By default, both are provided.

iboot

In fEqDistrib.test returns the bootstrap replicas.

Details

XYRP.test computes the p-values using random projections. Requires kSamples library. MMD.test computes Maximum Mean Discrepancy p-values using permutations (see Sejdinovic et al, (2013)) and MMDA.test does the same using an asymptotic approximation. fEqDistrib.test checks the equality of distributions using an embedding in a RKHS and two bootstrap approximations for calibration.

Value

A list with the following components by function:

  • XYRP.test: FDR.pv: p-value using FDR, proj.pv: Matrix of p-values obtained for projections.

  • MMD.test,MMDA.test: stat: Statistic, p.value: p-value, thresh: Threshold at level alpha.

  • fEqDistrib.test: result: data.frame with columns Stat and p.value, Boot: data.frame with bootstrap replicas if iboot=TRUE.

Author(s)

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

References

Sejdinovic, D., Sriperumbudur, B., Gretton, A., Fukumizu, K. Equivalence of distance-based and RKHS-based statistics in Hypothesis Testing The Annals of Statistics, 2013. DOI 10.1214/13-AOS1140.

See Also

fmean.test.fdata, cov.test.fdata.

Examples

## Not run: 
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)
XYRP.test(X,Y,nproj=15)
MMD.test(X,Y,B=1000)
fEqDistrib.test(X,Y,B=1000)

## End(Not run)


fda.usc documentation built on Oct. 17, 2022, 9:06 a.m.