{"id":32207056,"url":"https://github.com/ropensci/waywiser","last_synced_at":"2025-10-22T05:44:15.946Z","repository":{"id":40595519,"uuid":"507701589","full_name":"ropensci/waywiser","owner":"ropensci","description":"Ergonomic tooling to assess models of spatial data","archived":false,"fork":false,"pushed_at":"2025-04-16T00:12:46.000Z","size":13817,"stargazers_count":39,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-03T07:22:05.299Z","etag":null,"topics":["cran","r","r-package","spatial","spatial-analysis","tidymodels","tidyverse"],"latest_commit_sha":null,"homepage":"https://docs.ropensci.org/waywiser/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2022-06-26T22:51:06.000Z","updated_at":"2025-08-14T16:37:15.000Z","dependencies_parsed_at":"2023-02-18T08:01:01.275Z","dependency_job_id":"93907c08-ef4a-48b1-88ac-6694058cf230","html_url":"https://github.com/ropensci/waywiser","commit_stats":{"total_commits":131,"total_committers":2,"mean_commits":65.5,"dds":0.007633587786259555,"last_synced_commit":"d99c56a74ea590d3a88893b7afb44a837c51a0e1"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ropensci/waywiser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fwaywiser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fwaywiser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fwaywiser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fwaywiser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/waywiser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fwaywiser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280388288,"owners_count":26322496,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cran","r","r-package","spatial","spatial-analysis","tidymodels","tidyverse"],"created_at":"2025-10-22T05:44:13.764Z","updated_at":"2025-10-22T05:44:15.938Z","avatar_url":"https://github.com/ropensci.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nlibrary(ggplot2)\ntheme_set(theme_minimal())\n```\n\n# waywiser \u003ca href=\"https://docs.ropensci.org/waywiser/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![arXiv preprint](https://img.shields.io/badge/arXiv-2303.11312-brightgreen)](https://arxiv.org/abs/2303.11312)\n[![R-CMD-check](https://github.com/ropensci/waywiser/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/waywiser/actions/workflows/R-CMD-check.yaml)\n[![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://choosealicense.com/licenses/mit/)\n[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html#maturing)\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![Codecov test coverage](https://codecov.io/gh/ropensci/waywiser/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropensci/waywiser?branch=main)\n[![CRAN status](https://www.r-pkg.org/badges/version/waywiser)](https://CRAN.R-project.org/package=waywiser)\n[![Status at rOpenSci Software Peer Review](https://badges.ropensci.org/571_status.svg)](https://github.com/ropensci/software-review/issues/571)\n\u003c!-- badges: end --\u003e\n\n\"Waywiser\" is an old-timey name for a \n[surveyor's wheel](https://en.wikipedia.org/wiki/Surveyor%27s_wheel), a device \nthat makes measuring long distances easier than with measurement tools like a \nruler or yardstick. The waywiser R package makes it easier to measure the \nperformance of models fit to 2D spatial data by implementing a number of \nwell-established assessment methods in a consistent, ergonomic toolbox; features \ninclude new [yardstick](https://yardstick.tidymodels.org/) metrics\nfor measuring agreement and spatial autocorrelation, functions to assess model \npredictions across multiple scales, and methods to calculate the area of \napplicability of a model.\n\n## Installation\n\nYou can install waywiser from CRAN via:\n\n```r\ninstall.packages(\"waywiser\")\n```\n\nYou can install the development version of waywiser from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"ropensci/waywiser\")\n\n# or, equivalently:\ninstall.packages(\"waywiser\", repos = \"https://ropensci.r-universe.dev\")\n```\n\n## Example\n\nLet's say that we fit a linear model predicting crimes against people as a \nfunction of literacy, using the `guerry` data included in waywiser:\n\n```{r}\nlibrary(waywiser)\n\nset.seed(123)\nsplit_idx \u003c- sample(seq_len(nrow(guerry)), nrow(guerry) * 0.8)\nguerry_train \u003c- guerry[split_idx, ]\nguerry_test \u003c- guerry[-split_idx, ]\n\ncrime_model \u003c- lm(Crm_prs ~ Litercy, guerry_train)\n```\n\nWe want to assess this model, to better understand how well it predicts crime\nrates across 1830s France. One method to do so is to evaluate our predictions at\nmultiple levels of aggregation, as suggested by Riemann et al. (2010) \n(\u003cdoi: 10.1016/j.rse.2010.05.010\u003e). This approach is focused on \naggregating point predictions, so we'll convert our data to points and then see\nhow well our predictions perform when aggregated to two different scales:\n\n```{r}\nguerry_points \u003c- data.frame(\n  truth = guerry$Crm_prs,\n  estimate = predict(crime_model, guerry),\n  geometry = sf::st_centroid(sf::st_geometry(guerry))\n)\nguerry_points \u003c- sf::st_as_sf(guerry_points)\n\nguerry_multi_scale \u003c- ww_multi_scale(\n  guerry_points,\n  truth,\n  estimate,\n  n = list(c(5, 5), c(2, 2))\n)\n\nguerry_multi_scale\n```\n\nMore information about multi-scale assessment is included in `vignette(\"multi-scale-assessment\", package = \"waywiser\")`.\n\nWe could also assess the spatial dependence of our model residuals, to identify\nany potential \"hot spots\" where our model is consistently less accurate than \nwe'd expect by chance:\n\n```{r}\nguerry_predicted \u003c- guerry\nguerry_predicted$predictions \u003c- predict(crime_model, guerry)\n\nww_local_moran_i(guerry_predicted, Crm_prs, predictions)\n```\n\nMore information about multi-scale assessment is included in `vignette(\"residual-autocorrelation\", package = \"waywiser\")`.\n\nLastly, we can also see if there's any areas in our data that are too different\nfrom our training data for us to safely predict on, which fall outside the\n\"area of applicability\" defined by Meyer and Pebesma (2021) \n(\u003cdoi: 10.1111/2041-210X.13650\u003e):\n\n```{r}\ncrime_model_aoa \u003c- ww_area_of_applicability(\n  Crm_prs ~ Litercy,\n  guerry_train,\n  guerry_test,\n  importance = vip::vi_model(crime_model)\n)\n\nguerry_aoa \u003c- cbind(\n  guerry,\n  predict(crime_model_aoa, guerry)\n)\n\nplot(guerry_aoa[\"aoa\"])\n```\n\nWe can see that two areas are outside our model's area of applicability, meaning\nthat we probably can't trust our model when extrapolating into those regions!\n\nFor more information, check out [the documentation website!](https://docs.ropensci.org/waywiser/)\n\n## Citing waywiser\n\nTo cite waywiser in publications please use:\n\nMahoney M. J. (2023). waywiser: Ergonomic Methods for Assessing Spatial Models. arXiv:2303.11312 [cs.MS]. https://doi.org/10.48550/arXiv.2303.11312\n\nA BibTeX entry for LaTeX users is\n\n```bibtex\n  @Misc{,\n    title = {waywiser: Ergonomic Methods for Assessing Spatial Models},\n    author = {Michael J Mahoney},\n    year = {2023},\n    eprint = {2303.11312},\n    archiveprefix = {arXiv},\n    primaryclass = {cs.MS},\n    doi = {10.48550/arXiv.2303.11312},\n    url = {https://arxiv.org/abs/2303.11312},\n  }\n```\n\nSee `citation(\"waywiser\")` for the most up-to-date citation information.\n\n## Contributing\n\nPlease note that this package is released with a \n[Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). \nBy contributing to this project, you agree to abide by its terms.\n\n- If you think you have encountered a bug, please [submit an issue](https://github.com/ropensci/waywiser).\n\n- Please include a [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) (a minimal, reproducible example) to clearly communicate about your code.\n\n[![ropensci_footer](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fwaywiser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci%2Fwaywiser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fwaywiser/lists"}