fitCorFun: Automated fitting of a correlation function to the...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/spCopula.R

Description

Polynomials of different degrees can be fitted to the spatial/spatio-temporal correlogram calculated using calcBins. This function will be used to adjust the copula parameter in the spatial/spatio-temporal copula.

Usage

1
2
fitCorFun(bins, degree = 3, cutoff = NA, tlags, bounds = c(0, 1), 
          cor.method = NULL, weighted = FALSE)

Arguments

bins

Typically the output of calcBins. Any data.frame with a columns lagCor and meanDists in the first two columns will do.

degree

The degree of polynomial to be fitted - recycled if needed.

cutoff

Maximal distance to which lags should be included in the polynomial fit.

tlags

The temporal lags used for the genration of bins.

bounds

Bounds of the correlation values. The default is set [0,1] not allowing any negative relationship but perfect positive dependence.

cor.method

The output of calcBins has an attribute cor.method, in case this is not present the parameter cor.method will be used. In case the parameter cor.method is not NULL and the attribute cor.method is present, they will be compared.

weighted

shall the residuals be weighted by the number of points in the lag class?

Value

Returns a one/two-place function that provides correlation estimates for every separating spatial/spatio-temporal distance.

Author(s)

Benedikt Graeler

See Also

See also calcBins and spCopula.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# a simplified bins object (from demo(spcopula))
bins <- list(meanDists=c(64, 128, 203, 281, 361, 442, 522, 602, 681, 760), 
             lagCor=c(0.57,  0.49, 0.32, 0.29, 0.15, 0.14, 0.10, -0.00, 0.03, -0.01))
attr(bins,"cor.method") <- "kendall"

# plot the correlogram
plot(lagCor~meanDists,bins)

# fit and plot a linear model
calcKTauLin <- fitCorFun(bins, degree=1, cutoff=600)
curve(calcKTauLin,0, 1000, col="red",add=TRUE)

# fit and plot a polynomial model
calcKTauPol <- fitCorFun(bins, degree=5)
curve(calcKTauPol,0, 1000, col="purple",add=TRUE)

BenGraeler/spcopula documentation built on Nov. 20, 2020, 4:07 p.m.