From 26337baca89b0dfedd260d1521cc225776a67c85 Mon Sep 17 00:00:00 2001 From: andrewzm Date: Tue, 18 Jun 2024 00:48:06 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20andrewzm?= =?UTF-8?q?/FRK@306d26e27a539807628d12d06369da9d7bc77df8=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgdown.yml | 2 +- reference/SRE.html | 2 +- search.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgdown.yml b/pkgdown.yml index c14364f..e09015e 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,5 +2,5 @@ pandoc: 3.1.11 pkgdown: 2.0.9 pkgdown_sha: ~ articles: {} -last_built: 2024-06-17T06:49Z +last_built: 2024-06-18T00:47Z diff --git a/reference/SRE.html b/reference/SRE.html index 9d991ae..bfa9d49 100644 --- a/reference/SRE.html +++ b/reference/SRE.html @@ -574,7 +574,7 @@

Examples#> #> $time #> user system elapsed -#> 0.271 0.579 0.280 +#> 0.261 0.385 0.211 #> logLik(S) #> [1] -328.9443 diff --git a/search.json b/search.json index 337a9be..b2b2379 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Andrew Zammit-Mangion. Author, maintainer. Matthew Sainsbury-Dale. Author.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Zammit-Mangion , Cressie N (2021). “FRK: R Package Spatial Spatio-Temporal Prediction Large Datasets.” Journal Statistical Software, 98(4), 1–48. doi:10.18637/jss.v098.i04. Sainsbury-Dale M, Zammit-Mangion , Cressie N (2024). “Modeling Big, Heterogeneous, Non-Gaussian Spatial Spatio-Temporal Data Using FRK.” Journal Statistical Software, 108(10), 1–39. doi:10.18637/jss.v108.i10.","code":"@Article{, title = {{FRK}: An {R} Package for Spatial and Spatio-Temporal Prediction with Large Datasets}, author = {Andrew Zammit-Mangion and Noel Cressie}, journal = {Journal of Statistical Software}, year = {2021}, volume = {98}, number = {4}, pages = {1--48}, doi = {10.18637/jss.v098.i04}, } @Article{, title = {Modeling Big, Heterogeneous, Non-{G}aussian Spatial and Spatio-Temporal Data Using {FRK}}, author = {Matthew Sainsbury-Dale and Andrew Zammit-Mangion and Noel Cressie}, journal = {Journal of Statistical Software}, year = {2024}, volume = {108}, number = {10}, pages = {1--39}, doi = {10.18637/jss.v108.i10}, }"},{"path":"/index.html","id":"fixed-rank-kriging-","dir":"","previous_headings":"","what":"Fixed Rank Kriging","title":"Fixed Rank Kriging","text":"package FRK available CRAN! install, please type install recent development version, please load devtools type paper introducing package available . paper detailing approach non-Gaussian setting available (six-page summary paper available ). vignette “FRK_intro” summarises package, gives details EM algorithm may employed Gaussian setting, provides several examples. Another vignette, “FRK_non-Gaussian”, summarises inference non-Gaussian setting (Laplace approximation used), contains examples using non-Gaussian data newly available plotting methods. access vignettes, please click following links: Introduction FRK Tutorial modelling spatial spatio-temporal non-Gaussian data FRK pkgdown page also available .","code":"install.packages(\"FRK\") install_github(\"andrewzm/FRK\", dependencies = TRUE, build_vignettes = TRUE)"},{"path":"/index.html","id":"supporting-and-citing","dir":"","previous_headings":"","what":"Supporting and citing","title":"Fixed Rank Kriging","text":"use FRK work, research, activities, please cite using information provided citation(\"FRK\").","code":""},{"path":"/index.html","id":"description","dir":"","previous_headings":"","what":"Description","title":"Fixed Rank Kriging","text":"Package: FRK Type: Package Title: Fixed Rank Kriging Version: 2.1.5 Date: 2023-01-30 Author: Andrew Zammit-Mangion, Matthew Sainsbury-Dale Maintainer: Andrew Zammit-Mangion andrewzm@gmail.com Description: tool spatial/spatio-temporal modelling prediction large datasets. approach models field, hence covariance function, using set basis functions. fixed-rank basis-function representation facilitates modelling big data, method naturally allows non-stationary, anisotropic covariance functions. Discretisation spatial domain -called basic areal units (BAUs) facilitates use observations varying support (.e., point-referenced areal supports, potentially simultaneously), prediction arbitrary user-specified regions. FRK also supports inference various manifolds, including 2D plane 3D sphere, provides helper functions model, fit, predict, plot relative ease. Version 2.0.0 also supports modelling non-Gaussian data (e.g., Poisson, binomial, negative-binomial, gamma, inverse-Gaussian) employing generalised linear mixed model (GLMM) framework. Zammit-Mangion Cressie doi:10.18637/jss.v098.i04 describe FRK Gaussian setting, detail use basis functions BAUs, Sainsbury-Dale et al.  describe FRK non-Gaussian setting; two vignettes available summarise papers provide additional examples. Zammit-Mangion, . & Cressie N. (2021). “FRK: R package spatial spatio-temporal prediction large datasets.” Journal Statistical Software, 98, 1-48. Sainsbury-Dale, M., Zammit-Mangion, . & Cressie, N. (2023). “Modelling Big, Heterogeneous, Non-Gaussian Spatial Spatio-Temporal Data using FRK” Journal Statistical Software, accepted publication, https://arxiv.org/abs/2110.02507. License: GPL (>= 2)","code":""},{"path":[]},{"path":"/index.html","id":"gaussian-data","dir":"","previous_headings":"Quick start","what":"Gaussian data","title":"Fixed Rank Kriging","text":"","code":"library(\"FRK\") library(\"sp\") library(\"ggplot2\") library(\"ggpubr\") ## Setup m <- 1000 # Sample size RNGversion(\"3.6.0\"); set.seed(1) # Fix seed zdf <- data.frame(x = runif(m), y= runif(m)) # Generate random locs zdf$z <- sin(8 * zdf$x) + cos(8 * zdf$y) + 0.5 * rnorm(m) # Simulate data coordinates(zdf) = ~x+y # Turn into sp object ## Run FRK S <- FRK(f = z ~ 1, # Formula to FRK list(zdf), # All datasets are supplied in list n_EM = 10) # Max number of EM iterations pred <- predict(S) # Prediction stage ## Plotting plotlist <- plot(S, pred) ggarrange(plotlist = plotlist, nrow = 1, legend = \"top\")"},{"path":"/index.html","id":"non-gaussian-data","dir":"","previous_headings":"Quick start","what":"Non-Gaussian data","title":"Fixed Rank Kriging","text":"analyse simulated Poisson data. signify Poisson data model mean response modelled using square-root link function setting response = \"poisson\" link = \"sqrt\" FRK(). non-Gaussian response distributions available FRK binomial, negative-binomial, gamma, inverse-Gaussian distributions.","code":"## Simulate Poisson data using the previous example's data to construct a mean zdf$z <- rpois(m, lambda = zdf$z^2) ## Run FRK S <- FRK(f = z ~ 1, list(zdf), response = \"poisson\", # Poisson data model link = \"sqrt\") # square-root link function pred <- predict(S) ## Plotting plotlist <- plot(S, pred$newdata) ggarrange(plotlist$z, plotlist$p_mu, plotlist$interval90_mu, nrow = 1, legend = \"top\")"},{"path":"/index.html","id":"spatio-temporal-data","dir":"","previous_headings":"Quick start","what":"Spatio-temporal data","title":"Fixed Rank Kriging","text":"now analyse spatio-temporal data, using NOAA dataset.","code":"## Setup library(\"spacetime\") data(\"NOAA_df_1990\") Tmax <- subset(NOAA_df_1990, month %in% 7 & year == 1993) Tmax <- within(Tmax, {time = as.Date(paste(year,month,day,sep=\"-\"))}) STObj <- stConstruct(x = Tmax, space = c(\"lon\",\"lat\"), time = \"time\", interval = TRUE) ## BAUs: spatial BAUs are 1x1 pixels, temporal BAUs are 1 day intervals BAUs <- auto_BAUs(manifold = STplane(), cellsize = c(1, 1, 1), data=STObj, tunit = \"days\") BAUs$fs <- 1 # scalar fine-scale variance matrix, implicit in previous examples ## Basis functions G <- auto_basis(manifold = STplane(), data = STObj, nres = 2, tunit = \"days\") ## Run FRK STObj$std <- 2 # fix the measurement error variance S <- FRK(f = z ~ 1 + lat, data = list(STObj), basis = G, BAUs = BAUs, est_error = FALSE, method = \"TMB\") pred <- predict(S, percentiles = NULL) ## Plotting: include only some times via the argument subset_time plotlist <- plot(S, pred$newdata, subset_time = c(1, 7, 13, 19, 25, 31)) ggarrange(plotlist = plotlist, nrow = 1, legend = \"top\")"},{"path":"/index.html","id":"demonstrations","dir":"","previous_headings":"","what":"Demonstrations","title":"Fixed Rank Kriging","text":"package FRK currently used generate spatio-temporal animations fields observed satellite data. show daily prediction CO2 using data NASA OCO-2 September 2014 June 2016.","code":""},{"path":"/index.html","id":"acknowledgements","dir":"","previous_headings":"","what":"Acknowledgements","title":"Fixed Rank Kriging","text":"Thanks Michael Bertolacci designing FRK hex logo!","code":""},{"path":"/reference/AIRS_05_2003.html","id":null,"dir":"Reference","previous_headings":"","what":"AIRS data for May 2003 — AIRS_05_2003","title":"AIRS data for May 2003 — AIRS_05_2003","text":"Mid-tropospheric CO2 measurements Atmospheric InfraRed Sounder (AIRS). data measurements 60 degrees S 90 degrees N roughly 1:30 pm local time 1 May 15 May 2003. (AIRS release data 60 degrees S.)","code":""},{"path":"/reference/AIRS_05_2003.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"AIRS data for May 2003 — AIRS_05_2003","text":"","code":"AIRS_05_2003"},{"path":"/reference/AIRS_05_2003.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"AIRS data for May 2003 — AIRS_05_2003","text":"data frame 209631 rows 7 variables: year year retrieval month month retrieval day day retrieval lon longitude coordinate retrieval lat latitude coordinate retrieval co2avgret CO2 mole fraction retrieval ppm co2std standard error CO2 retrieval ppm","code":""},{"path":"/reference/AIRS_05_2003.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"AIRS data for May 2003 — AIRS_05_2003","text":"Chahine, M. et al. (2006). AIRS: Improving weather forecasting providing new data greenhouse gases. Bulletin American Meteorological Society 87, 911--26.","code":""},{"path":"/reference/Am_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Americium soil data — Am_data","title":"Americium soil data — Am_data","text":"Americium () concentrations spatial domain immediately surrounding location nuclear devices detonated Area 13 Nevada Test Site, 1954 1963.","code":""},{"path":"/reference/Am_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Americium soil data — Am_data","text":"","code":"Am_data"},{"path":"/reference/Am_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Americium soil data — Am_data","text":"data frame 212 rows 3 variables: Easting Easting metres Northing Northing metres Americium concentration 1000 counts per minute","code":""},{"path":"/reference/Am_data.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Americium soil data — Am_data","text":"Paul R, Cressie N (2011). “Lognormal block kriging contaminated soil.” European Journal Soil Science, 62, 337–345.","code":""},{"path":"/reference/BAUs_from_points.html","id":null,"dir":"Reference","previous_headings":"","what":"Creates pixels around points — BAUs_from_points","title":"Creates pixels around points — BAUs_from_points","text":"Takes SpatialPointsDataFrame converts SpatialPolygonsDataFrame constructing tiny (within machine tolerance) BAU around SpatialPoint.","code":""},{"path":"/reference/BAUs_from_points.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Creates pixels around points — BAUs_from_points","text":"","code":"BAUs_from_points(obj, offset = 1e-10) # S4 method for SpatialPoints BAUs_from_points(obj, offset = 1e-10) # S4 method for ST BAUs_from_points(obj, offset = 1e-10)"},{"path":"/reference/BAUs_from_points.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Creates pixels around points — BAUs_from_points","text":"obj object class SpatialPointsDataFrame offset edge size mini-BAU (default 1e-10)","code":""},{"path":"/reference/BAUs_from_points.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Creates pixels around points — BAUs_from_points","text":"function allows users mimic standard geospatial analysis BAUs used. Since FRK built concept BAU, function constructs tiny BAUs around observation prediction locations can subsequently passed functions SRE FRK. BAUs_from_points, user supplies data prediction locations accompanied covariates.","code":""},{"path":[]},{"path":"/reference/BAUs_from_points.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Creates pixels around points — BAUs_from_points","text":"","code":"library(sp) opts_FRK$set(\"parallel\",0L) df <- data.frame(x = rnorm(10), y = rnorm(10)) coordinates(df) <- ~x+y BAUs <- BAUs_from_points(df)"},{"path":"/reference/Basis-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Basis functions — Basis_obj-class","title":"Basis functions — Basis_obj-class","text":"object class Basis contains basis functions used construct matrix \\(S\\) FRK.","code":""},{"path":"/reference/Basis-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Basis functions — Basis_obj-class","text":"Basis functions central component FRK, package designed work user-defined specifications . convenience, however, several functions available aid user construct basis set given set data points. Please see auto_basis details. function local_basis helps user construct set local basis functions (e.g., bisquare functions) collection location scale parameters.","code":""},{"path":"/reference/Basis-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"Basis functions — Basis_obj-class","text":"manifold object class manifold contains information manifold distance measure used manifold. See manifold-class details n number basis functions set fn list length n, item function specific basis function pars list parameters \\(\\)-th item list contains parameters \\(\\)-th basis function, fn[[]] df data frame containing attributes specific basis function (example geometric centre local basis function) regular logical indicating basis functions (resolution) regular grid","code":""},{"path":[]},{"path":"/reference/Basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Generic basis-function constructor — Basis","title":"Generic basis-function constructor — Basis","text":"function meant used manual construction arbitrary basis functions. `local' basis functions, please use function local_basis instead.","code":""},{"path":"/reference/Basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generic basis-function constructor — Basis","text":"","code":"Basis(manifold, n, fn, pars, df, regular = FALSE)"},{"path":"/reference/Basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generic basis-function constructor — Basis","text":"manifold object class manifold, example, sphere n number basis functions (integer) fn list functions, one basis function. function encapsulated within environment manifold parameters required evaluate function defined. function takes single input s can class numeric, matrix, Matrix, returns vector contains basis function evaluations s. pars list containing list parameters function. local basis functions correspond location scale parameters. df data frame containing one row per basis function, typically providing informative summaries. regular logical indicating basis functions (resolution) regular grid","code":""},{"path":"/reference/Basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generic basis-function constructor — Basis","text":"constructor checks parameters valid constructing basis functions. requirement every function encapsulated tedious, necessary FRK work large range basis functions future. Please see example exemplifies process constructing linear basis functions scratch using function.","code":""},{"path":[]},{"path":"/reference/Basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generic basis-function constructor — Basis","text":"","code":"## Construct two linear basis functions on [0, 1] manifold <- real_line() n <- 2 lin_basis_fn <- function(manifold, grad, intercept) { function(s) grad*s + intercept } pars <- list(list(grad = 1, intercept = 0), list(grad = -1, intercept = 1)) fn <- list(lin_basis_fn(manifold, 1, 0), lin_basis_fn(manifold, -1, 1)) df <- data.frame(n = 1:2, grad = c(1, -1), m = c(1, -1)) G <- Basis(manifold = manifold, n = n, fn = fn, pars = pars, df = df) if (FALSE) { eval_basis(G, s = matrix(seq(0,1, by = 0.1), 11, 1))}"},{"path":"/reference/Basis_data.frame.html","id":null,"dir":"Reference","previous_headings":"","what":"Basis-function data frame object — data.frame<-","title":"Basis-function data frame object — data.frame<-","text":"Tools retrieving manipulating data frame within Basis objects. Use assignment data.frame()<- care; checks made ensure data frame conforms object.","code":""},{"path":"/reference/Basis_data.frame.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Basis-function data frame object — data.frame<-","text":"","code":"data.frame(x) <- value # S4 method for Basis $(x, name) # S4 method for Basis $(x, name) <- value # S4 method for Basis data.frame(x) <- value # S4 method for TensorP_Basis data.frame(x) <- value # S3 method for Basis as.data.frame(x, ...) # S3 method for TensorP_Basis as.data.frame(x, ...)"},{"path":"/reference/Basis_data.frame.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Basis-function data frame object — data.frame<-","text":"x obect class Basis assigning new data retrieving data value new data assigned Basis object name field name values retrieved assigned inside Basis object's data frame ... unused","code":""},{"path":"/reference/Basis_data.frame.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Basis-function data frame object — data.frame<-","text":"","code":"G <- local_basis() df <- data.frame(G) print(df$res) #> [1] 1 df$res <- 2 data.frame(G) <- df"},{"path":"/reference/MODIS_cloud_df.html","id":null,"dir":"Reference","previous_headings":"","what":"MODIS cloud data — MODIS_cloud_df","title":"MODIS cloud data — MODIS_cloud_df","text":"image cloud taken Moderate Resolution Imaging Spectroradiometer (MODIS) instrument aboard Aqua satellite (MODIS Characterization Support Team, 2015).","code":""},{"path":"/reference/MODIS_cloud_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MODIS cloud data — MODIS_cloud_df","text":"","code":"MODIS_cloud_df"},{"path":"/reference/MODIS_cloud_df.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"MODIS cloud data — MODIS_cloud_df","text":"data frame 33,750 rows 3 variables: x x-coordinate y y-coordinate z binary dependent variable: 1 cloud present, 0 cloud. variable thresholded original continuous measurement radiance supplied MODIS instrument z_unthresholded original continuous measurement radiance supplied MODIS instrument","code":""},{"path":"/reference/MODIS_cloud_df.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MODIS cloud data — MODIS_cloud_df","text":"MODIS Characterization Support Team (2015). MODIS 500m Calibrated Radiance Product.NASA MODIS Adaptive Processing System, Goddard Space Flight Center, USA.","code":""},{"path":"/reference/NOAA_df_1990.html","id":null,"dir":"Reference","previous_headings":"","what":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","title":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","text":"Maximum temperature data obtained National Oceanic Atmospheric Administration (NOAA) part USA 1990 1993 (inclusive). See https://iridl.ldeo.columbia.edu/ SOURCES/.NOAA/.NCDC/.DAILY/.FSOD/.","code":""},{"path":"/reference/NOAA_df_1990.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","text":"","code":"NOAA_df_1990"},{"path":"/reference/NOAA_df_1990.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","text":"data frame 196,253 rows 8 variables: year year retrieval month month retrieval day day retrieval z dependent variable proc variable name (Tmax) id station id lon longitude coordinate measurement station lat latitude coordinate measurement station","code":""},{"path":"/reference/NOAA_df_1990.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","text":"National Climatic Data Center, March 1993: Local Climatological Data. Environmental Information summary (C-2), NOAA-NCDC, Asheville, NC.","code":""},{"path":"/reference/SRE-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Spatial Random Effects class — SRE-class","title":"Spatial Random Effects class — SRE-class","text":"central class definition FRK package, containing model information required estimation prediction.","code":""},{"path":"/reference/SRE-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Spatial Random Effects class — SRE-class","text":"spatial random effects (SRE) model model employed Fixed Rank Kriging, SRE object contains information required estimation prediction spatial data. Object slots contain objects (example, object class Basis) matrices derived objects (example, matrix \\(S\\)) order facilitate computations.","code":""},{"path":"/reference/SRE-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"Spatial Random Effects class — SRE-class","text":"f formula used define SRE object. covariates employed need specified object BAUs data original data model's parameters estimated basis object class Basis used construct matrix \\(S\\) BAUs object class SpatialPolygonsDataFrame, SpatialPixelsDataFrame STFDF contains Basic Areal Units (BAUs) used () project data onto common discretisation point-referenced (ii) provide BAU--data relationship data spatial footprint S matrix constructed evaluating basis functions data locations (class Matrix) S0 matrix constructed evaluating basis functions BAUs (class Matrix) D_basis list distance-matrices class Matrix, one basis-function resolution Ve measurement-error variance-covariance matrix (typically diagonal class Matrix) Vfs fine-scale variance-covariance matrix data locations (typically diagonal class Matrix) constant proportionality estimated using EM algorithm Vfs_BAUs fine-scale variance-covariance matrix BAU centroids (typically diagonal class Matrix) constant proportionality estimated using EM algorithm Qfs_BAUs fine-scale precision matrix BAU centroids (typically diagonal class Matrix) constant proportionality estimated using EM algorithm Z vector observations (class Matrix) Cmat incidence matrix mapping observations BAUs X design matrix covariates data locations G list objects class Matrix containing design matrices random effects data locations G0 list objects class Matrix containing design matrices random effects BAUs K_type type prior covariance matrix random effects. Can \"block-exponential\" (correlation effects decays function distance basis-function centroids), \"unstructured\" (elements K unknown need estimated), \"neighbour\" (sparse precision matrix used, whereby neighbouring basis functions non-zero precision matrix elements). mu_eta updated expectation basis-function random effects (estimated) mu_gamma updated expectation random effects (estimated) S_eta updated covariance matrix random effects (estimated) Q_eta updated precision matrix random effects (estimated) Khat prior covariance matrix random effects (estimated) Khat_inv prior precision matrix random effects (estimated) alphahat fixed-effect regression coefficients (estimated) sigma2fshat fine-scale variation scaling (estimated) sigma2gamma random-effect variance parameters (estimated) fs_model type fine-scale variation (independent CAR-based). Currently \"ind\" permitted info_fit information fitting (convergence etc.) response character string indicating assumed distribution response variable link character string indicating desired link function. Can \"log\", \"identity\", \"logit\", \"probit\", \"cloglog\", \"reciprocal\", \"reciprocal-squared\". Note sensible link-function response-distribution combinations permitted. mu_xi updated expectation fine-scale random effects BAUs (estimated) Q_posterior updated joint precision matrix basis function random effects observed fine-scale random effects (estimated) log_likelihood log likelihood fitted model method fitting procedure used fit SRE model phi estimated dispersion parameter (assumed constant throughout spatial domain) k_Z vector known size parameters observation support level (applicable binomial negative-binomial response distributions) k_BAU vector known size parameters observed BAUs (applicable binomial negative-binomial response distributions) include_fs flag indicating whether fine-scale variation included model include_gamma flag indicating whether gamma random effects model normalise_wts TRUE, rows incidence matrices \\(C_Z\\) \\(C_P\\) normalised sum 1, mapping represents weighted average; false, normalisation weights occurs (.e., mapping corresponds weighted sum) fs_by_spatial_BAU TRUE, BAU associated fine-scale variance parameter obsidx indices observed BAUs simple_kriging_fixed logical indicating whether one wishes commit simple kriging fitting stage: TRUE, model fitting faster, option conduct universal kriging prediction stage removed","code":""},{"path":"/reference/SRE-class.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Spatial Random Effects class — SRE-class","text":"Zammit-Mangion, . Cressie, N. (2017). FRK: R package spatial spatio-temporal prediction large datasets. Journal Statistical Software, 98(4), 1-48. doi:10.18637/jss.v098.i04.","code":""},{"path":[]},{"path":"/reference/SRE.html","id":null,"dir":"Reference","previous_headings":"","what":"Construct SRE object, fit and predict — FRK","title":"Construct SRE object, fit and predict — FRK","text":"Spatial Random Effects (SRE) model central object FRK. function FRK() provides wrapper construction estimation SRE object data, using functions SRE() (object constructor) SRE.fit() (fitting data). Please see SRE-class details SRE object's properties methods.","code":""},{"path":"/reference/SRE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Construct SRE object, fit and predict — FRK","text":"","code":"FRK( f, data, basis = NULL, BAUs = NULL, est_error = TRUE, average_in_BAU = TRUE, sum_variables = NULL, normalise_wts = TRUE, fs_model = \"ind\", vgm_model = NULL, K_type = c(\"block-exponential\", \"precision\", \"unstructured\"), n_EM = 100, tol = 0.01, method = c(\"EM\", \"TMB\"), lambda = 0, print_lik = FALSE, response = c(\"gaussian\", \"poisson\", \"gamma\", \"inverse-gaussian\", \"negative-binomial\", \"binomial\"), link = c(\"identity\", \"log\", \"sqrt\", \"logit\", \"probit\", \"cloglog\", \"inverse\", \"inverse-squared\"), optimiser = nlminb, fs_by_spatial_BAU = FALSE, known_sigma2fs = NULL, taper = NULL, simple_kriging_fixed = FALSE, ... ) SRE( f, data, basis, BAUs, est_error = TRUE, average_in_BAU = TRUE, sum_variables = NULL, normalise_wts = TRUE, fs_model = \"ind\", vgm_model = NULL, K_type = c(\"block-exponential\", \"precision\", \"unstructured\"), normalise_basis = TRUE, response = c(\"gaussian\", \"poisson\", \"gamma\", \"inverse-gaussian\", \"negative-binomial\", \"binomial\"), link = c(\"identity\", \"log\", \"sqrt\", \"logit\", \"probit\", \"cloglog\", \"inverse\", \"inverse-squared\"), include_fs = TRUE, fs_by_spatial_BAU = FALSE, ... ) SRE.fit( object, n_EM = 100L, tol = 0.01, method = c(\"EM\", \"TMB\"), lambda = 0, print_lik = FALSE, optimiser = nlminb, known_sigma2fs = NULL, taper = NULL, simple_kriging_fixed = FALSE, ... ) # S4 method for SRE predict( object, newdata = NULL, obs_fs = FALSE, pred_time = NULL, covariances = FALSE, nsim = 400, type = \"mean\", k = NULL, percentiles = c(5, 95), kriging = \"simple\" ) # S4 method for SRE logLik(object) # S4 method for SRE nobs(object, ...) # S4 method for SRE coef(object, ...) # S4 method for SRE coef_uncertainty( object, percentiles = c(5, 95), nsim = 400, random_effects = FALSE ) simulate(object, newdata = NULL, nsim = 400, conditional_fs = FALSE, ...) # S4 method for SRE fitted(object, ...) # S4 method for SRE residuals(object, type = \"pearson\") # S4 method for SRE AIC(object, k = 2) # S4 method for SRE BIC(object)"},{"path":"/reference/SRE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Construct SRE object, fit and predict — FRK","text":"f R formula relating dependent variable (transformations thereof) covariates data list objects class SpatialPointsDataFrame, SpatialPolygonsDataFrame, STIDF, STFDF. using space-time objects, data frame must another field, t, containing time index data point basis object class Basis (TensorP_Basis) BAUs object class SpatialPolygonsDataFrame, SpatialPixelsDataFrame, STIDF, STFDF. object's data frame must contain covariate information well field fs describing fine-scale variation constant proportionality. function FRK() used directly, BAUs created automatically, coordinates can used covariates est_error (applicable response = \"gaussian\") flag indicating whether measurement-error variance estimated variogram techniques. set 0, data must contain field std. Measurement-error estimation currently implemented spatio-temporal datasets average_in_BAU TRUE, multiple data points falling BAU averaged; measurement error averaged data point taken average individual measurement errors sum_variables average_in_BAU == TRUE, string sum_variables indicates data variables (can observations covariates) summed rather averaged normalise_wts TRUE, rows incidence matrices CZ CP normalised sum 1, mapping represents weighted average; false, normalisation weights occurs (.e., mapping corresponds weighted sum) fs_model \"ind\" fine-scale variation independent BAU level. independent model allowed now, future implementation include CAR/ICAR (development) vgm_model (applicable response = \"gaussian\") object class variogramModel package gstat constructed using function vgm. object contains variogram model fit data. nugget taken measurement error est_error = TRUE. unspecified, variogram used gstat::vgm(1, \"Lin\", d, 1), d approximately one third maximum distance two data points K_type parameterisation used basis-function covariance matrix, K. method = \"EM\", K_type can \"unstructured\" \"block-exponential\". method = \"TMB\", K_type can \"precision\" \"block-exponential\". default \"block-exponential\", however FRK() used method = \"TMB\", computational reasons K_type set \"precision\" n_EM (applicable method = \"EM\") maximum number iterations EM algorithm tol (applicable method = \"EM\") convergence tolerance EM algorithm method parameter estimation method employ. Currently \"EM\" \"TMB\" supported lambda (applicable K_type = \"unstructured\") ridge-regression regularisation parameter (0 default). Can single number, vector (one parameter resolution) print_lik (applicable method = \"EM\") flag indicating whether plot log-likelihood vs. iteration convergence EM estimation algorithm response string indicating assumed distribution response variable. can \"gaussian\", \"poisson\", \"negative-binomial\", \"binomial\", \"gamma\", \"inverse-gaussian\". method = \"EM\", \"gaussian\" can used. Two distributions considered framework, namely binomial distribution negative-binomial distribution, assumed-known ‘size’ parameter ‘probability success’ parameter; see details exact parameterisations used, provide ‘size’ parameters link string indicating desired link function. Can \"log\", \"identity\", \"logit\", \"probit\", \"cloglog\", \"reciprocal\", \"reciprocal-squared\". Note sensible link-function response-distribution combinations permitted. method = \"EM\", \"identity\" can used optimiser (applicable method = \"TMB\") optimising function used model fitting method = \"TMB\" (default nlminb). Users may pass function object string corresponding named function. Optional parameters may passed optimiser via .... requirement optimiser first three arguments correspond initial parameters, objective function, gradient, respectively (may achieved simply constructing wrapper function) fs_by_spatial_BAU (applicable spatio-temporal setting method = \"TMB\") TRUE, spatial BAU associated fine-scale variance parameter; otherwise, single fine-scale variance parameter used known_sigma2fs known value fine-scale variance parameter. NULL (default), fine-scale variance parameter estimated usual. known_sigma2fs NULL, fine-scale variance fixed supplied value; may scalar, vector length equal number spatial BAUs (fs_by_spatial_BAU = TRUE) taper positive numeric indicating strength covariance/partial-correlation tapering. applicable K_type = \"block-exponential\", K_type = \"precision\" basis-functions irregular manifold plane. taper NULL (default) method = \"EM\", tapering applied; method = \"TMB\", tapering must applied (computational reasons), set 3 unspecified simple_kriging_fixed commit simple kriging fitting stage? TRUE, model fitting faster, option conduct universal kriging prediction stage removed ... parameters passed auto_basis() auto_BAUs() calling FRK(), user specified function optimiser() calling FRK() SRE.fit() normalise_basis flag indicating whether normalise basis functions reproduce stochastic process approximately constant variance spatially include_fs (applicable method = \"TMB\") flag indicating whether fine-scale variation included model object object class SRE returned constructor SRE() containing parameters information SRE model newdata object class SpatialPoylgons, SpatialPoints, STI, indicating regions points prediction carried . BAUs used option specified. obs_fs flag indicating whether fine-scale variation sits observation model (systematic error; indicated obs_fs = TRUE) process model (process fine-scale variation; indicated obs_fs = FALSE, default). non-Gaussian data models, /non-identity link functions, obs_fs = TRUE, fine-scale variation removed latent process \\(Y\\); however, re-introduced prediction conditonal mean μ simulated data Z* pred_time vector time indices prediction carried . time points used option specified covariances (applicable method = \"EM\") logical variable indicating whether prediction covariances returned . set TRUE, maximum 4000 prediction locations polygons allowed nsim number ) MC samples location using predict ii) response vectors using simulate type (applicable method = \"TMB\") vector strings indicating quantities inference desired. \"link\" type, inference latent Gaussian process \\(Y(\\cdot)\\) included; \"mean\" type, inference mean process \\(\\mu(\\cdot)\\) included (probability process, \\(\\pi(\\cdot)\\), applicable); \"response\" type, inference noisy data Z* included k (applicable response \"binomial\" \"negative-binomial\") vector size parameters BAU percentiles (applicable method = \"TMB\") vector scalars (0, 100) specifying desired percentiles posterior predictive distribution; NULL, percentiles computed kriging (applicable method = \"TMB\") string indicating kind kriging: \"simple\" ignores uncertainty due estimation fixed effects, \"universal\" accounts source uncertainty random_effects logical; set true, confidence intervals also provided random effects random effects γ (see `?SRE` details random effects) conditional_fs condition fitted fine-scale random effects?","code":""},{"path":"/reference/SRE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Construct SRE object, fit and predict — FRK","text":"following details provide summary model basic workflow used FRK. See Zammit-Mangion Cressie (2021) Sainsbury-Dale, Zammit-Mangion Cressie (2023) details. Model description hierarchical model implemented FRK spatial generalised linear mixed model (GLMM), may summarised Zj denotes datum, \\(EF\\) corresponds probability distribution exponential family dispersion parameter \\(\\psi\\), μZ vector containing conditional expectations datum, CZ matrix aggregates BAU-level mean process observation supports, μ mean process evaluated BAUs, \\(g\\) link function, Y latent Gaussian process evaluated BAUs, matrix T contains regression covariates BAU level associated fixed effects α, matrix G design matrix BAU level associated random effects γ, matrix S contains basis-function evaluations BAUs associated basis-function random effects η, ξ vector containing fine-scale variation BAU level. prior distribution random effects, γ, mean-zero multivariate Gaussian diagonal covariance matrix, group random effects associated variance parameter. variance parameters estimated model fitting. prior distribution basis-function coefficients, η, formulated using either covariance matrix K precision matrix Q, depending argument K_type. parameters matrices estimated model fitting. prior distribution fine-scale random effects, ξ, mean-zero multivariate Gaussian diagonal covariance matrix, Σξ. default, Σξ = σ2ξV, V known, positive-definite diagonal matrix whose elements provided field fs BAUs. absence problem specific fine-scale information, fs can simply set 1, V = . spatio-temporal setting, another model Σξ can used setting fs_by_spatial_BAU = TRUE, case spatial BAU associated fine-scale variance parameter (see Sainsbury-Dale et al., 2023, Sec. 2.6). either case, fine-scale variance parameter(s) either estimated model fitting, provided user via argument known_sigma2fs. Gaussian data model identity link function data Gaussian, identity link function used, preceding model simplifies considerably: Specifically, Z data vector, δ systematic error BAU level, e represents independent measurement error. Distributions size parameters Two distributions considered framework, namely binomial distribution negative-binomial distribution, assumed-known ‘size’ parameter ‘probability success’ parameter. Given vector size parameters associated data, kZ, parameterisation used FRK assumes Zj represents either number `successes' kZj trials (binomial data model) represents number failures kZj successes (negative-binomial data model). model fitting, BAU-level size parameters k needed. user must supply size parameters either data though BAUs. done depends whether data areal point-referenced, whether overlap common BAUs . simplest case observation associated single BAU BAU associated one observation support; , straightforward assign elements kZ elements k vice-versa, user may provide either k kZ. observation associated exactly one BAU, BAUs associated multiple observations, user must provide kZ, used infer k ; particular, ki = Σj∈ai kZj , \\(= 1, \\dots, N\\), ai denotes indices observations associated BAU Ai. one observations encompass multiple BAUs, k must provided BAUs, meaningfully distribute kZj multiple BAUs associated datum Zj. case, infer kZ using kZj = Σi∈cj ki , \\(j = 1, \\dots, m\\), cj denotes indices BAUs associated observation Zj. Set-SRE() constructs spatial random effects model user-defined formula, data object (list spatially-referenced data), basis functions set Basic Areal Units (BAUs). first takes object list data maps BAUs -- entails binning point-referenced data BAUs (averaging within BAU average_in_BAU = TRUE), finding BAUs associated observations. Following , incidence matrix, CZ, constructed. required matrices (S, T, CZ, etc.) constructed within SRE() returned part SRE object. SRE() also intitialises parameters random effects using sensible defaults. Please see SRE-class details. functions observed_BAUs() unobserved_BAUs() return indices observed unobserved BAUs, respectively. include random effects FRK please follow notation used lme4. example, add random effect according variable fct, simply add `(1 | fct)' formula used calling FRK() SRE(). Note FRK supports simple, uncorrelated random effects formula term '(1 + x | fct)' throw error (since lme4 parlance implies random effect corresponding intercept slope correlated). one wishes model intercept linear trend level fct, one can force intercept slope terms uncorrelated using notation \"(x || fct)\", shorthand \"(1 | fct) + (x - 1 | x2)\". Model fitting SRE.fit() takes object class SRE estimates unknown parameters, namely covariance matrix K, fine scale variance (σ2ξ σ2δ, depending whether Case 1 Case 2 chosen; see vignette \"FRK_intro\") regression parameters α. two methods model fitting currently implemented, implement maximum likelihood estimation (MLE). MLE via expectation maximisation (EM) algorithm. method implemented Gaussian data identity link function. log-likelihood (given Section 2.2 vignette) evaluated iteration current parameter estimate. Optimation continues convergence reached (log-likelihood stops changing tol), number EM iterations reaches n_EM. actual computations E-step M-step relatively straightforward. E-step contains inverse \\(r \\times r\\) matrix, \\(r\\) number basis functions exceed 2000. M-step first updates matrix K, depends sufficient statistics basis-function coefficients η. , regression parameters α updated simple optimisation routine (line search) used update fine-scale variance σ2δ σ2ξ. fine-scale errors measurement random errors homoscedastic, closed-form solution available update σ2ξ σ2δ. Irrespectively, since updates α, σ2δ σ2ξ, dependent, two updates iterated change σ2. 0.1%. MLE via TMB. method implemented available data models link functions offered FRK. Furthermore, method facilitates inclusion many basis function possible EM algorithm (excess 10,000). TMB applies Laplace approximation integrate latent random effects complete-data likelihood. resulting approximation marginal log-likelihood, derivatives respect parameters, called within R using optimising function optimiser (default nlminb()). Wrapper set-model fitting function FRK() acts wrapper functions SRE() SRE.fit(). added advantage using FRK() directly automatically generates BAUs basis functions based data. Hence FRK() can called using list data objects R formula, although R formula can contain space time covariates BAUs explicitly supplied covariate data. Prediction parameters estimated, SRE object passed onto function predict() order carry optimal predictions BAUs used construct SRE model SRE(). first part prediction process construct matrix S prediction polygons. made computationally efficient treating prediction polygons prediction combination BAUs. yield valid results BAUs relatively small. matrix S found, standard Gaussian inversion (conditioning) using estimated parameters used prediction. predict() returns BAUs (object specified newdata), class SpatialPixelsDataFrame, SpatialPolygonsDataFrame, STFDF, predictions uncertainty quantification added. method = \"TMB\", returned object list, containing previously described predictions, list Monte Carlo samples. predictions uncertainties can easily plotted using plot spplot package sp.","code":""},{"path":"/reference/SRE.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Construct SRE object, fit and predict — FRK","text":"Zammit-Mangion, . Cressie, N. (2021). FRK: R package spatial spatio-temporal prediction large datasets. Journal Statistical Software, 98(4), 1-48. doi:10.18637/jss.v098.i04. Sainsbury-Dale, M. Zammit-Mangion, . Cressie, N. (2024) Modelling Big, Heterogeneous, Non-Gaussian Spatial Spatio-Temporal Data using FRK. Journal Statistical Software, 108(10), 1--39. doi:10.18637/jss.v108.i10.","code":""},{"path":[]},{"path":"/reference/SRE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Construct SRE object, fit and predict — FRK","text":"","code":"library(\"FRK\") library(\"sp\") ## Generate process and data m <- 250 # Sample size zdf <- data.frame(x = runif(m), y= runif(m)) # Generate random locs zdf$Y <- 3 + sin(7 * zdf$x) + cos(9 * zdf$y) # Latent process zdf$z <- rnorm(m, mean = zdf$Y) # Simulate data coordinates(zdf) = ~x+y # Turn into sp object ## Construct BAUs and basis functions BAUs <- auto_BAUs(manifold = plane(), data = zdf, nonconvex_hull = FALSE, cellsize = c(0.03, 0.03), type=\"grid\") BAUs$fs <- 1 # scalar fine-scale covariance matrix basis <- auto_basis(manifold = plane(), data = zdf, nres = 2) ## Construct the SRE model S <- SRE(f = z ~ 1, list(zdf), basis = basis, BAUs = BAUs) #> Loading required namespace: gstat ## Fit with 2 EM iterations so to take as little time as possible S <- SRE.fit(S, n_EM = 2, tol = 0.01, print_lik = TRUE) #> NOTE: In FRK >2.0 simple_kriging_fixed = FALSE by default, and hence #> universal kriging is done by default. However this is only the case when #> method = 'TMB'. When method = 'EM', simple kriging is done, irrespective of #> what the argument simple_kriging_fixed is set to. #> | | | 0% | |=================================== | 50% | |======================================================================| 100% #> Maximum EM iterations reached ## Check fit info, final log-likelihood, and estimated regression coefficients info_fit(S) #> $method #> [1] \"EM\" #> #> $num_iterations #> [1] 2 #> #> $sigma2fshat_equal_0 #> [1] 1 #> #> $converged #> [1] 0 #> #> $plot_lik #> $plot_lik$x #> [1] 1 2 #> #> $plot_lik$llk #> [1] -337.1287 -329.4578 #> #> $plot_lik$ylab #> [1] \"log likelihood\" #> #> $plot_lik$xlab #> [1] \"EM iteration\" #> #> #> $time #> user system elapsed #> 0.271 0.579 0.280 #> logLik(S) #> [1] -328.9443 coef(S) #> Intercept #> 3.117274 ## Predict over BAUs pred <- predict(S) ## Plot if (FALSE) { plotlist <- plot(S, pred) ggpubr::ggarrange(plotlist = plotlist, nrow = 1, align = \"hv\", legend = \"top\")}"},{"path":"/reference/SRE.predict.html","id":null,"dir":"Reference","previous_headings":"","what":"Deprecated: Please use predict — SRE.predict","title":"Deprecated: Please use predict — SRE.predict","text":"Deprecated: Please use predict","code":""},{"path":"/reference/SRE.predict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Deprecated: Please use predict — SRE.predict","text":"","code":"SRE.predict(...)"},{"path":"/reference/SRE.predict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Deprecated: Please use predict — SRE.predict","text":"... (Deprecated)","code":""},{"path":"/reference/STplane.html","id":null,"dir":"Reference","previous_headings":"","what":"plane in space-time — STplane","title":"plane in space-time — STplane","text":"Initialisation 2D plane temporal dimension.","code":""},{"path":"/reference/STplane.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"plane in space-time — STplane","text":"","code":"STplane(measure = Euclid_dist(dim = 3L))"},{"path":"/reference/STplane.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"plane in space-time — STplane","text":"measure object class measure","code":""},{"path":"/reference/STplane.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"plane in space-time — STplane","text":"2D plane time component added initialised using measure object. default, measure object (measure) Euclidean distance 3 dimensions, Euclid_dist.","code":""},{"path":"/reference/STplane.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"plane in space-time — STplane","text":"","code":"P <- STplane() print(type(P)) #> [1] \"STplane\" print(sp::dimensions(P)) #> [1] 3"},{"path":"/reference/STsphere.html","id":null,"dir":"Reference","previous_headings":"","what":"Space-time sphere — STsphere","title":"Space-time sphere — STsphere","text":"Initialisation 2-sphere (S2) temporal dimension","code":""},{"path":"/reference/STsphere.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Space-time sphere — STsphere","text":"","code":"STsphere(radius = 6371)"},{"path":"/reference/STsphere.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Space-time sphere — STsphere","text":"radius radius sphere","code":""},{"path":"/reference/STsphere.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Space-time sphere — STsphere","text":"spatial-sphere, sphere surface initialised using radius parameter. default value radius R R=6371, Earth's radius km, measure used compute distances sphere great-circle distance sphere radius R. default Euclidean geometry used factor time component, dist((s1,t1),(s2,t2)) = sqrt(gc_dist(s1,s2)^2 + (t1 - t2)^2). Frequently distance can used since separate correlation length scales space time estimated EM algorithm (effectively scale space time separately).","code":""},{"path":"/reference/STsphere.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Space-time sphere — STsphere","text":"","code":"S <- STsphere() print(sp::dimensions(S)) #> [1] 3"},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":null,"dir":"Reference","previous_headings":"","what":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"Convert SpatialPolygonsDataFrame SpatialPixelsDataFrame object data frame.","code":""},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"","code":"SpatialPolygonsDataFrame_to_df(sp_polys, vars = names(sp_polys))"},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"sp_polys object class SpatialPolygonsDataFrame SpatialPixelsDataFrame vars variables put data frame (default )","code":""},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"function mainly used plotting SpatialPolygonsDataFrame objects ggplot rather spplot. coordinates polygon extracted concatenated one long data frame. attributes polygon attached data frame variables vary polygon id (rownames object).","code":""},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"","code":"library(sp) library(ggplot2) opts_FRK$set(\"parallel\",0L) df <- data.frame(id = c(rep(1,4),rep(2,4)), x = c(0,1,0,0,2,3,2,2), y=c(0,0,1,0,0,1,1,0)) pols <- df_to_SpatialPolygons(df,\"id\",c(\"x\",\"y\"),CRS()) polsdf <- SpatialPolygonsDataFrame(pols,data.frame(p = c(1,2),row.names=row.names(pols))) df2 <- SpatialPolygonsDataFrame_to_df(polsdf) if (FALSE) ggplot(df2,aes(x=x,y=y,group=id)) + geom_polygon()"},{"path":"/reference/TensorP.html","id":null,"dir":"Reference","previous_headings":"","what":"Tensor product of basis functions — TensorP","title":"Tensor product of basis functions — TensorP","text":"Constructs new set basis functions finding tensor product two sets basis functions.","code":""},{"path":"/reference/TensorP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tensor product of basis functions — TensorP","text":"","code":"TensorP(Basis1, Basis2) # S4 method for Basis,Basis TensorP(Basis1, Basis2)"},{"path":"/reference/TensorP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tensor product of basis functions — TensorP","text":"Basis1 first set basis functions Basis2 second set basis functions","code":""},{"path":[]},{"path":"/reference/TensorP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tensor product of basis functions — TensorP","text":"","code":"library(spacetime) library(sp) library(dplyr) #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union sim_data <- data.frame(lon = runif(20,-180,180), lat = runif(20,-90,90), t = 1:20, z = rnorm(20), std = 0.1) time <- as.POSIXct(\"2003-05-01\",tz=\"\") + 3600*24*(sim_data$t-1) space <- sim_data[,c(\"lon\",\"lat\")] coordinates(space) = ~lon+lat # change into an sp object slot(space, \"proj4string\") = CRS(\"+proj=longlat +ellps=sphere\") STobj <- STIDF(space,time,data=sim_data) G_spatial <- auto_basis(manifold = sphere(), data=as(STobj,\"Spatial\"), nres = 1, type = \"bisquare\", subsamp = 20000) G_temporal <- local_basis(manifold=real_line(),loc = matrix(c(1,3)),scale = rep(1,2)) G <- TensorP(G_spatial,G_temporal) # show_basis(G_spatial) # show_basis(G_temporal)"},{"path":"/reference/auto_BAUs.html","id":null,"dir":"Reference","previous_headings":"","what":"Automatic BAU generation — auto_BAUs","title":"Automatic BAU generation — auto_BAUs","text":"function calls generic function auto_BAU (exported) series checks easiest way generate set Basic Areal Units (BAUs) manifold used; see details.","code":""},{"path":"/reference/auto_BAUs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Automatic BAU generation — auto_BAUs","text":"","code":"auto_BAUs( manifold, type = NULL, cellsize = NULL, isea3h_res = NULL, data = NULL, nonconvex_hull = TRUE, convex = -0.05, tunit = NULL, xlims = NULL, ylims = NULL, spatial_BAUs = NULL, ... )"},{"path":"/reference/auto_BAUs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Automatic BAU generation — auto_BAUs","text":"manifold object class manifold type either ``grid'' ``hex'', indicating whether gridded hexagonal BAUs used. type unspecified, ``hex'' used sphere, ``grid'' used otherwise cellsize denotes size gridcell type = ``grid''. Needs length 1 (square-grid case) vector length dimensions(manifold) (rectangular-grid case) isea3h_res resolution number isea3h DGGRID cells type ``hex'' manifold surface sphere data object class SpatialPointsDataFrame, SpatialPolygonsDataFrame, STIDF, STFDF. Provision data implies domain bounded, thus necessary manifold real_line, plane, STplane, necessary manifold surface sphere nonconvex_hull flag indicating whether use fmesher generate non-convex hull. Otherwise convex hull used convex convex parameter used smoothing extended boundary working bounded domain (, object data supplied); see details tunit temporal unit requiring space-time BAUs. Can \"secs\", \"mins\", \"hours\", etc. xlims limits horizontal axis (overrides automatic selection) ylims limits vertical axis (overrides automatic selection) spatial_BAUs object class SpatialPolygonsDataFrame SpatialPixelsDataFrame representing spatial BAUs used spatio-temporal setting (left NULL, spatial BAUs constructed automatically using data) ... currently unused","code":""},{"path":"/reference/auto_BAUs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Automatic BAU generation — auto_BAUs","text":"auto_BAUs constructs set Basic Areal Units (BAUs) used data pre-processing prediction. , BAUs need sufficienly fine resolution inferences affected due binning. Two types BAUs supported FRK: ``hex'' (hexagonal) ``grid'' (rectangular). order ``grid'' set BAUs, user specify cellsize length one, length equal dimensions manifold, , length 1 real_line length 2 surface sphere plane. ``hex'' set BAUs desired, first element cellsize used determine side length dividing value approximately 2. argument type ignored real_line ``hex'' available manifold. object data provided, automatic domain selection may carried employing fmesher function fm_nonconvex_hull_inla, finds (non-convex) hull surrounding data points (centroids data polygons). domain extended smoothed using parameter convex. parameter convex negative, larger absolute value convex results larger domain smoother boundaries.","code":""},{"path":[]},{"path":"/reference/auto_BAUs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Automatic BAU generation — auto_BAUs","text":"","code":"## First a 1D example library(sp) set.seed(1) data <- data.frame(x = runif(10)*10, y = 0, z= runif(10)*10) coordinates(data) <- ~x+y Grid1D_df <- auto_BAUs(manifold = real_line(), cellsize = 1, data=data) if (FALSE) spplot(Grid1D_df) ## Now a 2D example data(meuse) coordinates(meuse) = ~x+y # change into an sp object ## Grid BAUs GridPols_df <- auto_BAUs(manifold = plane(), cellsize = 200, type = \"grid\", data = meuse, nonconvex_hull = 0) if (FALSE) plot(GridPols_df) ## Hex BAUs HexPols_df <- auto_BAUs(manifold = plane(), cellsize = 200, type = \"hex\", data = meuse, nonconvex_hull = 0) if (FALSE) plot(HexPols_df)"},{"path":"/reference/auto_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Automatic basis-function placement — auto_basis","title":"Automatic basis-function placement — auto_basis","text":"Automatically generate set local basis functions domain, automatically prune regions sparse data.","code":""},{"path":"/reference/auto_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Automatic basis-function placement — auto_basis","text":"","code":"auto_basis( manifold = plane(), data, regular = 1, nres = 3, prune = 0, max_basis = NULL, subsamp = 10000, type = c(\"bisquare\", \"Gaussian\", \"exp\", \"Matern32\"), isea3h_lo = 2, bndary = NULL, scale_aperture = ifelse(is(manifold, \"sphere\"), 1, 1.25), verbose = 0L, buffer = 0, tunit = NULL, ... )"},{"path":"/reference/auto_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Automatic basis-function placement — auto_basis","text":"manifold object class manifold, example, sphere plane data object class SpatialPointsDataFrame SpatialPolygonsDataFrame containing data basis-function placement based, list ; see details regular integer indicating number regularly-placed basis functions first resolution. two dimensions, dictates smallest number basis functions row column coarsest resolution. regular=0, irregular grid used, one based triangulation domain increased mesh density areas high data density; see details nres number basis-function resolutions use prune threshold parameter dictates basis function considered irrelevent unidentifiable, thus removed; see details [deprecated] max_basis maximum number basis functions. overrides parameter nres subsamp maximum amount data points consider carrying basis-function placement: data objects randomly sampled full dataset. Keep number fairly high (order 10^5), otherwise fine-resolution basis functions may spuriously removed type type basis functions use; see details isea3h_lo manifold = sphere(), argument dictates ISEA3H resolution coarsest one used first resolution bndary matrix containing points containing boundary. regular == 0 can used define boundary irregularly-spaced basis functions placed scale_aperture aperture (case bisquare, similar interpretation basis) width basis function minimum distance basis function centroids multiplied scale_aperture. Typically ranges 1 1.5 defaulted 1 sphere 1.25 manifolds. verbose logical variable indicating whether output summary basis functions created buffer numeric 0 0.5 indicating size buffer basis functions along boundary. buffer added computing number basis functions dimension, increasing number factor buffer. buffer may needed prior distribution basis-function coefficients formulated terms precision matrix tunit temporal unit, required constructing spatio-temporal basis. used BAUs. Can \"secs\", \"mins\", \"hours\", \"days\", \"years\", etc. ... unused","code":""},{"path":"/reference/auto_basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Automatic basis-function placement — auto_basis","text":"function automatically places basis functions within domain interest. domain plane real line, object data used establish domain boundary. Let \\(\\phi(u)\\) denote value basis function evaluated \\(u = s - c\\), \\(s\\) spatial coordinate \\(c\\) basis-function centroid. argument type can either ``Gaussian'', case ``bisquare'', case ``exp'', case ``Matern32'', case parameters \\(\\sigma, R, \\tau\\) \\(\\kappa\\) scale arguments. manifold real line, basis functions placed regularly inside domain, number basis functions coarsest resolution dictated integer parameter regular greater zero. real line, subsequent resolution twice many basis functions. scale basis function set based minimum distance centre locations following placement. scale equal minimum distance type basis function Gaussian, exponential, Matern32, equal 1.5 times value function bisquare. manifold plane, regular > 0, basis functions placed regularly within bounding box data, smallest number basis functions row column equal value regular coarsest resolution (note, just smallest number basis functions). Subsequent resolutions twice number basis functions row column. regular = 0, function fmesher::fm_nonconvex_hull_inla() used construct (non-convex) hull around data. buffer smoothness hull determined parameter convex. domain boundary found, fmesher::fm_mesh_2d_inla() used construct triangular mesh node vertices coincide data locations, subject minimum maximum triangular-side-length constraints. result mesh dense regions high data density dense regions sparse data. Even basis functions irregularly placed, scale taken function minimum distance basis function centres, detailed . may changed future revision package. manifold surface sphere, basis functions placed centroids discrete global grid (DGG), first basis resolution corresponding third resolution DGG (ISEA3H resolution 2, yields 92 basis functions globally). recommended go nres == 3 (ISEA3H resolutions 2--4) whole sphere; nres=3 yields total 1176 basis functions. ISEA3H resolution 6 available FRK; finer resolutions; please install dggrids https://github.com/andrewzm/dggrids using devtools. Basis functions influenced data points may hinder convergence EM algorithm K_type = \"unstructured\", since associated hidden states , large, unidentifiable. hence provide means automatically remove basis functions parameter prune. final set contains basis functions column sums associated matrix \\(S\\) (, recall, value/average basis functions /data points/polygons) greater prune. prune == 0, basis functions removed original design.","code":""},{"path":[]},{"path":"/reference/auto_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Automatic basis-function placement — auto_basis","text":"","code":"if (FALSE) { library(sp) library(ggplot2) ## Create a synthetic dataset set.seed(1) d <- data.frame(lon = runif(n=1000,min = -179, max = 179), lat = runif(n=1000,min = -90, max = 90), z = rnorm(5000)) coordinates(d) <- ~lon + lat slot(d, \"proj4string\") = CRS(\"+proj=longlat +ellps=sphere\") ## Now create basis functions over sphere G <- auto_basis(manifold = sphere(),data=d, nres = 2,prune=15, type = \"bisquare\", subsamp = 20000) ## Plot show_basis(G,draw_world()) }"},{"path":"/reference/coef_uncertainty.html","id":null,"dir":"Reference","previous_headings":"","what":"Uncertainty quantification of the fixed effects — coef_uncertainty","title":"Uncertainty quantification of the fixed effects — coef_uncertainty","text":"Compute confidence intervals fixed effects (upper lower bound specifed percentiles; default 90% confidence central interval)","code":""},{"path":"/reference/coef_uncertainty.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Uncertainty quantification of the fixed effects — coef_uncertainty","text":"","code":"coef_uncertainty( object, percentiles = c(5, 95), nsim = 400, random_effects = FALSE )"},{"path":"/reference/coef_uncertainty.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Uncertainty quantification of the fixed effects — coef_uncertainty","text":"object object class SRE returned constructor SRE() containing parameters information SRE model percentiles (applicable method = \"TMB\") vector scalars (0, 100) specifying desired percentiles posterior predictive distribution; NULL, percentiles computed nsim number Monte Carlo samples used compute confidence intervals random_effects logical; set true, confidence intervals also provided random effects random effects γ (see `?SRE` details random effects)","code":""},{"path":"/reference/combine_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Combine basis functions — combine_basis","title":"Combine basis functions — combine_basis","text":"Takes list objects class Basis returns single object class Basis.","code":""},{"path":"/reference/combine_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Combine basis functions — combine_basis","text":"","code":"combine_basis(Basis_list) # S4 method for list combine_basis(Basis_list)"},{"path":"/reference/combine_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Combine basis functions — combine_basis","text":"Basis_list list objects class Basis. element list assumed represent single resolution basis functions","code":""},{"path":[]},{"path":"/reference/combine_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Combine basis functions — combine_basis","text":"","code":"## Construct two resolutions of basis functions using local_basis() Basis1 <- local_basis(manifold = real_line(), loc = matrix(seq(0, 1, length.out = 3), ncol = 1), scale = rep(0.4, 3)) Basis2 <- local_basis(manifold = real_line(), loc = matrix(seq(0, 1, length.out = 6), ncol = 1), scale = rep(0.2, 6)) ## Combine basis-function resolutions into a single Basis object combine_basis(list(Basis1, Basis2)) #> Number of basis functions: 9 #> Number of resolutions: 2 #> Regular: 0 #> Type of manifold: real_line #> Dimension of manifold: 1 #> First basis function: #> function (s) { stopifnot(ncol(s) == dimensions(manifold)) y <- distance(manifold, s, c) (1 - (y/R)^2)^2 * (y < R) }"},{"path":"/reference/df_to_SpatialPolygons.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"Convert data frame SpatialPolygons object.","code":""},{"path":"/reference/df_to_SpatialPolygons.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"","code":"df_to_SpatialPolygons(df, keys, coords, proj)"},{"path":"/reference/df_to_SpatialPolygons.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"df data frame containing polygon information, see details keys vector variable names used group rows belonging polygon coords vector variable names identifying coordinate columns proj projection SpatialPolygons object. Needs class CRS","code":""},{"path":"/reference/df_to_SpatialPolygons.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"row data frame df contains coordinates labels (keys) identify polygon coordinates belong. function groups data frame according keys forms SpatialPolygons object coordinates group. important rings closed, , last row group identical first row. Since keys can length greater one, identify polygon new key forming MD5 hash made respective keys variables unique (therefore hashed key also unique). lon-lat coordinates use proj = CRS(\"+proj=longlat +ellps=sphere\").","code":""},{"path":"/reference/df_to_SpatialPolygons.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"","code":"library(sp) df <- data.frame(id = c(rep(1,4),rep(2,4)), x = c(0,1,0,0,2,3,2,2), y=c(0,0,1,0,0,1,1,0)) pols <- df_to_SpatialPolygons(df,\"id\",c(\"x\",\"y\"),CRS()) if (FALSE) plot(pols)"},{"path":"/reference/dist-matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Distance Matrix Computation from Two Matrices — dist-matrix","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"function extends dist accept two arguments.","code":""},{"path":"/reference/dist-matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"","code":"distR(x1, x2 = NULL)"},{"path":"/reference/dist-matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"x1 matrix size N1 x n x2 matrix size N2 x n","code":""},{"path":"/reference/dist-matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"Matrix size N1 x N2","code":""},{"path":"/reference/dist-matrix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"Computes distances coordinates x1 coordinates x2. matrices x1 x2 need number rows, need number columns (e.g., manifold dimensions).","code":""},{"path":"/reference/dist-matrix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"","code":"A <- matrix(rnorm(50),5,10) D <- distR(A,A[-3,])"},{"path":"/reference/distance.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute distance — distance","title":"Compute distance — distance","text":"Compute distance using object class measure manifold.","code":""},{"path":"/reference/distance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute distance — distance","text":"","code":"distance(d, x1, x2 = NULL) # S4 method for measure distance(d, x1, x2 = NULL) # S4 method for manifold distance(d, x1, x2 = NULL)"},{"path":"/reference/distance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute distance — distance","text":"d object class measure manifold x1 first coordinate x2 second coordinate","code":""},{"path":[]},{"path":"/reference/distance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute distance — distance","text":"","code":"distance(sphere(),matrix(0,1,2),matrix(10,1,2)) #> [,1] #> [1,] 1568.521 distance(plane(),matrix(0,1,2),matrix(10,1,2)) #> [,1] #> [1,] 14.14214"},{"path":"/reference/distances.html","id":null,"dir":"Reference","previous_headings":"","what":"Pre-configured distances — distances","title":"Pre-configured distances — distances","text":"Useful objects class distance included package.","code":""},{"path":"/reference/distances.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pre-configured distances — distances","text":"","code":"measure(dist, dim) Euclid_dist(dim = 2L) gc_dist(R = NULL) gc_dist_time(R = NULL)"},{"path":"/reference/distances.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pre-configured distances — distances","text":"dist function taking two arguments x1,x2 dim dimension manifold (e.g., 2 plane) R great-circle radius","code":""},{"path":"/reference/distances.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Pre-configured distances — distances","text":"Initialises object class measure contains function dist used computing distance two points. Currently Euclidean distance great-circle distance included FRK.","code":""},{"path":"/reference/distances.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pre-configured distances — distances","text":"","code":"M1 <- measure(distR,2) D <- distance(M1,matrix(rnorm(10),5,2))"},{"path":"/reference/draw_world.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a map of the world with country boundaries. — draw_world","title":"Draw a map of the world with country boundaries. — draw_world","text":"Layers ggplot2 map world current ggplot2 object.","code":""},{"path":"/reference/draw_world.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a map of the world with country boundaries. — draw_world","text":"","code":"draw_world(g = ggplot() + theme_bw() + xlab(\"\") + ylab(\"\"), inc_border = TRUE)"},{"path":"/reference/draw_world.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a map of the world with country boundaries. — draw_world","text":"g initial ggplot object inc_border flag indicating whether map border drawn ; see details.","code":""},{"path":"/reference/draw_world.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Draw a map of the world with country boundaries. — draw_world","text":"function uses ggplot2::map_data() order create world map. Since, default, creates lines crossing world (-180,180) longitude boundary, function .homogenise_maps() used split polygons boundary two. inc_border TRUE, border drawn around lon-lat space; option useful projections yield rectangular plots (e.g., sinusoidal global projection).","code":""},{"path":[]},{"path":"/reference/draw_world.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a map of the world with country boundaries. — draw_world","text":"","code":"if (FALSE) { library(ggplot2) draw_world(g = ggplot())}"},{"path":"/reference/eval_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate basis functions — eval_basis","title":"Evaluate basis functions — eval_basis","text":"Evaluate basis functions points average functions polygons.","code":""},{"path":"/reference/eval_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate basis functions — eval_basis","text":"","code":"eval_basis(basis, s) # S4 method for Basis,matrix eval_basis(basis, s) # S4 method for Basis,SpatialPointsDataFrame eval_basis(basis, s) # S4 method for Basis,SpatialPolygonsDataFrame eval_basis(basis, s) # S4 method for Basis,STIDF eval_basis(basis, s) # S4 method for TensorP_Basis,matrix eval_basis(basis, s) # S4 method for TensorP_Basis,STIDF eval_basis(basis, s) # S4 method for TensorP_Basis,STFDF eval_basis(basis, s)"},{"path":"/reference/eval_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate basis functions — eval_basis","text":"basis object class Basis s object class matrix, SpatialPointsDataFrame SpatialPolygonsDataFrame containing spatial locations/footprints","code":""},{"path":"/reference/eval_basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Evaluate basis functions — eval_basis","text":"function evaluates basis functions isolated points, averages basis functions polygons, computing matrix \\(S\\). latter operation carried using Monte Carlo integration 1000 samples per polygon. using space-time basis functions, object must contain field t containing numeric representation time, example, containing number seconds, hours, days since first data point.","code":""},{"path":[]},{"path":"/reference/eval_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate basis functions — eval_basis","text":"","code":"library(sp) ### Create a synthetic dataset set.seed(1) d <- data.frame(lon = runif(n=500,min = -179, max = 179), lat = runif(n=500,min = -90, max = 90), z = rnorm(500)) coordinates(d) <- ~lon + lat slot(d, \"proj4string\") = CRS(\"+proj=longlat\") ### Now create basis functions on sphere G <- auto_basis(manifold = sphere(),data=d, nres = 2,prune=15, type = \"bisquare\", subsamp = 20000) #> NOTE: Zero process variability is implicitly enforced in regions where basis functions are pruned. Please use the option prune carefully: regions of data paucity are generally not reflective of regions of low process variability. Please set prune = 0 if unsure what to do. ### Now evaluate basis functions at origin S <- eval_basis(G,matrix(c(0,0),1,2))"},{"path":"/reference/info_fit.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve fit information for SRE model — info_fit","title":"Retrieve fit information for SRE model — info_fit","text":"Takes object class SRE returns list containing relevant information parameter estimation","code":""},{"path":"/reference/info_fit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve fit information for SRE model — info_fit","text":"","code":"info_fit(object) # S4 method for SRE info_fit(object)"},{"path":"/reference/info_fit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve fit information for SRE model — info_fit","text":"object object class SRE","code":""},{"path":[]},{"path":"/reference/info_fit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve fit information for SRE model — info_fit","text":"","code":"# See example in the help file for FRK"},{"path":"/reference/initialize-manifold-method.html","id":null,"dir":"Reference","previous_headings":"","what":"manifold — initialize,manifold-method","title":"manifold — initialize,manifold-method","text":"Manifold initialisation. function called directly manifold virtual class.","code":""},{"path":"/reference/initialize-manifold-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"manifold — initialize,manifold-method","text":"","code":"# S4 method for manifold initialize(.Object)"},{"path":"/reference/initialize-manifold-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"manifold — initialize,manifold-method","text":".Object manifold object passed lower-level constructor","code":""},{"path":"/reference/isea3h.html","id":null,"dir":"Reference","previous_headings":"","what":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","title":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","text":"data used obtained https://webpages.sou.edu/~sahrk/dgg/isea.old/gen/isea3h.html represent ISEA discrete global grids (DGGRIDs) generated using DGGRID software. original .gen files converted data frame using function dggrid_gen_to_df, available dggrids package. resolutions 0--6 supplied FRK note resolution 0 ISEA3H equal resolution 1 FRK. higher resolutions dggrids can installed https://github.com/andrewzm/dggrids/ using devtools.","code":""},{"path":"/reference/isea3h.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","text":"","code":"isea3h"},{"path":"/reference/isea3h.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","text":"data frame 284,208 rows 5 variables: id grid identification number within given resolution lon longitude coordinate lat latitude coordinate res DGGRID resolution (0 -- 6) centroid 0-1 variable, indicating whether point describes centroid polygon, whether boundary point polygon","code":""},{"path":"/reference/isea3h.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","text":"Sahr, K. (2008). Location coding icosahedral aperture 3 hexagon discrete global grids. Computers, Environment Urban Systems, 32, 174--187.","code":""},{"path":"/reference/local_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Construct a set of local basis functions — local_basis","title":"Construct a set of local basis functions — local_basis","text":"Construct set local basis functions based pre-specified location scale parameters.","code":""},{"path":"/reference/local_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Construct a set of local basis functions — local_basis","text":"","code":"local_basis( manifold = sphere(), loc = matrix(c(1, 0), nrow = 1), scale = 1, type = c(\"bisquare\", \"Gaussian\", \"exp\", \"Matern32\"), res = 1, regular = FALSE ) radial_basis( manifold = sphere(), loc = matrix(c(1, 0), nrow = 1), scale = 1, type = c(\"bisquare\", \"Gaussian\", \"exp\", \"Matern32\") )"},{"path":"/reference/local_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Construct a set of local basis functions — local_basis","text":"manifold object class manifold, example, sphere loc matrix size n dimensions(manifold) indicating centres basis functions scale vector length n containing scale parameters basis functions; see details type either \"bisquare\", \"Gaussian\", \"exp\", \"Matern32\" res vector length n containing resolutions basis functions regular logical indicating basis functions (resolution) regular grid","code":""},{"path":"/reference/local_basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Construct a set of local basis functions — local_basis","text":"functions lays local basis functions domain interest based pre-specified location scale parameters. type ``bisquare'', $$\\phi(u) = \\left(1- \\left(\\frac{\\| u \\|}{R}\\right)^2\\right)^2 (\\|u\\| < R),$$ scale given \\(R\\), range support bisquare function. type ``Gaussian'', $$\\phi(u) = \\exp\\left(-\\frac{\\|u \\|^2}{2\\sigma^2}\\right),$$ scale given \\(\\sigma\\), standard deviation. type ``exp'', $$\\phi(u) = \\exp\\left(-\\frac{\\|u\\|}{ \\tau}\\right),$$ scale given \\(\\tau\\), e-folding length. type ``Matern32'', $$\\phi(u) = \\left(1 + \\frac{\\sqrt{3}\\|u\\|}{\\kappa}\\right)\\exp\\left(-\\frac{\\sqrt{3}\\| u \\|}{\\kappa}\\right),$$ scale given \\(\\kappa\\), function's scale.","code":""},{"path":[]},{"path":"/reference/local_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Construct a set of local basis functions — local_basis","text":"","code":"library(ggplot2) G <- local_basis(manifold = real_line(), loc=matrix(1:10,10,1), scale=rep(2,10), type=\"bisquare\") if (FALSE) show_basis(G)"},{"path":"/reference/loglik.html","id":null,"dir":"Reference","previous_headings":"","what":"(Deprecated) Retrieve log-likelihood — loglik","title":"(Deprecated) Retrieve log-likelihood — loglik","text":"function deprecated; please use logLik","code":""},{"path":"/reference/loglik.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"(Deprecated) Retrieve log-likelihood — loglik","text":"","code":"loglik(object) # S4 method for SRE loglik(object)"},{"path":"/reference/loglik.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"(Deprecated) Retrieve log-likelihood — loglik","text":"object object class SRE","code":""},{"path":"/reference/manifold-class.html","id":null,"dir":"Reference","previous_headings":"","what":"manifold — manifold-class","title":"manifold — manifold-class","text":"class manifold virtual; manifold classes inherit class.","code":""},{"path":"/reference/manifold-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"manifold — manifold-class","text":"manifold object characterised character variable type, contains description manifold, variable measure type measure. typical measure Euclidean distance. FRK supports five manifolds; real line (one dimension), instantiated using real_line(); 2D plane, instantiated using plane(); 2D-sphere surface S2, instantiated using sphere(); R2 space-time manifold, instantiated using STplane(), S2 space-time manifold, instantiated using STsphere(). User-specific manifolds can also specified, however helper functions manifold specific, auto_BAUs auto_basis, work pre-configured manifolds. Importantly, one can change distance function used manifold synthesise anisotropy heterogeneity. See vignette one example.","code":""},{"path":[]},{"path":"/reference/manifold.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve manifold — manifold","title":"Retrieve manifold — manifold","text":"Retrieve manifold FRK object.","code":""},{"path":"/reference/manifold.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve manifold — manifold","text":"","code":"manifold(.Object) # S4 method for Basis manifold(.Object) # S4 method for TensorP_Basis manifold(.Object)"},{"path":"/reference/manifold.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve manifold — manifold","text":".Object FRK object","code":""},{"path":[]},{"path":"/reference/manifold.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve manifold — manifold","text":"","code":"G <- local_basis(manifold = plane(), loc=matrix(0,1,2), scale=0.2, type=\"bisquare\") manifold(G) #> Type of manifold: plane #> Dimension of manifold: 2 #> Distance function: #> function (x1, x2) distR(x1, x2)"},{"path":"/reference/measure-class.html","id":null,"dir":"Reference","previous_headings":"","what":"measure — measure-class","title":"measure — measure-class","text":"Measure class used defining measures used compute distances points objects constructed FRK package.","code":""},{"path":"/reference/measure-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"measure — measure-class","text":"object class measure contains distance function variable dim dimensions Riemannian manifold distance computed.","code":""},{"path":[]},{"path":"/reference/nbasis.html","id":null,"dir":"Reference","previous_headings":"","what":"Number of basis functions — nbasis","title":"Number of basis functions — nbasis","text":"Retrieve number basis functions Basis SRE object.","code":""},{"path":"/reference/nbasis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Number of basis functions — nbasis","text":"","code":"nbasis(.Object) # S4 method for Basis_obj nbasis(.Object) # S4 method for SRE nbasis(.Object)"},{"path":"/reference/nbasis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Number of basis functions — nbasis","text":".Object object class Basis SRE","code":""},{"path":[]},{"path":"/reference/nbasis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Number of basis functions — nbasis","text":"","code":"library(sp) data(meuse) coordinates(meuse) = ~x+y # change into an sp object G <- auto_basis(manifold = plane(), data=meuse, nres = 2, regular=1, type = \"Gaussian\") print(nbasis(G)) #> [1] 129"},{"path":"/reference/nres.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the number of resolutions — nres","title":"Return the number of resolutions — nres","text":"Return number resolutions basis function object.","code":""},{"path":"/reference/nres.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the number of resolutions — nres","text":"","code":"nres(b) # S4 method for Basis nres(b) # S4 method for TensorP_Basis nres(b) # S4 method for SRE nres(b)"},{"path":"/reference/nres.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the number of resolutions — nres","text":"b object class Basis SRE","code":""},{"path":[]},{"path":"/reference/nres.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return the number of resolutions — nres","text":"","code":"library(sp) set.seed(1) d <- data.frame(lon = runif(n=500,min = -179, max = 179), lat = runif(n=500,min = -90, max = 90), z = rnorm(500)) coordinates(d) <- ~lon + lat slot(d, \"proj4string\") = CRS(\"+proj=longlat\") ### Now create basis functions on sphere G <- auto_basis(manifold = sphere(),data=d, nres = 2,prune=15, type = \"bisquare\", subsamp = 20000) #> NOTE: Zero process variability is implicitly enforced in regions where basis functions are pruned. Please use the option prune carefully: regions of data paucity are generally not reflective of regions of low process variability. Please set prune = 0 if unsure what to do. nres(G) #> [1] 2"},{"path":"/reference/observed_BAUs.html","id":null,"dir":"Reference","previous_headings":"","what":"Observed (or unobserved) BAUs — observed_BAUs","title":"Observed (or unobserved) BAUs — observed_BAUs","text":"Computes indices (numeric vector) observed (unobserved) BAUs","code":""},{"path":"/reference/observed_BAUs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Observed (or unobserved) BAUs — observed_BAUs","text":"","code":"observed_BAUs(object) unobserved_BAUs(object) # S4 method for SRE observed_BAUs(object) # S4 method for SRE unobserved_BAUs(object)"},{"path":"/reference/observed_BAUs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Observed (or unobserved) BAUs — observed_BAUs","text":"object object class SRE","code":""},{"path":[]},{"path":"/reference/observed_BAUs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Observed (or unobserved) BAUs — observed_BAUs","text":"","code":"# See example in the help file for FRK"},{"path":"/reference/opts_FRK.html","id":null,"dir":"Reference","previous_headings":"","what":"FRK options — opts_FRK","title":"FRK options — opts_FRK","text":"main options list FRK package.","code":""},{"path":"/reference/opts_FRK.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"FRK options — opts_FRK","text":"","code":"opts_FRK"},{"path":"/reference/opts_FRK.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"FRK options — opts_FRK","text":"List 2 $ set:function(opt,value) $ get:function(opt)","code":""},{"path":"/reference/opts_FRK.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"FRK options — opts_FRK","text":"opts_FRK list containing two functions, set get, can used set options retrieve options, respectively. Currently FRK uses three options: \"progress\": flag indicating whether progress bars displayed \"verbose\": flag indicating whether certain progress messages shown . Currently option applicable method = \"TMB\" \"parallel\": integer indicating number cores use. number 0 1 indicates parallelism","code":""},{"path":"/reference/opts_FRK.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"FRK options — opts_FRK","text":"","code":"opts_FRK$set(\"progress\",1L) opts_FRK$get(\"parallel\") #> [1] 0"},{"path":"/reference/plane.html","id":null,"dir":"Reference","previous_headings":"","what":"plane — plane","title":"plane — plane","text":"Initialisation 2D plane.","code":""},{"path":"/reference/plane.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"plane — plane","text":"","code":"plane(measure = Euclid_dist(dim = 2L))"},{"path":"/reference/plane.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"plane — plane","text":"measure object class measure","code":""},{"path":"/reference/plane.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"plane — plane","text":"2D plane initialised using measure object. default, measure object (measure) Euclidean distance 2 dimensions, Euclid_dist.","code":""},{"path":"/reference/plane.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"plane — plane","text":"","code":"P <- plane() print(type(P)) #> [1] \"plane\" print(sp::dimensions(P)) #> [1] 2"},{"path":"/reference/plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot predictions from FRK analysis — plot","title":"Plot predictions from FRK analysis — plot","text":"function acts wrapper around plot_spatial_or_ST. plots fields Spatial*DataFrame STFDF object corresponding prediction prediction uncertainty quantification. also uses @data slot SRE object plot training data set(s), generates informative, latex-style legend labels plots.","code":""},{"path":"/reference/plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot predictions from FRK analysis — plot","text":"","code":"plot(x, y, ...) # S4 method for SRE,list plot(x, y, ...) # S4 method for SRE,STFDF plot(x, y, ...) # S4 method for SRE,SpatialPointsDataFrame plot(x, y, ...) # S4 method for SRE,SpatialPixelsDataFrame plot(x, y, ...) # S4 method for SRE,SpatialPolygonsDataFrame plot(x, y, ...)"},{"path":"/reference/plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot predictions from FRK analysis — plot","text":"x object class SRE y Spatial*DataFrame STFDF object resulting call predict(x). Keep mind predict() returns list method = \"TMB\"; element $newdata contains required Spatial/ST object. list passed, receive error: \"x\" \"y\" lengths differ. ... optional arguments passed plot_spatial_or_ST","code":""},{"path":"/reference/plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot predictions from FRK analysis — plot","text":"list ggplot objects consisting observed data, predictions, standard errors. list can supplied , example, ggpubr::ggarrange().","code":""},{"path":"/reference/plot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot predictions from FRK analysis — plot","text":"","code":"## See example in the help file for SRE"},{"path":"/reference/plot_spatial_or_ST.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"Takes object class Spatial*DataFrame STFDF, plots requested data columns using ggplot2","code":""},{"path":"/reference/plot_spatial_or_ST.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"","code":"plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... ) # S4 method for STFDF plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... ) # S4 method for SpatialPointsDataFrame plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... ) # S4 method for SpatialPixelsDataFrame plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... ) # S4 method for SpatialPolygonsDataFrame plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... )"},{"path":"/reference/plot_spatial_or_ST.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"newdata object class Spatial*DataFrame STFDF column_names vector strings indicating columns data plot map_layer (optional) ggplot layer object add plotted layer, often map subset_time (optional) vector times included; applicable STFDF objects palette palette supplied argument palette scale_*_distiller(). Alternatively, palette = \"nasa\", vibrant colour palette created using scale_*_gradientn() plot_over_world logical; TRUE, coord_map(\"mollweide\") draw_world used plot world labels_from_coordnames logical; TRUE, coordinate names newdata (.e., coordnames(newdata)) used horizontal- vertical-axis labels. Otherwise, generic names, s_1 s_2, used ... optional arguments passed whatever geom appropriate Spatial*DataFrame STFDF object (geom_point, geom_tile, geom_raster, geom_polygon)","code":""},{"path":"/reference/plot_spatial_or_ST.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"list ggplot objects corresponding provided column_names. list can supplied , example, ggpubr::ggarrange().","code":""},{"path":[]},{"path":"/reference/plot_spatial_or_ST.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"","code":"## See example in the help file for FRK"},{"path":"/reference/plotting-themes.html","id":null,"dir":"Reference","previous_headings":"","what":"Plotting themes — plotting-themes","title":"Plotting themes — plotting-themes","text":"Formats ggplot object neat plotting.","code":""},{"path":"/reference/plotting-themes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plotting themes — plotting-themes","text":"","code":"LinePlotTheme() EmptyTheme()"},{"path":"/reference/plotting-themes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plotting themes — plotting-themes","text":"Object class ggplot","code":""},{"path":"/reference/plotting-themes.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plotting themes — plotting-themes","text":"LinePlotTheme() creates ggplot object white background, relatively large font, grid lines. EmptyTheme() hand creates ggplot object axes legends.","code":""},{"path":"/reference/plotting-themes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plotting themes — plotting-themes","text":"","code":"if (FALSE) { X <- data.frame(x=runif(100),y = runif(100), z = runif(100)) LinePlotTheme() + geom_point(data=X,aes(x,y,colour=z)) EmptyTheme() + geom_point(data=X,aes(x,y,colour=z))}"},{"path":"/reference/real_line.html","id":null,"dir":"Reference","previous_headings":"","what":"real line — real_line","title":"real line — real_line","text":"Initialisation real-line (1D) manifold.","code":""},{"path":"/reference/real_line.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"real line — real_line","text":"","code":"real_line(measure = Euclid_dist(dim = 1L))"},{"path":"/reference/real_line.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"real line — real_line","text":"measure object class measure","code":""},{"path":"/reference/real_line.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"real line — real_line","text":"real line initialised using measure object. default, measure object (measure) describes distance two points absolute difference two coordinates.","code":""},{"path":"/reference/real_line.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"real line — real_line","text":"","code":"R <- real_line() print(type(R)) #> [1] \"real_line\" print(sp::dimensions(R)) #> [1] 1"},{"path":"/reference/remove_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Removes basis functions — remove_basis","title":"Removes basis functions — remove_basis","text":"Takes object class Basis returns object class Basis selected basis functions removed","code":""},{"path":"/reference/remove_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Removes basis functions — remove_basis","text":"","code":"remove_basis(Basis, rmidx) # S4 method for Basis,ANY remove_basis(Basis, rmidx) # S4 method for Basis,SpatialPolygons remove_basis(Basis, rmidx)"},{"path":"/reference/remove_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Removes basis functions — remove_basis","text":"Basis object class Basis rmidx indices basis functions remove. SpatialPolygons object; basis functions overlapping SpatialPolygons object retained","code":""},{"path":[]},{"path":"/reference/remove_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Removes basis functions — remove_basis","text":"","code":"library(sp) df <- data.frame(x = rnorm(10), y = rnorm(10)) coordinates(df) <- ~x+y G <- auto_basis(plane(),df,nres=1) data.frame(G) # Print info on basis #> loc1 loc2 scale res #> 1 -1.9123458 -1.6219373 2.286276 1 #> 2 -0.3886904 -1.6219373 2.286276 1 #> 3 1.1349651 -1.6219373 2.286276 1 #> 4 -1.9123458 -0.4025903 2.286276 1 #> 5 -0.3886904 -0.4025903 2.286276 1 #> 6 1.1349651 -0.4025903 2.286276 1 #> 7 -1.9123458 0.8167566 2.286276 1 #> 8 -0.3886904 0.8167566 2.286276 1 #> 9 1.1349651 0.8167566 2.286276 1 #> 10 -1.9123458 2.0361036 2.286276 1 #> 11 -0.3886904 2.0361036 2.286276 1 #> 12 1.1349651 2.0361036 2.286276 1 ## Removing basis functions by index G_subset <- remove_basis(G, 1:(nbasis(G)-1)) data.frame(G_subset) #> loc1 loc2 scale res #> 12 1.134965 2.036104 2.286276 1 ## Removing basis functions using SpatialPolygons x <- 1 poly <- Polygon(rbind(c(-x, -x), c(-x, x), c(x, x), c(x, -x), c(-x, -x))) polys <- Polygons(list(poly), \"1\") spatpolys <- SpatialPolygons(list(polys)) G_subset <- remove_basis(G, spatpolys) data.frame(G_subset) #> loc1 loc2 scale res #> 5 -0.3886904 -0.4025903 2.286276 1 #> 8 -0.3886904 0.8167566 2.286276 1"},{"path":"/reference/show_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Show basis functions — show_basis","title":"Show basis functions — show_basis","text":"Generic plotting function visualising basis functions.","code":""},{"path":"/reference/show_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show basis functions — show_basis","text":"","code":"show_basis(basis, ...) # S4 method for Basis show_basis(basis, g = ggplot() + theme_bw() + xlab(\"\") + ylab(\"\")) # S4 method for TensorP_Basis show_basis(basis, g = ggplot())"},{"path":"/reference/show_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show basis functions — show_basis","text":"basis object class Basis ... use g object class gg (ggplot object) overlay basis functions (optional)","code":""},{"path":"/reference/show_basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Show basis functions — show_basis","text":"function show_basis adapts behaviour manifold used. real_line, 1D basis functions plotted colour distinguishing different resolutions. plane, local basis functions supported (present). basis function shown circle diameter equal scale parameter function. Linetype distinguishes resolution. sphere, centres basis functions shown circles, larger sizes corresponding coarser resolutions. Space-time basis functions subclass TensorP_Basis visualised showing spatial basis functions temporal basis functions two separate plots.","code":""},{"path":[]},{"path":"/reference/show_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Show basis functions — show_basis","text":"","code":"library(ggplot2) library(sp) data(meuse) coordinates(meuse) = ~x+y # change into an sp object G <- auto_basis(manifold = plane(),data=meuse,nres = 2,regular=2,prune=0.1,type = \"bisquare\") #> NOTE: Zero process variability is implicitly enforced in regions where basis functions are pruned. Please use the option prune carefully: regions of data paucity are generally not reflective of regions of low process variability. Please set prune = 0 if unsure what to do. if (FALSE) show_basis(G,ggplot()) + geom_point(data=data.frame(meuse),aes(x,y))"},{"path":"/reference/sphere.html","id":null,"dir":"Reference","previous_headings":"","what":"sphere — sphere","title":"sphere — sphere","text":"Initialisation 2-sphere, S2.","code":""},{"path":"/reference/sphere.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"sphere — sphere","text":"","code":"sphere(radius = 6371)"},{"path":"/reference/sphere.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"sphere — sphere","text":"radius radius sphere","code":""},{"path":"/reference/sphere.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"sphere — sphere","text":"2D surface sphere initialised using radius parameter. default value radius R R=6371 km, Earth's radius, measure used compute distances sphere great-circle distance sphere radius R.","code":""},{"path":"/reference/sphere.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"sphere — sphere","text":"","code":"S <- sphere() print(sp::dimensions(S)) #> [1] 2"},{"path":"/reference/type.html","id":null,"dir":"Reference","previous_headings":"","what":"Type of manifold — type","title":"Type of manifold — type","text":"Retrieve slot type object","code":""},{"path":"/reference/type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Type of manifold — type","text":"","code":"type(.Object) # S4 method for manifold type(.Object)"},{"path":"/reference/type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Type of manifold — type","text":".Object object class Basis manifold","code":""},{"path":[]},{"path":"/reference/type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Type of manifold — type","text":"","code":"S <- sphere() print(type(S)) #> [1] \"surface of sphere\""},{"path":"/reference/worldmap.html","id":null,"dir":"Reference","previous_headings":"","what":"World map — worldmap","title":"World map — worldmap","text":"world map extracted package maps v.3.0.1 running ggplot2::map_data(\"world\"). reduce data size, every third point data frame contained worldmap.","code":""},{"path":"/reference/worldmap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"World map — worldmap","text":"","code":"worldmap"},{"path":"/reference/worldmap.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"World map — worldmap","text":"data frame 33971 rows 6 variables: long longitude coordinate lat latitude coordinate group polygon (region) number order order point polygon boundary region region name subregion subregion name","code":""},{"path":"/reference/worldmap.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"World map — worldmap","text":"Original S code Becker, R.. Wilks, R.. R version Brownrigg, R. Enhancements made Minka, T.P. Deckmyn, . (2015) maps: Draw Geographical Maps, R package version 3.0.1.","code":""}] +[{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Andrew Zammit-Mangion. Author, maintainer. Matthew Sainsbury-Dale. Author.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Zammit-Mangion , Cressie N (2021). “FRK: R Package Spatial Spatio-Temporal Prediction Large Datasets.” Journal Statistical Software, 98(4), 1–48. doi:10.18637/jss.v098.i04. Sainsbury-Dale M, Zammit-Mangion , Cressie N (2024). “Modeling Big, Heterogeneous, Non-Gaussian Spatial Spatio-Temporal Data Using FRK.” Journal Statistical Software, 108(10), 1–39. doi:10.18637/jss.v108.i10.","code":"@Article{, title = {{FRK}: An {R} Package for Spatial and Spatio-Temporal Prediction with Large Datasets}, author = {Andrew Zammit-Mangion and Noel Cressie}, journal = {Journal of Statistical Software}, year = {2021}, volume = {98}, number = {4}, pages = {1--48}, doi = {10.18637/jss.v098.i04}, } @Article{, title = {Modeling Big, Heterogeneous, Non-{G}aussian Spatial and Spatio-Temporal Data Using {FRK}}, author = {Matthew Sainsbury-Dale and Andrew Zammit-Mangion and Noel Cressie}, journal = {Journal of Statistical Software}, year = {2024}, volume = {108}, number = {10}, pages = {1--39}, doi = {10.18637/jss.v108.i10}, }"},{"path":"/index.html","id":"fixed-rank-kriging-","dir":"","previous_headings":"","what":"Fixed Rank Kriging","title":"Fixed Rank Kriging","text":"package FRK available CRAN! install, please type install recent development version, please load devtools type paper introducing package available . paper detailing approach non-Gaussian setting available (six-page summary paper available ). vignette “FRK_intro” summarises package, gives details EM algorithm may employed Gaussian setting, provides several examples. Another vignette, “FRK_non-Gaussian”, summarises inference non-Gaussian setting (Laplace approximation used), contains examples using non-Gaussian data newly available plotting methods. access vignettes, please click following links: Introduction FRK Tutorial modelling spatial spatio-temporal non-Gaussian data FRK pkgdown page also available .","code":"install.packages(\"FRK\") install_github(\"andrewzm/FRK\", dependencies = TRUE, build_vignettes = TRUE)"},{"path":"/index.html","id":"supporting-and-citing","dir":"","previous_headings":"","what":"Supporting and citing","title":"Fixed Rank Kriging","text":"use FRK work, research, activities, please cite using information provided citation(\"FRK\").","code":""},{"path":"/index.html","id":"description","dir":"","previous_headings":"","what":"Description","title":"Fixed Rank Kriging","text":"Package: FRK Type: Package Title: Fixed Rank Kriging Version: 2.1.5 Date: 2023-01-30 Author: Andrew Zammit-Mangion, Matthew Sainsbury-Dale Maintainer: Andrew Zammit-Mangion andrewzm@gmail.com Description: tool spatial/spatio-temporal modelling prediction large datasets. approach models field, hence covariance function, using set basis functions. fixed-rank basis-function representation facilitates modelling big data, method naturally allows non-stationary, anisotropic covariance functions. Discretisation spatial domain -called basic areal units (BAUs) facilitates use observations varying support (.e., point-referenced areal supports, potentially simultaneously), prediction arbitrary user-specified regions. FRK also supports inference various manifolds, including 2D plane 3D sphere, provides helper functions model, fit, predict, plot relative ease. Version 2.0.0 also supports modelling non-Gaussian data (e.g., Poisson, binomial, negative-binomial, gamma, inverse-Gaussian) employing generalised linear mixed model (GLMM) framework. Zammit-Mangion Cressie doi:10.18637/jss.v098.i04 describe FRK Gaussian setting, detail use basis functions BAUs, Sainsbury-Dale et al.  describe FRK non-Gaussian setting; two vignettes available summarise papers provide additional examples. Zammit-Mangion, . & Cressie N. (2021). “FRK: R package spatial spatio-temporal prediction large datasets.” Journal Statistical Software, 98, 1-48. Sainsbury-Dale, M., Zammit-Mangion, . & Cressie, N. (2023). “Modelling Big, Heterogeneous, Non-Gaussian Spatial Spatio-Temporal Data using FRK” Journal Statistical Software, accepted publication, https://arxiv.org/abs/2110.02507. License: GPL (>= 2)","code":""},{"path":[]},{"path":"/index.html","id":"gaussian-data","dir":"","previous_headings":"Quick start","what":"Gaussian data","title":"Fixed Rank Kriging","text":"","code":"library(\"FRK\") library(\"sp\") library(\"ggplot2\") library(\"ggpubr\") ## Setup m <- 1000 # Sample size RNGversion(\"3.6.0\"); set.seed(1) # Fix seed zdf <- data.frame(x = runif(m), y= runif(m)) # Generate random locs zdf$z <- sin(8 * zdf$x) + cos(8 * zdf$y) + 0.5 * rnorm(m) # Simulate data coordinates(zdf) = ~x+y # Turn into sp object ## Run FRK S <- FRK(f = z ~ 1, # Formula to FRK list(zdf), # All datasets are supplied in list n_EM = 10) # Max number of EM iterations pred <- predict(S) # Prediction stage ## Plotting plotlist <- plot(S, pred) ggarrange(plotlist = plotlist, nrow = 1, legend = \"top\")"},{"path":"/index.html","id":"non-gaussian-data","dir":"","previous_headings":"Quick start","what":"Non-Gaussian data","title":"Fixed Rank Kriging","text":"analyse simulated Poisson data. signify Poisson data model mean response modelled using square-root link function setting response = \"poisson\" link = \"sqrt\" FRK(). non-Gaussian response distributions available FRK binomial, negative-binomial, gamma, inverse-Gaussian distributions.","code":"## Simulate Poisson data using the previous example's data to construct a mean zdf$z <- rpois(m, lambda = zdf$z^2) ## Run FRK S <- FRK(f = z ~ 1, list(zdf), response = \"poisson\", # Poisson data model link = \"sqrt\") # square-root link function pred <- predict(S) ## Plotting plotlist <- plot(S, pred$newdata) ggarrange(plotlist$z, plotlist$p_mu, plotlist$interval90_mu, nrow = 1, legend = \"top\")"},{"path":"/index.html","id":"spatio-temporal-data","dir":"","previous_headings":"Quick start","what":"Spatio-temporal data","title":"Fixed Rank Kriging","text":"now analyse spatio-temporal data, using NOAA dataset.","code":"## Setup library(\"spacetime\") data(\"NOAA_df_1990\") Tmax <- subset(NOAA_df_1990, month %in% 7 & year == 1993) Tmax <- within(Tmax, {time = as.Date(paste(year,month,day,sep=\"-\"))}) STObj <- stConstruct(x = Tmax, space = c(\"lon\",\"lat\"), time = \"time\", interval = TRUE) ## BAUs: spatial BAUs are 1x1 pixels, temporal BAUs are 1 day intervals BAUs <- auto_BAUs(manifold = STplane(), cellsize = c(1, 1, 1), data=STObj, tunit = \"days\") BAUs$fs <- 1 # scalar fine-scale variance matrix, implicit in previous examples ## Basis functions G <- auto_basis(manifold = STplane(), data = STObj, nres = 2, tunit = \"days\") ## Run FRK STObj$std <- 2 # fix the measurement error variance S <- FRK(f = z ~ 1 + lat, data = list(STObj), basis = G, BAUs = BAUs, est_error = FALSE, method = \"TMB\") pred <- predict(S, percentiles = NULL) ## Plotting: include only some times via the argument subset_time plotlist <- plot(S, pred$newdata, subset_time = c(1, 7, 13, 19, 25, 31)) ggarrange(plotlist = plotlist, nrow = 1, legend = \"top\")"},{"path":"/index.html","id":"demonstrations","dir":"","previous_headings":"","what":"Demonstrations","title":"Fixed Rank Kriging","text":"package FRK currently used generate spatio-temporal animations fields observed satellite data. show daily prediction CO2 using data NASA OCO-2 September 2014 June 2016.","code":""},{"path":"/index.html","id":"acknowledgements","dir":"","previous_headings":"","what":"Acknowledgements","title":"Fixed Rank Kriging","text":"Thanks Michael Bertolacci designing FRK hex logo!","code":""},{"path":"/reference/AIRS_05_2003.html","id":null,"dir":"Reference","previous_headings":"","what":"AIRS data for May 2003 — AIRS_05_2003","title":"AIRS data for May 2003 — AIRS_05_2003","text":"Mid-tropospheric CO2 measurements Atmospheric InfraRed Sounder (AIRS). data measurements 60 degrees S 90 degrees N roughly 1:30 pm local time 1 May 15 May 2003. (AIRS release data 60 degrees S.)","code":""},{"path":"/reference/AIRS_05_2003.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"AIRS data for May 2003 — AIRS_05_2003","text":"","code":"AIRS_05_2003"},{"path":"/reference/AIRS_05_2003.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"AIRS data for May 2003 — AIRS_05_2003","text":"data frame 209631 rows 7 variables: year year retrieval month month retrieval day day retrieval lon longitude coordinate retrieval lat latitude coordinate retrieval co2avgret CO2 mole fraction retrieval ppm co2std standard error CO2 retrieval ppm","code":""},{"path":"/reference/AIRS_05_2003.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"AIRS data for May 2003 — AIRS_05_2003","text":"Chahine, M. et al. (2006). AIRS: Improving weather forecasting providing new data greenhouse gases. Bulletin American Meteorological Society 87, 911--26.","code":""},{"path":"/reference/Am_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Americium soil data — Am_data","title":"Americium soil data — Am_data","text":"Americium () concentrations spatial domain immediately surrounding location nuclear devices detonated Area 13 Nevada Test Site, 1954 1963.","code":""},{"path":"/reference/Am_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Americium soil data — Am_data","text":"","code":"Am_data"},{"path":"/reference/Am_data.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Americium soil data — Am_data","text":"data frame 212 rows 3 variables: Easting Easting metres Northing Northing metres Americium concentration 1000 counts per minute","code":""},{"path":"/reference/Am_data.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Americium soil data — Am_data","text":"Paul R, Cressie N (2011). “Lognormal block kriging contaminated soil.” European Journal Soil Science, 62, 337–345.","code":""},{"path":"/reference/BAUs_from_points.html","id":null,"dir":"Reference","previous_headings":"","what":"Creates pixels around points — BAUs_from_points","title":"Creates pixels around points — BAUs_from_points","text":"Takes SpatialPointsDataFrame converts SpatialPolygonsDataFrame constructing tiny (within machine tolerance) BAU around SpatialPoint.","code":""},{"path":"/reference/BAUs_from_points.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Creates pixels around points — BAUs_from_points","text":"","code":"BAUs_from_points(obj, offset = 1e-10) # S4 method for SpatialPoints BAUs_from_points(obj, offset = 1e-10) # S4 method for ST BAUs_from_points(obj, offset = 1e-10)"},{"path":"/reference/BAUs_from_points.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Creates pixels around points — BAUs_from_points","text":"obj object class SpatialPointsDataFrame offset edge size mini-BAU (default 1e-10)","code":""},{"path":"/reference/BAUs_from_points.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Creates pixels around points — BAUs_from_points","text":"function allows users mimic standard geospatial analysis BAUs used. Since FRK built concept BAU, function constructs tiny BAUs around observation prediction locations can subsequently passed functions SRE FRK. BAUs_from_points, user supplies data prediction locations accompanied covariates.","code":""},{"path":[]},{"path":"/reference/BAUs_from_points.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Creates pixels around points — BAUs_from_points","text":"","code":"library(sp) opts_FRK$set(\"parallel\",0L) df <- data.frame(x = rnorm(10), y = rnorm(10)) coordinates(df) <- ~x+y BAUs <- BAUs_from_points(df)"},{"path":"/reference/Basis-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Basis functions — Basis_obj-class","title":"Basis functions — Basis_obj-class","text":"object class Basis contains basis functions used construct matrix \\(S\\) FRK.","code":""},{"path":"/reference/Basis-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Basis functions — Basis_obj-class","text":"Basis functions central component FRK, package designed work user-defined specifications . convenience, however, several functions available aid user construct basis set given set data points. Please see auto_basis details. function local_basis helps user construct set local basis functions (e.g., bisquare functions) collection location scale parameters.","code":""},{"path":"/reference/Basis-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"Basis functions — Basis_obj-class","text":"manifold object class manifold contains information manifold distance measure used manifold. See manifold-class details n number basis functions set fn list length n, item function specific basis function pars list parameters \\(\\)-th item list contains parameters \\(\\)-th basis function, fn[[]] df data frame containing attributes specific basis function (example geometric centre local basis function) regular logical indicating basis functions (resolution) regular grid","code":""},{"path":[]},{"path":"/reference/Basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Generic basis-function constructor — Basis","title":"Generic basis-function constructor — Basis","text":"function meant used manual construction arbitrary basis functions. `local' basis functions, please use function local_basis instead.","code":""},{"path":"/reference/Basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generic basis-function constructor — Basis","text":"","code":"Basis(manifold, n, fn, pars, df, regular = FALSE)"},{"path":"/reference/Basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generic basis-function constructor — Basis","text":"manifold object class manifold, example, sphere n number basis functions (integer) fn list functions, one basis function. function encapsulated within environment manifold parameters required evaluate function defined. function takes single input s can class numeric, matrix, Matrix, returns vector contains basis function evaluations s. pars list containing list parameters function. local basis functions correspond location scale parameters. df data frame containing one row per basis function, typically providing informative summaries. regular logical indicating basis functions (resolution) regular grid","code":""},{"path":"/reference/Basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generic basis-function constructor — Basis","text":"constructor checks parameters valid constructing basis functions. requirement every function encapsulated tedious, necessary FRK work large range basis functions future. Please see example exemplifies process constructing linear basis functions scratch using function.","code":""},{"path":[]},{"path":"/reference/Basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generic basis-function constructor — Basis","text":"","code":"## Construct two linear basis functions on [0, 1] manifold <- real_line() n <- 2 lin_basis_fn <- function(manifold, grad, intercept) { function(s) grad*s + intercept } pars <- list(list(grad = 1, intercept = 0), list(grad = -1, intercept = 1)) fn <- list(lin_basis_fn(manifold, 1, 0), lin_basis_fn(manifold, -1, 1)) df <- data.frame(n = 1:2, grad = c(1, -1), m = c(1, -1)) G <- Basis(manifold = manifold, n = n, fn = fn, pars = pars, df = df) if (FALSE) { eval_basis(G, s = matrix(seq(0,1, by = 0.1), 11, 1))}"},{"path":"/reference/Basis_data.frame.html","id":null,"dir":"Reference","previous_headings":"","what":"Basis-function data frame object — data.frame<-","title":"Basis-function data frame object — data.frame<-","text":"Tools retrieving manipulating data frame within Basis objects. Use assignment data.frame()<- care; checks made ensure data frame conforms object.","code":""},{"path":"/reference/Basis_data.frame.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Basis-function data frame object — data.frame<-","text":"","code":"data.frame(x) <- value # S4 method for Basis $(x, name) # S4 method for Basis $(x, name) <- value # S4 method for Basis data.frame(x) <- value # S4 method for TensorP_Basis data.frame(x) <- value # S3 method for Basis as.data.frame(x, ...) # S3 method for TensorP_Basis as.data.frame(x, ...)"},{"path":"/reference/Basis_data.frame.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Basis-function data frame object — data.frame<-","text":"x obect class Basis assigning new data retrieving data value new data assigned Basis object name field name values retrieved assigned inside Basis object's data frame ... unused","code":""},{"path":"/reference/Basis_data.frame.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Basis-function data frame object — data.frame<-","text":"","code":"G <- local_basis() df <- data.frame(G) print(df$res) #> [1] 1 df$res <- 2 data.frame(G) <- df"},{"path":"/reference/MODIS_cloud_df.html","id":null,"dir":"Reference","previous_headings":"","what":"MODIS cloud data — MODIS_cloud_df","title":"MODIS cloud data — MODIS_cloud_df","text":"image cloud taken Moderate Resolution Imaging Spectroradiometer (MODIS) instrument aboard Aqua satellite (MODIS Characterization Support Team, 2015).","code":""},{"path":"/reference/MODIS_cloud_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MODIS cloud data — MODIS_cloud_df","text":"","code":"MODIS_cloud_df"},{"path":"/reference/MODIS_cloud_df.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"MODIS cloud data — MODIS_cloud_df","text":"data frame 33,750 rows 3 variables: x x-coordinate y y-coordinate z binary dependent variable: 1 cloud present, 0 cloud. variable thresholded original continuous measurement radiance supplied MODIS instrument z_unthresholded original continuous measurement radiance supplied MODIS instrument","code":""},{"path":"/reference/MODIS_cloud_df.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MODIS cloud data — MODIS_cloud_df","text":"MODIS Characterization Support Team (2015). MODIS 500m Calibrated Radiance Product.NASA MODIS Adaptive Processing System, Goddard Space Flight Center, USA.","code":""},{"path":"/reference/NOAA_df_1990.html","id":null,"dir":"Reference","previous_headings":"","what":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","title":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","text":"Maximum temperature data obtained National Oceanic Atmospheric Administration (NOAA) part USA 1990 1993 (inclusive). See https://iridl.ldeo.columbia.edu/ SOURCES/.NOAA/.NCDC/.DAILY/.FSOD/.","code":""},{"path":"/reference/NOAA_df_1990.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","text":"","code":"NOAA_df_1990"},{"path":"/reference/NOAA_df_1990.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","text":"data frame 196,253 rows 8 variables: year year retrieval month month retrieval day day retrieval z dependent variable proc variable name (Tmax) id station id lon longitude coordinate measurement station lat latitude coordinate measurement station","code":""},{"path":"/reference/NOAA_df_1990.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"NOAA maximum temperature data for 1990--1993 — NOAA_df_1990","text":"National Climatic Data Center, March 1993: Local Climatological Data. Environmental Information summary (C-2), NOAA-NCDC, Asheville, NC.","code":""},{"path":"/reference/SRE-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Spatial Random Effects class — SRE-class","title":"Spatial Random Effects class — SRE-class","text":"central class definition FRK package, containing model information required estimation prediction.","code":""},{"path":"/reference/SRE-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Spatial Random Effects class — SRE-class","text":"spatial random effects (SRE) model model employed Fixed Rank Kriging, SRE object contains information required estimation prediction spatial data. Object slots contain objects (example, object class Basis) matrices derived objects (example, matrix \\(S\\)) order facilitate computations.","code":""},{"path":"/reference/SRE-class.html","id":"slots","dir":"Reference","previous_headings":"","what":"Slots","title":"Spatial Random Effects class — SRE-class","text":"f formula used define SRE object. covariates employed need specified object BAUs data original data model's parameters estimated basis object class Basis used construct matrix \\(S\\) BAUs object class SpatialPolygonsDataFrame, SpatialPixelsDataFrame STFDF contains Basic Areal Units (BAUs) used () project data onto common discretisation point-referenced (ii) provide BAU--data relationship data spatial footprint S matrix constructed evaluating basis functions data locations (class Matrix) S0 matrix constructed evaluating basis functions BAUs (class Matrix) D_basis list distance-matrices class Matrix, one basis-function resolution Ve measurement-error variance-covariance matrix (typically diagonal class Matrix) Vfs fine-scale variance-covariance matrix data locations (typically diagonal class Matrix) constant proportionality estimated using EM algorithm Vfs_BAUs fine-scale variance-covariance matrix BAU centroids (typically diagonal class Matrix) constant proportionality estimated using EM algorithm Qfs_BAUs fine-scale precision matrix BAU centroids (typically diagonal class Matrix) constant proportionality estimated using EM algorithm Z vector observations (class Matrix) Cmat incidence matrix mapping observations BAUs X design matrix covariates data locations G list objects class Matrix containing design matrices random effects data locations G0 list objects class Matrix containing design matrices random effects BAUs K_type type prior covariance matrix random effects. Can \"block-exponential\" (correlation effects decays function distance basis-function centroids), \"unstructured\" (elements K unknown need estimated), \"neighbour\" (sparse precision matrix used, whereby neighbouring basis functions non-zero precision matrix elements). mu_eta updated expectation basis-function random effects (estimated) mu_gamma updated expectation random effects (estimated) S_eta updated covariance matrix random effects (estimated) Q_eta updated precision matrix random effects (estimated) Khat prior covariance matrix random effects (estimated) Khat_inv prior precision matrix random effects (estimated) alphahat fixed-effect regression coefficients (estimated) sigma2fshat fine-scale variation scaling (estimated) sigma2gamma random-effect variance parameters (estimated) fs_model type fine-scale variation (independent CAR-based). Currently \"ind\" permitted info_fit information fitting (convergence etc.) response character string indicating assumed distribution response variable link character string indicating desired link function. Can \"log\", \"identity\", \"logit\", \"probit\", \"cloglog\", \"reciprocal\", \"reciprocal-squared\". Note sensible link-function response-distribution combinations permitted. mu_xi updated expectation fine-scale random effects BAUs (estimated) Q_posterior updated joint precision matrix basis function random effects observed fine-scale random effects (estimated) log_likelihood log likelihood fitted model method fitting procedure used fit SRE model phi estimated dispersion parameter (assumed constant throughout spatial domain) k_Z vector known size parameters observation support level (applicable binomial negative-binomial response distributions) k_BAU vector known size parameters observed BAUs (applicable binomial negative-binomial response distributions) include_fs flag indicating whether fine-scale variation included model include_gamma flag indicating whether gamma random effects model normalise_wts TRUE, rows incidence matrices \\(C_Z\\) \\(C_P\\) normalised sum 1, mapping represents weighted average; false, normalisation weights occurs (.e., mapping corresponds weighted sum) fs_by_spatial_BAU TRUE, BAU associated fine-scale variance parameter obsidx indices observed BAUs simple_kriging_fixed logical indicating whether one wishes commit simple kriging fitting stage: TRUE, model fitting faster, option conduct universal kriging prediction stage removed","code":""},{"path":"/reference/SRE-class.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Spatial Random Effects class — SRE-class","text":"Zammit-Mangion, . Cressie, N. (2017). FRK: R package spatial spatio-temporal prediction large datasets. Journal Statistical Software, 98(4), 1-48. doi:10.18637/jss.v098.i04.","code":""},{"path":[]},{"path":"/reference/SRE.html","id":null,"dir":"Reference","previous_headings":"","what":"Construct SRE object, fit and predict — FRK","title":"Construct SRE object, fit and predict — FRK","text":"Spatial Random Effects (SRE) model central object FRK. function FRK() provides wrapper construction estimation SRE object data, using functions SRE() (object constructor) SRE.fit() (fitting data). Please see SRE-class details SRE object's properties methods.","code":""},{"path":"/reference/SRE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Construct SRE object, fit and predict — FRK","text":"","code":"FRK( f, data, basis = NULL, BAUs = NULL, est_error = TRUE, average_in_BAU = TRUE, sum_variables = NULL, normalise_wts = TRUE, fs_model = \"ind\", vgm_model = NULL, K_type = c(\"block-exponential\", \"precision\", \"unstructured\"), n_EM = 100, tol = 0.01, method = c(\"EM\", \"TMB\"), lambda = 0, print_lik = FALSE, response = c(\"gaussian\", \"poisson\", \"gamma\", \"inverse-gaussian\", \"negative-binomial\", \"binomial\"), link = c(\"identity\", \"log\", \"sqrt\", \"logit\", \"probit\", \"cloglog\", \"inverse\", \"inverse-squared\"), optimiser = nlminb, fs_by_spatial_BAU = FALSE, known_sigma2fs = NULL, taper = NULL, simple_kriging_fixed = FALSE, ... ) SRE( f, data, basis, BAUs, est_error = TRUE, average_in_BAU = TRUE, sum_variables = NULL, normalise_wts = TRUE, fs_model = \"ind\", vgm_model = NULL, K_type = c(\"block-exponential\", \"precision\", \"unstructured\"), normalise_basis = TRUE, response = c(\"gaussian\", \"poisson\", \"gamma\", \"inverse-gaussian\", \"negative-binomial\", \"binomial\"), link = c(\"identity\", \"log\", \"sqrt\", \"logit\", \"probit\", \"cloglog\", \"inverse\", \"inverse-squared\"), include_fs = TRUE, fs_by_spatial_BAU = FALSE, ... ) SRE.fit( object, n_EM = 100L, tol = 0.01, method = c(\"EM\", \"TMB\"), lambda = 0, print_lik = FALSE, optimiser = nlminb, known_sigma2fs = NULL, taper = NULL, simple_kriging_fixed = FALSE, ... ) # S4 method for SRE predict( object, newdata = NULL, obs_fs = FALSE, pred_time = NULL, covariances = FALSE, nsim = 400, type = \"mean\", k = NULL, percentiles = c(5, 95), kriging = \"simple\" ) # S4 method for SRE logLik(object) # S4 method for SRE nobs(object, ...) # S4 method for SRE coef(object, ...) # S4 method for SRE coef_uncertainty( object, percentiles = c(5, 95), nsim = 400, random_effects = FALSE ) simulate(object, newdata = NULL, nsim = 400, conditional_fs = FALSE, ...) # S4 method for SRE fitted(object, ...) # S4 method for SRE residuals(object, type = \"pearson\") # S4 method for SRE AIC(object, k = 2) # S4 method for SRE BIC(object)"},{"path":"/reference/SRE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Construct SRE object, fit and predict — FRK","text":"f R formula relating dependent variable (transformations thereof) covariates data list objects class SpatialPointsDataFrame, SpatialPolygonsDataFrame, STIDF, STFDF. using space-time objects, data frame must another field, t, containing time index data point basis object class Basis (TensorP_Basis) BAUs object class SpatialPolygonsDataFrame, SpatialPixelsDataFrame, STIDF, STFDF. object's data frame must contain covariate information well field fs describing fine-scale variation constant proportionality. function FRK() used directly, BAUs created automatically, coordinates can used covariates est_error (applicable response = \"gaussian\") flag indicating whether measurement-error variance estimated variogram techniques. set 0, data must contain field std. Measurement-error estimation currently implemented spatio-temporal datasets average_in_BAU TRUE, multiple data points falling BAU averaged; measurement error averaged data point taken average individual measurement errors sum_variables average_in_BAU == TRUE, string sum_variables indicates data variables (can observations covariates) summed rather averaged normalise_wts TRUE, rows incidence matrices CZ CP normalised sum 1, mapping represents weighted average; false, normalisation weights occurs (.e., mapping corresponds weighted sum) fs_model \"ind\" fine-scale variation independent BAU level. independent model allowed now, future implementation include CAR/ICAR (development) vgm_model (applicable response = \"gaussian\") object class variogramModel package gstat constructed using function vgm. object contains variogram model fit data. nugget taken measurement error est_error = TRUE. unspecified, variogram used gstat::vgm(1, \"Lin\", d, 1), d approximately one third maximum distance two data points K_type parameterisation used basis-function covariance matrix, K. method = \"EM\", K_type can \"unstructured\" \"block-exponential\". method = \"TMB\", K_type can \"precision\" \"block-exponential\". default \"block-exponential\", however FRK() used method = \"TMB\", computational reasons K_type set \"precision\" n_EM (applicable method = \"EM\") maximum number iterations EM algorithm tol (applicable method = \"EM\") convergence tolerance EM algorithm method parameter estimation method employ. Currently \"EM\" \"TMB\" supported lambda (applicable K_type = \"unstructured\") ridge-regression regularisation parameter (0 default). Can single number, vector (one parameter resolution) print_lik (applicable method = \"EM\") flag indicating whether plot log-likelihood vs. iteration convergence EM estimation algorithm response string indicating assumed distribution response variable. can \"gaussian\", \"poisson\", \"negative-binomial\", \"binomial\", \"gamma\", \"inverse-gaussian\". method = \"EM\", \"gaussian\" can used. Two distributions considered framework, namely binomial distribution negative-binomial distribution, assumed-known ‘size’ parameter ‘probability success’ parameter; see details exact parameterisations used, provide ‘size’ parameters link string indicating desired link function. Can \"log\", \"identity\", \"logit\", \"probit\", \"cloglog\", \"reciprocal\", \"reciprocal-squared\". Note sensible link-function response-distribution combinations permitted. method = \"EM\", \"identity\" can used optimiser (applicable method = \"TMB\") optimising function used model fitting method = \"TMB\" (default nlminb). Users may pass function object string corresponding named function. Optional parameters may passed optimiser via .... requirement optimiser first three arguments correspond initial parameters, objective function, gradient, respectively (may achieved simply constructing wrapper function) fs_by_spatial_BAU (applicable spatio-temporal setting method = \"TMB\") TRUE, spatial BAU associated fine-scale variance parameter; otherwise, single fine-scale variance parameter used known_sigma2fs known value fine-scale variance parameter. NULL (default), fine-scale variance parameter estimated usual. known_sigma2fs NULL, fine-scale variance fixed supplied value; may scalar, vector length equal number spatial BAUs (fs_by_spatial_BAU = TRUE) taper positive numeric indicating strength covariance/partial-correlation tapering. applicable K_type = \"block-exponential\", K_type = \"precision\" basis-functions irregular manifold plane. taper NULL (default) method = \"EM\", tapering applied; method = \"TMB\", tapering must applied (computational reasons), set 3 unspecified simple_kriging_fixed commit simple kriging fitting stage? TRUE, model fitting faster, option conduct universal kriging prediction stage removed ... parameters passed auto_basis() auto_BAUs() calling FRK(), user specified function optimiser() calling FRK() SRE.fit() normalise_basis flag indicating whether normalise basis functions reproduce stochastic process approximately constant variance spatially include_fs (applicable method = \"TMB\") flag indicating whether fine-scale variation included model object object class SRE returned constructor SRE() containing parameters information SRE model newdata object class SpatialPoylgons, SpatialPoints, STI, indicating regions points prediction carried . BAUs used option specified. obs_fs flag indicating whether fine-scale variation sits observation model (systematic error; indicated obs_fs = TRUE) process model (process fine-scale variation; indicated obs_fs = FALSE, default). non-Gaussian data models, /non-identity link functions, obs_fs = TRUE, fine-scale variation removed latent process \\(Y\\); however, re-introduced prediction conditonal mean μ simulated data Z* pred_time vector time indices prediction carried . time points used option specified covariances (applicable method = \"EM\") logical variable indicating whether prediction covariances returned . set TRUE, maximum 4000 prediction locations polygons allowed nsim number ) MC samples location using predict ii) response vectors using simulate type (applicable method = \"TMB\") vector strings indicating quantities inference desired. \"link\" type, inference latent Gaussian process \\(Y(\\cdot)\\) included; \"mean\" type, inference mean process \\(\\mu(\\cdot)\\) included (probability process, \\(\\pi(\\cdot)\\), applicable); \"response\" type, inference noisy data Z* included k (applicable response \"binomial\" \"negative-binomial\") vector size parameters BAU percentiles (applicable method = \"TMB\") vector scalars (0, 100) specifying desired percentiles posterior predictive distribution; NULL, percentiles computed kriging (applicable method = \"TMB\") string indicating kind kriging: \"simple\" ignores uncertainty due estimation fixed effects, \"universal\" accounts source uncertainty random_effects logical; set true, confidence intervals also provided random effects random effects γ (see `?SRE` details random effects) conditional_fs condition fitted fine-scale random effects?","code":""},{"path":"/reference/SRE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Construct SRE object, fit and predict — FRK","text":"following details provide summary model basic workflow used FRK. See Zammit-Mangion Cressie (2021) Sainsbury-Dale, Zammit-Mangion Cressie (2023) details. Model description hierarchical model implemented FRK spatial generalised linear mixed model (GLMM), may summarised Zj denotes datum, \\(EF\\) corresponds probability distribution exponential family dispersion parameter \\(\\psi\\), μZ vector containing conditional expectations datum, CZ matrix aggregates BAU-level mean process observation supports, μ mean process evaluated BAUs, \\(g\\) link function, Y latent Gaussian process evaluated BAUs, matrix T contains regression covariates BAU level associated fixed effects α, matrix G design matrix BAU level associated random effects γ, matrix S contains basis-function evaluations BAUs associated basis-function random effects η, ξ vector containing fine-scale variation BAU level. prior distribution random effects, γ, mean-zero multivariate Gaussian diagonal covariance matrix, group random effects associated variance parameter. variance parameters estimated model fitting. prior distribution basis-function coefficients, η, formulated using either covariance matrix K precision matrix Q, depending argument K_type. parameters matrices estimated model fitting. prior distribution fine-scale random effects, ξ, mean-zero multivariate Gaussian diagonal covariance matrix, Σξ. default, Σξ = σ2ξV, V known, positive-definite diagonal matrix whose elements provided field fs BAUs. absence problem specific fine-scale information, fs can simply set 1, V = . spatio-temporal setting, another model Σξ can used setting fs_by_spatial_BAU = TRUE, case spatial BAU associated fine-scale variance parameter (see Sainsbury-Dale et al., 2023, Sec. 2.6). either case, fine-scale variance parameter(s) either estimated model fitting, provided user via argument known_sigma2fs. Gaussian data model identity link function data Gaussian, identity link function used, preceding model simplifies considerably: Specifically, Z data vector, δ systematic error BAU level, e represents independent measurement error. Distributions size parameters Two distributions considered framework, namely binomial distribution negative-binomial distribution, assumed-known ‘size’ parameter ‘probability success’ parameter. Given vector size parameters associated data, kZ, parameterisation used FRK assumes Zj represents either number `successes' kZj trials (binomial data model) represents number failures kZj successes (negative-binomial data model). model fitting, BAU-level size parameters k needed. user must supply size parameters either data though BAUs. done depends whether data areal point-referenced, whether overlap common BAUs . simplest case observation associated single BAU BAU associated one observation support; , straightforward assign elements kZ elements k vice-versa, user may provide either k kZ. observation associated exactly one BAU, BAUs associated multiple observations, user must provide kZ, used infer k ; particular, ki = Σj∈ai kZj , \\(= 1, \\dots, N\\), ai denotes indices observations associated BAU Ai. one observations encompass multiple BAUs, k must provided BAUs, meaningfully distribute kZj multiple BAUs associated datum Zj. case, infer kZ using kZj = Σi∈cj ki , \\(j = 1, \\dots, m\\), cj denotes indices BAUs associated observation Zj. Set-SRE() constructs spatial random effects model user-defined formula, data object (list spatially-referenced data), basis functions set Basic Areal Units (BAUs). first takes object list data maps BAUs -- entails binning point-referenced data BAUs (averaging within BAU average_in_BAU = TRUE), finding BAUs associated observations. Following , incidence matrix, CZ, constructed. required matrices (S, T, CZ, etc.) constructed within SRE() returned part SRE object. SRE() also intitialises parameters random effects using sensible defaults. Please see SRE-class details. functions observed_BAUs() unobserved_BAUs() return indices observed unobserved BAUs, respectively. include random effects FRK please follow notation used lme4. example, add random effect according variable fct, simply add `(1 | fct)' formula used calling FRK() SRE(). Note FRK supports simple, uncorrelated random effects formula term '(1 + x | fct)' throw error (since lme4 parlance implies random effect corresponding intercept slope correlated). one wishes model intercept linear trend level fct, one can force intercept slope terms uncorrelated using notation \"(x || fct)\", shorthand \"(1 | fct) + (x - 1 | x2)\". Model fitting SRE.fit() takes object class SRE estimates unknown parameters, namely covariance matrix K, fine scale variance (σ2ξ σ2δ, depending whether Case 1 Case 2 chosen; see vignette \"FRK_intro\") regression parameters α. two methods model fitting currently implemented, implement maximum likelihood estimation (MLE). MLE via expectation maximisation (EM) algorithm. method implemented Gaussian data identity link function. log-likelihood (given Section 2.2 vignette) evaluated iteration current parameter estimate. Optimation continues convergence reached (log-likelihood stops changing tol), number EM iterations reaches n_EM. actual computations E-step M-step relatively straightforward. E-step contains inverse \\(r \\times r\\) matrix, \\(r\\) number basis functions exceed 2000. M-step first updates matrix K, depends sufficient statistics basis-function coefficients η. , regression parameters α updated simple optimisation routine (line search) used update fine-scale variance σ2δ σ2ξ. fine-scale errors measurement random errors homoscedastic, closed-form solution available update σ2ξ σ2δ. Irrespectively, since updates α, σ2δ σ2ξ, dependent, two updates iterated change σ2. 0.1%. MLE via TMB. method implemented available data models link functions offered FRK. Furthermore, method facilitates inclusion many basis function possible EM algorithm (excess 10,000). TMB applies Laplace approximation integrate latent random effects complete-data likelihood. resulting approximation marginal log-likelihood, derivatives respect parameters, called within R using optimising function optimiser (default nlminb()). Wrapper set-model fitting function FRK() acts wrapper functions SRE() SRE.fit(). added advantage using FRK() directly automatically generates BAUs basis functions based data. Hence FRK() can called using list data objects R formula, although R formula can contain space time covariates BAUs explicitly supplied covariate data. Prediction parameters estimated, SRE object passed onto function predict() order carry optimal predictions BAUs used construct SRE model SRE(). first part prediction process construct matrix S prediction polygons. made computationally efficient treating prediction polygons prediction combination BAUs. yield valid results BAUs relatively small. matrix S found, standard Gaussian inversion (conditioning) using estimated parameters used prediction. predict() returns BAUs (object specified newdata), class SpatialPixelsDataFrame, SpatialPolygonsDataFrame, STFDF, predictions uncertainty quantification added. method = \"TMB\", returned object list, containing previously described predictions, list Monte Carlo samples. predictions uncertainties can easily plotted using plot spplot package sp.","code":""},{"path":"/reference/SRE.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Construct SRE object, fit and predict — FRK","text":"Zammit-Mangion, . Cressie, N. (2021). FRK: R package spatial spatio-temporal prediction large datasets. Journal Statistical Software, 98(4), 1-48. doi:10.18637/jss.v098.i04. Sainsbury-Dale, M. Zammit-Mangion, . Cressie, N. (2024) Modelling Big, Heterogeneous, Non-Gaussian Spatial Spatio-Temporal Data using FRK. Journal Statistical Software, 108(10), 1--39. doi:10.18637/jss.v108.i10.","code":""},{"path":[]},{"path":"/reference/SRE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Construct SRE object, fit and predict — FRK","text":"","code":"library(\"FRK\") library(\"sp\") ## Generate process and data m <- 250 # Sample size zdf <- data.frame(x = runif(m), y= runif(m)) # Generate random locs zdf$Y <- 3 + sin(7 * zdf$x) + cos(9 * zdf$y) # Latent process zdf$z <- rnorm(m, mean = zdf$Y) # Simulate data coordinates(zdf) = ~x+y # Turn into sp object ## Construct BAUs and basis functions BAUs <- auto_BAUs(manifold = plane(), data = zdf, nonconvex_hull = FALSE, cellsize = c(0.03, 0.03), type=\"grid\") BAUs$fs <- 1 # scalar fine-scale covariance matrix basis <- auto_basis(manifold = plane(), data = zdf, nres = 2) ## Construct the SRE model S <- SRE(f = z ~ 1, list(zdf), basis = basis, BAUs = BAUs) #> Loading required namespace: gstat ## Fit with 2 EM iterations so to take as little time as possible S <- SRE.fit(S, n_EM = 2, tol = 0.01, print_lik = TRUE) #> NOTE: In FRK >2.0 simple_kriging_fixed = FALSE by default, and hence #> universal kriging is done by default. However this is only the case when #> method = 'TMB'. When method = 'EM', simple kriging is done, irrespective of #> what the argument simple_kriging_fixed is set to. #> | | | 0% | |=================================== | 50% | |======================================================================| 100% #> Maximum EM iterations reached ## Check fit info, final log-likelihood, and estimated regression coefficients info_fit(S) #> $method #> [1] \"EM\" #> #> $num_iterations #> [1] 2 #> #> $sigma2fshat_equal_0 #> [1] 1 #> #> $converged #> [1] 0 #> #> $plot_lik #> $plot_lik$x #> [1] 1 2 #> #> $plot_lik$llk #> [1] -337.1287 -329.4578 #> #> $plot_lik$ylab #> [1] \"log likelihood\" #> #> $plot_lik$xlab #> [1] \"EM iteration\" #> #> #> $time #> user system elapsed #> 0.261 0.385 0.211 #> logLik(S) #> [1] -328.9443 coef(S) #> Intercept #> 3.117274 ## Predict over BAUs pred <- predict(S) ## Plot if (FALSE) { plotlist <- plot(S, pred) ggpubr::ggarrange(plotlist = plotlist, nrow = 1, align = \"hv\", legend = \"top\")}"},{"path":"/reference/SRE.predict.html","id":null,"dir":"Reference","previous_headings":"","what":"Deprecated: Please use predict — SRE.predict","title":"Deprecated: Please use predict — SRE.predict","text":"Deprecated: Please use predict","code":""},{"path":"/reference/SRE.predict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Deprecated: Please use predict — SRE.predict","text":"","code":"SRE.predict(...)"},{"path":"/reference/SRE.predict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Deprecated: Please use predict — SRE.predict","text":"... (Deprecated)","code":""},{"path":"/reference/STplane.html","id":null,"dir":"Reference","previous_headings":"","what":"plane in space-time — STplane","title":"plane in space-time — STplane","text":"Initialisation 2D plane temporal dimension.","code":""},{"path":"/reference/STplane.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"plane in space-time — STplane","text":"","code":"STplane(measure = Euclid_dist(dim = 3L))"},{"path":"/reference/STplane.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"plane in space-time — STplane","text":"measure object class measure","code":""},{"path":"/reference/STplane.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"plane in space-time — STplane","text":"2D plane time component added initialised using measure object. default, measure object (measure) Euclidean distance 3 dimensions, Euclid_dist.","code":""},{"path":"/reference/STplane.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"plane in space-time — STplane","text":"","code":"P <- STplane() print(type(P)) #> [1] \"STplane\" print(sp::dimensions(P)) #> [1] 3"},{"path":"/reference/STsphere.html","id":null,"dir":"Reference","previous_headings":"","what":"Space-time sphere — STsphere","title":"Space-time sphere — STsphere","text":"Initialisation 2-sphere (S2) temporal dimension","code":""},{"path":"/reference/STsphere.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Space-time sphere — STsphere","text":"","code":"STsphere(radius = 6371)"},{"path":"/reference/STsphere.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Space-time sphere — STsphere","text":"radius radius sphere","code":""},{"path":"/reference/STsphere.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Space-time sphere — STsphere","text":"spatial-sphere, sphere surface initialised using radius parameter. default value radius R R=6371, Earth's radius km, measure used compute distances sphere great-circle distance sphere radius R. default Euclidean geometry used factor time component, dist((s1,t1),(s2,t2)) = sqrt(gc_dist(s1,s2)^2 + (t1 - t2)^2). Frequently distance can used since separate correlation length scales space time estimated EM algorithm (effectively scale space time separately).","code":""},{"path":"/reference/STsphere.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Space-time sphere — STsphere","text":"","code":"S <- STsphere() print(sp::dimensions(S)) #> [1] 3"},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":null,"dir":"Reference","previous_headings":"","what":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"Convert SpatialPolygonsDataFrame SpatialPixelsDataFrame object data frame.","code":""},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"","code":"SpatialPolygonsDataFrame_to_df(sp_polys, vars = names(sp_polys))"},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"sp_polys object class SpatialPolygonsDataFrame SpatialPixelsDataFrame vars variables put data frame (default )","code":""},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"function mainly used plotting SpatialPolygonsDataFrame objects ggplot rather spplot. coordinates polygon extracted concatenated one long data frame. attributes polygon attached data frame variables vary polygon id (rownames object).","code":""},{"path":"/reference/SpatialPolygonsDataFrame_to_df.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"SpatialPolygonsDataFrame to df — SpatialPolygonsDataFrame_to_df","text":"","code":"library(sp) library(ggplot2) opts_FRK$set(\"parallel\",0L) df <- data.frame(id = c(rep(1,4),rep(2,4)), x = c(0,1,0,0,2,3,2,2), y=c(0,0,1,0,0,1,1,0)) pols <- df_to_SpatialPolygons(df,\"id\",c(\"x\",\"y\"),CRS()) polsdf <- SpatialPolygonsDataFrame(pols,data.frame(p = c(1,2),row.names=row.names(pols))) df2 <- SpatialPolygonsDataFrame_to_df(polsdf) if (FALSE) ggplot(df2,aes(x=x,y=y,group=id)) + geom_polygon()"},{"path":"/reference/TensorP.html","id":null,"dir":"Reference","previous_headings":"","what":"Tensor product of basis functions — TensorP","title":"Tensor product of basis functions — TensorP","text":"Constructs new set basis functions finding tensor product two sets basis functions.","code":""},{"path":"/reference/TensorP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tensor product of basis functions — TensorP","text":"","code":"TensorP(Basis1, Basis2) # S4 method for Basis,Basis TensorP(Basis1, Basis2)"},{"path":"/reference/TensorP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tensor product of basis functions — TensorP","text":"Basis1 first set basis functions Basis2 second set basis functions","code":""},{"path":[]},{"path":"/reference/TensorP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tensor product of basis functions — TensorP","text":"","code":"library(spacetime) library(sp) library(dplyr) #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union sim_data <- data.frame(lon = runif(20,-180,180), lat = runif(20,-90,90), t = 1:20, z = rnorm(20), std = 0.1) time <- as.POSIXct(\"2003-05-01\",tz=\"\") + 3600*24*(sim_data$t-1) space <- sim_data[,c(\"lon\",\"lat\")] coordinates(space) = ~lon+lat # change into an sp object slot(space, \"proj4string\") = CRS(\"+proj=longlat +ellps=sphere\") STobj <- STIDF(space,time,data=sim_data) G_spatial <- auto_basis(manifold = sphere(), data=as(STobj,\"Spatial\"), nres = 1, type = \"bisquare\", subsamp = 20000) G_temporal <- local_basis(manifold=real_line(),loc = matrix(c(1,3)),scale = rep(1,2)) G <- TensorP(G_spatial,G_temporal) # show_basis(G_spatial) # show_basis(G_temporal)"},{"path":"/reference/auto_BAUs.html","id":null,"dir":"Reference","previous_headings":"","what":"Automatic BAU generation — auto_BAUs","title":"Automatic BAU generation — auto_BAUs","text":"function calls generic function auto_BAU (exported) series checks easiest way generate set Basic Areal Units (BAUs) manifold used; see details.","code":""},{"path":"/reference/auto_BAUs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Automatic BAU generation — auto_BAUs","text":"","code":"auto_BAUs( manifold, type = NULL, cellsize = NULL, isea3h_res = NULL, data = NULL, nonconvex_hull = TRUE, convex = -0.05, tunit = NULL, xlims = NULL, ylims = NULL, spatial_BAUs = NULL, ... )"},{"path":"/reference/auto_BAUs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Automatic BAU generation — auto_BAUs","text":"manifold object class manifold type either ``grid'' ``hex'', indicating whether gridded hexagonal BAUs used. type unspecified, ``hex'' used sphere, ``grid'' used otherwise cellsize denotes size gridcell type = ``grid''. Needs length 1 (square-grid case) vector length dimensions(manifold) (rectangular-grid case) isea3h_res resolution number isea3h DGGRID cells type ``hex'' manifold surface sphere data object class SpatialPointsDataFrame, SpatialPolygonsDataFrame, STIDF, STFDF. Provision data implies domain bounded, thus necessary manifold real_line, plane, STplane, necessary manifold surface sphere nonconvex_hull flag indicating whether use fmesher generate non-convex hull. Otherwise convex hull used convex convex parameter used smoothing extended boundary working bounded domain (, object data supplied); see details tunit temporal unit requiring space-time BAUs. Can \"secs\", \"mins\", \"hours\", etc. xlims limits horizontal axis (overrides automatic selection) ylims limits vertical axis (overrides automatic selection) spatial_BAUs object class SpatialPolygonsDataFrame SpatialPixelsDataFrame representing spatial BAUs used spatio-temporal setting (left NULL, spatial BAUs constructed automatically using data) ... currently unused","code":""},{"path":"/reference/auto_BAUs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Automatic BAU generation — auto_BAUs","text":"auto_BAUs constructs set Basic Areal Units (BAUs) used data pre-processing prediction. , BAUs need sufficienly fine resolution inferences affected due binning. Two types BAUs supported FRK: ``hex'' (hexagonal) ``grid'' (rectangular). order ``grid'' set BAUs, user specify cellsize length one, length equal dimensions manifold, , length 1 real_line length 2 surface sphere plane. ``hex'' set BAUs desired, first element cellsize used determine side length dividing value approximately 2. argument type ignored real_line ``hex'' available manifold. object data provided, automatic domain selection may carried employing fmesher function fm_nonconvex_hull_inla, finds (non-convex) hull surrounding data points (centroids data polygons). domain extended smoothed using parameter convex. parameter convex negative, larger absolute value convex results larger domain smoother boundaries.","code":""},{"path":[]},{"path":"/reference/auto_BAUs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Automatic BAU generation — auto_BAUs","text":"","code":"## First a 1D example library(sp) set.seed(1) data <- data.frame(x = runif(10)*10, y = 0, z= runif(10)*10) coordinates(data) <- ~x+y Grid1D_df <- auto_BAUs(manifold = real_line(), cellsize = 1, data=data) if (FALSE) spplot(Grid1D_df) ## Now a 2D example data(meuse) coordinates(meuse) = ~x+y # change into an sp object ## Grid BAUs GridPols_df <- auto_BAUs(manifold = plane(), cellsize = 200, type = \"grid\", data = meuse, nonconvex_hull = 0) if (FALSE) plot(GridPols_df) ## Hex BAUs HexPols_df <- auto_BAUs(manifold = plane(), cellsize = 200, type = \"hex\", data = meuse, nonconvex_hull = 0) if (FALSE) plot(HexPols_df)"},{"path":"/reference/auto_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Automatic basis-function placement — auto_basis","title":"Automatic basis-function placement — auto_basis","text":"Automatically generate set local basis functions domain, automatically prune regions sparse data.","code":""},{"path":"/reference/auto_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Automatic basis-function placement — auto_basis","text":"","code":"auto_basis( manifold = plane(), data, regular = 1, nres = 3, prune = 0, max_basis = NULL, subsamp = 10000, type = c(\"bisquare\", \"Gaussian\", \"exp\", \"Matern32\"), isea3h_lo = 2, bndary = NULL, scale_aperture = ifelse(is(manifold, \"sphere\"), 1, 1.25), verbose = 0L, buffer = 0, tunit = NULL, ... )"},{"path":"/reference/auto_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Automatic basis-function placement — auto_basis","text":"manifold object class manifold, example, sphere plane data object class SpatialPointsDataFrame SpatialPolygonsDataFrame containing data basis-function placement based, list ; see details regular integer indicating number regularly-placed basis functions first resolution. two dimensions, dictates smallest number basis functions row column coarsest resolution. regular=0, irregular grid used, one based triangulation domain increased mesh density areas high data density; see details nres number basis-function resolutions use prune threshold parameter dictates basis function considered irrelevent unidentifiable, thus removed; see details [deprecated] max_basis maximum number basis functions. overrides parameter nres subsamp maximum amount data points consider carrying basis-function placement: data objects randomly sampled full dataset. Keep number fairly high (order 10^5), otherwise fine-resolution basis functions may spuriously removed type type basis functions use; see details isea3h_lo manifold = sphere(), argument dictates ISEA3H resolution coarsest one used first resolution bndary matrix containing points containing boundary. regular == 0 can used define boundary irregularly-spaced basis functions placed scale_aperture aperture (case bisquare, similar interpretation basis) width basis function minimum distance basis function centroids multiplied scale_aperture. Typically ranges 1 1.5 defaulted 1 sphere 1.25 manifolds. verbose logical variable indicating whether output summary basis functions created buffer numeric 0 0.5 indicating size buffer basis functions along boundary. buffer added computing number basis functions dimension, increasing number factor buffer. buffer may needed prior distribution basis-function coefficients formulated terms precision matrix tunit temporal unit, required constructing spatio-temporal basis. used BAUs. Can \"secs\", \"mins\", \"hours\", \"days\", \"years\", etc. ... unused","code":""},{"path":"/reference/auto_basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Automatic basis-function placement — auto_basis","text":"function automatically places basis functions within domain interest. domain plane real line, object data used establish domain boundary. Let \\(\\phi(u)\\) denote value basis function evaluated \\(u = s - c\\), \\(s\\) spatial coordinate \\(c\\) basis-function centroid. argument type can either ``Gaussian'', case ``bisquare'', case ``exp'', case ``Matern32'', case parameters \\(\\sigma, R, \\tau\\) \\(\\kappa\\) scale arguments. manifold real line, basis functions placed regularly inside domain, number basis functions coarsest resolution dictated integer parameter regular greater zero. real line, subsequent resolution twice many basis functions. scale basis function set based minimum distance centre locations following placement. scale equal minimum distance type basis function Gaussian, exponential, Matern32, equal 1.5 times value function bisquare. manifold plane, regular > 0, basis functions placed regularly within bounding box data, smallest number basis functions row column equal value regular coarsest resolution (note, just smallest number basis functions). Subsequent resolutions twice number basis functions row column. regular = 0, function fmesher::fm_nonconvex_hull_inla() used construct (non-convex) hull around data. buffer smoothness hull determined parameter convex. domain boundary found, fmesher::fm_mesh_2d_inla() used construct triangular mesh node vertices coincide data locations, subject minimum maximum triangular-side-length constraints. result mesh dense regions high data density dense regions sparse data. Even basis functions irregularly placed, scale taken function minimum distance basis function centres, detailed . may changed future revision package. manifold surface sphere, basis functions placed centroids discrete global grid (DGG), first basis resolution corresponding third resolution DGG (ISEA3H resolution 2, yields 92 basis functions globally). recommended go nres == 3 (ISEA3H resolutions 2--4) whole sphere; nres=3 yields total 1176 basis functions. ISEA3H resolution 6 available FRK; finer resolutions; please install dggrids https://github.com/andrewzm/dggrids using devtools. Basis functions influenced data points may hinder convergence EM algorithm K_type = \"unstructured\", since associated hidden states , large, unidentifiable. hence provide means automatically remove basis functions parameter prune. final set contains basis functions column sums associated matrix \\(S\\) (, recall, value/average basis functions /data points/polygons) greater prune. prune == 0, basis functions removed original design.","code":""},{"path":[]},{"path":"/reference/auto_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Automatic basis-function placement — auto_basis","text":"","code":"if (FALSE) { library(sp) library(ggplot2) ## Create a synthetic dataset set.seed(1) d <- data.frame(lon = runif(n=1000,min = -179, max = 179), lat = runif(n=1000,min = -90, max = 90), z = rnorm(5000)) coordinates(d) <- ~lon + lat slot(d, \"proj4string\") = CRS(\"+proj=longlat +ellps=sphere\") ## Now create basis functions over sphere G <- auto_basis(manifold = sphere(),data=d, nres = 2,prune=15, type = \"bisquare\", subsamp = 20000) ## Plot show_basis(G,draw_world()) }"},{"path":"/reference/coef_uncertainty.html","id":null,"dir":"Reference","previous_headings":"","what":"Uncertainty quantification of the fixed effects — coef_uncertainty","title":"Uncertainty quantification of the fixed effects — coef_uncertainty","text":"Compute confidence intervals fixed effects (upper lower bound specifed percentiles; default 90% confidence central interval)","code":""},{"path":"/reference/coef_uncertainty.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Uncertainty quantification of the fixed effects — coef_uncertainty","text":"","code":"coef_uncertainty( object, percentiles = c(5, 95), nsim = 400, random_effects = FALSE )"},{"path":"/reference/coef_uncertainty.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Uncertainty quantification of the fixed effects — coef_uncertainty","text":"object object class SRE returned constructor SRE() containing parameters information SRE model percentiles (applicable method = \"TMB\") vector scalars (0, 100) specifying desired percentiles posterior predictive distribution; NULL, percentiles computed nsim number Monte Carlo samples used compute confidence intervals random_effects logical; set true, confidence intervals also provided random effects random effects γ (see `?SRE` details random effects)","code":""},{"path":"/reference/combine_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Combine basis functions — combine_basis","title":"Combine basis functions — combine_basis","text":"Takes list objects class Basis returns single object class Basis.","code":""},{"path":"/reference/combine_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Combine basis functions — combine_basis","text":"","code":"combine_basis(Basis_list) # S4 method for list combine_basis(Basis_list)"},{"path":"/reference/combine_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Combine basis functions — combine_basis","text":"Basis_list list objects class Basis. element list assumed represent single resolution basis functions","code":""},{"path":[]},{"path":"/reference/combine_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Combine basis functions — combine_basis","text":"","code":"## Construct two resolutions of basis functions using local_basis() Basis1 <- local_basis(manifold = real_line(), loc = matrix(seq(0, 1, length.out = 3), ncol = 1), scale = rep(0.4, 3)) Basis2 <- local_basis(manifold = real_line(), loc = matrix(seq(0, 1, length.out = 6), ncol = 1), scale = rep(0.2, 6)) ## Combine basis-function resolutions into a single Basis object combine_basis(list(Basis1, Basis2)) #> Number of basis functions: 9 #> Number of resolutions: 2 #> Regular: 0 #> Type of manifold: real_line #> Dimension of manifold: 1 #> First basis function: #> function (s) { stopifnot(ncol(s) == dimensions(manifold)) y <- distance(manifold, s, c) (1 - (y/R)^2)^2 * (y < R) }"},{"path":"/reference/df_to_SpatialPolygons.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"Convert data frame SpatialPolygons object.","code":""},{"path":"/reference/df_to_SpatialPolygons.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"","code":"df_to_SpatialPolygons(df, keys, coords, proj)"},{"path":"/reference/df_to_SpatialPolygons.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"df data frame containing polygon information, see details keys vector variable names used group rows belonging polygon coords vector variable names identifying coordinate columns proj projection SpatialPolygons object. Needs class CRS","code":""},{"path":"/reference/df_to_SpatialPolygons.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"row data frame df contains coordinates labels (keys) identify polygon coordinates belong. function groups data frame according keys forms SpatialPolygons object coordinates group. important rings closed, , last row group identical first row. Since keys can length greater one, identify polygon new key forming MD5 hash made respective keys variables unique (therefore hashed key also unique). lon-lat coordinates use proj = CRS(\"+proj=longlat +ellps=sphere\").","code":""},{"path":"/reference/df_to_SpatialPolygons.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert data frame to SpatialPolygons — df_to_SpatialPolygons","text":"","code":"library(sp) df <- data.frame(id = c(rep(1,4),rep(2,4)), x = c(0,1,0,0,2,3,2,2), y=c(0,0,1,0,0,1,1,0)) pols <- df_to_SpatialPolygons(df,\"id\",c(\"x\",\"y\"),CRS()) if (FALSE) plot(pols)"},{"path":"/reference/dist-matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Distance Matrix Computation from Two Matrices — dist-matrix","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"function extends dist accept two arguments.","code":""},{"path":"/reference/dist-matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"","code":"distR(x1, x2 = NULL)"},{"path":"/reference/dist-matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"x1 matrix size N1 x n x2 matrix size N2 x n","code":""},{"path":"/reference/dist-matrix.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"Matrix size N1 x N2","code":""},{"path":"/reference/dist-matrix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"Computes distances coordinates x1 coordinates x2. matrices x1 x2 need number rows, need number columns (e.g., manifold dimensions).","code":""},{"path":"/reference/dist-matrix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Distance Matrix Computation from Two Matrices — dist-matrix","text":"","code":"A <- matrix(rnorm(50),5,10) D <- distR(A,A[-3,])"},{"path":"/reference/distance.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute distance — distance","title":"Compute distance — distance","text":"Compute distance using object class measure manifold.","code":""},{"path":"/reference/distance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute distance — distance","text":"","code":"distance(d, x1, x2 = NULL) # S4 method for measure distance(d, x1, x2 = NULL) # S4 method for manifold distance(d, x1, x2 = NULL)"},{"path":"/reference/distance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute distance — distance","text":"d object class measure manifold x1 first coordinate x2 second coordinate","code":""},{"path":[]},{"path":"/reference/distance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute distance — distance","text":"","code":"distance(sphere(),matrix(0,1,2),matrix(10,1,2)) #> [,1] #> [1,] 1568.521 distance(plane(),matrix(0,1,2),matrix(10,1,2)) #> [,1] #> [1,] 14.14214"},{"path":"/reference/distances.html","id":null,"dir":"Reference","previous_headings":"","what":"Pre-configured distances — distances","title":"Pre-configured distances — distances","text":"Useful objects class distance included package.","code":""},{"path":"/reference/distances.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pre-configured distances — distances","text":"","code":"measure(dist, dim) Euclid_dist(dim = 2L) gc_dist(R = NULL) gc_dist_time(R = NULL)"},{"path":"/reference/distances.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pre-configured distances — distances","text":"dist function taking two arguments x1,x2 dim dimension manifold (e.g., 2 plane) R great-circle radius","code":""},{"path":"/reference/distances.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Pre-configured distances — distances","text":"Initialises object class measure contains function dist used computing distance two points. Currently Euclidean distance great-circle distance included FRK.","code":""},{"path":"/reference/distances.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pre-configured distances — distances","text":"","code":"M1 <- measure(distR,2) D <- distance(M1,matrix(rnorm(10),5,2))"},{"path":"/reference/draw_world.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a map of the world with country boundaries. — draw_world","title":"Draw a map of the world with country boundaries. — draw_world","text":"Layers ggplot2 map world current ggplot2 object.","code":""},{"path":"/reference/draw_world.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a map of the world with country boundaries. — draw_world","text":"","code":"draw_world(g = ggplot() + theme_bw() + xlab(\"\") + ylab(\"\"), inc_border = TRUE)"},{"path":"/reference/draw_world.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a map of the world with country boundaries. — draw_world","text":"g initial ggplot object inc_border flag indicating whether map border drawn ; see details.","code":""},{"path":"/reference/draw_world.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Draw a map of the world with country boundaries. — draw_world","text":"function uses ggplot2::map_data() order create world map. Since, default, creates lines crossing world (-180,180) longitude boundary, function .homogenise_maps() used split polygons boundary two. inc_border TRUE, border drawn around lon-lat space; option useful projections yield rectangular plots (e.g., sinusoidal global projection).","code":""},{"path":[]},{"path":"/reference/draw_world.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a map of the world with country boundaries. — draw_world","text":"","code":"if (FALSE) { library(ggplot2) draw_world(g = ggplot())}"},{"path":"/reference/eval_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate basis functions — eval_basis","title":"Evaluate basis functions — eval_basis","text":"Evaluate basis functions points average functions polygons.","code":""},{"path":"/reference/eval_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate basis functions — eval_basis","text":"","code":"eval_basis(basis, s) # S4 method for Basis,matrix eval_basis(basis, s) # S4 method for Basis,SpatialPointsDataFrame eval_basis(basis, s) # S4 method for Basis,SpatialPolygonsDataFrame eval_basis(basis, s) # S4 method for Basis,STIDF eval_basis(basis, s) # S4 method for TensorP_Basis,matrix eval_basis(basis, s) # S4 method for TensorP_Basis,STIDF eval_basis(basis, s) # S4 method for TensorP_Basis,STFDF eval_basis(basis, s)"},{"path":"/reference/eval_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate basis functions — eval_basis","text":"basis object class Basis s object class matrix, SpatialPointsDataFrame SpatialPolygonsDataFrame containing spatial locations/footprints","code":""},{"path":"/reference/eval_basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Evaluate basis functions — eval_basis","text":"function evaluates basis functions isolated points, averages basis functions polygons, computing matrix \\(S\\). latter operation carried using Monte Carlo integration 1000 samples per polygon. using space-time basis functions, object must contain field t containing numeric representation time, example, containing number seconds, hours, days since first data point.","code":""},{"path":[]},{"path":"/reference/eval_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate basis functions — eval_basis","text":"","code":"library(sp) ### Create a synthetic dataset set.seed(1) d <- data.frame(lon = runif(n=500,min = -179, max = 179), lat = runif(n=500,min = -90, max = 90), z = rnorm(500)) coordinates(d) <- ~lon + lat slot(d, \"proj4string\") = CRS(\"+proj=longlat\") ### Now create basis functions on sphere G <- auto_basis(manifold = sphere(),data=d, nres = 2,prune=15, type = \"bisquare\", subsamp = 20000) #> NOTE: Zero process variability is implicitly enforced in regions where basis functions are pruned. Please use the option prune carefully: regions of data paucity are generally not reflective of regions of low process variability. Please set prune = 0 if unsure what to do. ### Now evaluate basis functions at origin S <- eval_basis(G,matrix(c(0,0),1,2))"},{"path":"/reference/info_fit.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve fit information for SRE model — info_fit","title":"Retrieve fit information for SRE model — info_fit","text":"Takes object class SRE returns list containing relevant information parameter estimation","code":""},{"path":"/reference/info_fit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve fit information for SRE model — info_fit","text":"","code":"info_fit(object) # S4 method for SRE info_fit(object)"},{"path":"/reference/info_fit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve fit information for SRE model — info_fit","text":"object object class SRE","code":""},{"path":[]},{"path":"/reference/info_fit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve fit information for SRE model — info_fit","text":"","code":"# See example in the help file for FRK"},{"path":"/reference/initialize-manifold-method.html","id":null,"dir":"Reference","previous_headings":"","what":"manifold — initialize,manifold-method","title":"manifold — initialize,manifold-method","text":"Manifold initialisation. function called directly manifold virtual class.","code":""},{"path":"/reference/initialize-manifold-method.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"manifold — initialize,manifold-method","text":"","code":"# S4 method for manifold initialize(.Object)"},{"path":"/reference/initialize-manifold-method.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"manifold — initialize,manifold-method","text":".Object manifold object passed lower-level constructor","code":""},{"path":"/reference/isea3h.html","id":null,"dir":"Reference","previous_headings":"","what":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","title":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","text":"data used obtained https://webpages.sou.edu/~sahrk/dgg/isea.old/gen/isea3h.html represent ISEA discrete global grids (DGGRIDs) generated using DGGRID software. original .gen files converted data frame using function dggrid_gen_to_df, available dggrids package. resolutions 0--6 supplied FRK note resolution 0 ISEA3H equal resolution 1 FRK. higher resolutions dggrids can installed https://github.com/andrewzm/dggrids/ using devtools.","code":""},{"path":"/reference/isea3h.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","text":"","code":"isea3h"},{"path":"/reference/isea3h.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","text":"data frame 284,208 rows 5 variables: id grid identification number within given resolution lon longitude coordinate lat latitude coordinate res DGGRID resolution (0 -- 6) centroid 0-1 variable, indicating whether point describes centroid polygon, whether boundary point polygon","code":""},{"path":"/reference/isea3h.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"ISEA Aperture 3 Hexagon (ISEA3H) Discrete Global Grid — isea3h","text":"Sahr, K. (2008). Location coding icosahedral aperture 3 hexagon discrete global grids. Computers, Environment Urban Systems, 32, 174--187.","code":""},{"path":"/reference/local_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Construct a set of local basis functions — local_basis","title":"Construct a set of local basis functions — local_basis","text":"Construct set local basis functions based pre-specified location scale parameters.","code":""},{"path":"/reference/local_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Construct a set of local basis functions — local_basis","text":"","code":"local_basis( manifold = sphere(), loc = matrix(c(1, 0), nrow = 1), scale = 1, type = c(\"bisquare\", \"Gaussian\", \"exp\", \"Matern32\"), res = 1, regular = FALSE ) radial_basis( manifold = sphere(), loc = matrix(c(1, 0), nrow = 1), scale = 1, type = c(\"bisquare\", \"Gaussian\", \"exp\", \"Matern32\") )"},{"path":"/reference/local_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Construct a set of local basis functions — local_basis","text":"manifold object class manifold, example, sphere loc matrix size n dimensions(manifold) indicating centres basis functions scale vector length n containing scale parameters basis functions; see details type either \"bisquare\", \"Gaussian\", \"exp\", \"Matern32\" res vector length n containing resolutions basis functions regular logical indicating basis functions (resolution) regular grid","code":""},{"path":"/reference/local_basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Construct a set of local basis functions — local_basis","text":"functions lays local basis functions domain interest based pre-specified location scale parameters. type ``bisquare'', $$\\phi(u) = \\left(1- \\left(\\frac{\\| u \\|}{R}\\right)^2\\right)^2 (\\|u\\| < R),$$ scale given \\(R\\), range support bisquare function. type ``Gaussian'', $$\\phi(u) = \\exp\\left(-\\frac{\\|u \\|^2}{2\\sigma^2}\\right),$$ scale given \\(\\sigma\\), standard deviation. type ``exp'', $$\\phi(u) = \\exp\\left(-\\frac{\\|u\\|}{ \\tau}\\right),$$ scale given \\(\\tau\\), e-folding length. type ``Matern32'', $$\\phi(u) = \\left(1 + \\frac{\\sqrt{3}\\|u\\|}{\\kappa}\\right)\\exp\\left(-\\frac{\\sqrt{3}\\| u \\|}{\\kappa}\\right),$$ scale given \\(\\kappa\\), function's scale.","code":""},{"path":[]},{"path":"/reference/local_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Construct a set of local basis functions — local_basis","text":"","code":"library(ggplot2) G <- local_basis(manifold = real_line(), loc=matrix(1:10,10,1), scale=rep(2,10), type=\"bisquare\") if (FALSE) show_basis(G)"},{"path":"/reference/loglik.html","id":null,"dir":"Reference","previous_headings":"","what":"(Deprecated) Retrieve log-likelihood — loglik","title":"(Deprecated) Retrieve log-likelihood — loglik","text":"function deprecated; please use logLik","code":""},{"path":"/reference/loglik.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"(Deprecated) Retrieve log-likelihood — loglik","text":"","code":"loglik(object) # S4 method for SRE loglik(object)"},{"path":"/reference/loglik.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"(Deprecated) Retrieve log-likelihood — loglik","text":"object object class SRE","code":""},{"path":"/reference/manifold-class.html","id":null,"dir":"Reference","previous_headings":"","what":"manifold — manifold-class","title":"manifold — manifold-class","text":"class manifold virtual; manifold classes inherit class.","code":""},{"path":"/reference/manifold-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"manifold — manifold-class","text":"manifold object characterised character variable type, contains description manifold, variable measure type measure. typical measure Euclidean distance. FRK supports five manifolds; real line (one dimension), instantiated using real_line(); 2D plane, instantiated using plane(); 2D-sphere surface S2, instantiated using sphere(); R2 space-time manifold, instantiated using STplane(), S2 space-time manifold, instantiated using STsphere(). User-specific manifolds can also specified, however helper functions manifold specific, auto_BAUs auto_basis, work pre-configured manifolds. Importantly, one can change distance function used manifold synthesise anisotropy heterogeneity. See vignette one example.","code":""},{"path":[]},{"path":"/reference/manifold.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve manifold — manifold","title":"Retrieve manifold — manifold","text":"Retrieve manifold FRK object.","code":""},{"path":"/reference/manifold.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve manifold — manifold","text":"","code":"manifold(.Object) # S4 method for Basis manifold(.Object) # S4 method for TensorP_Basis manifold(.Object)"},{"path":"/reference/manifold.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve manifold — manifold","text":".Object FRK object","code":""},{"path":[]},{"path":"/reference/manifold.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Retrieve manifold — manifold","text":"","code":"G <- local_basis(manifold = plane(), loc=matrix(0,1,2), scale=0.2, type=\"bisquare\") manifold(G) #> Type of manifold: plane #> Dimension of manifold: 2 #> Distance function: #> function (x1, x2) distR(x1, x2)"},{"path":"/reference/measure-class.html","id":null,"dir":"Reference","previous_headings":"","what":"measure — measure-class","title":"measure — measure-class","text":"Measure class used defining measures used compute distances points objects constructed FRK package.","code":""},{"path":"/reference/measure-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"measure — measure-class","text":"object class measure contains distance function variable dim dimensions Riemannian manifold distance computed.","code":""},{"path":[]},{"path":"/reference/nbasis.html","id":null,"dir":"Reference","previous_headings":"","what":"Number of basis functions — nbasis","title":"Number of basis functions — nbasis","text":"Retrieve number basis functions Basis SRE object.","code":""},{"path":"/reference/nbasis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Number of basis functions — nbasis","text":"","code":"nbasis(.Object) # S4 method for Basis_obj nbasis(.Object) # S4 method for SRE nbasis(.Object)"},{"path":"/reference/nbasis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Number of basis functions — nbasis","text":".Object object class Basis SRE","code":""},{"path":[]},{"path":"/reference/nbasis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Number of basis functions — nbasis","text":"","code":"library(sp) data(meuse) coordinates(meuse) = ~x+y # change into an sp object G <- auto_basis(manifold = plane(), data=meuse, nres = 2, regular=1, type = \"Gaussian\") print(nbasis(G)) #> [1] 129"},{"path":"/reference/nres.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the number of resolutions — nres","title":"Return the number of resolutions — nres","text":"Return number resolutions basis function object.","code":""},{"path":"/reference/nres.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the number of resolutions — nres","text":"","code":"nres(b) # S4 method for Basis nres(b) # S4 method for TensorP_Basis nres(b) # S4 method for SRE nres(b)"},{"path":"/reference/nres.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the number of resolutions — nres","text":"b object class Basis SRE","code":""},{"path":[]},{"path":"/reference/nres.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return the number of resolutions — nres","text":"","code":"library(sp) set.seed(1) d <- data.frame(lon = runif(n=500,min = -179, max = 179), lat = runif(n=500,min = -90, max = 90), z = rnorm(500)) coordinates(d) <- ~lon + lat slot(d, \"proj4string\") = CRS(\"+proj=longlat\") ### Now create basis functions on sphere G <- auto_basis(manifold = sphere(),data=d, nres = 2,prune=15, type = \"bisquare\", subsamp = 20000) #> NOTE: Zero process variability is implicitly enforced in regions where basis functions are pruned. Please use the option prune carefully: regions of data paucity are generally not reflective of regions of low process variability. Please set prune = 0 if unsure what to do. nres(G) #> [1] 2"},{"path":"/reference/observed_BAUs.html","id":null,"dir":"Reference","previous_headings":"","what":"Observed (or unobserved) BAUs — observed_BAUs","title":"Observed (or unobserved) BAUs — observed_BAUs","text":"Computes indices (numeric vector) observed (unobserved) BAUs","code":""},{"path":"/reference/observed_BAUs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Observed (or unobserved) BAUs — observed_BAUs","text":"","code":"observed_BAUs(object) unobserved_BAUs(object) # S4 method for SRE observed_BAUs(object) # S4 method for SRE unobserved_BAUs(object)"},{"path":"/reference/observed_BAUs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Observed (or unobserved) BAUs — observed_BAUs","text":"object object class SRE","code":""},{"path":[]},{"path":"/reference/observed_BAUs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Observed (or unobserved) BAUs — observed_BAUs","text":"","code":"# See example in the help file for FRK"},{"path":"/reference/opts_FRK.html","id":null,"dir":"Reference","previous_headings":"","what":"FRK options — opts_FRK","title":"FRK options — opts_FRK","text":"main options list FRK package.","code":""},{"path":"/reference/opts_FRK.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"FRK options — opts_FRK","text":"","code":"opts_FRK"},{"path":"/reference/opts_FRK.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"FRK options — opts_FRK","text":"List 2 $ set:function(opt,value) $ get:function(opt)","code":""},{"path":"/reference/opts_FRK.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"FRK options — opts_FRK","text":"opts_FRK list containing two functions, set get, can used set options retrieve options, respectively. Currently FRK uses three options: \"progress\": flag indicating whether progress bars displayed \"verbose\": flag indicating whether certain progress messages shown . Currently option applicable method = \"TMB\" \"parallel\": integer indicating number cores use. number 0 1 indicates parallelism","code":""},{"path":"/reference/opts_FRK.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"FRK options — opts_FRK","text":"","code":"opts_FRK$set(\"progress\",1L) opts_FRK$get(\"parallel\") #> [1] 0"},{"path":"/reference/plane.html","id":null,"dir":"Reference","previous_headings":"","what":"plane — plane","title":"plane — plane","text":"Initialisation 2D plane.","code":""},{"path":"/reference/plane.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"plane — plane","text":"","code":"plane(measure = Euclid_dist(dim = 2L))"},{"path":"/reference/plane.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"plane — plane","text":"measure object class measure","code":""},{"path":"/reference/plane.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"plane — plane","text":"2D plane initialised using measure object. default, measure object (measure) Euclidean distance 2 dimensions, Euclid_dist.","code":""},{"path":"/reference/plane.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"plane — plane","text":"","code":"P <- plane() print(type(P)) #> [1] \"plane\" print(sp::dimensions(P)) #> [1] 2"},{"path":"/reference/plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot predictions from FRK analysis — plot","title":"Plot predictions from FRK analysis — plot","text":"function acts wrapper around plot_spatial_or_ST. plots fields Spatial*DataFrame STFDF object corresponding prediction prediction uncertainty quantification. also uses @data slot SRE object plot training data set(s), generates informative, latex-style legend labels plots.","code":""},{"path":"/reference/plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot predictions from FRK analysis — plot","text":"","code":"plot(x, y, ...) # S4 method for SRE,list plot(x, y, ...) # S4 method for SRE,STFDF plot(x, y, ...) # S4 method for SRE,SpatialPointsDataFrame plot(x, y, ...) # S4 method for SRE,SpatialPixelsDataFrame plot(x, y, ...) # S4 method for SRE,SpatialPolygonsDataFrame plot(x, y, ...)"},{"path":"/reference/plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot predictions from FRK analysis — plot","text":"x object class SRE y Spatial*DataFrame STFDF object resulting call predict(x). Keep mind predict() returns list method = \"TMB\"; element $newdata contains required Spatial/ST object. list passed, receive error: \"x\" \"y\" lengths differ. ... optional arguments passed plot_spatial_or_ST","code":""},{"path":"/reference/plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot predictions from FRK analysis — plot","text":"list ggplot objects consisting observed data, predictions, standard errors. list can supplied , example, ggpubr::ggarrange().","code":""},{"path":"/reference/plot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot predictions from FRK analysis — plot","text":"","code":"## See example in the help file for SRE"},{"path":"/reference/plot_spatial_or_ST.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"Takes object class Spatial*DataFrame STFDF, plots requested data columns using ggplot2","code":""},{"path":"/reference/plot_spatial_or_ST.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"","code":"plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... ) # S4 method for STFDF plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... ) # S4 method for SpatialPointsDataFrame plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... ) # S4 method for SpatialPixelsDataFrame plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... ) # S4 method for SpatialPolygonsDataFrame plot_spatial_or_ST( newdata, column_names, map_layer = NULL, subset_time = NULL, palette = \"Spectral\", plot_over_world = FALSE, labels_from_coordnames = TRUE, ... )"},{"path":"/reference/plot_spatial_or_ST.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"newdata object class Spatial*DataFrame STFDF column_names vector strings indicating columns data plot map_layer (optional) ggplot layer object add plotted layer, often map subset_time (optional) vector times included; applicable STFDF objects palette palette supplied argument palette scale_*_distiller(). Alternatively, palette = \"nasa\", vibrant colour palette created using scale_*_gradientn() plot_over_world logical; TRUE, coord_map(\"mollweide\") draw_world used plot world labels_from_coordnames logical; TRUE, coordinate names newdata (.e., coordnames(newdata)) used horizontal- vertical-axis labels. Otherwise, generic names, s_1 s_2, used ... optional arguments passed whatever geom appropriate Spatial*DataFrame STFDF object (geom_point, geom_tile, geom_raster, geom_polygon)","code":""},{"path":"/reference/plot_spatial_or_ST.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"list ggplot objects corresponding provided column_names. list can supplied , example, ggpubr::ggarrange().","code":""},{"path":[]},{"path":"/reference/plot_spatial_or_ST.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot a Spatial*DataFrame or STFDF object — plot_spatial_or_ST","text":"","code":"## See example in the help file for FRK"},{"path":"/reference/plotting-themes.html","id":null,"dir":"Reference","previous_headings":"","what":"Plotting themes — plotting-themes","title":"Plotting themes — plotting-themes","text":"Formats ggplot object neat plotting.","code":""},{"path":"/reference/plotting-themes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plotting themes — plotting-themes","text":"","code":"LinePlotTheme() EmptyTheme()"},{"path":"/reference/plotting-themes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plotting themes — plotting-themes","text":"Object class ggplot","code":""},{"path":"/reference/plotting-themes.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plotting themes — plotting-themes","text":"LinePlotTheme() creates ggplot object white background, relatively large font, grid lines. EmptyTheme() hand creates ggplot object axes legends.","code":""},{"path":"/reference/plotting-themes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plotting themes — plotting-themes","text":"","code":"if (FALSE) { X <- data.frame(x=runif(100),y = runif(100), z = runif(100)) LinePlotTheme() + geom_point(data=X,aes(x,y,colour=z)) EmptyTheme() + geom_point(data=X,aes(x,y,colour=z))}"},{"path":"/reference/real_line.html","id":null,"dir":"Reference","previous_headings":"","what":"real line — real_line","title":"real line — real_line","text":"Initialisation real-line (1D) manifold.","code":""},{"path":"/reference/real_line.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"real line — real_line","text":"","code":"real_line(measure = Euclid_dist(dim = 1L))"},{"path":"/reference/real_line.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"real line — real_line","text":"measure object class measure","code":""},{"path":"/reference/real_line.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"real line — real_line","text":"real line initialised using measure object. default, measure object (measure) describes distance two points absolute difference two coordinates.","code":""},{"path":"/reference/real_line.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"real line — real_line","text":"","code":"R <- real_line() print(type(R)) #> [1] \"real_line\" print(sp::dimensions(R)) #> [1] 1"},{"path":"/reference/remove_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Removes basis functions — remove_basis","title":"Removes basis functions — remove_basis","text":"Takes object class Basis returns object class Basis selected basis functions removed","code":""},{"path":"/reference/remove_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Removes basis functions — remove_basis","text":"","code":"remove_basis(Basis, rmidx) # S4 method for Basis,ANY remove_basis(Basis, rmidx) # S4 method for Basis,SpatialPolygons remove_basis(Basis, rmidx)"},{"path":"/reference/remove_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Removes basis functions — remove_basis","text":"Basis object class Basis rmidx indices basis functions remove. SpatialPolygons object; basis functions overlapping SpatialPolygons object retained","code":""},{"path":[]},{"path":"/reference/remove_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Removes basis functions — remove_basis","text":"","code":"library(sp) df <- data.frame(x = rnorm(10), y = rnorm(10)) coordinates(df) <- ~x+y G <- auto_basis(plane(),df,nres=1) data.frame(G) # Print info on basis #> loc1 loc2 scale res #> 1 -1.9123458 -1.6219373 2.286276 1 #> 2 -0.3886904 -1.6219373 2.286276 1 #> 3 1.1349651 -1.6219373 2.286276 1 #> 4 -1.9123458 -0.4025903 2.286276 1 #> 5 -0.3886904 -0.4025903 2.286276 1 #> 6 1.1349651 -0.4025903 2.286276 1 #> 7 -1.9123458 0.8167566 2.286276 1 #> 8 -0.3886904 0.8167566 2.286276 1 #> 9 1.1349651 0.8167566 2.286276 1 #> 10 -1.9123458 2.0361036 2.286276 1 #> 11 -0.3886904 2.0361036 2.286276 1 #> 12 1.1349651 2.0361036 2.286276 1 ## Removing basis functions by index G_subset <- remove_basis(G, 1:(nbasis(G)-1)) data.frame(G_subset) #> loc1 loc2 scale res #> 12 1.134965 2.036104 2.286276 1 ## Removing basis functions using SpatialPolygons x <- 1 poly <- Polygon(rbind(c(-x, -x), c(-x, x), c(x, x), c(x, -x), c(-x, -x))) polys <- Polygons(list(poly), \"1\") spatpolys <- SpatialPolygons(list(polys)) G_subset <- remove_basis(G, spatpolys) data.frame(G_subset) #> loc1 loc2 scale res #> 5 -0.3886904 -0.4025903 2.286276 1 #> 8 -0.3886904 0.8167566 2.286276 1"},{"path":"/reference/show_basis.html","id":null,"dir":"Reference","previous_headings":"","what":"Show basis functions — show_basis","title":"Show basis functions — show_basis","text":"Generic plotting function visualising basis functions.","code":""},{"path":"/reference/show_basis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Show basis functions — show_basis","text":"","code":"show_basis(basis, ...) # S4 method for Basis show_basis(basis, g = ggplot() + theme_bw() + xlab(\"\") + ylab(\"\")) # S4 method for TensorP_Basis show_basis(basis, g = ggplot())"},{"path":"/reference/show_basis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Show basis functions — show_basis","text":"basis object class Basis ... use g object class gg (ggplot object) overlay basis functions (optional)","code":""},{"path":"/reference/show_basis.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Show basis functions — show_basis","text":"function show_basis adapts behaviour manifold used. real_line, 1D basis functions plotted colour distinguishing different resolutions. plane, local basis functions supported (present). basis function shown circle diameter equal scale parameter function. Linetype distinguishes resolution. sphere, centres basis functions shown circles, larger sizes corresponding coarser resolutions. Space-time basis functions subclass TensorP_Basis visualised showing spatial basis functions temporal basis functions two separate plots.","code":""},{"path":[]},{"path":"/reference/show_basis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Show basis functions — show_basis","text":"","code":"library(ggplot2) library(sp) data(meuse) coordinates(meuse) = ~x+y # change into an sp object G <- auto_basis(manifold = plane(),data=meuse,nres = 2,regular=2,prune=0.1,type = \"bisquare\") #> NOTE: Zero process variability is implicitly enforced in regions where basis functions are pruned. Please use the option prune carefully: regions of data paucity are generally not reflective of regions of low process variability. Please set prune = 0 if unsure what to do. if (FALSE) show_basis(G,ggplot()) + geom_point(data=data.frame(meuse),aes(x,y))"},{"path":"/reference/sphere.html","id":null,"dir":"Reference","previous_headings":"","what":"sphere — sphere","title":"sphere — sphere","text":"Initialisation 2-sphere, S2.","code":""},{"path":"/reference/sphere.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"sphere — sphere","text":"","code":"sphere(radius = 6371)"},{"path":"/reference/sphere.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"sphere — sphere","text":"radius radius sphere","code":""},{"path":"/reference/sphere.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"sphere — sphere","text":"2D surface sphere initialised using radius parameter. default value radius R R=6371 km, Earth's radius, measure used compute distances sphere great-circle distance sphere radius R.","code":""},{"path":"/reference/sphere.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"sphere — sphere","text":"","code":"S <- sphere() print(sp::dimensions(S)) #> [1] 2"},{"path":"/reference/type.html","id":null,"dir":"Reference","previous_headings":"","what":"Type of manifold — type","title":"Type of manifold — type","text":"Retrieve slot type object","code":""},{"path":"/reference/type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Type of manifold — type","text":"","code":"type(.Object) # S4 method for manifold type(.Object)"},{"path":"/reference/type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Type of manifold — type","text":".Object object class Basis manifold","code":""},{"path":[]},{"path":"/reference/type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Type of manifold — type","text":"","code":"S <- sphere() print(type(S)) #> [1] \"surface of sphere\""},{"path":"/reference/worldmap.html","id":null,"dir":"Reference","previous_headings":"","what":"World map — worldmap","title":"World map — worldmap","text":"world map extracted package maps v.3.0.1 running ggplot2::map_data(\"world\"). reduce data size, every third point data frame contained worldmap.","code":""},{"path":"/reference/worldmap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"World map — worldmap","text":"","code":"worldmap"},{"path":"/reference/worldmap.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"World map — worldmap","text":"data frame 33971 rows 6 variables: long longitude coordinate lat latitude coordinate group polygon (region) number order order point polygon boundary region region name subregion subregion name","code":""},{"path":"/reference/worldmap.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"World map — worldmap","text":"Original S code Becker, R.. Wilks, R.. R version Brownrigg, R. Enhancements made Minka, T.P. Deckmyn, . (2015) maps: Draw Geographical Maps, R package version 3.0.1.","code":""}]