RFfit(model, x, y = NULL, z = NULL, T = NULL, grid, data,
lower = NULL, upper = NULL, bc_lambda, methods,
sub.methods, optim.control = NULL, users.guess = NULL,
distances = NULL, dim, transform = NULL, ...)
RFgetModelNames()
to get all options.
All parameters that are set to NA
will be estimatedGridTopology
or
raster
;
For more options see coord
;
If a matrix is given then the columns are interpreted as independent
realisations.
If also a time component is given, then in the data the indices for
the spatial components run the fastest.
param
is a vector, lower
has to be a vector as well and
its length must equal the number of parameters to be estimated. The order
of param
has to be maintained. param
(except that no NA's should
be contained) or model
.x
-coordinates, distances might
be given. The the dimension of the space dim
must be given explicitely.parscale
may not be given. transform=list()
is not valid for estimating, but returns
structural information to set up
If x
-coordinates are not given, the function will check
data
for NA
s and will perform imputing.
The function has many more options to tune the optimizer,
see
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.
RandomFields
,
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")
n <- if (interactive()) 100 else 5
#########################################################
## simulate some data first ##
points <- if (interactive()) 100 else 40
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=n) #1000
#########################################################
## estimation; 'NA' means: "to be estimated" ##
estmodel <- RMgencauchy(var=NA, scale=NA, alpha=NA, beta=2) +
RMtrend(mean=NA)
RFfit(estmodel, data=d)
#########################################################
## Estimation with fixed sill (variance + nugget ##
## equals a given constant) ##
estmodel <- RMgencauchy(var=NA, scale=NA, alpha=NA, beta=NA) +
RMnugget(var=NA) + RMtrend(mean=NA)
RFfit(estmodel, data=d, fit.sill=1, fit.optim_var_elimination="try")
#########################################################
## estimation in a anisotropic framework ##
x <- y <- (1:3)/4
model <- RMexp(Aniso=matrix(nc=2, c(4,2,-2,1)), var=1.5)
d <- RFsimulate(model, x=x, y=y, n=n)
estmodel <- RMexp(Aniso=matrix(nc=2, c(NA,NA,-2,1)), var=NA) +
RMtrend(mean=NA)
RFfit(estmodel, data=d, fit.nphi=20)
#########################################################
## AN EXAMPLE HOW TO USE OF PARAMETER 'transform' ##
## estimation of coupled parameters (first column of ##
## the matrix 'Aniso' has identical entries) ##
# source("RandomFields/tests/source.R")
RFfit(estmodel, data=d, transform=list()) # shows positions of NAs
f <- function(param) param[c(1,2,2)]
RFfit(estmodel, data=d, transform=list(c(TRUE, TRUE, FALSE), f))
RFoptions(modus_operandi="normal")
FinalizeExample()
Run the code above in your browser using DataLab