Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

RFratiotest

Likelihood ratio test


Description

The function performs an approximate chi2 test or a Monte Carlo likelihood ratio test based on fitgauss. Currently, it only works for Gaussian random fields.

Usage

RFratiotest(nullmodel, alternative, x, y = NULL, z = NULL, T = NULL,
            grid=NULL, data, alpha, n = 5 / alpha, seed = 0, 
            lower = NULL, upper = NULL, methods,
            sub.methods, optim.control = NULL, users.guess = NULL,
            distances = NULL, dim, transform = NULL, ...)

Arguments

nullmodel, alternative

See Details.

The set of parameters to be estimated for nullmodel should be a subset of the parameters to be estimated for alternative if alternative is given.

alpha

value in [0,1] or missing. Significance level.

n

integer. The test is based on n-1 simulations.

seed

integer. If not NULL and not NA, the .Random.seed is set to seed. Otherwise, set.seed is set to the value of RFoptions{}$basic$seed if the latter is not NA.

x

vector of x coordinates, or object of class GridTopology or raster; for more options see RFsimulateAdvanced.

y,z

optional vectors of y (z) coordinates, which should not be given if x is a matrix.

T

optional vector of time coordinates, T must always be an equidistant vector. Instead of T=seq(from=From, by=By, len=Len), one may also write T=c(From, By, Len).

grid

logical; the function finds itself the correct value in nearly all cases, so that usually grid need not be given. See also RFsimulateAdvanced.

data

matrix, data.frame or object of class RFsp;
If a matrix is given the ordering of the colums is the following: space, time, multivariate, repetitions, i.e. the index for the space runs the fastest and that for repetitions the slowest.

lower

list or vector. Lower bounds for the parameters. If lower 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 lower has to be maintained. A component being NA means that no manual lower bound for the corresponding parameter is set.
If lower is a list, lower has to be of (exactly) the same structure of the model.

upper

list or vector. Upper bounds for the parameters. See lower.

methods

Main methods to be used for estimating. If several methods are given, estimation will be performed with each method and the results reported.

sub.methods

variants of the least squares fit of the variogram. variants of the maximum likelihood fit of the covariance function. See RFfit for details.

users.guess

User's guess of the parameters. All the parameters must be given using the same rules as for lower (except that no NA's should be contained).

distances,dim

another alternative for the argument x to pass the (relative) coordinates, see RFsimulateAdvanced.

optim.control

control list for optim, which uses ‘L-BFGS-B’. However parscale may not be given.

transform

obsolete for users; use param instead. transform=list() will return structural information to set up the correct function.

...

for advanced use: further options and control arguments for the simulation that are passed to and processed by RFoptions. If params is given, then ... may include also the variables used in params.

Details

nullmodel (and the alternative) can be

  • a covariance model, see RMmodel or type RFgetModelNames(type="variogram") to get all options.

    If RFoptions ratiotest_approx is TRUE the chisq approximation is performed. Otherwise a Monte Carlo ratio test is performed.

  • RFfit or RMmodelFit

    Here, a chisq approximative test is always performed on the already fitted models.

RFratiotest tries to detect whether nullmodel is a submodel of alternative. If it fails,

  • a message is printed that says that an automatic detection has not been possible;

  • it is not guaranteed anymore that the alternative model returns a (log) likelihood that is at least as large as that of the nullmodel, even if nullmodel is a submodel of alternative. This is due to numerical optimisation which is never perfect.

Otherwise it is guaranteed that the alternative model has a (log) likelihood that is at least as large as that of the nullmodel.

Value

The test returns a message whether the null hypothesis, i.e. the smaller model is accepted. Invisibly, a list that also contains

  • p, the p-value

  • n

  • data.ratio the log ratio for the data

  • simu.ratio the log ratio for the simulations

  • data.fit the models fitted to the data

  • msg the message that is also directly returned

It has S3 class "RFratiotest".

Methods

print

prints the summary

summary

gives a summary

Note

An important RFoptions is ratiotest_approx.

Note

Note that the likelihood ratio test may take a huge amount of time.

Note

This function does not depend on the value of RFoptions()$PracticalRange. The function RFratiotest always uses the standard specification of the covariance model as given in RMmodel.

Author(s)

See Also

Examples


RandomFields

Simulation and Analysis of Random Fields

v3.3.10
GPL (>= 3)
Authors
Martin Schlather [aut, cre], Alexander Malinowski [aut], Marco Oesting [aut], Daphne Boecker [aut], Kirstin Strokorb [aut], Sebastian Engelke [aut], Johannes Martini [aut], Felix Ballani [aut], Olga Moreva [aut], Jonas Auel[ctr], Peter Menck [ctr], Sebastian Gross [ctr], Ulrike Ober [ctb], Paulo Ribeiro [ctb], Brian D. Ripley [ctb], Richard Singleton [ctb], Ben Pfaff [ctb], R Core Team [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.