RFfit: Fitting model parameters to spatial data (regionalised...

Description Usage Arguments Details Value Note References See Also Examples

View source: R/RFfit.R

Description

The function estimates arbitrary parameters of a random field specification with various methods. Currently, the models to be fitted can be

The fitting of max-stable random fields and others has not been implemented yet.

Usage

1
2
3
4
RFfit(model, x, y = NULL, z = NULL, T = NULL, grid=NULL, data,
      lower = NULL, upper = NULL, methods,
      sub.methods, optim.control = NULL, users.guess = NULL,
      distances = NULL, dim, transform = NULL, params=NULL, ...)

Arguments

model,params \argModel

All parameters that are set to NA will be estimated; see the examples below.

Type RFgetModelNames(type="variogram") to get all options for model.

x \argX
y,z \argYz
T \argT
grid \argGrid
data \argData
lower \argLower
upper \argUpper
methods \argFitmethods
sub.methods \argFitsubmethods

. See Details.

users.guess \argUsersguess
distances,dim \argDistances
optim.control \argOptimcontrol
transform \argTransform
... \argDots

Details

For details on the simulation methods see

If x-coordinates are not given, the function will check data for NAs and will perform imputing.

The function has many more options to tune the optimizer, see RFoptions for details.

If the model defines a Gaussian random field, the options for methods and submethods are currently "ml" and c("self", "plain", "sqrt.nr", "sd.inv", "internal"), respectively.

Value

The result depends on the logical value of spConform. If TRUE, an S4 object is created. In case the model indicates a Gaussian random field, an RFfit object is created.

If spConform=FALSE, a list is returned. In case the model indicates a Gaussian random field, the details are given in fitgauss.

Note

References

See Also

RFfitOptimiser, RFlikelihood, RFratiotest, RMmodel, RandomFields, weather.

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
28
29
30
31
32
33
34
35
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again




RFoptions(modus_operandi="sloppy")


#########################################################
## simulate some data first                            ## 
points <- 100
x <- runif(points, 0, 3)
y <- runif(points, 0, 3) ## random points in square [0, 3]^2
model <- RMgencauchy(alpha=1, beta=2)
d <- RFsimulate(model, x=x, y=y, grid=FALSE, n=100) #1000


#########################################################
## estimation; 'NA' means: "to be estimated"           ##
estmodel <- RMgencauchy(var=NA, scale=NA, alpha=NA, beta=2) +
            RMtrend(mean=NA)
RFfit(estmodel, data=d)


#########################################################
## coupling alpha and beta                             ##
estmodel <- RMgencauchy(var=NA, scale=NA, alpha=NA, beta=NA) + 
            RMtrend(NA)
RFfit(estmodel, data=d, transform = NA) ## just for information
trafo <- function(a) c(a[1], rep(a[2], 2))
fit <- RFfit(estmodel, data=d,
             transform = list(c(TRUE, TRUE, FALSE), trafo))
print(fit)
print(fit, full=TRUE)

RandomFields documentation built on Feb. 6, 2020, 5:13 p.m.