% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/class_generics_and_maybes.R,
%   R/class_spflow_network_multi.R, R/class_spflow_model.R
\name{pair_cor}
\alias{pair_cor}
\alias{pair_cor,spflow_network_multi-method}
\alias{pair_cor,spflow_model-method}
\title{Correlation matrices for OD data}
\usage{
pair_cor(object, ...)

\S4method{pair_cor}{spflow_network_multi}(
  object,
  id_net_pair = id(object)[["pairs"]][[1]],
  spflow_formula,
  add_lags_x = TRUE,
  add_lags_y = FALSE
)

\S4method{pair_cor}{spflow_model}(
  object,
  add_fitted = TRUE,
  add_resid = TRUE,
  model,
  exploit_fit = TRUE
)
}
\arguments{
\item{object}{A \code{\link[=spflow_model-class]{spflow_model-class()}} or a \code{\link[=spflow_network_multi-class]{spflow_network_multi-class()}}}

\item{...}{Arguments to be passed to methods}

\item{id_net_pair}{A character indicating the id of a \code{\link[=spflow_network_pair-class]{spflow_network_pair-class()}}}

\item{spflow_formula}{A formula specifying how variables should be used
(for details see section Formula interface in the help page of \code{\link[=spflow]{spflow()}})}

\item{add_lags_x}{A logical, indicating whether spatial lags of the exogenous variables
should be included.}

\item{add_lags_y}{A logical, indicating whether spatial lags of the dependent variables
should be included.}

\item{add_resid, add_fitted}{Logicals, indicating whether the model residuals and fitted value
should be added to the correlation matrix}

\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()}}.}

\item{exploit_fit}{A logical, if \code{TRUE} the correlation that is generated as a byproduct of
fitting the model is returned.
Otherwise it is recreated from the input data, without considering the
weights.}
}
\value{
A matrix of pairwise correlations between all variables
}
\description{
The method computes person correlations for all variables available for the
the origins, destinations, and OD-pairs.
The OD-pairs information can be either come from a
\link[=spflow_network_multi-class]{spflow_network_multi} or a
\link[=spflow_model-class]{spflow_models}.
}
\examples{

# Used with a spflow_network_multi ...
cor_mat <- pair_cor(multi_net_usa_ge, "ge_ge") # without transformations
cor_image(cor_mat)

cor_mat <- pair_cor( # with transformations and spatial lags
  multi_net_usa_ge,
  "ge_ge",
  y9 ~ . + P_(log(DISTANCE + 1) + .),
  add_lags_y = TRUE)
cor_image(cor_mat)

# Used with a model...
gravity_ge <- spflow(
  y1 ~ . + P_(DISTANCE),
  multi_net_usa_ge,
  "ge_ge",
  spflow_control(model = "model_1"))

cor_mat <- pair_cor(gravity_ge)
cor_image(cor_mat)

}
\seealso{
\code{\link[=spflow_network_multi-class]{spflow_network_multi-class()}}, \code{\link[=spflow_model-class]{spflow_model-class()}}
}
\author{
Lukas Dargel
}
