fisher.sim {clrng}R Documentation

fisher.sim

Description

Performs Monte carlo's simulation for Fisher's exact test on GPU.

Usage

fisher.sim(
  x,
  N,
  streams,
  Nglobal = getOption("clrng.Nglobal"),
  type = getOption("clrng.type"),
  returnStatistics = FALSE,
  verbose = FALSE
)

Arguments

x

a vclMatrix of integers.

N

an integer specifying number of replicates.

streams

a vclMatrix of streams. Default using streams with package default initial seeds.

Nglobal

a (non-empty) integer vector specifying size of the index space on GPU for use, with default value from global option 'clrng.Nglobal'.

type

a character string specifying "double" or "float" of the returned test statistics, with default value from global option 'clrng.type'.

returnStatistics

a logical value, if TRUE, return test statistics, default is FALSE.

verbose

a logical value, if TRUE, print extra information, default is FALSE.

Value

a ‘htest’ object of p-value and actual number of replicates and a list of test statistics, streams used, threshold.

Examples

library('clrng')
if (detectGPUs() >= 1) {
  setContext(grep("gpu", listContexts()$device_type)[1])
  
  Job <- matrix(c(1,2,1,0, 3,3,6,1, 10,10,14,9, 6,7,12,11), 4, 4)
  Job <- gpuR::vclMatrix(Job, type="integer")
  
  getOption('clrng.type')
  options(clrng.Nglobal = c(64,16))
  streams <- createStreamsGpu()
  result <- fisher.sim(Job, 1e5, streams = streams)
  print(result)
  result$streams
  result$threshold
} else {
  message("No GPU context available")
}


[Package clrng version 0.0.5 Index]