Learn R Programming

geocausal (version 0.3.2)

get_base_dens: Get the baseline density

Description

`get_base_dens()` takes a dataframe and returns the baseline densities using Scott's rule of thumb (out-of-sample data) or fitting an inhomogeneous Poisson model (in-sample data) by regressing the in-sample data on time-invariant covariates.

Usage

get_base_dens(
  window,
  option,
  ndim = 256,
  out_data,
  out_coordinates = c("longitude", "latitude"),
  hfr,
  dep_var,
  indep_var,
  ratio
)

Value

an im object of baseline density

Arguments

window

owin object

option

"in" (using in-sample data) or "out" (using out-of-sample data)

ndim

the number of dimensions of grid cells (ndim^2). By default, ndim = 256.

out_data

dataframe (if using out-of-sample data)

out_coordinates

vector of column names of longitudes and latitudes (in this order) (if using in-sample data)

hfr

hyperframe (if using in-sample data)

dep_var

the name of the dependent variable (if using in-sample data)

indep_var

the names of time-invariant independent varaibles (if using in-sample data)

ratio

for random sampling of data (if using in-sample data)