Skip to content

Commit

Permalink
Update dbd.perm2.R
Browse files Browse the repository at this point in the history
  • Loading branch information
Naima16 authored Dec 4, 2019
1 parent 94f5844 commit dc9d19c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions dbd.perm2.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ dbd.perm2 <- function(mat, g, perm.method=1, nperm=999, nn.print=0,clock=TRUE)
#
# Three permutation methods are implemented –
# Before computing mat2,
# Method 1. Permute data in individual columns of mat1. (Model 1 in the paper)
# Method 2. Permute data in individual rows of mat1. (Model 2 in the paper)
# ### Method 2 has low power. ###
# Method 1. (Method A in the paper) Permute data in individual rows of mat1. (Model 2 in the paper)
# Method 2. (Method B in the paper) Permute data in individual columns of mat1. (Model 1 in the paper)
#
# ### Method 1 has low power. ###

# Value –
# The output list comprises the following elements:
Expand Down Expand Up @@ -114,14 +115,14 @@ dbd.perm2 <- function(mat, g, perm.method=1, nperm=999, nn.print=0,clock=TRUE)

mat1.perm = matrix(0,n,p)

##this is model 1 in the paper
if(perm.method==1) { # Permute data in individual columns of mat1 (sites x species)
mat1.perm = .Call("sampleC_col_real",mat1)
}
## this is model 2 in the paper
if(perm.method==2) { # Permute p/a data in individual rows of mat1 (sites x species)
## this is model A in the paper
if(perm.method==1) { # Permute p/a data in individual rows of mat1 (sites x species)
mat1.perm=.Call("sampleC_row_real",mat1)
}
##this is model B in the paper
if(perm.method==2) { # Permute data in individual columns of mat1 (sites x species)
mat1.perm = .Call("sampleC_col_real",mat1)
}

# Create matrix "mat2" of sites x genera
mat2=.Call("produit",mat1.perm,A)
Expand Down

0 comments on commit dc9d19c

Please sign in to comment.