summaryrefslogtreecommitdiff
path: root/inst/param/estim/stk_param_getdefaultbounds_lnv.m
blob: 8329aa4b3fae8beb2ddb7dbd001cb697cfdd130c (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
% STK_PARAM_GETDEFAULTBOUNDS_LNV [STK internal]

% Copyright Notice
%
%    Copyright (C) 2017, 2018 CentraleSupelec
%    Copyright (C) 2017 LNE
%    Copyright (C) 2012 SUPELEC
%
%    Authors:  Emmanuel Vazquez  <emmanuel.vazquez@centralesupelec.fr>
%              Remi Stroh        <remi.stroh@lne.fr>
%              Julien Bect       <julien.bect@centralesupelec.fr>

% Copying Permission Statement
%
%    This file is part of
%
%            STK: a Small (Matlab/Octave) Toolbox for Kriging
%               (http://sourceforge.net/projects/kriging)
%
%    STK is free software: you can redistribute it and/or modify it under
%    the terms of the GNU General Public License as published by the Free
%    Software Foundation,  either version 3  of the License, or  (at your
%    option) any later version.
%
%    STK is distributed  in the hope that it will  be useful, but WITHOUT
%    ANY WARRANTY;  without even the implied  warranty of MERCHANTABILITY
%    or FITNESS  FOR A  PARTICULAR PURPOSE.  See  the GNU  General Public
%    License for more details.
%
%    You should  have received a copy  of the GNU  General Public License
%    along with STK.  If not, see <http://www.gnu.org/licenses/>.

function [lb_lnv, ub_lnv] = stk_param_getdefaultbounds_lnv ...
    (model, lnv0, xi, zi) %#ok<INUSL>

if isnumeric (lnv0)
    
    if isscalar (lnv0)
        
        TOLVAR = 0.5;
        
        % Bounds for the variance parameter
        empirical_variance = var (zi);
        lb_lnv = log (eps);
        ub_lnv = log (empirical_variance) + TOLVAR;
        
        % Make sure that lnv0 falls within the bounds
        if ~ isempty (lnv0)
            lb_lnv = min (lb_lnv, lnv0 - TOLVAR);
            ub_lnv = max (ub_lnv, lnv0 + TOLVAR);
        end
        
    else
        
        lb_lnv = [];
        ub_lnv = [];
        
    end
    
else  % parameter object
    
    [lb_lnv, ub_lnv] = stk_param_getdefaultbounds (lnv0, xi, zi);
    
end

end % function