# NOT RUN {
# }
# NOT RUN {
data(eco.test)
# Moran's I
### one test
con <- eco.weight(eco[["XY"]], method = "circle", d1 = 0, d2 = 2)
global <- eco.gsa(Z = eco[["P"]][, 1], con = con, method = "I", nsim = 200)
global
require(adegenet)
con2<-chooseCN(eco[["XY"]], type = 1, result.type = "listw", plot.nb = FALSE)
global <- eco.gsa(Z = eco[["P"]][, 1], con = con2, method = "I", nsim = 200)
global
#-----------------------
# ACCESSORS USE EXAMPLE
#-----------------------
# the slots are accesed with the generic format
# (ecoslot. + name of the slot + name of the object).
# See help("EcoGenetics accessors")
# observed value
ecoslot.OBS(global)
# p-value
ecoslot.PVAL(global)
#----------------
# multiple tests
#----------------
data(eco3)
con <- eco.weight(eco3[["XY"]], method = "circle", d1 = 0, d2 = 500)
global <- eco.gsa(Z = eco3[["P"]], con = con, method = "I", nsim = 200)
global
# Plot method for multivariable eco.gsa objects:
eco.plotGlobal(global)
#--------------------------------
# accessor use in multiple tests
#--------------------------------
ecoslot.MULTI(global)
#----------------------------------------
# Gearys's C
con <- eco.weight(eco[["XY"]], method = "circle", d1 = 0, d2 = 2)
global.C <- eco.gsa(Z = eco[["P"]][, 1], con = con, method = "C", nsim = 200)
global.C
#----------------------------------------
# Bivariate's Moran's Ixy
con <- eco.weight(eco[["XY"]], method = "circle", d1 = 0, d2 = 2)
global.Ixy <- eco.gsa(Z = eco[["P"]][, 1], Y = eco[["E"]][, 1],
con = con, method = "CC", nsim = 200)
global.Ixy
#----------------------------------------
# Join-count
## using the allelic frequency matrix of an ecogen object.
## The data is diploid. Frequencies are transformed into counts
## as ploidy * frequency_matrix:
Z = 2* eco[["A"]]
jc <- eco.gsa(Z[, 1], con = con, method = "JC")
eco.plotGlobal(jc)
# multiple tests
# using the first ten alleles of the matrix
global.JC <- eco.gsa(Z[, 1:10], con = con, method = "JC", nsim = 99)
global.JC
# plot method for multivariable join-count
eco.plotGlobal(global.JC)
# counting joins between genotypes in the first locus the G matrix:
global.JC <- eco.gsa(Z = eco[["G"]][, 1], ploidy = 2, con = con, method = "JC", nsim = 99)
global.JC
eco.plotGlobal(global.JC)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab