{"id":32203996,"url":"https://github.com/morrowcj/remoteparts","last_synced_at":"2025-10-22T04:49:50.958Z","repository":{"id":37500872,"uuid":"252229132","full_name":"morrowcj/remotePARTS","owner":"morrowcj","description":"remotePARTS is a set of tools for running Partitioned spatio-temporal auto regression analyses on remotely-sensed data sets. ","archived":false,"fork":false,"pushed_at":"2025-07-25T06:42:31.000Z","size":163369,"stargazers_count":22,"open_issues_count":12,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-22T04:49:25.683Z","etag":null,"topics":["autocorrelation","big-data","remote-sensing-in-r","statistical-analysis"],"latest_commit_sha":null,"homepage":"https://morrowcj.github.io/remotePARTS/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morrowcj.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-04-01T16:29:02.000Z","updated_at":"2025-07-25T06:42:35.000Z","dependencies_parsed_at":"2023-02-12T08:30:45.532Z","dependency_job_id":"69aeb1d2-686e-467c-a7ae-207051b4673e","html_url":"https://github.com/morrowcj/remotePARTS","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/morrowcj/remotePARTS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morrowcj%2FremotePARTS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morrowcj%2FremotePARTS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morrowcj%2FremotePARTS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morrowcj%2FremotePARTS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morrowcj","download_url":"https://codeload.github.com/morrowcj/remotePARTS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morrowcj%2FremotePARTS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280382976,"owners_count":26321423,"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":["autocorrelation","big-data","remote-sensing-in-r","statistical-analysis"],"created_at":"2025-10-22T04:49:49.961Z","updated_at":"2025-10-22T04:49:50.953Z","avatar_url":"https://github.com/morrowcj.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  echo = TRUE, collapse = TRUE, comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\", out.width = \"100%\"\n)\n```\n\n## remotePARTS\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/remotePARTS)](https://CRAN.R-project.org/package=remotePARTS)\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![R-CMD-check](https://github.com/morrowcj/remotePARTS/workflows/R-CMD-check/badge.svg)](https://github.com/morrowcj/remotePARTS/actions)\n[![status](https://joss.theoj.org/papers/c6a3da6a56aa0fb0e1f8a4f36cab12c2/status.svg)](https://joss.theoj.org/papers/c6a3da6a56aa0fb0e1f8a4f36cab12c2)\n[![Codecov test coverage](https://codecov.io/gh/morrowcj/remotePARTS/graph/badge.svg)](https://app.codecov.io/gh/morrowcj/remotePARTS)\n\u003c!-- badges: end --\u003e\n\n*remotePARTS* is a software package for the *R* statistical programming language. \nThe package contains tools for analyzing spatiotemporal data, typically obtained \nvia remote sensing.\n\n## Description\n\nThese tools were created to test map-scale hypotheses about trends in large \nremotely sensed data sets, but they are useful for analyzing trends in any \nspatial data, with or without a temporal component. Statistical tests are \nconducted with the PARTS method for analyzing spatially autocorrelated time \nseries (Ives et al., 2021). The method's unique approach can handle extremely\nlarge data sets that other spatiotemporal models cannot, while still \nappropriately accounting for autocorrelation structure. This is \ndone by partitioning the data into smaller chunks, analyzing chunks separately\nand then combining the separate analyses into a single test, that accounts for\ncorrelations among chunks, of the map-scale hypotheses.\n\n## Installation\n\nTo install the package and it's dependencies from CRAN, use the following R code:\n\n```{r, eval = FALSE}\ninstall.packages(\"remotePARTS\")\n```\n\nTo install the latest stable version of this package from github, use\n\n```{r, eval = FALSE}\nremotes::install_github(\"morrowcj/remotePARTS\")\n```\n\nand to test out the newest features and functionality, use \n\n```{r, eval = FALSE}\nremotes::install_github(\"morrowcj/remotePARTS\", ref = \"develop\")\n```\n\nTo ensure the vignette is built when installing from GitHub, use \n\n```{r, eval = FALSE}\nremotes::install_github(\"morrowcj/remotePARTS\", build_vignettes = TRUE)\n```\n\nThen, upon successful installation, load the package with \n`library(remotePARTS)`. \n\n### Dependencies\n\nSince the matrix operations in this package rely on C++ code, as implemented \nvia the [RcppEigen package](https://github.com/RcppCore/RcppEigen),\nthe latest version of [Rtools](https://cran.r-project.org/bin/windows/Rtools/)\nis required for Windows and C++11 is required for other systems. \n\n\u003c!--- Now that the package is on CRAN, I am not 100% certain that the above statement\nis strictly true anymore, but I'm going to leave it for now until I learn more. ---\u003e\n\n## Citation\n\nTo cite this package in publications, please use:\n\n  Morrow CJ, Ives AR (2025). “remotePARTS: Spatiotemporal autoregression analyses for large data sets.” _Journal of Open Source\n  Software_, *10*(109), 7937. doi:10.21105/joss.07937 \u003chttps://doi.org/10.21105/joss.07937\u003e.\n\n## Contribution, bugs, and feature requests\n\nIf you wish to contribute to this package, report bugs, suggest new features, tests,\nor behavior, correct typos, update documentation, or anything else, please submit a\n[GitHub Issue](https://github.com/morrowcj/remotePARTS/issues). We welcome and\nappreciate any and all feedback.\n\n## Testing\n\nTo manually run the package's unit tests from a cloned directory, \nafter installing dependencies, use\n\n```{r, eval = FALSE, echo = TRUE}\ndevtools::test()  # run unit tests in tests/testthat/\ndevtools::check() # full R CMD check (tests + docs)\n```\n\nTest coverage is currently low, especially among functions with \nstochastic outcomes. As the package develops, additional tests\nwill be added.\n\n## Typical Workflow\n\nA typical *remotePARTS* workflow is comprised of two broad steps for analyzing\ntrends in spatiotemporal datasets: 1) time series analysis and 2) spatial \nanalysis. For purely spatial problems, step 1 is skipped. We briefly summarize \nthese steps and the expected data structure below.\n\n#### Input data\n\nCurrently, *remotePARTS* requires that the data are formatted as \"flat\" files\n(i.e., data frames with 1 row per pixel) with x- and y-coordinates. We will \nnot go into detail of how to prepare your data here, as other packages are\ndedicated to reading and manipulating spatial data (e.g., see \n`raster::rasterToPoints()`). We recognize that this is a limitation, since flat\nfiles are highly inefficient. Future versions of this package may include\ninterfaces with raster objects if enough users express interest.\n\nTo demonstrate the package's basic functionality, we first simulate a \nsmall spatiotemporal data set for analysis:\n\n```{r, warning=FALSE, message=FALSE}\nlibrary(tibble); library(dplyr); library(tidyr); library(viridisLite)\nlibrary(ggplot2); library(remotePARTS)\n\n# set a random seed, for reproducibility\nset.seed(42) # don't panic\n\n# simulate a spatiotemporal response variable\nsim_spatiotemp \u003c- function(\n    n, k, n_time = 4, b.0 = 0, b.x = 0.5, b.y = 1, \n    b.xy = 0.1, sd.xy = 0.2, b.t = 0.2, ar = 0.4,  \n    sd.t = 0.1\n){\n  coords = expand_grid(\n    x = seq(0, 1, length.out = n), y = seq(0, 1, length.out = k)\n  )\n  \n  time = seq_len(n_time)\n  \n  tibble::tibble(\n    x = coords[[1]], y = coords[[2]],\n    z.0 = b.0 + x*b.x + y*b.y + x*y*b.xy,\n    eps = rnorm(n = length(x), mean = 0, sd = sd.xy),\n    time.effect = list(time * b.t),\n  )  |\u003e \n    rowwise() |\u003e\n    mutate(\n      z.0 = z.0 + eps,\n      sp.innov = list(z.0 + time.effect + rnorm(n_time, sd = sd.t)), \n      z = list(arima.sim(list(ar = ar), n_time, innov = sp.innov))\n    ) |\u003e \n    unnest_wider(z, names_sep = \".\") |\u003e \n    select(-\"time.effect\", -\"sp.innov\", -\"eps\")\n}\n```\n\nThe function defined above generates a data frame for `n` $\\times$ `k` pixels. \nThe response variable (`z`) depends upon the `x` and `y` coordinates of the map.\nThe resulting spatial patterns (`z.0`) are used as the random innovations\nof an AR(1) time series model to generate the spatiotemporal response \n(`z.1` -- `z.4`). These data are visualized below:\n\n```{r, fig.asp=0.8, fig.width=5, out.width=\"50%\", cache = TRUE}\n# build the data\ndat \u003c- sim_spatiotemp(n = 100, k = 100)\n\n# extract coordinates\ncoords \u003c- select(dat, x, y)\n\n# visualize the data\ndat |\u003e \n  pivot_longer(cols = z.1:z.4, names_to = \"time\", values_to = \"z\") |\u003e \n  mutate(time = as.numeric(gsub(\"z\\\\.\", \"\", time))) |\u003e \n  ggplot(aes(x = x, y = y, fill = z)) + \n  facet_wrap(~time, labeller = \"label_both\") + \n  geom_tile() + \n  scale_fill_viridis_c(option = \"magma\") \n```\n\n#### 1. Time series analysis\n\nWith properly structured data, the first step is to conduct a time series \nanalysis. This is done with the `fitAR_map` function.\n\n```{r, cache = TRUE, message=FALSE, warning=FALSE}\n# fit a pixel-wise autoregression model to the full map\nAR_fit \u003c- fitAR_map(Y = dat |\u003e select(z.1:z.4) |\u003e as.matrix(), coords = coords)\n\n# combine results into a data frame\ndf \u003c- data.frame(\n  coords = AR_fit$coords, coefs = AR_fit$coefficients, \n  resids = AR_fit$residuals\n)\n```\n\nThis function returns time series regression coefficients and \nresidual estimates for each pixel: \n\n```{r, fig.asp=0.8, fig.width=4, out.width=\"40%\"}\ndf |\u003e \n  ggplot(aes(x = coords.x, y = coords.y, fill = coefs.t)) +\n  geom_tile() +\n  labs(x = \"x\", y = \"y\", fill = \"t coef\") +\n  scale_fill_viridis_c(option = \"magma\")\n```\n\n```{r, fig.asp=0.8, fig.width=5, out.width=\"50%\"}\ndf |\u003e \n  pivot_longer(resids.1:resids.4, names_to = \"time\", values_to = \"resids\") |\u003e \n  mutate(time = as.numeric(gsub(\"resids\\\\.\", \"\", time))) |\u003e \n  ggplot(aes(x = coords.x, y = coords.y, fill = resids)) +\n  facet_wrap(~time, labeller = \"label_both\") +\n  geom_tile() +\n  labs(x = \"x\", y = \"y\", fill = \"resid\") +\n  scale_fill_viridis_c(option = \"magma\")\n```\n\n#### 2. spatial analysis\n\nThe second step is to conduct a spatial analysis with `fitGLS_partition`. In \nthis case, we'll estimate how the temporal trend differs across the `x` and `y` \ncoordinates.  \n\n```{r, cache = TRUE}\n# randomly divide the data into partitions\npartitions \u003c- sample_partitions(npix = nrow(df), partsize = 1000)\n\n# fit the partitioned GLS\npart_GLS \u003c- fitGLS_partition(\n  formula = coefs.t ~ coords.x + coords.y + coords.x:coords.y, data = df, \n  partmat = partitions, coord.names = c(\"coords.x\", \"coords.y\"), ncores = 8\n)\n```\n\nThe results provide coefficient estimates that are corrected for spatial and \ntemporal autocorrelation: \n\n```{r}\npart_GLS$overall$t.test\n```\nNote that these are are not direct estimates of the parameters \nused to generate the data with `sim_spatiotemp` above. For example the \ncoefficients for `coords.x` and `coords.y` are estimates of \n`b.t` $\\times$ `b.x` and `b.t` $\\times$ `b.y`.\n\n##### 2a. Purely spatial problem\n\nThis method can also be used for purely spatial problems. Here we will use our\noriginal spatial variable (`z.0`):\n\n```{r, cache = TRUE}\n# add the spatial variable into the data frame\ndf$z.0 \u003c- dat$z.0\n\n# fit the partitioned GLS\npart_GLS1 \u003c- fitGLS_partition(\n  formula = z.0 ~ coords.x + coords.y + coords.x:coords.y, data = df, \n  partmat = partitions, coord.names = c(\"coords.x\", \"coords.y\"), ncores = 8\n)\n```\n\n```{r}\npart_GLS1$overall$t.test\n```\n\nIn this case, the coefficients *are* direct estimates of the spatial parameters \n(`b.0`, `b.x`, `b.y`, `b.xy`) given to `sim_spatiotemp`.\n\n#### Vignette\n\nFor detailed examples of how to use `remotePARTS` and all its options, with \nreal data, see the `Alaska` vignette:\n\n```{r, eval = FALSE}\nvignette(\"Alaska\")\n```\n\nThe latest stable version of the vignette is also hosted online at \nhttps://morrowcj.github.io/remotePARTS/Alaska.html.\n\n## References\n\nIves, Anthony R., et al. \"Statistical inference for trends in spatiotemporal data.\"\nRemote Sensing of Environment 266 (2021): 112678. https://doi.org/10.1016/j.rse.2021.112678 \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorrowcj%2Fremoteparts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorrowcj%2Fremoteparts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorrowcj%2Fremoteparts/lists"}