Compositional variogram model fitting

Description

Fits a parametric variogram model to an empirical logratio-Variogram

Usage

1
2
3
4
5
6
vgmFit2lrv(emp,vg,...,mode="log",psgn=rep(-1,length(param)),print.level=1)
vgmFit(emp,vg,...,mode="log",psgn=rep(-1,length(param)),print.level=1)
vgmGof(p = vgmGetParameters(vg), emp, vg, mode = "log")
vgmGetParameters(vg,envir=environment(vg))
vgmSetParameters(vg,p)
          

Arguments

emp

An empirical logratio-Variogram as e.g. returned by logratioVariogram

vg

A compositional clr-variogram (or ilt-vagriogram) model function.

...

further parameters to nlm

mode

either "ls" or "log" for selection of either using either least squares or least squares on logarithmic values.

psgn

Contains a parameter code for each of the parameters. -1 means the parameter should be used as is. 0 means the parameter is nonnegativ and 1 means the parameter is striktly positiv. This allows to provide parameter limits if the fitting procedure fails.

print.level

The print.level of nlm. 0 for no printing. 1 for a rough information about the sucess and 2 for step by step printing.

p

Is the parameter of the variogram model in linearized form as e.g. returned by vgmGetParameters.

envir

The environment the default parameters of the model should be evaluated in.

Details

The function is mainly a wrapper to nlm specifying the an objective function for modell fitting, taking the starting values of fitting procedure from the default arguments and writing the results back. Variogram model fitting is more an art than a straight forward procedure. Fitting procedures typically only find a right optimum if reasonable starting parameters are provided. The fit should be visually checked afterwards.
The meaning of psgn is subject to change. We will probably provide a more automatic procedure later.
vgmFit is a copy of vgmFit2lrv, but deprecated. The name will later be used for other functionality.

Value

vgmFit2lrv returns a list of two elements.

nlm

The result of nlm containing covergence codes.

vg

A version of vg but with default parameters modified according to the fitting.

vgmGof returns a scalar quantifiying the goodness of fit, of a model and an empirical variogram.
vgmGetParameters extracts the default values of a variogram model function to a parameter vector. It returns a numeric vector.
vgmSetParameters does the inverse operation and modifies the default according to the new values in p. It returns vg with modifiend default parameter values.

Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

See Also

vgram2lrvgram, CompLinModCoReg, logratioVariogram

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
data(juraset)
X <- with(juraset,cbind(X,Y))
comp <- acomp(juraset,c("Cd","Cu","Pb","Co","Cr"))
lrv <- logratioVariogram(comp,X,maxdist=1,nbins=10)
fff <- CompLinModCoReg(~nugget()+sph(0.5)+R1*exp(0.7),comp)
fit <- vgmFit(lrv,fff)
fit
fff(1:3)
plot(lrv,lrvg=vgram2lrvgram(fit$vg))

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.