Description Usage Arguments Details Value Author(s) References See Also Examples
This function estimates a parametric model fitted to an empirical variogram. The estimates are calculated using the weighted least squares method.
1 2 | Variog.fit(emp.variog, variog.model="exponential", max.dist.fit=NULL,
init.val=NULL, fix.nugget=FALSE)
|
emp.variog |
an object of the class emp.variog, output of the function |
variog.model |
character string giving the name of the parametric model to fit to the empirical variogram. Implemented models are exponential, spherical, gauss, gencauchy, and matern. |
max.dist.fit |
number giving the maximum distance considered when fitting the variogram. |
init.val |
numeric vector giving the initial values for the parameters. The number of initial values to be entered depends on the variogram model specified. If the variog.model specified is exponential, spherical or gauss, then the parameters required are, in order, the nugget effect, the variance and the range. If the variog.model specified is gencauchy, the parameters required are, in order, the nugget effect, the variance, the range, the smoothness parameter a, and the long-range parameter b. If the variog.model specified is matern the parameters required are, in order, the nugget effect, the variance, the range, and the smoothness parameter a. For more details on the valid range for the parameters and for the equation of the variogram models listed above, look below at the section "Details". |
fix.nugget |
logical field indicating whether the nugget should be considered fixed or not. If TRUE the nugget effect will be assumed to be constant, and a value for the fixed nugget effect can be also provided. If the value provided is different from the one entered in the init.val field, then the value of the nugget effect is taken to be the one entered in the init.val field. If FALSE the nugget effect will be estimated along with the other parameters in the variogram model. |
The function estimates the parameters in the variogram model by minimizing the weighted least-square loss function
LOSS(θ) = ∑_k n_k [ ≤ft( \frac{\hat{γ_k} - γ_k(θ)}{γ_k(θ)} \right)^2 ]
where n_k is the number of pairs contributing to the variogram computation in the kth bin, \hat{γ_k} is the value of the empirical variogram in the kth bin and γ_k(θ) is the value of the estimated parametric variogram model at the midpoint of the kth bin.
- Parametric variogram models -
The parametric model implemented for the variogram are: exponential (exponential), spherical(spherical), gaussian (gauss), generalized Cauchy (gencauchy) and Whittle-Matern (matern).
- exponential:
The equation of the exponential variogram with parameters the nugget effect, ρ, the variance, σ^{2}, and the range, r, is given by:
γ(d) = ρ+σ^{2} \cdot (1-exp(- \frac{d}{r}))
where d is the distance between the two locations and γ(d) is the value of the exponential variogram at distance d.
Notice that: the nugget effect, ρ, is a non-negative number, while the variance, σ^2, and the range, r, are positive numbers.
- spherical
The equation of the spherical variogram with parameters the nugget effect, ρ, the variance, σ^{2}, and the range, r, is given by:
γ(d) = ρ+σ^{2} \cdot (\frac{3}{2} \cdot\frac{d}{r}-\frac{1}{2} \cdot \frac{d^3}{r^3})
where d is the distance between the two locations and γ(d) is the value of the spherical variogram at distance d.
Notice that: the nugget effect, ρ, is a non-negative number, while the variance, σ^2, and the range, r, are positive numbers.
- gauss
The equation of the gaussian variogram with parameters the nugget effect, ρ, the variance, σ^{2}, and the range, r, is given by:
γ(d) = ρ+σ^{2} \cdot (1-exp(- \frac{d^2}{r^2} ))
where d is the distance between the two locations and γ(d) is the value of the gaussian variogram at distance d.
Notice that: the nugget effect, ρ, is a non-negative number, while the variance, σ^2, and the range, r, are positive numbers.
- gencauchy
The equation of the generalized Cauchy variogram with parameters the nugget effect, ρ, the variance, σ^{2}, the range, r, the smoothness parameter, a, and the long-range parameter, b, is given by:
γ(d) = ρ+σ^{2} \cdot (1-(1+\frac{d^a}{r^a})^{- \frac{b}{a}})
where d is the distance between the two locations and γ(d) is the value of the generalized Cauchy variogram at distance d.
Notice that: the nugget effect, ρ, is a non-negative number, the variance, σ^2, and the range, r, are positive numbers, the smoothness parameter, a, is a number in (0,2], and the long-range parameter, b, is a positive number.
- matern
The equation of the Whittle-Matern variogram with parameters the nugget effect, ρ, the variance, σ^{2}, the range, r, and the smoothness parameter, a, is given by:
γ(d) = ρ+σ^{2} \cdot (1-(\frac{2^{1-a}}{Γ(a)}\cdot \frac{d^a}{r^a} \cdot K_{a}(\frac{d}{r}))
where d is the distance between the two locations, γ(d) is the value of the Whittle-Matern variogram at distance d, Γ is the gamma function and K_a is the Bessel function of the third kind with parameter a.
Notice that: the nugget effect, ρ, is a non-negative number, the variance, σ^2, the range, r, and the smoothness parameter, a, are positive numbers.
- Defaults -
The default value for the maximum distance is \frac{1}{2 \cdot √{2}} times the maximum distance considered in the empirical variogram.
Default for the initial values of the parameters is NULL, in which case the initial values for the parameters are determined internally and depend on the empirical variogram values.
By default, the nugget effect is not considered constant. Thus, the
default value for the fix.nugget
field is FALSE.
The function returns a list with components given by:
model |
name of the parametric model fitted to the empirical variogram. |
nugget |
Estimate of the nugget effect. |
variance |
Estimate of the variance. |
range |
Estimate of the range. |
additional.par |
Numeric vector with the estimates of the additional parameters required by the parametric variogram model. This is returned only if the parametric model fitted are gencauchy or matern |
Berrocal, V. J. (veroberrocal@gmail.com), Raftery, A. E., Gneiting, T., Gel, Y.
Gel, Y., Raftery, A. E., Gneiting, T. (2004). Calibrated probabilistic mesoscale weather field forecasting: the Geostatistical Output Perturbation (GOP) method (with discussion). Journal of the American Statistical Association, Vol. 99 (467), 575–583.
Cressie, N. A. C. (1993) Statistics for Spatial Data (revised ed.). Wiley: New York.
Gneiting, T., Schlather, M. (2004). Stochastic models that separate fractal dimension and the Hurst effect. SIAM Review 46, 269–282.
Stein, M. L. (1999). Interpolation of Spatial Data - Some Theory for Kriging. Springer-Verlag: New York.
Emp.variog
for computation of the empirical
variogram of forecast errors, and avg.variog
for computation
of the empirical variogram of a random variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Loading data
library(fields)
library(RandomFields)
data(slp)
day <- slp$date.obs
id <- slp$id.stat
coord1 <- slp$lon.stat
coord2 <- slp$lat.stat
obs <- slp$obs
forecast <- slp$forecast
## Computing the empirical variogram
variogram <-
Emp.variog(day=day,obs=obs,forecast=forecast,id=id,coord1=coord1,coord2=coord2,
cut.points=NULL,max.dist=NULL,nbins=NULL)
## Estimating parameters
## Without specifying initial values for the parameters
param.variog <-
Variog.fit(emp.variog=variogram,variog.model="exponential",max.dist.fit=NULL,
init.val=NULL,fix.nugget=FALSE)
## Plotting the empirical variogram with the estimated parametric variogram superimposed
plot(variogram$bin.midpoints,variogram$empir.variog,xlab="Distance",ylab="Semi-variance")
lines(variogram$bin.midpoints,linesmodel(distance=variogram$bin.midpoints,
variog.model="exponential",param=c(param.variog$nugget,
param.variog$variance,param.variog$range)))
## Specifying the initial values for the parameters and keeping the nugget effect fixed
param.variog <-
Variog.fit(emp.variog=variogram,variog.model="exponential",max.dist.fit=NULL,
init.val=c(0,2,100),fix.nugget=TRUE)
## Plotting the empirical variogram with superimposed the estimated parametric variogram
plot(variogram$bin.midpoints,variogram$empir.variog,xlab="Distance",ylab="Semi-variance")
lines(variogram$bin.midpoints,linesmodel(distance=variogram$bin.midpoints,
variog.model="exponential",param=c(param.variog$nugget,
param.variog$variance,param.variog$range)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.