Skip to content

Commit

Permalink
Merge branch 'master' into 2023_12_fmesher
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewzm committed Jun 17, 2024
2 parents dbf9631 + ce2583f commit e8694a2
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 67 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Package: FRK
Type: Package
Title: Fixed Rank Kriging
Version: 2.2.1
Date: 2023-12-08
Version: 2.2.3
Date: 2024-04-03
Authors@R: c(
person("Andrew", "Zammit-Mangion", , "[email protected]", c("aut", "cre")),
person("Matthew", "Sainsbury-Dale", , "[email protected]", c("aut")))
Maintainer: Andrew Zammit-Mangion <[email protected]>
VignetteBuilder: knitr
Description: A tool for spatial/spatio-temporal modelling and prediction with large datasets. The approach models the field, and hence the covariance function, using a set of basis functions. This fixed-rank basis-function representation facilitates the modelling of big data, and the method naturally allows for non-stationary, anisotropic covariance functions. Discretisation of the spatial domain into so-called basic areal units (BAUs) facilitates the use of observations with varying support (i.e., both point-referenced and areal supports, potentially simultaneously), and prediction over arbitrary user-specified regions. `FRK` also supports inference over various manifolds, including the 2D plane and 3D sphere, and it provides helper functions to model, fit, predict, and plot with relative ease. Version 2.0.0 and above also supports the modelling of non-Gaussian data (e.g., Poisson, binomial, negative-binomial, gamma, and inverse-Gaussian) by employing a generalised linear mixed model (GLMM) framework. Zammit-Mangion and Cressie <doi:10.18637/jss.v098.i04> describe `FRK` in a Gaussian setting, and detail its use of basis functions and BAUs, while Sainsbury-Dale et al. <arXiv:2110.02507> describe `FRK` in a non-Gaussian setting; two vignettes are available that summarise these papers and provide additional examples.
Description: A tool for spatial/spatio-temporal modelling and prediction with large datasets. The approach models the field, and hence the covariance function, using a set of basis functions. This fixed-rank basis-function representation facilitates the modelling of big data, and the method naturally allows for non-stationary, anisotropic covariance functions. Discretisation of the spatial domain into so-called basic areal units (BAUs) facilitates the use of observations with varying support (i.e., both point-referenced and areal supports, potentially simultaneously), and prediction over arbitrary user-specified regions. `FRK` also supports inference over various manifolds, including the 2D plane and 3D sphere, and it provides helper functions to model, fit, predict, and plot with relative ease. Version 2.0.0 and above also supports the modelling of non-Gaussian data (e.g., Poisson, binomial, negative-binomial, gamma, and inverse-Gaussian) by employing a generalised linear mixed model (GLMM) framework. Zammit-Mangion and Cressie <doi:10.18637/jss.v098.i04> describe `FRK` in a Gaussian setting, and detail its use of basis functions and BAUs, while Sainsbury-Dale, Zammit-Mangion, and Cressie <doi:10.18637/jss.v108.i10> describe `FRK` in a non-Gaussian setting; two vignettes are available that summarise these papers and provide additional examples.
URL: https://andrewzm.github.io/FRK/, https://github.com/andrewzm/FRK/
BugReports: https://github.com/andrewzm/FRK/issues/
Depends:
Expand Down
2 changes: 1 addition & 1 deletion R/SRE.R
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
#' @references
#' Zammit-Mangion, A. and Cressie, N. (2021). FRK: An R package for spatial and spatio-temporal prediction with large datasets. Journal of Statistical Software, 98(4), 1-48. doi:10.18637/jss.v098.i04.
#'
#' Sainsbury-Dale, M. and Zammit-Mangion, A. and Cressie, N. (2023) Modelling Big, Heterogeneous, Non-Gaussian Spatial and Spatio-Temporal Data using FRK, arXiv:2110.02507
#' Sainsbury-Dale, M. and Zammit-Mangion, A. and Cressie, N. (2024) Modelling Big, Heterogeneous, Non-Gaussian Spatial and Spatio-Temporal Data using FRK. Journal of Statistical Software, 108(10), 1--39. doi:10.18637/jss.v108.i10.
#' @export
#' @examples
#' library("FRK")
Expand Down
56 changes: 29 additions & 27 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
bibentry(
bibtype = "Article",
title = "FRK: an R package for spatial and spatio-temporal prediction with large datasets",
author = c(person("Andrew Zammit-Mangion"), person("Noel Cressie")),
journal = "Journal of Statistical Software",
year = "2021",
volume = "98",
number = "4",
pages = "1--48",
header = "To cite FRK version 1 (with EM algorithm) in publications use:",
textVersion = paste(
"Zammit-Mangion A, Cressie N (2021).",
"FRK: an R package for spatial and spatio-temporal prediction with large datasets.",
"Journal of Statistical Software, 98(4), 1–48."
)
bibentry(bibtype = "Article",
title = "{FRK}: An {R} Package for Spatial and Spatio-Temporal Prediction with Large Datasets",
author = c(person(given = "Andrew",
family = "Zammit-Mangion"),
person(given = "Noel",
family = "Cressie")),
journal = "Journal of Statistical Software",
year = "2021",
volume = "98",
number = "4",
pages = "1--48",
doi = "10.18637/jss.v098.i04",
header = "To cite FRK version 1 (with EM algorithm) in publications use:",
)


bibentry(
bibtype = "Article",
title = "Modelling big, heterogeneous, non-Gaussian spatial and spatio-temporal data using FRK",
author = c(person("Matthew Sainsbury-Dale"), person("Andrew Zammit-Mangion"), person("Noel Cressie")),
journal = "arXiv:2110.02507",
year = "2022",
header = "To cite FRK version 2 (non-Gaussian data) in publications use:", textVersion = paste(
"Sainsbury-Dale M, Zammit-Mangion A, Cressie N (2022).",
"Modelling big, heterogeneous, non-Gaussian spatial and spatio-temporal data using FRK",
"arXiv:2110.02507"
)
bibentry(bibtype = "Article",
title = "Modeling Big, Heterogeneous, Non-{G}aussian Spatial and Spatio-Temporal Data Using {FRK}",
author = c(person(given = "Matthew",
family = "Sainsbury-Dale",
email = "[email protected]"),
person(given = "Andrew",
family = "Zammit-Mangion"),
person(given = "Noel",
family = "Cressie")),
journal = "Journal of Statistical Software",
year = "2024",
volume = "108",
number = "10",
pages = "1--39",
doi = "10.18637/jss.v108.i10",
header = "To cite FRK version 2 (non-Gaussian data) in publications use:"
)
2 changes: 1 addition & 1 deletion man/SRE.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions vignettes/FRK_intro-concordance.tex
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
\Sconcordance{concordance:FRK_intro.tex:FRK_intro.Rnw:%
1 223 1 50 0 1 7 48 1 4 0 7 1 4 0 17 1 7 0 5 1 4 0 14 1 4 0 6 1 4 %
0 8 1 7 0 12 1 4 0 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 10 1 4 0 %
25 1 4 0 9 1 1 13 22 1 8 0 21 1 4 0 1 1 1 10 14 1 1 12 11 1 1 9 11 1 1 %
10 15 1 1 27 2 1 1 52 6 1 3 0 19 1 4 0 7 1 1 13 10 1 4 0 7 1 4 0 12 1 4 %
0 10 1 2 0 3 1 1 42 5 1 3 0 69 1}
82 changes: 58 additions & 24 deletions vignettes/FRK_intro.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -613,45 +613,64 @@ mumax <- quantile(X$mu,0.99)
@

<<echo=FALSE,fig.width=7,fig.height=3.5,out.width="\\linewidth",fig.pos="t!",fig.cap="CO$_2$ mole-fraction readings in ppm from the \\tt{AIRS}.\\label{fig:AIRSresults1}",fig.align="centre",dev = 'png',dpi=70>>=
g1 <- (EmptyTheme() +
geom_point(data=data.frame(AIRS_05_2003),
aes(lon,lat,
colour=pmin(pmax(
co2avgret,mumin),
df_to_plot <- data.frame(
lon = as.numeric(AIRS_05_2003$lon),
lat = as.numeric(AIRS_05_2003$lat),
co2avgret = as.numeric(AIRS_05_2003$co2avgret)
)
g1 <- (ggplot(df_to_plot) + geom_point(data = df_to_plot,
aes(lon, lat,
colour = pmin(pmax(
co2avgret, mumin),
mumax)),
pch=46) +
scale_colour_distiller(palette="Spectral",
guide_legend(title="co2 (ppm)")
) +
coord_map("mollweide")) %>%
draw_world(inc_border=TRUE) +
xlab("lon (deg)") +
ylab("lat (deg)")
pch = 46) +
scale_colour_distiller(palette = "Spectral",
name = "co2 (ppm)") +
coord_map("mollweide")) %>%
draw_world(inc_border=TRUE) +
xlab("lon (deg)") +
ylab("lat (deg)") +
theme_minimal() +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank())
print(g1)
@

<<echo=FALSE,fig.width=7,fig.height=3.5,out.width="\\linewidth",fig.pos="t!",fig.cap="Prediction of $\\Yvec_P$ in ppm following FRK on the \\tt{AIRS} data.\\label{fig:AIRSresults2}",fig.align="centre",dev = 'png',dpi=70>>=
g2 <- (EmptyTheme() +
g2 <- (ggplot() +
geom_polygon(data=X,
aes(lon,lat,fill=pmin(pmax(mu,mumin),mumax),group=id))+
scale_fill_distiller(palette="Spectral",name="pred. (ppm)",limits=c(mumin,mumax)) +
coord_map("mollweide")) %>%
draw_world(inc_border=TRUE)+
xlab("lon (deg)") +
ylab("lat (deg)")
ylab("lat (deg)") +
theme_minimal() +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank())
print(g2)
@

<<echo=FALSE,fig.keep=TRUE,fig.width=7,fig.height=3.5,out.width="\\linewidth",fig.pos="t!",fig.cap="Prediction standard error of $\\Yvec_P$ in ppm following FRK on the \\tt{AIRS} data.\\label{fig:AIRSresults3}",fig.align="centre",dev = 'png',dpi=70>>=
X$se <- pmax(sqrt(X$var),0.32)
g3 <- (EmptyTheme() +
g3 <- (ggplot() +
geom_polygon(data=X,
aes(lon,lat,fill=se,group=id))+
scale_fill_distiller(palette="BrBG",name="s.e. (ppm)") +
coord_map("mollweide")) %>%
draw_world(inc_border=TRUE)+
xlab("lon (deg)") +
ylab("lat (deg)")
ylab("lat (deg)") +
theme_minimal() +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank())
print(g3)
@
Expand Down Expand Up @@ -996,7 +1015,7 @@ mumax <- max(X$mu)


<<echo=FALSE, fig.keep=TRUE,fig.cap="CO$_2$ readings taken from the \\tt{AIRS} on the 04, 08 and 12 May 2003 in ppm. \\label{fig:FRK_AIRS_ST1}",fig.align="center",out.width="\\linewidth",fig.height=3,fig.width=16,fig.pos="t!",dev = 'png',dpi=70>>=
g1 <- (EmptyTheme() +
g1 <- (ggplot() +
geom_point(data=dplyr::filter(AIRS_05_2003,day %in% c(4,8,12)),
aes(lon,lat,
colour=pmin(pmax(
Expand All @@ -1005,24 +1024,34 @@ g1 <- (EmptyTheme() +
size=0.5) +
facet_grid(~day)+
scale_colour_distiller(palette="Spectral",
guide_legend(title="co2 (ppm)")) +
name="co2 (ppm)") +
coord_map("mollweide") +
xlab("lon (deg)") +
ylab("lat (deg)")) %>%
ylab("lat (deg)") +
theme_minimal() +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank()) ) %>%
draw_world(inc_border=TRUE)
print(g1)
@

<<echo=FALSE, fig.keep=TRUE,fig.cap="Prediction of $\\Yvec_P$ in ppm on 04, 08, and 12 May 2003 obtained with \\pkg{FRK} on the \\tt{AIRS} data. \\label{fig:FRK_AIRS_ST2}",fig.align="center",out.width="\\linewidth",fig.height=3,fig.width=16,fig.pos="t!",dev = 'png',dpi=70>>=
g2 <- (EmptyTheme() +
g2 <- (ggplot() +
geom_polygon(data=filter(X,(t %in% c(4,8,12)) & abs(lon) < 175),
aes(lon,lat,fill=mu,group=id))+
scale_fill_distiller(palette="Spectral",name="pred. (ppm)") +
coord_map("mollweide") +
facet_grid(~t) +
xlab("lon (deg)") +
ylab("lat (deg)")) %>%
ylab("lat (deg)") +
theme_minimal() +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank())) %>%
draw_world(inc_border=FALSE)
print(g2)
Expand All @@ -1031,14 +1060,19 @@ print(g2)
<<echo=FALSE, fig.keep=TRUE,fig.cap="Prediction standard error of $\\Yvec_P$ in ppm on 04, 08 and 12 May 2003 obtained with \\pkg{FRK} on the \\tt{AIRS} data. \\label{fig:FRK_AIRS_ST3}",fig.align="center",out.width="\\linewidth",fig.height=3,fig.width=16,fig.pos="t!",dev = 'png',dpi=70>>=
X$se <- sqrt(X$var)
g3 <- (EmptyTheme() +
g3 <- (ggplot() +
geom_polygon(data=filter(X,(t %in% c(4,8,12)) & abs(lon) < 175),
aes(lon,lat,fill=se,group=id))+
scale_fill_distiller(palette="BrBG",name="s.e. (ppm)") +
coord_map("mollweide") +
facet_grid(~t) +
xlab("lon (deg)") +
ylab("lat (deg)")) %>%
ylab("lat (deg)") +
theme_minimal() +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank()) ) %>%
draw_world(inc_border=FALSE)
print(g3)
Expand Down

0 comments on commit e8694a2

Please sign in to comment.