Description Usage Arguments Details Value See Also Examples
This function wraps most package functions, to ease the spatial implementation of Bayesian networks with minimal coding.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
network |
The Bayesian network. An object of class |
target |
character. The node of interest to be modelled and mapped. |
spatialData |
character with path to one or more raster files or to a single spatial vector file, or a list of objects of
class 'RasterLayer' (for raster), or a single object of class 'sf' or 'SpatialPolygonsDataFrame' (for spatial vector).
The spatial data associated to given network nodes, provided as file paths or as (list of) spatial objects. Items must be ordered
accordingly to the corresponding nodes listed in |
lookup |
character (path to file) or a formatted list. This argument can be provided as path to a comma separated file or a formatted list (see |
msk |
a character (path to raster or vector file), or a bounding box as numeric (xmin,xmax,ymin,ymax),
or one or more (as list of) rasters of class "RasterLayer", or a single object of class "sf" or "SpatialPolygonsDataFrame".
The reference data (raster or vector) to be used as mask. All model outputs will have the same extent (outline) as this object.
All locations with no data (i.e. NA) cells in |
what |
character. The required output, one or more of these are valid:
|
midvals |
vector of length equal to the number of states of the target node.
Applies only if the target node is a continuous variable, in which case |
targetState |
character. One or more states of interest from the target node. Applies only
when argument |
spatial |
logical. Should the output be spatially explicit -i.e. a georeferenced raster or spatial vector?
Default is TRUE, returning an object of class "RasterLayer" or "sf" for polygons. If FALSE, returns a data frame
with one row for each valid cell/feature from |
inparallel |
logical or integer. Should the function use parallel processing facilities? Default is FALSE: a single process will be launched. If TRUE, all cores/processors but one will be used. Alternatively, an integer can be provided to dictate the number of cores/processors to be used. |
export |
Logical or character. Should the spatial output be exported to file?
Applies only if argument |
path |
The directory to store the output files, when |
field |
character. Only for spatial vector data (e.g. shapefile), the field/column names in the attribute table corresponding to the nodes, ordered accordingly. |
verbose |
logical. If |
... |
Additional arguments to force one or more nodes to a state (i.e. fixing evidence). If the node is associated to any input spatial data, the latter will be ignored, thus resulting spatially equal everywhere. Node name must be provided as argument and the associated fixed state as character; both node and state names must be typed exactly as their names in the network. |
exportRaster |
deprecated, use |
bnspatial
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 spatial object is exported to a file, the file name is set by default, accordingly to the following naming convention:
"class"
<target node name>_Class.<file format -default .tif>
"entropy"
<target node name>_ShanEntropy.<file format -default .tif>
"probability"
<target node name>_Probability_.<targetState>.<file format -default .tif>
"expected"
<target node name>_ExpectedValue.<file format -default .tif>
"variation"
<target node name>_CoefVariation.<file format -default .tif>
An additional comma separated file (.csv) is written to the same directory when "class"
,
providing a key to interpret the spatial object values and the state they refer to.
A list of "RasterLayer" or "SpatialPolygonsDataFrame" objects or a data.frame, depending on input arguments: see mapTarget
.
Some basic information about discretization and network/data link are printed on screen during execution.
setClasses
; mapTarget
; linkNode
; loadNetwork
1 2 3 4 5 6 7 8 | list2env(ConwyData, environment())
network <- LandUseChange
spatialData <- c(ConwyLU, ConwySlope, ConwyStatus)
lookup <- LUclasses
bn <- bnspatial(network, 'FinalLULC', spatialData, lookup)
bn
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.