Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorDonegan committed Dec 4, 2024
1 parent 3628b92 commit 6eaa474
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/convenience-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ sim_sar <- function(m = 1,
w,
type = c("SEM", "SLM"),
approx = FALSE,
K = 15,
K = 20,
...) {
check_sa_data(mu, w)
type <- match.arg(type)
Expand Down Expand Up @@ -625,7 +625,7 @@ me_diag <- function(fit,
}
}

#' Extract eigenfunctions of a connectivity matrix for spatial filtering
#' Prepare data for spatial filtering
#'
#' @export
#' @param C A binary spatial weights matrix. See \code{\link[geostan]{shape2mat}}.
Expand Down
4 changes: 3 additions & 1 deletion vignettes/raster-regression.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ sar_list <- prep_sar_data2(row = row, col = col)
W <- sar_list$W
z <- sim_sar(rho = .8, w = W, quick = TRUE)
y <- sim_sar(mu = -.5 * z, rho = .9, w = W, quick = TRUE)
y <- sim_sar(mu = -.5 * z, rho = .7, w = W, quick = TRUE)
dat <- cbind(y, z)
```

The approximate method uses matrix powers, and for high values of SA (especially values of rho greater than 0.9) the approximation is sensitive to the number of powers taken. In `sim_sar` this is controlled by the argument `K`. For `rho = 0.9`, you may need to raise the default value of K for the approximation to hold. Notice that $0.9^{45} = 0.009$, which is near zero and should provide sound results, whereas $0.9^25 = 0.07$ which is not quite there, and $0.9^{15} = 0.2$ will be completely inadequate. In geostan 0.8.0, the default is $K = 20$.

## References

0 comments on commit 6eaa474

Please sign in to comment.