create_prior: Create a prior distribution

View source: R/prior_functions.R

create_priorR Documentation

Create a prior distribution

Description

Functions to create a prior distribution. A prior distribution is a raster layer where all values add up to 1. The function create_prior creates a prior using one or more raster layers. The function create_uniform_prior creates a uniform prior. The function create_network_prior extracts a prior from the propagation model. This is based on the assumption that an MNO will place cells where they expect people. The function prior_filter can be used to filter a prior raster using a polygons object (for instance, the administrative region of interest).

Usage

create_prior(..., name = "composite", weights = NULL)

create_uniform_prior(raster)

create_network_prior(strength, raster)

prior_filter(prior, region)

Arguments

...

one of more raster objects, or a list of it. When multiple raster layers are used, these are first combined using a weighed sum (see argument weights and the underlying function combine_raster_layers). After that, these values are normalised such that the values add up to 1

name

name of the prior

weights

The weights of the raster objects, which should be a vector of the same length as the number of specified raster layers. See also the underlying function combine_raster_layers.

raster

raster object that contains the raster tile index numbers (e.g. created with create_raster)

strength

a signal strength model object, which is the result of compute_sig_strength

prior

object created with create_prior, create_network_prior or create_uniform_prior

region

a polygons object (class sf) that specifies a region. If the object contains multiple polygons, they are considered as one.

Value

data frame with two columns, raster id number rid and probability p. These probabilities will add up to 1.

See Also

vignette("mobloc")

Examples

## Not run: 
# set parameters
ZL_param <- prop_param()

# load data
data("ZL_cellplan", "ZL_muni", "ZL_elevation", "ZL_landuse")

# create environment layer (needed to calculate path loss exponent (ple))
ZL_envir <- combine_raster_layers(ZL_landuse, weights = c(1, 1, 1, 0, 0))

# validate cellplan
ZL_cellplan <- validate_cellplan(ZL_cellplan, param = ZL_param, region = ZL_muni,
    envir = ZL_envir, elevation = ZL_elevation)

# create raster
ZL_bbox <- sf::st_bbox(c(xmin = 4012000, ymin = 3077000, xmax = 4048000, ymax = 3117000),
    crs = sf::st_crs(3035))
ZL_raster <- create_raster(ZL_bbox)

# process cellplan (result is propagation model and connection likelihood)
ZL_prop <- process_cellplan(cp = ZL_cellplan, raster = ZL_raster,
    elevation = ZL_elevation, param = ZL_param)

# create priors
ZL_uniform_prior <- create_uniform_prior(ZL_raster)
ZL_network_prior <- create_network_prior(ZL_prop, ZL_raster)
ZL_landuse_prior <- create_prior(ZL_landuse, weights = c(1, 1, .1, 0, .5))
ZL_comp_prior <- create_prior(ZL_network_prior, ZL_landuse_prior, weights = c(.25, .75))

## End(Not run)

MobilePhoneESSnetBigData/mobloc documentation built on Feb. 18, 2024, 3:41 a.m.