coeffs {USP}R Documentation

Calculate coefficients of a function's series expansion

Description

This function is used in InfKern to produce the kernel matrix from functional data defined on the interval [0,1]. For further details see Section 7.4 of (Berrett et al. 2021).

Usage

coeffs(X, Ntrunc)

Arguments

X

The discretised functions whose coefficients are required. This should be a matrix with one row per function, and with Ndisc columns, where Ndisc is the grid size of the discretisation.

Ntrunc

The number of coefficients that are required. The function returns coefficients 1,...,Ntrunc.

Value

The coefficients of X in its expansion in terms of sine functions. See (Berrett et al. 2021) for more detail.

References

Berrett TB, Kontoyiannis I, Samworth RJ (2021). “Optimal rates for independence testing via U-statistic permutation tests.” Annals of Statistics, to appear.

Examples

t=seq(from=0,to=1,length.out=1000); X=t^2
U=coeffs(X,100)[1,]; L=5
plot(t,X,type="l")
approx=rep(0,1000)
for(l in 1:L){
approx=approx+qnorm(U[l])*sqrt(2)*sin((l-1/2)*pi*t)/((l-1/2)*pi)
lines(t,approx,col=l+1)
}

[Package USP version 0.1.2 Index]