Learn R Programming

subrank (version 0.9.9.3)

simany: Test statistic distribution under any hypothesis

Description

Simulates the test statistic, under independence

Usage

simany(sampsize,dimension,subsampsizes,sampnum,nbsafe=5,nthreads=2, fun=NULL, ...)

Value

lrs

the distances with independent case

lrs2mean

the distances with theoretical value, given dependence fun

scarcities

the proportions of non-reached vector ranks

DistTypes

a recall of the list of the distance types: "KL","L2","L1","APE"

Arguments

sampsize

sample size

dimension

sample dimension

subsampsizes

vector of sub-sample sizes

sampnum

number of samples

nbsafe

the ratio between the number of sub-samples and the cardinality of the discretized copula.

nthreads

number of number of threads, assumed to be strictly positive. For "full throttle" computations, consider using parallel::detectCores()

fun

the function describing the dependence.

...

optional arguments to fun

Author

Jerome Collet

Examples

Run this code
depquad <- function(lon,dd,a)
{
  x <- rnorm(lon)
  y0 <- a*x^2
  y <- y0 + rnorm(lon)
  reste=rnorm((dd-2)*lon)
  return(c(x,y,reste))
}
sims0=simany(101,3,8,50,nbsafe=1)
seuils=apply(sims0$lrs,3,quantile,0.95)
seuils=matrix(ncol=4,nrow=50,seuils,byrow=TRUE)
sims1=simany(101,3,8,50,nbsafe=1,fun=depquad,a=0.5)
apply(sims1$lrs[,1,]>seuils,2,mean)

Run the code above in your browser using DataLab