% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spflow_refit.R
\name{spflow_refit}
\alias{spflow_refit}
\title{Refitting spflow models}
\usage{
spflow_refit(
  object,
  refit_type = "ar_family",
  sample_weights = NULL,
  protected_params = "(Intercept)",
  keep_data = FALSE
)
}
\arguments{
\item{object}{a \code{\link[=spflow_model-class]{spflow_model-class()}}}

\item{refit_type}{A character}

\item{sample_weights}{A list of lists}

\item{protected_params}{A character}

\item{keep_data}{A logical, if \code{TRUE}
the refitted model retains all data of the original}
}
\value{
A list of models
}
\description{
(warning: experimental functionality) \cr
Use the statistics contained in an \code{\link[=spflow_model-class]{spflow_model-class()}} to efficiently
estimate new models.
}
\details{
There are three possible ways to refit the model, which can be selected via
the \code{refit_type} argument.
\itemize{
\item "ar_family" allows to estimate the 9 forms of autocorrelation version
detailed in the docs of \code{\link[=spflow_control]{spflow_control()}}
\item "stepwise"  implements a backward selection procedure for the explanatory
variables.
\item "samples"   allows to estimate the same model on different sub samples.
the interface to this functionality will probably change in
future versions.
}
}
\examples{

# fit the most exhaustive model (default)
res <- spflow(y9 ~ . + P_(DISTANCE), multi_net_usa_ge)

# refit the family of 9 models based on different autocorrelation structures
res9_ar <- spflow_refit(res)
compare_results(res9_ar)

# refit based on stepwise selection procedure
res_Xstep <- spflow_refit(res, refit_type = "stepwise")
compare_results(res_Xstep)

}
\author{
Lukas Dargel
}
