morrowcj/remotePARTS

Default values of fitGLS_opt() allow for negative nugget.

Opened this issue · 1 comments

Problem

By default, no transformations or limits are placed on the parameters for fitGLS_opt(). This allows the nugget to be any value that returns a valid likelihood - including negative values. Negative values of the nugget are nonsensical, though.

Solution

The most straight forward solution would be to limit the nugget to be between 0 and 1 by default, since this makes the most sense from the semivariogram perspective. This is easily achieved through the trans and backtrans arguments and the logit function.

fitGLS_opt(formula, data, coords,
    trans = list(nugget = function(p){log(p/(1-p))}),
    backtrans = list(nugget = function(l){1/(1+exp(-l))}),
    ...
) 

Note that this solution is already presented in the examples for the function, but should be implemented by default to prevent nonsensical results.