Description Usage Arguments Value References Examples

View source: R/USPFunctional.R

We implement the permutation independence test described in \insertCiteBKS2020USP
for functional data taking values in *L^2([0,1])*. The discretised functions are
expressed in a series expansion, and an independence test is carried out between the
coefficients of the functions, using a Fourier basis to define the test statistic.

1 | ```
USPFunctional(X, Y, Ntrunc, M, B = 999, ties.method = "standard")
``` |

`X` |
A matrix of the discretised functional data from the first sample. There are |

`Y` |
A matrix of the discretised functional data from the second sample. The discretisation
grid may be different to the grid used for |

`Ntrunc` |
The number of coefficients to retain from the series expansions of |

`M` |
The maximum frequency to use in the Fourier basis when testing the independence of the coefficients. |

`B` |
The number of permutations used to calibrate the test. |

`ties.method` |
If "standard" then calculate the p-value as in (5) of \insertCiteBKS2020USP, which is slightly conservative. If "random" then break ties randomly. This preserves Type I error control. |

A p-value for the test of the independence of *X* and *Y*.

BKS2020USP

1 2 3 4 5 6 7 8 9 10 11 | ```
n=50; r=0.6; Ndisc=1000; t=1/Ndisc
X=matrix(rep(0,Ndisc*n),nrow=n); Y=matrix(rep(0,Ndisc*n),nrow=n)
for(i in 1:n){
x = rnorm(Ndisc, mean=0, sd= 1)
se = sqrt(1 - r^2) #standard deviation of error
e = rnorm(Ndisc, mean=0, sd=se)
y = r*x + e
X[i,] <- cumsum(x*sqrt(t))
Y[i,] <- cumsum(y*sqrt(t))
}
USPFunctional(X,Y,2,1,999)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.