% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spflow_impacts.R
\name{impacts_matrix,spflow_model-method}
\alias{impacts_matrix,spflow_model-method}
\title{Compute spatial impacts matrix}
\usage{
\S4method{impacts_matrix}{spflow_model}(
  object,
  ...,
  change_net,
  change_var,
  change_obs = 1L,
  x_is_log = FALSE
)
}
\arguments{
\item{object}{an \code{\link[=spflow_model-class]{spflow_model-class()}}}

\item{...}{arguments passed on to \code{\link[=predict_effect]{predict_effect()}}}

\item{change_net}{a character of length one, identifying one of the
\code{\link[=spflow_network_classes]{spflow_network_classes()}} where changes to the data should be applied}

\item{change_var}{a character of length one, identifying one variable
The character musts refer to the variable and its name to the id of}

\item{change_obs}{A numeric that identifies the observation(s) to change (by position)}

\item{x_is_log}{A logical, if \code{TRUE} the independent variable is assumed to
be in logs and the effects are computed for a relative change of the form
\code{x_new = 1.01 * x_old}.
If \code{FALSE} the effects are computed for a unit increase of the form
\code{x_new = 1 + x_old}.}
}
\value{
A Matrix
}
\description{
Marginal effect in spatial econometric models are observation dependent.
Here we compute the changes to all observations that follow from changes in
a one variable for one (or multiple) observations.
Here, these effects are represented as a matrix with the same dimension as the
dependent variable.
}
\examples{

model9 <- spflow(
spflow_formula = y9 ~ . + P_(DISTANCE),
spflow_networks = multi_net_usa_ge,
id_net_pair = "ge_ge")

# effect matrix, summary and decomposition
MI <- impacts_matrix(model9,change_net = "ge",change_var =  "X", change_obs = 8)
total_effect <- sum(MI)
intra_effect <- MI[8,8]
origi_effect <- sum(MI[,8]) - intra_effect
desti_effect <- sum(MI[8,]) - intra_effect
netwo_effect <- sum(MI[-8,-8])
total_effect == (intra_effect + origi_effect + desti_effect + netwo_effect)
}
\seealso{
predict_effect
}
\author{
Lukas Dargel
}
