# NOT RUN {
# }
# NOT RUN {
## Compare data generated using the radial data against three landscape models
##
## Prepare two resistance surfaces to test (the true radial, and the false river)
## These are produced as a RasterStack object
if (require(raster)) {
resistanceMaps <- stack(
raster(system.file("extdata/radial.asc", package="memgene")),
raster(system.file("extdata/river.asc", package="memgene")))
} else {
stop("raster package required for mgLandscape.")
}
## Prepare the radial data for analysis
radialData <- read.csv(system.file("extdata/radial.csv", package="memgene"))
radialGen <- radialData[, -c(1,2)]
radialXY <- radialData[, 1:2]
if (require(adegenet)) {
radialDM <- codomToPropShared(radialGen)
} else {
stop("adegenent package required to produce genetic distance matrix in example.")
}
## Analyse the two resistance surfaces and a Euclidean model
## and produce a table comparing the three
## Set permutations at low values for a faster (though less accurate) run
compareThree <- mgLandscape(resistanceMaps, radialDM, radialXY, euclid=TRUE,
forwardPerm=100, finalPerm=100)
print(compareThree)
## Results can vary between runs because selected MEM eigenvectors may vary.
## Setting forwardPerm higher will increase consistency in this regard.
##
## We see that the true radial surface has the highest [a] fraction and
## the lowest [c] fraction indicating that it does well at capturing
## the spatial genetic variation that we expect in this simulated genetic data
# }
Run the code above in your browser using DataLab