findOutlyingPoints | R Documentation |
Spatial or environmental outliers
findOutlyingPoints(
pres,
spOutliers = TRUE,
envOutliers = TRUE,
method = "grubbs",
pval = 1e-05,
checkPairs = TRUE,
kRosner = 3,
verbose = TRUE
)
pres |
a 'SpatialPoints' or 'SpatialPointsDataFrame' object describing the locations of species records. A 'SpatialPointsDataFrame' containing the values of environmental variables to be used must be supplied if 'envOutliers=TRUE' |
spOutliers |
logical; perform spatial outlier analysis |
envOutliers |
logical; perform environmental outlier analysis |
method |
character; options are 'iqr', 'grubbs', 'dixon', 'rosner'. Only a single value can be used; if mutliple tests are desired, call 'findOuliers' multiple times specifying different methods. |
pval |
user-specified p-value for assessing the significance of Grubbs test statistic. |
checkPairs |
logical; check for a single pair of outliers using the Grubbs test. This can only be performed for sample sizes <30. Only a single test is used because repeating it tends to throw out more points than seem reasonable, by eye. The value has no effect unless ‘method=’grubbs''. |
kRosner |
integer between 1 and 10. Determines the number of outliers suspected with a Rosner test. The value has no effect unless ‘method=’rosner''. |
verbose |
logical; print messages |
See Examples.
Returns the SpatialPointsDataFrame provided with additional logical columns indicating spatial outliers (‘spOutliers') and environmental outliers (’'envOutliers').
Cory Merow <cory.merow@gmail.com>
myPres=read.csv(system.file('extdata/SpeciesCSVs/Camissonia_tanacetifolia.csv',
package='occOutliers'))
myPres=myPres[complete.cases(myPres),]
sp::coordinates(myPres)=c(1,2)
myEnv=raster::stack(system.file('extdata/AllEnv.tif',package='occOutliers'))
names(myEnv)=read.table(system.file('extdata/layerNames.csv',package='occOutliers'))[,1]
myPresDF=sp::SpatialPointsDataFrame(myPres,data.frame(raster::extract(myEnv,myPres)))
presOut=findOutlyingPoints(pres=myPresDF,
spOutliers=TRUE,
envOutliers=TRUE,
pval=1e-5)
world.shp=readRDS(system.file('extdata/worldShpMollwide.rds',package='occOutliers'))
plotOutliers(presOut,shpToPlot = world.shp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.