% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spflow_neighborhood.R
\name{expand_spflow_neighborhood}
\alias{expand_spflow_neighborhood}
\title{Derive the OD-level neighborhood matrices}
\usage{
expand_spflow_neighborhood(
  OW,
  DW,
  n_o = nrow(OW),
  n_d = nrow(DW),
  M_indicator = NULL,
  model = "model_9"
)
}
\arguments{
\item{OW}{The origin neighborhood matrix}

\item{DW}{The destination neighborhood matrix}

\item{n_o}{A numeric indicating the number of origins}

\item{n_d}{A numeric indicating the number of destinations}

\item{M_indicator}{A matrix of binary indicators for origin-destination
pairs that should be included in the model. When the argument is NULL or
when all entries of this matrix are different from zero we consider the
Cartesian product of all origins and destinations as OD pairs.}

\item{model}{A character indicating the model number, that controls different spatial
dependence structures should be one of \code{paste0("model_", 1:9)}.
Details are given in the documentation of \code{\link[=spflow_control]{spflow_control()}}.}
}
\value{
A list of at most three (sparse) matrices with names
given by \code{c("Wd", "Wo", "Ww")}.
}
\description{
Use the neighborhood matrices of origins and destinations to derive the
up to three neighborhood matrices of the origin-destination pairs:
\itemize{
\item \code{W_d} relates to flows starting from the same origin going to neighbors of the destination
\item \code{W_o} relates to flows starting from the neighbors of the origin going the same destination
\item \code{W_w} relates to flows starting from the neighbors of the origin going the neighbors of the destination
}
}
\examples{
expand_spflow_neighborhood(DW = 1-diag(2),OW = 1-diag(2))
}
\author{
Lukas Dargel
}
