Skip to content

Commit

Permalink
Updated vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewzm committed Mar 29, 2019
1 parent bc6df7d commit 4d379dd
Show file tree
Hide file tree
Showing 7 changed files with 306 additions and 266 deletions.
18 changes: 9 additions & 9 deletions R/EFDR_functions.R
Expand Up @@ -34,7 +34,7 @@
#'
#' @examples
#' ## See vignettes by typing vignette("EFDR_vignettes")
test.efdr <- function(Z,wf = "la8",J=3, alpha=0.05,n.hyp=100,b=11,iteration = 200, parallel = 1L)
test.efdr <- function(Z,wf = "la8",J=2, alpha=0.05,n.hyp=100,b=11,iteration = 200, parallel = 1L)
{

.check_args(Z = Z,wf = wf,J = J,alpha = alpha,n.hyp = n.hyp,b = b,iteration = iteration,parallel = parallel)
Expand All @@ -52,7 +52,7 @@ test.efdr <- function(Z,wf = "la8",J=3, alpha=0.05,n.hyp=100,b=11,iteration = 20
test.efdr.base(Z, wf=wf,J=J, alpha = alpha, n.hyp = nhat, b=b, nei=nei)
}

test.efdr.base <- function(Z,wf = "la8",J=3, alpha=0.05,n.hyp=100,b=11,nei = NULL, parallel = 1L)
test.efdr.base <- function(Z,wf = "la8",J=2, alpha=0.05,n.hyp=100,b=11,nei = NULL, parallel = 1L)
{
.check_args(Z = Z,wf = wf,J = J,alpha = alpha,n.hyp = n.hyp,b = b,nei = nei, parallel = parallel)

Expand Down Expand Up @@ -98,7 +98,7 @@ test.efdr.base <- function(Z,wf = "la8",J=3, alpha=0.05,n.hyp=100,b=11,nei = NUL

#' @rdname wavelet-test
#' @export
test.fdr <- function(Z,wf = "la8",J=3,alpha=0.05)
test.fdr <- function(Z,wf = "la8",J=2,alpha=0.05)
{

.check_args(Z = Z,wf = wf,J = J,alpha = alpha)
Expand Down Expand Up @@ -138,7 +138,7 @@ test.fdr <- function(Z,wf = "la8",J=3,alpha=0.05)

#' @rdname wavelet-test
#' @export
test.bonferroni <- function(Z,wf="la8",J=3,alpha=0.05)
test.bonferroni <- function(Z,wf="la8",J=2,alpha=0.05)
{

.check_args(Z = Z,wf = wf,J = J,alpha = alpha)
Expand Down Expand Up @@ -172,7 +172,7 @@ test.bonferroni <- function(Z,wf="la8",J=3,alpha=0.05)

#' @rdname wavelet-test
#' @export
test.los <- function(Z,wf="la8",J=3,alpha=0.05)
test.los <- function(Z,wf="la8",J=2,alpha=0.05)
{
.check_args(Z = Z,wf = wf,J = J,alpha = alpha)

Expand Down Expand Up @@ -260,7 +260,7 @@ test_image <- function(h=1,r=10,n1 = 64, n2=64) {
#' @examples
#' Z <- test_image(h = 0.5, r = 14, n1 = 64)$z
#' print(wav_th(Z,wf="la8",J=3,th=0.5))
wav_th <- function(Z, wf = "la8", J = 3, th = 1) {
wav_th <- function(Z, wf = "la8", J = 2, th = 1) {
stopifnot(is.numeric(th))
.check_args(Z = Z,wf = wf,J = J)

Expand Down Expand Up @@ -527,7 +527,7 @@ diagnostic.table <- function(reject.true,reject, n) {
#' @examples
#' image <- matrix(rnorm(64),8,8)
# nei <- nei.efdr(image,b=11)
nei.efdr <- function(Z,wf="la8",J=3,b=11,parallel=1L) {
nei.efdr <- function(Z,wf="la8",J=2,b=11,parallel=1L) {

.check_args(Z=Z,wf=wf,J=J,b=b,parallel=parallel)

Expand Down Expand Up @@ -573,7 +573,7 @@ nei.efdr <- function(Z,wf="la8",J=3,b=11,parallel=1L) {
}

### check input arguments
.check_args <- function(Z,wf="la8",J=3,alpha = 0.05,n.hyp = 1L,b = 11L,nei = NULL,iteration = 1L,parallel=1L) {
.check_args <- function(Z,wf="la8",J=2,alpha = 0.05,n.hyp = 1L,b = 11L,nei = NULL,iteration = 1L,parallel=1L) {
if(!is.matrix(Z)) stop("Z needs to be a matrix")
#if(!(ncol(Z) == nrow(Z))) stop("Z needs to be square")
if(!(.IsPowerOfTwo(ncol(Z))) | !(.IsPowerOfTwo(nrow(Z)))) stop("Z needs to have rows and columns a power of two")
Expand All @@ -598,7 +598,7 @@ nei.efdr <- function(Z,wf="la8",J=3,b=11,parallel=1L) {
}

### function to find the L*
.gdf <- function(Z, wf = "la8", J = 3, alpha = 0.05, n.hyp=c(100,150,200),iteration=200,b=11,nei=NULL,parallel=1L)
.gdf <- function(Z, wf = "la8", J = 2, alpha = 0.05, n.hyp=c(100,150,200),iteration=200,b=11,nei=NULL,parallel=1L)
{

stopifnot(is.numeric(iteration))
Expand Down
4 changes: 2 additions & 2 deletions inst/doc/EFDR.Rmd
Expand Up @@ -50,7 +50,7 @@ fields::image.plot(Z_noisy,zlim=c(-0.5,1.5),asp=1)
Next, the user needs to provide some essential parameters. These are
- `alpha`: significance level
- `wf`: wavelet name (typically "la8")
- `J`: number of multi-level resolutions (for a 64 x 64, 3 is sufficient)
- `J`: number of multi-level resolutions (for a 64 x 64, 3 is usually sufficient)
- `b`: number of neighbours to consider with EFDR
- `n.hyp`: numeric vector of test counts, from which the optimal number of tests, $L^*$, will be found. Setting this to a scalar fixes the number of tests a priori
- `iteration`: number of iterations in the Monte Carlo integration described earlier
Expand Down Expand Up @@ -177,7 +177,7 @@ First, load the dataset using RCurl:
```{r,message=FALSE,cache=FALSE}
library(RCurl)
airs.raw <- read.table(textConnection(getURL(
"http://hpc.niasra.uow.edu.au/ckan/dataset/6ddf61bb-2f9a-424a-8775-e23ebaa55afb/resource/e1206e1c-9dca-42b6-8455-3cdd98c6a943/download/airs2003may116.csv"
"https://hpc.niasra.uow.edu.au/ckan/dataset/6ddf61bb-2f9a-424a-8775-e23ebaa55afb/resource/e1206e1c-9dca-42b6-8455-3cdd98c6a943/download/airs2003may116.csv"
)),header=T,sep=",")
```

Expand Down

0 comments on commit 4d379dd

Please sign in to comment.