fitsvariog: Fit an exponential model to empirical variogram

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/fitsvariog.R

Description

The function fits an exponential model to empirical variogram and provides the estimates of the covariance parameters.

Usage

1
fitsvariog(vario, ini.cov.pars, plot = TRUE, ...)

Arguments

vario

an object of class svariog, typically an output of the function svariog.

ini.cov.pars

initial values for variogram model: sigma^2 (partial sill) and phi (range parameter). See variofit from package geoR.

plot

logical, if TRUE, the empirical variogram is plotted with the fitted model and the value of the conventional estimate of the genetic diversity (Hhat in wagner et al 2005).

...

additional parameters passed to variofit (package geoR). SEE DETAILS SECTION BELOW.

Details

The function calls the function variofit from package geoR (Diggle and Ribeiro, 2007). It fits an exponential model to the empirical variogram and returns the estimated parameters. In addition, the parameters FN, bf and Sp (Vekemans and Hardy, 2004) are estimated from the fitted variogram following Wagner et al. (2005). The optional arguments are :

cov.model

variogram model to be fitted. The only available model the the exponential model.

fix.nugget

logical, indicating whether the parameter tau^2 (nugget variance) should be considered as fixed (fix.nugget = TRUE) or should be estimated (fix.nugget = FALSE). See variofit from package geoR.

nugget

value for the nugget parameter. Defaults set to zero. See variofit from package geoR.

max.dist

maximum distance considered when fitting the variogram. Defaults set to svario$max.dist. See variofit from package geoR.

Value

param

a vector giving the fitted parameters

fit

an object of class variofit from the package geoR

Author(s)

Jean-Pierre Rossi Jean-Pierre Rossi <[email protected]>

References

Diggle, P. J. and P. J. Ribeiro 2007. Model-based Geostatistics, Springer.

Vekemans, X. and O. J. Hardy. 2004. New insights from fine-scale spatial genetic structure analyses in plant populations. Molecular Ecology 13: 921-935.

Wagner, H. H., R. Holderegger, S. Werth, F. Gugerli, S. E. Hoebee and C. Scheidegger. 2005. Variogram analysis of the spatial genetic structure of continuous populations using multilocus microsatellite data. Genetics 169, 1739-1752.

See Also

svariog

Examples

 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
## fit model to empirical variograms from simulated datsets
data(aniso)
va <- svariog(X=aniso, plot=FALSE)
fit <- fitsvariog(vario=va, ini.cov.pars=c(0.05,10), nugget=0.2, max.dist=30, plot = TRUE)
fit

data(sim03)
va <- svariog(X=sim03, plot=TRUE)
fit <- fitsvariog(vario=va, ini.cov.pars=c(0.05,4.5), nugget=0.5, max.dist=200)
fit

# graphical display
fit <- fitsvariog(vario=va, ini.cov.pars=c(0.05,4.5), nugget=0.5, max.dist=200, plot=FALSE)
plot(va$svario$u, va$svario$v)
lines(fit$fit)

## fit model to empirical variograms from field data and see how the maximum distance 
## to be used can change the results
data(crypho)
va <- svariog(X=crypho, plot=TRUE, messages=FALSE)
fit1 <- fitsvariog(vario=va, ini.cov.pars=c(0.03,100), nugget=0.1, max.dist=300, plot = TRUE)
fit2 <- fitsvariog(vario=va, ini.cov.pars=c(0.03,100), nugget=0.1, max.dist=600, plot = TRUE)

# plot results
plot(va$svario$u, va$svario$v)
lines(fit1$fit, col="blue")
lines(fit2$fit, col="red")

ggene documentation built on May 31, 2017, 4:17 a.m.