Title: | Bayesian Geostatistical Modeling with RAMPS |
---|---|
Description: | Bayesian geostatistical modeling of Gaussian processes using a reparameterized and marginalized posterior sampling (RAMPS) algorithm designed to lower autocorrelation in MCMC samples. Package performance is tuned for large spatial datasets. |
Authors: | Brian J Smith [aut, cre], Jun Yan [aut], Mary Kathryn Cowles [aut] |
Maintainer: | Brian J Smith <[email protected]> |
License: | GPL-2 |
Version: | 0.6.18 |
Built: | 2025-01-14 02:51:04 UTC |
Source: | https://github.com/cran/ramps |
This function is a constructor for the 'corRCauchy'
class, representing a Cauchy (rational quadratic) spatial correlation structure. Letting denote the range, the correlation between two observations a distance
apart is
.
corRCauchy(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRCauchy(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric “range” parameter value for the rational quadratic correlation structure, which must be greater than zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRCauchy'
, also inheriting from class 'corRSpatial'
, representing a rational quadratic spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected] and Jose Pinheiro [email protected], and Douglas Bates [email protected]
Cressie, N.A.C. (1993), “Statistics for Spatial Data”, J. Wiley & Sons.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRCauchy(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Cauchy <- corRCauchy(1, form = ~ x + y) cs1Cauchy <- Initialize(cs1Cauchy, spatDat) corMatrix(cs1Cauchy) cs2Cauchy <- corRCauchy(1, form = ~ x + y, metric = "man") cs2Cauchy <- Initialize(cs2Cauchy, spatDat) corMatrix(cs2Cauchy)
sp1 <- corRCauchy(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Cauchy <- corRCauchy(1, form = ~ x + y) cs1Cauchy <- Initialize(cs1Cauchy, spatDat) corMatrix(cs1Cauchy) cs2Cauchy <- corRCauchy(1, form = ~ x + y, metric = "man") cs2Cauchy <- Initialize(cs2Cauchy, spatDat) corMatrix(cs2Cauchy)
Standard classes of spatial correlation structures available for the georamps
function.
Spatial Structures:
corRCauchy
Cauchy correlation.
corRExp
exponential correlation.
corRExpwr
powered exponential correlation.
corRGaus
Gaussian correlation.
corRGneit
Gneiting approximation to Gaussian correlation.
corRLin
linear correlation.
corRMatern
Matern correlation.
corRSpher
spherical correlation.
corRWave
sine wave correlation.
Spatio-Temporal Structures:
corRExp2
exponential correlation.
corRExpwr2
powered exponential correlation.
Temporally Integrated Spatial Structure:
corRExpwr2Dt
powered exponential correlation.
Users may define their own corRStruct
classes by specifying a constructor
function and, at a minimum, methods for the functions corMatrix
and coef
.
Brian Smith [email protected] and Jose Pinheiro [email protected], and Douglas Bates [email protected]
corRCauchy
,
corRExp
,
corRExp2
,
corRExpwr
,
corRExpwr2
,
corRExpwr2Dt
,
corRGaus
,
corRGneit
,
corRLin
,
corRMatern
,
corRSpher
corRWave
This function is a constructor for the 'corRExp'
class, representing an exponential spatial correlation structure. Letting denote the range, the correlation between two observations a distance
apart is
.
corRExp(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRExp(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric “range” parameter value for the exponential correlation structure, which must be greater than zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRExp'
, also inheriting from class 'corRSpatial'
, representing an exponential spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected] and Jose Pinheiro [email protected], and Douglas Bates [email protected]
Cressie, N.A.C. (1993), “Statistics for Spatial Data”, J. Wiley & Sons.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRExp(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Exp <- corRExp(1, form = ~ x + y) cs1Exp <- Initialize(cs1Exp, spatDat) corMatrix(cs1Exp) cs2Exp <- corRExp(1, form = ~ x + y, metric = "man") cs2Exp <- Initialize(cs2Exp, spatDat) corMatrix(cs2Exp)
sp1 <- corRExp(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Exp <- corRExp(1, form = ~ x + y) cs1Exp <- Initialize(cs1Exp, spatDat) corMatrix(cs1Exp) cs2Exp <- corRExp(1, form = ~ x + y, metric = "man") cs2Exp <- Initialize(cs2Exp, spatDat) corMatrix(cs2Exp)
This function is a constructor for the 'corRExp2'
class, representing a non-separable spatial correlation structure. Letting denote the spatial range,
the temporal range, and
the space-time interaction, the correlation between two observations a distance
apart in space and
in time is
.
corRExp2(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRExp2(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric vector of three parameter values for the exponential correlation structure, corresponding to the “spatial range”, “temporal range”, and “space-time interaction”. The range parameter values must be greater than zero, and the interaction greater than or equal to zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRExp2'
, inheriting from class 'corRSpatioTemporal'
, representing a non-separable spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected]
Cressie, N. and Huang, H.-C. (1993) “Classes of Nonseperable, Spatio-Temporal Stationary Covariance Functions”, Journal of the American Statistical Association, 94, 1330-1340.
sp1 <- corRExp2(form = ~ x + y + t) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4, t=(0:4)/4) cs1Exp <- corRExp2(c(1, 1, 1), form = ~ x + y + t) cs1Exp <- Initialize(cs1Exp, spatDat) corMatrix(cs1Exp) cs2Exp <- corRExp2(c(1, 1, 1), form = ~ x + y + t, metric = "man") cs2Exp <- Initialize(cs2Exp, spatDat) corMatrix(cs2Exp)
sp1 <- corRExp2(form = ~ x + y + t) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4, t=(0:4)/4) cs1Exp <- corRExp2(c(1, 1, 1), form = ~ x + y + t) cs1Exp <- Initialize(cs1Exp, spatDat) corMatrix(cs1Exp) cs2Exp <- corRExp2(c(1, 1, 1), form = ~ x + y + t, metric = "man") cs2Exp <- Initialize(cs2Exp, spatDat) corMatrix(cs2Exp)
This function is a constructor for the 'corRExpwr'
class, representing a powered exponential spatial correlation structure. Letting denote the range and
the shape, the correlation between two observations a distance
apart is
.
corRExpwr(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRExpwr(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric vector of two parameter values for the powered exponential correlation structure, corresponding to the “range” and “shape”. The range parameter value must be greater than zero, and the shape in the interval (0, 2]. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRExpwr'
, also inheriting from class 'corRSpatial'
, representing a powered exponential spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected]
Cressie, N.A.C. (1993), “Statistics for Spatial Data”, J. Wiley & Sons.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRExpwr(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Expwr <- corRExpwr(c(1, 1), form = ~ x + y) cs1Expwr <- Initialize(cs1Expwr, spatDat) corMatrix(cs1Expwr) cs2Expwr <- corRExpwr(c(1, 1), form = ~ x + y, metric = "man") cs2Expwr <- Initialize(cs2Expwr, spatDat) corMatrix(cs2Expwr)
sp1 <- corRExpwr(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Expwr <- corRExpwr(c(1, 1), form = ~ x + y) cs1Expwr <- Initialize(cs1Expwr, spatDat) corMatrix(cs1Expwr) cs2Expwr <- corRExpwr(c(1, 1), form = ~ x + y, metric = "man") cs2Expwr <- Initialize(cs2Expwr, spatDat) corMatrix(cs2Expwr)
This function is a constructor for the 'corRExpwr2'
class, representing a non-separable spatial correlation structure. Letting denote the spatial range,
the spatial shape,
the temporal range,
the temporal shape, and
the space-time interaction, the correlation between two observations a distance
apart in space and
in time is
.
corRExpwr2(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRExpwr2(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric vector of five parameter values for the powered exponential correlation structure, corresponding to the “spatial range”, “spatial shape”, “temporal range”, “temporal shape”, and “space-time interaction”. The range parameter values must be greater than zero, the shapes in the interval (0, 2], and the interaction greater than or equal to zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRExpwr2'
, inheriting from class 'corRSpatioTemporal'
, representing a non-separable spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected]
Cressie, N. and Huang, H.-C. (1993) “Classes of Nonseperable, Spatio-Temporal Stationary Covariance Functions”, Journal of the American Statistical Association, 94, 1330-1340.
Gneiting, T. (2002) “Nonseparable, stationary covariance functions for space-time data”, Journal of the American Statistical Association, 97, 590-600.
sp1 <- corRExpwr2(form = ~ x + y + t) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4, t=(0:4)/4) cs1Expwr <- corRExpwr2(c(1, 1, 1, 1, 1), form = ~ x + y + t) cs1Expwr <- Initialize(cs1Expwr, spatDat) corMatrix(cs1Expwr) cs2Expwr <- corRExpwr2(c(1, 1, 1, 1, 1), form = ~ x + y + t, metric = "man") cs2Expwr <- Initialize(cs2Expwr, spatDat) corMatrix(cs2Expwr)
sp1 <- corRExpwr2(form = ~ x + y + t) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4, t=(0:4)/4) cs1Expwr <- corRExpwr2(c(1, 1, 1, 1, 1), form = ~ x + y + t) cs1Expwr <- Initialize(cs1Expwr, spatDat) corMatrix(cs1Expwr) cs2Expwr <- corRExpwr2(c(1, 1, 1, 1, 1), form = ~ x + y + t, metric = "man") cs2Expwr <- Initialize(cs2Expwr, spatDat) corMatrix(cs2Expwr)
This function is a constructor for the 'corRExpwr2Dt'
class, representing a non-separable spatial correlation structure for temporally integrated measurements. Letting denote the spatial range,
the spatial shape,
the temporal range, and
the space-time interaction, the correlation between two observations a distance
apart in space and
in time is
.
corRExpwr2Dt(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRExpwr2Dt(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric vector of four parameter values for the powered exponential correlation structure, corresponding to the “spatial range”, “spatial shape”, “temporal range”, and “space-time interaction”. The range parameter values must be greater than zero, the shape in the interval (0, 2], and the interaction greater than or equal to zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRExpwr2Dt'
, also inheriting from class 'corRSpatial'
, representing a non-separable spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected]
Cressie, N. and Huang, H.-C. (1993) “Classes of Nonseperable, Spatio-Temporal Stationary Covariance Functions”, Journal of the American Statistical Association, 94, 1330-1340.
Smith, B.J. and Oleson, J.J. (2007) “Geostatistical Hierarchical Model for Temporally Integrated Radon Measurements”, Jounal of Agricultural, Biological, and Environmental Statistics, in press.
sp1 <- corRExpwr2Dt(form = ~ x + y + t1 + t2) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4, t1=(0:4)/4, t2=(1:5)/4) cs1ExpwrDt <- corRExpwr2Dt(c(1, 1, 1, 1), form = ~ x + y + t1 + t2) cs1ExpwrDt <- Initialize(cs1ExpwrDt, spatDat) corMatrix(cs1ExpwrDt) cs2ExpwrDt <- corRExpwr2Dt(c(1, 1, 1, 1), form = ~ x + y + t1 + t2, metric = "man") cs2ExpwrDt <- Initialize(cs2ExpwrDt, spatDat) corMatrix(cs2ExpwrDt)
sp1 <- corRExpwr2Dt(form = ~ x + y + t1 + t2) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4, t1=(0:4)/4, t2=(1:5)/4) cs1ExpwrDt <- corRExpwr2Dt(c(1, 1, 1, 1), form = ~ x + y + t1 + t2) cs1ExpwrDt <- Initialize(cs1ExpwrDt, spatDat) corMatrix(cs1ExpwrDt) cs2ExpwrDt <- corRExpwr2Dt(c(1, 1, 1, 1), form = ~ x + y + t1 + t2, metric = "man") cs2ExpwrDt <- Initialize(cs2ExpwrDt, spatDat) corMatrix(cs2ExpwrDt)
This function is a constructor for the 'corRGaus'
class, representing a Gaussian spatial correlation structure. Letting denote the range, the correlation between two observations a distance
apart is
.
corRGaus(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRGaus(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric “range” parameter value for the Gaussian correlation structure, which must be greater than zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRGaus'
, also inheriting from class 'corRSpatial'
, representing a Gaussian spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected] and Jose Pinheiro [email protected], and Douglas Bates [email protected]
Cressie, N.A.C. (1993), “Statistics for Spatial Data”, J. Wiley & Sons.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRGaus(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Gaus <- corRGaus(1, form = ~ x + y) cs1Gaus <- Initialize(cs1Gaus, spatDat) corMatrix(cs1Gaus) cs2Gaus <- corRGaus(1, form = ~ x + y, metric = "man") cs2Gaus <- Initialize(cs2Gaus, spatDat) corMatrix(cs2Gaus)
sp1 <- corRGaus(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Gaus <- corRGaus(1, form = ~ x + y) cs1Gaus <- Initialize(cs1Gaus, spatDat) corMatrix(cs1Gaus) cs2Gaus <- corRGaus(1, form = ~ x + y, metric = "man") cs2Gaus <- Initialize(cs2Gaus, spatDat) corMatrix(cs2Gaus)
This function is a constructor for the 'corRGneit'
class, representing the Gneiting approximation to the Gaussian correlation structure. Letting denote the range, the correlation between two observations a distance
apart is
, where s = 0.301187465825. If
the correlation is zero.
corRGneit(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRGneit(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric “range” parameter value for the Gneiting correlation structure, which must be greater than zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRGneit'
, also inheriting from class 'corRSpatial'
, representing the Gneiting spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected]
Gneiting, T. (1999), “Correlation Functions for Atmospheric Data Analysis”, Quarterly Journal of the Royal Meteorological Society, 125(559), 2449-2464.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRGneit(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Gneit <- corRGneit(1, form = ~ x + y) cs1Gneit <- Initialize(cs1Gneit, spatDat) corMatrix(cs1Gneit) cs2Gneit <- corRGneit(1, form = ~ x + y, metric = "man") cs2Gneit <- Initialize(cs2Gneit, spatDat) corMatrix(cs2Gneit)
sp1 <- corRGneit(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Gneit <- corRGneit(1, form = ~ x + y) cs1Gneit <- Initialize(cs1Gneit, spatDat) corMatrix(cs1Gneit) cs2Gneit <- corRGneit(1, form = ~ x + y, metric = "man") cs2Gneit <- Initialize(cs2Gneit, spatDat) corMatrix(cs2Gneit)
This function is a constructor for the 'corRLin'
class, representing a linear spatial correlation structure. Letting denote the range, the correlation between two observations a distance
apart is
. If
the correlation is zero.
corRLin(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRLin(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric “range” parameter value for the linear correlation structure, which must be greater than zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRLin'
, also inheriting from class 'corRSpatial'
, representing a linear spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected] and Jose Pinheiro [email protected], and Douglas Bates [email protected]
Cressie, N.A.C. (1993), “Statistics for Spatial Data”, J. Wiley & Sons.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRLin(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Lin <- corRLin(1, form = ~ x + y) cs1Lin <- Initialize(cs1Lin, spatDat) corMatrix(cs1Lin) cs2Lin <- corRLin(1, form = ~ x + y, metric = "man") cs2Lin <- Initialize(cs2Lin, spatDat) corMatrix(cs2Lin)
sp1 <- corRLin(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Lin <- corRLin(1, form = ~ x + y) cs1Lin <- Initialize(cs1Lin, spatDat) corMatrix(cs1Lin) cs2Lin <- corRLin(1, form = ~ x + y, metric = "man") cs2Lin <- Initialize(cs2Lin, spatDat) corMatrix(cs2Lin)
This function is a constructor for the 'corRMatern'
class, representing a Matern spatial correlation structure. Letting denote the range, and
the scale, the correlation between two observations a distance
apart is
.
corRMatern(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRMatern(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric vector of two parameter values for the Matern correlation structure, corresponding to the “range” and “scale”. The range parameter value must be greater than zero, and the scale in the interval (0, 2]. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRMatern'
, also inheriting from class 'corRSpatial'
, representing a Matern spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected]
Cressie, N.A.C. (1993), “Statistics for Spatial Data”, J. Wiley & Sons.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRMatern(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Matern <- corRMatern(c(1, 1), form = ~ x + y) cs1Matern <- Initialize(cs1Matern, spatDat) corMatrix(cs1Matern) cs2Matern <- corRMatern(c(1, 1), form = ~ x + y, metric = "man") cs2Matern <- Initialize(cs2Matern, spatDat) corMatrix(cs2Matern)
sp1 <- corRMatern(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Matern <- corRMatern(c(1, 1), form = ~ x + y) cs1Matern <- Initialize(cs1Matern, spatDat) corMatrix(cs1Matern) cs2Matern <- corRMatern(c(1, 1), form = ~ x + y, metric = "man") cs2Matern <- Initialize(cs2Matern, spatDat) corMatrix(cs2Matern)
This function is a constructor for the 'corRSpher'
class, representing a spherical spatial correlation structure. Letting denote the range, the correlation between two observations a distance
apart is
. If
the correlation is zero.
corRSpher(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRSpher(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric “range” parameter value for the spherical correlation structure, which must be greater than zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
An object of class 'corRSpher'
, also inheriting from class 'corRSpatial'
, representing a spherical spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Jose Pinheiro [email protected], Douglas Bates [email protected], and Brian Smith [email protected]
Cressie, N.A.C. (1993), “Statistics for Spatial Data”, J. Wiley & Sons.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRSpher(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Spher <- corRSpher(1, form = ~ x + y) cs1Spher <- Initialize(cs1Spher, spatDat) corMatrix(cs1Spher) cs2Spher <- corRSpher(1, form = ~ x + y, metric = "man") cs2Spher <- Initialize(cs2Spher, spatDat) corMatrix(cs2Spher)
sp1 <- corRSpher(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Spher <- corRSpher(1, form = ~ x + y) cs1Spher <- Initialize(cs1Spher, spatDat) corMatrix(cs1Spher) cs2Spher <- corRSpher(1, form = ~ x + y, metric = "man") cs2Spher <- Initialize(cs2Spher, spatDat) corMatrix(cs2Spher)
This function is a constructor for the 'corRWave'
class, representing a sine wave spatial correlation structure. Letting denote the range, the correlation between two observations a distance
apart is
.
corRWave(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
corRWave(value = numeric(0), form = ~ 1, metric = c("euclidean", "maximum", "manhattan", "haversine"), radius = 3956)
value |
optional numeric “range” parameter value for the sine wave correlation structure, which must be greater than zero. Defaults to |
form |
one-sided formula of the form |
metric |
optional character string specifying the distance metric to be used. The currently available options are |
radius |
radius to be used in the haversine formula for great-circle distance. Defaults to the Earth's radius of 3,956 miles. |
Object of class 'corRWave'
, also inheriting from class 'corRSpatial'
, representing a sine wave spatial correlation structure.
When "haversine"
is used as the distance metric, longitude and latitude coordinates must be given as the first and second covariates, respectively, in the formula specification for the form
argument.
Brian Smith [email protected]
Cressie, N.A.C. (1993), “Statistics for Spatial Data”, J. Wiley & Sons.
Venables, W.N. and Ripley, B.D. (1997) “Modern Applied Statistics with S-plus”, 2nd Edition, Springer-Verlag.
sp1 <- corRWave(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Wave <- corRWave(1, form = ~ x + y) cs1Wave <- Initialize(cs1Wave, spatDat) corMatrix(cs1Wave) cs2Wave <- corRWave(1, form = ~ x + y, metric = "man") cs2Wave <- Initialize(cs2Wave, spatDat) corMatrix(cs2Wave)
sp1 <- corRWave(form = ~ x + y + z) spatDat <- data.frame(x = (0:4)/4, y = (0:4)/4) cs1Wave <- corRWave(1, form = ~ x + y) cs1Wave <- Initialize(cs1Wave, spatDat) corMatrix(cs1Wave) cs2Wave <- corRWave(1, form = ~ x + y, metric = "man") cs2Wave <- Initialize(cs2Wave, spatDat) corMatrix(cs2Wave)
Calculates the Deviance Information Criterion (DIC) for comparisons of georamps
model fits.
## S3 method for class 'ramps' DIC(object, ...)
## S3 method for class 'ramps' DIC(object, ...)
object |
object returned by |
... |
some methods for this generic require additional arguments. None are used in this method. |
An numeric vector with the following two elements:
DIC |
value of the Deviance Information Criterion. |
pD |
effective number of model parameters. |
Brian Smith [email protected]
Spiegelhalter, D.J., Best, N.G., Carlin, B.P., and van der Linde, A. (2002) “Bayesian Measures of Model Complexity and Fit”, Journal of the Royal Statistical Society - Series B, 64, 583-639.
## DIC calculation for georamps example results ## Not run: DIC(NURE.fit) ## End(Not run)
## DIC calculation for georamps example results ## Not run: DIC(NURE.fit) ## End(Not run)
Generates additional posterior samples for georamps
model fits by restarting the MCMC sampler at the last set of sampled parameter values.
expand.chain(object, n)
expand.chain(object, n)
object |
object returned by |
n |
additional number of times to iterate the MCMC sampler. |
'ramps'
object containing the previously and newly sampled parameter values.
Brian Smith [email protected]
## Generate 25 additional samples for the georamps example ## Not run: fit <- expand.chain(NURE.fit, 25) ## End(Not run)
## Generate 25 additional samples for the georamps example ## Not run: fit <- expand.chain(NURE.fit, 25) ## End(Not run)
This function generate a grid of points over a US state with given increment size or resolution.
genUSStateGrid(state, incr = NULL, resolution = NULL)
genUSStateGrid(state, incr = NULL, resolution = NULL)
state |
the name of a US state. |
incr |
a numeric vector of length 2 specifying the increment in longitude and latitude. |
resolution |
a numeric vector of length 2 specifying the size of the grid in longitude and latitude. |
A data.frame:
lon |
longitude of the grid point. |
lat |
latitude of the grid point. |
id |
the id number of the county in which the grid point is located. |
county |
the name of the county in which the grid point is located. |
Jun Yan [email protected]
mygrid <- genUSStateGrid('iowa', resolution=c(8, 4)) map('state', 'iowa') points(mygrid)
mygrid <- genUSStateGrid('iowa', resolution=c(8, 4)) map('state', 'iowa') points(mygrid)
A completely spatial random set of point is generated for a US state.
genUSStateSites(state, nsites)
genUSStateSites(state, nsites)
state |
the name of a US state. |
nsites |
the number of sites needed. |
A matrix of longitude and latitude....
General function for fitting Bayesian geostatistical models using the reparameterized and marginalized posterior sampling (RAMPS) algorithm of Yan et al. (2007).
georamps(fixed, random, correlation, data, subset, weights, variance = list(fixed = ~ 1, random = ~ 1, spatial = ~ 1), aggregate = list(grid = NULL, blockid = ""), kmat = NULL, control = ramps.control(...), contrasts = NULL, ...)
georamps(fixed, random, correlation, data, subset, weights, variance = list(fixed = ~ 1, random = ~ 1, spatial = ~ 1), aggregate = list(grid = NULL, blockid = ""), kmat = NULL, control = ramps.control(...), contrasts = NULL, ...)
fixed |
two-sided linear |
random |
optional one-sided formula of the form |
correlation |
|
data |
optional data frame containing the variables named in |
subset |
optional expression indicating the subset of rows in |
weights |
optional numerical vector of measurement error variance (inverse) weights to be used in the fitting process. Defaults to a value of 1 for point-source measurements and the number of grid points for areal measurements (see the |
variance |
optional list of one-sided formulas, each of the form |
aggregate |
optional list of elements: |
kmat |
optional |
control |
list of parameters for controlling the fitting process. See the |
contrasts |
optional list. See the |
... |
further arguments passed to or from other methods. |
An object of class 'ramps'
containing the following elements:
params |
|
z |
|
loglik |
vector of data log-likelihood values at each MCMC iteration. |
evals |
vector of slice sampler evaluations at each MCMC iteration. |
call |
the matched function call to |
y |
response vector. |
xmat |
design matrix for the main effects. |
terms |
the |
xlevels |
list of the factor levels for |
etype |
grouping factor for the measurement error variances. |
weights |
weights used in the fitting process. |
kmat |
matrix for mapping the spatial parameters to the observed data. |
correlation |
specified |
coords |
matrix of unique coordinates for the measurement and grid sites. |
ztype |
grouping factor for the spatial variances. |
wmat |
matrix for mapping the random effects to the observed data. |
retype |
grouping factor for the random effects variances. |
control |
a list of control parameters used in the fitting process. |
Brian Smith [email protected], Jun Yan [email protected], and Kate Cowles [email protected]
Yan, J., Cowles, M.K., Wang, S., and Armstrong, M. (2007) “Parallelizing MCMC for Bayesian Spatiotemporal Geostatistical Models”, Statistics and Computing, 17(4), 323-335.
Smith, B. J., Yan, J., and Cowles, M. K. (2008) “Unified Geostatistical Modeling for Data Fusion and Spatial Heteroskedasticity with R Package ramps”, Journal of Statistical Software, 25(10), 1-21.
corRClasses
,
ramps.control
,
mcmc
,
DIC.ramps
,
plot.ramps
,
predict.ramps
,
summary.ramps
,
window.ramps
## Not run: ## Load the included uranium datasets for use in this example data(NURE) ## Geostatistical analysis of areal measurements NURE.ctrl1 <- ramps.control( iter = 25, beta = param(0, "flat"), sigma2.e = param(1, "invgamma", shape = 2.0, scale = 0.1, tuning = 0.75), phi = param(10, "uniform", min = 0, max = 35, tuning = 0.50), sigma2.z = param(1, "invgamma", shape = 2.0, scale = 0.1) ) NURE.fit1 <- georamps(log(ppm) ~ 1, correlation = corRExp(form = ~ lon + lat, metric = "haversine"), weights = area, data = NURE, subset = (measurement == 1), aggregate = list(grid = NURE.grid, blockid = "id"), control = NURE.ctrl1 ) print(NURE.fit1) summary(NURE.fit1) ## Analysis of point-source measurements NURE.ctrl2 <- ramps.control( iter = 25, beta = param(0, "flat"), sigma2.e = param(1, "invgamma", shape = 2.0, scale = 0.1, tuning = 0.75), phi = param(10, "uniform", min = 0, max = 35, tuning = 0.5), sigma2.z = param(1, "invgamma", shape = 2.0, scale = 0.1) ) NURE.fit2 <- georamps(log(ppm) ~ 1, correlation = corRExp(form = ~ lon + lat, metric = "haversine"), data = NURE, subset = (measurement == 2), control = NURE.ctrl2 ) print(NURE.fit2) summary(NURE.fit2) ## Joint analysis of areal and point-source measurements with ## prediction only at grid sites NURE.ctrl <- ramps.control( iter = 25, beta = param(rep(0, 2), "flat"), sigma2.e = param(rep(1, 2), "invgamma", shape = 2.0, scale = 0.1, tuning = 0.75), phi = param(10, "uniform", min = 0, max = 35, tuning = 0.5), sigma2.z = param(1, "invgamma", shape = 2.0, scale = 0.1), z.monitor = NURE.grid ) NURE.fit <- georamps(log(ppm) ~ factor(measurement) - 1, correlation = corRExp(form = ~ lon + lat, metric = "haversine"), variance = list(fixed = ~ measurement), weights = area * (measurement == 1) + (measurement == 2), data = NURE, aggregate = list(grid = NURE.grid, blockid = "id"), control = NURE.ctrl ) print(NURE.fit) summary(NURE.fit) ## Discard initial 5 MCMC samples as a burn-in sequence fit <- window(NURE.fit, iter = 6:25) print(fit) summary(fit) ## Deviance Information Criterion DIC(fit) ## Prediction at unmeasured sites ct <- map("state", "connecticut", plot = FALSE) lon <- seq(min(ct$x, na.rm = TRUE), max(ct$x, na.rm = TRUE), length = 20) lat <- seq(min(ct$y, na.rm = TRUE), max(ct$y, na.rm = TRUE), length = 15) grid <- expand.grid(lon, lat) newsites <- data.frame(lon = grid[,1], lat = grid[,2], measurement = 1) pred <- predict(fit, newsites) plot(pred, func = function(x) exp(mean(x)), database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Posterior Mean", legend.args = list(text = "ppm", side = 3, line = 1)) plot(pred, func = function(x) exp(sd(x)), database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Posterior Standard Deviation", legend.args = list(text = "ppm", side = 3, line = 1)) ## End(Not run)
## Not run: ## Load the included uranium datasets for use in this example data(NURE) ## Geostatistical analysis of areal measurements NURE.ctrl1 <- ramps.control( iter = 25, beta = param(0, "flat"), sigma2.e = param(1, "invgamma", shape = 2.0, scale = 0.1, tuning = 0.75), phi = param(10, "uniform", min = 0, max = 35, tuning = 0.50), sigma2.z = param(1, "invgamma", shape = 2.0, scale = 0.1) ) NURE.fit1 <- georamps(log(ppm) ~ 1, correlation = corRExp(form = ~ lon + lat, metric = "haversine"), weights = area, data = NURE, subset = (measurement == 1), aggregate = list(grid = NURE.grid, blockid = "id"), control = NURE.ctrl1 ) print(NURE.fit1) summary(NURE.fit1) ## Analysis of point-source measurements NURE.ctrl2 <- ramps.control( iter = 25, beta = param(0, "flat"), sigma2.e = param(1, "invgamma", shape = 2.0, scale = 0.1, tuning = 0.75), phi = param(10, "uniform", min = 0, max = 35, tuning = 0.5), sigma2.z = param(1, "invgamma", shape = 2.0, scale = 0.1) ) NURE.fit2 <- georamps(log(ppm) ~ 1, correlation = corRExp(form = ~ lon + lat, metric = "haversine"), data = NURE, subset = (measurement == 2), control = NURE.ctrl2 ) print(NURE.fit2) summary(NURE.fit2) ## Joint analysis of areal and point-source measurements with ## prediction only at grid sites NURE.ctrl <- ramps.control( iter = 25, beta = param(rep(0, 2), "flat"), sigma2.e = param(rep(1, 2), "invgamma", shape = 2.0, scale = 0.1, tuning = 0.75), phi = param(10, "uniform", min = 0, max = 35, tuning = 0.5), sigma2.z = param(1, "invgamma", shape = 2.0, scale = 0.1), z.monitor = NURE.grid ) NURE.fit <- georamps(log(ppm) ~ factor(measurement) - 1, correlation = corRExp(form = ~ lon + lat, metric = "haversine"), variance = list(fixed = ~ measurement), weights = area * (measurement == 1) + (measurement == 2), data = NURE, aggregate = list(grid = NURE.grid, blockid = "id"), control = NURE.ctrl ) print(NURE.fit) summary(NURE.fit) ## Discard initial 5 MCMC samples as a burn-in sequence fit <- window(NURE.fit, iter = 6:25) print(fit) summary(fit) ## Deviance Information Criterion DIC(fit) ## Prediction at unmeasured sites ct <- map("state", "connecticut", plot = FALSE) lon <- seq(min(ct$x, na.rm = TRUE), max(ct$x, na.rm = TRUE), length = 20) lat <- seq(min(ct$y, na.rm = TRUE), max(ct$y, na.rm = TRUE), length = 15) grid <- expand.grid(lon, lat) newsites <- data.frame(lon = grid[,1], lat = grid[,2], measurement = 1) pred <- predict(fit, newsites) plot(pred, func = function(x) exp(mean(x)), database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Posterior Mean", legend.args = list(text = "ppm", side = 3, line = 1)) plot(pred, func = function(x) exp(sd(x)), database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Posterior Standard Deviation", legend.args = list(text = "ppm", side = 3, line = 1)) ## End(Not run)
Connecticut, USA, areal and point-source uranium measurements from the United States Geological Survey (USGS) National Uranium Resource Evaluation (NURE) project.
data(NURE)
data(NURE)
The following variables are provided in the NURE
data frame:
ppm
uranium measurements in parts per million.
measurement
type of measurement: 1 = areal, 2 = point-source.
lon
longitude coordinates of point-source measurements.
lat
latitude coordinates of point-source measurements.
easting
Universal Transverse Mercator easting coordinates - projected distances from the central meridian.
northing
Universal Transverse Mercator northing coordinates - projected distances from the equator.
county
counties from which measurements were taken.
area
county land mass areas in square miles.
id
unique identifiers for measured counties or sites.
A grid of coordinates is provided by the NURE.grid
data frame to facilitate Monte Carlo integration in geostatistical modeling of areal measurements. The included columns are
lon
longitude coordinates of grid sites.
lat
latitude coordinates of grid sites.
id
county identifiers.
Areal measurements in NURE
can be matched to the grid coordinates in NURE.grid
via the shared "id"
variable.
Duval, J.S., Jones, W.J., Riggle, F.R., and Pitkin, J.A. (1989) “Equivalent uranium map of conterminous United States”, USGS Open-File Report 89-478.
Smith, S.M.(2006) “National Geochemical Database Reformatted Data from the National Uranium Resource Evaluation (NURE) Hydrogeochemical and Stream Sediment Reconnaissance (HSSR) Program”, USGS Open-File Report 97-492.
data(NURE) ## Map areal and point-source measurements ppm1 <- NURE$ppm[NURE$measurement == 1] level <- (max(ppm1) - ppm1) / diff(range(ppm1)) map("county", "connecticut", fill = TRUE, col = gray(level)) title("Connecticut Uranium Measurements") points(NURE$lon, NURE$lat) ## Map grid sites map("county", "connecticut") title("Regular Grid of Coordinates") points(NURE.grid$lon, NURE.grid$lat)
data(NURE) ## Map areal and point-source measurements ppm1 <- NURE$ppm[NURE$measurement == 1] level <- (max(ppm1) - ppm1) / diff(range(ppm1)) map("county", "connecticut", fill = TRUE, col = gray(level)) title("Connecticut Uranium Measurements") points(NURE$lon, NURE$lat) ## Map grid sites map("county", "connecticut") title("Regular Grid of Coordinates") points(NURE.grid$lon, NURE.grid$lat)
Function used in conjunction with ramps.control
to specify the initial values and prior distributions used in calls to georamps
.
param(init, prior = c("flat", "invgamma", "normal", "uniform", "user"), tuning, ...)
param(init, prior = c("flat", "invgamma", "normal", "uniform", "user"), tuning, ...)
init |
numerical vector of initial parameter values. |
prior |
character string specifying the prior distribution. This must be one of |
tuning |
numerical tuning values the slice-simplex routine in the MCMC sampler. |
... |
hyperparameters of the specified prior distribution. See details below. |
The supported prior distributions and associated hyperparameters are:
"flat"
Flat prior with no hyperparameters.
"invgamma"
Inverse-gamma with hyperparameters shape > 0
and scale > 0
such that .
"normal"
Normal with hyperparameters mean
and variance
such that . The
variance
hyperparameter must be positive definite and may be supplied either as a vector (independence) or a matrix.
"uniform"
Uniform with hyperparameters min
and max > min
such that .
"user"
Use-defined function supplied as hyperparameter f
which takes a single numeric vector of length and order equal to the associated model parameters and whose returns values are proportional to the prior distribution.
The number of model parameters to be initialized is determined by length(init)
. Missing values occurring in the supplied init
vector will be replaced with draws from the prior distribution, for all but the "flat"
specification.
A list of class 'param'
containing the following components:
init |
numerical vector of initial parameter values. |
prior |
character string specifying the prior distribution. |
tuning |
numerical vector of tuning values of |
... |
hyperparameters of the specified prior distribution. |
Brian Smith [email protected]
## Initial values for a flat prior param(rep(0, 2), "flat") ## Random generation of initial values for an inverse-gamma prior param(rep(NA, 2), "invgamma", shape = 2.0, scale = 0.1) ## Independent normal priors param(rep(0, 2), "normal", mean = c(0, 0), variance = c(100, 100)) ## Correlated normal priors npv <- rbind(c(100, 25), c(25, 100)) param(rep(0, 2), "normal", mean = c(0, 0), variance = npv) ## Uniform prior and MCMC tuning parameter specification param(10, "uniform", min = 0, max = 100, tuning = 0.5)
## Initial values for a flat prior param(rep(0, 2), "flat") ## Random generation of initial values for an inverse-gamma prior param(rep(NA, 2), "invgamma", shape = 2.0, scale = 0.1) ## Independent normal priors param(rep(0, 2), "normal", mean = c(0, 0), variance = c(100, 100)) ## Correlated normal priors npv <- rbind(c(100, 25), c(25, 100)) param(rep(0, 2), "normal", mean = c(0, 0), variance = npv) ## Uniform prior and MCMC tuning parameter specification param(10, "uniform", min = 0, max = 100, tuning = 0.5)
Creates surface maps of posterior spatial distributions from georamps
or predict.ramps
.
## S3 method for class 'ramps' plot(x, type = c("i", "c", "w"), col = tim.colors(64), func = mean, sites = FALSE, database = NULL, regions = ".", resolution = c(64, 64), bw = 1, ...) ## S3 method for class 'predict.ramps' plot(x, type = c("i", "c", "w"), col = tim.colors(64), func = mean, database = NULL, regions = ".", resolution = c(64, 64), bw = 1, ...)
## S3 method for class 'ramps' plot(x, type = c("i", "c", "w"), col = tim.colors(64), func = mean, sites = FALSE, database = NULL, regions = ".", resolution = c(64, 64), bw = 1, ...) ## S3 method for class 'predict.ramps' plot(x, type = c("i", "c", "w"), col = tim.colors(64), func = mean, database = NULL, regions = ".", resolution = c(64, 64), bw = 1, ...)
x |
object returned by |
type |
type of plot to produce: |
col |
vector of colors such as that generated by |
func |
function defining the posterior summary statistic to be plotted. |
sites |
logical value indicating whether to include the measurements sites in the plot. |
database |
character string naming a geographical database for the mapping of geographic boundaries. See |
regions |
character vector naming the polygons to draw. See |
resolution |
numerical vector of length 2 specifying the number of pixels (width x height) for the surface image. |
bw |
numerical value specifying the bandwidth used for smoothing the spatial surface as a percentage of the diagonal length of the plot region. Defaults to 1% of the diagonal length. |
... |
additional arguments passed to the underlying plotting function associated with the specified |
Brian Smith [email protected]
georamps
predict.ramps
contour
drape.plot
image
image.plot
map
## Surface maps of the georamps example results ## Not run: plot(NURE.fit, database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Spatial Process Posterior Mean") ## End(Not run)
## Surface maps of the georamps example results ## Not run: plot(NURE.fit, database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Spatial Process Posterior Mean") ## End(Not run)
Obtains prediction of main effects plus spatial variability from a georamps
model fit.
## S3 method for class 'ramps' predict(object, newdata, type = c("response", "spatial", "error", "random"), ...)
## S3 method for class 'ramps' predict(object, newdata, type = c("response", "spatial", "error", "random"), ...)
object |
object returned by |
newdata |
data frame containing covariate values for the main effect, unmeasured spatial coordinates, and (if applicable) spatial variance indices with which to predict. |
type |
character string specifying the type of spatial prediction to perform. The default value |
... |
some methods for this generic require additional arguments. None are used in this method. |
Prediction will be performed only at the coordinates in newdata
that differ from those used in the initial georamps
model fitting. In particular, overlapping coordinates will be excluded automatically in the prediction.
'predict.ramps'
object, inheriting from class 'matrix'
, of samples from the posterior predictive distribution. Labels for the samples at each new coordinate are supplied in the returned column names and MCMC iteration numbers in the row names. A matrix containing the new coordinates is supplied in the coords
attribute of the object.
Brian Smith [email protected]
georamps
plot.predict.ramps
,
window.predict.ramps
,
## Prediction for georamps example results ## Not run: ct <- map("state", "connecticut", plot = FALSE) lon <- seq(min(ct$x, na.rm = TRUE), max(ct$x, na.rm = TRUE), length = 20) lat <- seq(min(ct$y, na.rm = TRUE), max(ct$y, na.rm = TRUE), length = 15) grid <- expand.grid(lon, lat) newsites <- data.frame(lon = grid[,1], lat = grid[,2], measurement = 1) NURE.pred <- predict(NURE.fit, newsites) par(mfrow=c(2,1)) plot(NURE.pred, func = function(x) exp(mean(x)), database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Posterior Mean", legend.args = list(text = "ppm", side = 3, line = 1)) plot(NURE.pred, func = function(x) exp(sd(x)), database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Posterior Standard Deviation", legend.args = list(text = "ppm", side = 3, line = 1)) ## End(Not run)
## Prediction for georamps example results ## Not run: ct <- map("state", "connecticut", plot = FALSE) lon <- seq(min(ct$x, na.rm = TRUE), max(ct$x, na.rm = TRUE), length = 20) lat <- seq(min(ct$y, na.rm = TRUE), max(ct$y, na.rm = TRUE), length = 15) grid <- expand.grid(lon, lat) newsites <- data.frame(lon = grid[,1], lat = grid[,2], measurement = 1) NURE.pred <- predict(NURE.fit, newsites) par(mfrow=c(2,1)) plot(NURE.pred, func = function(x) exp(mean(x)), database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Posterior Mean", legend.args = list(text = "ppm", side = 3, line = 1)) plot(NURE.pred, func = function(x) exp(sd(x)), database = "state", regions = "connecticut", resolution = c(200, 150), bw = 5, main = "Posterior Standard Deviation", legend.args = list(text = "ppm", side = 3, line = 1)) ## End(Not run)
Auxiliary function that provides a user interface to control the georamps
model fitting algorithm.
ramps.control(iter = 1000, beta, sigma2.e, phi, sigma2.z, sigma2.re, z.monitor = TRUE, mpdfun = c("mpdbeta", "mpdbetaz"), file)
ramps.control(iter = 1000, beta, sigma2.e, phi, sigma2.z, sigma2.re, z.monitor = TRUE, mpdfun = c("mpdbeta", "mpdbetaz"), file)
iter |
numerical value indicating the number of consecutive MCMC samples to generate, or a vector indicating specific iterations to monitor. |
beta |
|
sigma2.e |
|
phi |
|
sigma2.z |
|
sigma2.re |
|
z.monitor |
logical value indicating whether to monitor the latent spatial parameters, or data frame containing a subset of the coordinates at which to monitor the parameters. |
mpdfun |
character string giving the type of marginalized posterior density used for slice sampling and calculation of the data likelihood. Default is marginalization with respect to the beta parameters |
file |
vector or list of character strings specifying external files to which to save monitored parameters. Elements of the object named “params” and “z” will be taken to be the output files for model parameters and latent parameters, respectively. If these element names are not supplied, then the first element is taken to be the “params” output file and the second the “z” output file. Defaults to no external outputting of monitored parameters. |
Tuning parameters may be set for the sigma2
and phi
arguments via the param
function. If a user-defined prior is specified, then tuning parameters must be supplied and are taken to be the initial widths of the slice sampling windows. Otherwise, tuning parameters are taken to be factors by which the initial widths are multiplied. Separate tuning parameters may be set for each of the arguments. However, only the minimum of all sigma2
tuning parameters is used in the sampling of those parameters.
A list containing the following components:
iter |
sorted numerical vector of unique MCMC iterations to be monitored. |
beta |
|
sigma2.e |
|
phi |
|
sigma2.z |
|
sigma2.re |
|
z |
list with element: |
mpdfun |
character string specifying the marginalized posterior distribution. |
file |
list with elements: |
expand |
non-negative integer value indicating the starting point of the MCMC sampler, initialized to zero. |
Brian Smith [email protected]
ctrl <- ramps.control( iter = seq(1, 100, by = 2), beta = param(rep(0, 2), "flat"), sigma2.e = param(rep(1, 2), "invgamma", shape = 2.0, scale = 0.1), phi = param(10, "uniform", min = 0, max = 100, tuning = 0.5), sigma2.z = param(1, "invgamma", shape = 2.0, scale = 0.1), file = c("params.txt", "z.txt") )
ctrl <- ramps.control( iter = seq(1, 100, by = 2), beta = param(rep(0, 2), "flat"), sigma2.e = param(rep(1, 2), "invgamma", shape = 2.0, scale = 0.1), phi = param(10, "uniform", min = 0, max = 100, tuning = 0.5), sigma2.z = param(1, "invgamma", shape = 2.0, scale = 0.1), file = c("params.txt", "z.txt") )
Simulated Iowa, USA, areal and point-source measurements analyzed in the Working Example of the ramps package paper published in Journal of Statistical Software.
data(simJSS)
data(simJSS)
The following variables are provided in the simIowa
data frame:
areal
type of measurement: 1 = areal, 0 = point-source.
y
simulated measurement.
id
unique identifiers for measurements.
siteId
unique identifiers for point-source measurement sites.
lon
longitude coordinates of point-source measurements.
lat
latitude coordinates of point-source measurements.
weights
number of sites per measurement.
A grid of coordinates is provided by the simGrid
data frame to facilitate Monte Carlo integration in geostatistical modeling of areal measurements. The included columns are
lon
longitude coordinates of grid sites.
lat
latitude coordinates of grid sites.
id
county identifiers.
county
county names.
Areal measurements in simIowa
can be matched to the grid coordinates in simGrid
via the shared "id"
variable.
Areal and point-source observations were generated from from a geostatistical model using the county structure in the state of Iowa, USA. There are 99 counties in the state. Areal observations were generated from each as county averages from a uniform grid of 391 sites - approximately 4 sites per county. An additional 600 point-source observations were generated from a set of 300 unique sites sampled from a uniform distribution in Iowa.
An exponential correlation structure with a range parameter of 10 was used for the underlying Gaussian spatial structure. Measurement errors were generated with variances of 0.25 for point-source data and 0.09 for areal data. Site-specific non-spatial random effects were generated with a variance 0.16. One fixed effects covariate with coefficient equal to 0.5 was included as an indicator for areal observations.
Smith, B. J., Yan, J., and Cowles, M. K. (2008) “Unified Geostatistical Modeling for Data Fusion and Spatial Heteroskedasticity with R Package ramps”, Journal of Statistical Software, 25(10), 1-21.
data(simJSS) ## Map areal and point-source measurements y <- simIowa$y[simIowa$areal == 1] level <- (max(y) - y) / diff(range(y)) map("county", "iowa", fill = TRUE, col = gray(level)) title("Simulated Iowa Measurements") points(simIowa$lon, simIowa$lat) ## Map grid sites map("county", "iowa") title("Regular Grid of Coordinates") points(simGrid$lon, simGrid$lat)
data(simJSS) ## Map areal and point-source measurements y <- simIowa$y[simIowa$areal == 1] level <- (max(y) - y) / diff(range(y)) map("county", "iowa", fill = TRUE, col = gray(level)) title("Simulated Iowa Measurements") points(simIowa$lon, simIowa$lat) ## Map grid sites map("county", "iowa") title("Regular Grid of Coordinates") points(simGrid$lon, simGrid$lat)
Posterior summaries of georamps
model parameters.
## S3 method for class 'ramps' summary(object, ...)
## S3 method for class 'ramps' summary(object, ...)
object |
object returned by |
... |
additional arguments to be passed to |
Two sets of summary statistics for each model parameter. Sample mean, standard deviation, naive standard error of the mean, and time-series-based standard error are included in the first set. Quantiles are included in the second.
Brian Smith [email protected]
## Posterior summaries for georamps example results ## Not run: summary(NURE.fit) ## End(Not run)
## Posterior summaries for georamps example results ## Not run: summary(NURE.fit) ## End(Not run)
Post-processing function to subset the MCMC iterations in georamps
or predict.ramps
results.
## S3 method for class 'ramps' window(x, iter, ...) ## S3 method for class 'predict.ramps' window(x, iter, ...)
## S3 method for class 'ramps' window(x, iter, ...) ## S3 method for class 'predict.ramps' window(x, iter, ...)
x |
object returned by |
iter |
numerical vector specifying the MCMC iterations to subset. |
... |
some methods for this generic require additional arguments. None are used in this method. |
Subsetted object of the same class as the one supplied.
Brian Smith [email protected]
## Exclude first five iterations of the georamps example results ## Not run: fit <- window(NURE.fit, iter = 6:25) print(fit) summary(fit) ## End(Not run)
## Exclude first five iterations of the georamps example results ## Not run: fit <- window(NURE.fit, iter = 6:25) print(fit) summary(fit) ## End(Not run)