bnspatial(network, target, spatialData, lookup, msk = NULL, what = c("class", "entropy"), midvals = NULL, targetState = NULL, spatial = TRUE, inparallel = FALSE, exportRaster = FALSE, path = NULL, verbose = TRUE, ...)setClasses )msk will be ignored as well."class" returns the relatively most likely states.
"entropy" calculates the Shannon index and returns the entropy given the state probabilities.
"probability" returns an object for each state of the target node, with associated probability.
"expected" gives the expected value for the target node (see Details). Only valid for continuous target nodes. midValues argument must be provided.
"variation" returns the coefficient of variation, as a measure of uncertainty.
midvals must contain the mid values for each of the intervalswhat includes 'probability'. Default is set to all states of the node.msk raster and in columns the output required by mask argument.spatial=TRUE. When exportRaster=TRUE, rasters will be
exported in .tif format. A character specifying another extension can be provided, in which case the
raster will be exported in that format. Only formats listed by writeFormats are valid.exportRaster is not FALSE.
Default is the working directory (getwd()). File names are set by a default naming convention, see Details.verbose = TRUE a summary of class boundaries and associated nodes and data will be printed to screen for quick checks.mapTarget.
Some basic information about discretization and network/data link are printed on screen during execution.
The expected value is calculated by summing the mid values of target node states weighted by their probability:
p1 * midVal_1 + p2 * midval_2 + ... + pn * midval_n
When a RasterLayer is exported to a file, the file name is set by default, accordingly to the following naming convention:
"class" "entropy" "probability" "expected" "variation" An additional comma separated file (.csv) is written to the same directory when "class",
providing a key to interpret the raster values and the state they refer to.
setClasses; mapTarget; linkNode; loadNetwork
data(ConwyData)
network <- LandUseChange
spatialData <- c(currentLU, slope, status)
lookup <- LUclasses
bn <- bnspatial(network, 'FinalLULC', spatialData, lookup)
bn
Run the code above in your browser using DataLab