| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/spdep.R |
| 3 |
\name{tidy.sarlm} |
| 4 |
\alias{tidy.sarlm} |
| 5 |
\alias{spatialreg_tidiers} |
| 6 |
\title{Tidying methods for spatially autoregressive models} |
| 7 |
\usage{ |
| 8 |
\method{tidy}{sarlm}(x, conf.int = FALSE, conf.level = 0.95, ...) |
| 9 |
} |
| 10 |
\arguments{ |
| 11 |
\item{x}{An object returned from \code{\link[spatialreg:ML_models]{spatialreg::lagsarlm()}} |
| 12 |
or \code{\link[spatialreg:ML_models]{spatialreg::errorsarlm()}}.} |
| 13 |
|
| 14 |
\item{conf.int}{Logical indicating whether or not to include a confidence |
| 15 |
interval in the tidied output. Defaults to \code{FALSE}.} |
| 16 |
|
| 17 |
\item{conf.level}{The confidence level to use for the confidence interval |
| 18 |
if \code{conf.int = TRUE}. Must be strictly greater than 0 and less than 1. |
| 19 |
Defaults to 0.95, which corresponds to a 95 percent confidence interval.} |
| 20 |
|
| 21 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 22 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 23 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 24 |
argument has a default value, the default value will be used. |
| 25 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 26 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 27 |
\itemize{ |
| 28 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 29 |
it will be ignored. |
| 30 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 31 |
will be ignored. |
| 32 |
}} |
| 33 |
} |
| 34 |
\description{ |
| 35 |
These methods tidy the coefficients of spatial autoregression |
| 36 |
models generated by functions in the \code{spatialreg} package. |
| 37 |
} |
| 38 |
\examples{ |
| 39 |
\dontshow{if (rlang::is_installed(c("spdep", "spatialreg")) && identical(Sys.getenv("NOT_CRAN"), "true")) withAutoprint(\{ # examplesIf} |
| 40 |
|
| 41 |
|
| 42 |
# load libraries for models and data |
| 43 |
library(spatialreg) |
| 44 |
library(spdep) |
| 45 |
|
| 46 |
# load data |
| 47 |
data(oldcol, package = "spdep") |
| 48 |
|
| 49 |
listw <- nb2listw(COL.nb, style = "W") |
| 50 |
|
| 51 |
# fit model |
| 52 |
crime_sar <- |
| 53 |
lagsarlm(CRIME ~ INC + HOVAL, |
| 54 |
data = COL.OLD, |
| 55 |
listw = listw, |
| 56 |
method = "eigen" |
| 57 |
) |
| 58 |
|
| 59 |
# summarize model fit with tidiers |
| 60 |
tidy(crime_sar) |
| 61 |
tidy(crime_sar, conf.int = TRUE) |
| 62 |
glance(crime_sar) |
| 63 |
augment(crime_sar) |
| 64 |
|
| 65 |
# fit another model |
| 66 |
crime_sem <- errorsarlm(CRIME ~ INC + HOVAL, data = COL.OLD, listw) |
| 67 |
|
| 68 |
# summarize model fit with tidiers |
| 69 |
tidy(crime_sem) |
| 70 |
tidy(crime_sem, conf.int = TRUE) |
| 71 |
glance(crime_sem) |
| 72 |
augment(crime_sem) |
| 73 |
|
| 74 |
# fit another model |
| 75 |
crime_sac <- sacsarlm(CRIME ~ INC + HOVAL, data = COL.OLD, listw) |
| 76 |
|
| 77 |
# summarize model fit with tidiers |
| 78 |
tidy(crime_sac) |
| 79 |
tidy(crime_sac, conf.int = TRUE) |
| 80 |
glance(crime_sac) |
| 81 |
augment(crime_sac) |
| 82 |
\dontshow{\}) # examplesIf} |
| 83 |
} |
| 84 |
\seealso{ |
| 85 |
\code{\link[=tidy]{tidy()}}, \code{\link[spatialreg:ML_models]{spatialreg::lagsarlm()}}, \code{\link[spatialreg:ML_models]{spatialreg::errorsarlm()}}, |
| 86 |
\code{\link[spatialreg:ML_models]{spatialreg::sacsarlm()}} |
| 87 |
|
| 88 |
Other spatialreg tidiers: |
| 89 |
\code{\link{augment.sarlm}()}, |
| 90 |
\code{\link{glance.sarlm}()} |
| 91 |
} |
| 92 |
\concept{spatialreg tidiers} |
| 93 |
\value{ |
| 94 |
A \code{\link[tibble:tibble]{tibble::tibble()}} with columns: |
| 95 |
\item{conf.high}{Upper bound on the confidence interval for the estimate.} |
| 96 |
\item{conf.low}{Lower bound on the confidence interval for the estimate.} |
| 97 |
\item{estimate}{The estimated value of the regression term.} |
| 98 |
\item{p.value}{The two-sided p-value associated with the observed statistic.} |
| 99 |
\item{statistic}{The value of a T-statistic to use in a hypothesis that the regression term is non-zero.} |
| 100 |
\item{std.error}{The standard error of the regression term.} |
| 101 |
\item{term}{The name of the regression term.} |
| 102 |
|
| 103 |
} |