# CompLikelihood: Optimizes the Composite log-likelihood In CompRandFld: Composite-Likelihood Based Analysis of Random Fields

## Description

Subroutine called by FitComposite. The procedure estimates the model parameters by maximisation of the composite log-likelihood.

## Usage

 ```1 2 3 4 5 6``` ```CompLikelihood(coordx, coordy, corrmodel, data, distance, flagcorr, flagnuis, fixed, grid, likelihood, lower, model, namescorr, namesnuis, namesparam, numparam, numparamcorr, optimizer, param, spacetime, threshold, type, upper, varest, vartype, winconst, winstp) ```

## Arguments

 `coordx` A numeric (d x 2)-matrix (where `d` is the number of points) assigning 2-dimensions of coordinates or a numeric vector assigning 1-dimension of coordinates. `coordy` A numeric vector assigning 1-dimension of coordinates; `coordy` is interpreted only if `coordx` is a numeric vector otherwise it will be ignored. `corrmodel` Numeric; the id of the correlation model. `data` A numeric vector or a (n x d)-matrix or (d x d x n)-matrix of observations. `distance` String; the name of the spatial distance. The default is `Eucl`, the euclidean distance. See the Section Details. `flagcorr` A numeric vector of binary values denoting which paramerters of the correlation function will be estimated. `flagnuis` A numeric vector of binary values denoting which nuisance paramerters will be estimated. `fixed` A numeric vector of parameters that will be considered as known values. `grid` Logical; if `FALSE` (the default) the data are interpreted as a vector or a (n x d)-matrix, instead if `TRUE` then (d x d x n)-matrix is considered. `likelihood` String; the configuration of the compositelikelihood, see `FitComposite`. `lower` A numeric vector with the lower bounds of the parameters' ranges. `model` Numeric; the id value of the density associated to the likelihood objects. `namescorr` String; the names of the correlation parameters. `namesnuis` String; the names of the nuisance parameters. `namesparam` String; the names of the parameters to be maximised. `numparam` Numeric; the number of parameters to be maximised. `numparamcorr` Numeric; the number of correlation parameters. `optimizer` String; the optimization algorithm (see `optim` for details). 'Nelder-Mead' is the default. `param` A numeric vector of parameters' values. `spacetime` Logical; if `TRUE` the random field is spatial-temporal otherwise is a spatial field. `threshold` Numeric; a value indicating a threshold for the binary random field, see `FitComposite`. `type` String; the type of the likelihood objects. If `Pairwise` (the default) then the marginal composite likelihood is formed by pairwise marginal likelihoods. `upper` A numeric vector with the upper bounds of the parameters' ranges. `varest` Logical; if `TRUE` the estimate' variances and standard errors are returned. `FALSE` is the default. `vartype` String; the type of estimation method for computing the estimate variances, see `FitComposite`. `winconst` Numeric; a positive value – if `vartype=SubSamp` – determines the window size in the sub-sampling estimates of the variances, see `FitComposite`. `winstp` Numeric; a positive value – if `vartype=SubSamp` – determines the window step in the sub-sampling estimates of the variances, see `FitComposite`.

## Author(s)

`FitComposite`