summaryrefslogtreecommitdiff
path: root/inst/param/estim/stk_param_relik.m
diff options
context:
space:
mode:
Diffstat (limited to 'inst/param/estim/stk_param_relik.m')
-rw-r--r--inst/param/estim/stk_param_relik.m28
1 files changed, 15 insertions, 13 deletions
diff --git a/inst/param/estim/stk_param_relik.m b/inst/param/estim/stk_param_relik.m
index a6646aa..ee9f323 100644
--- a/inst/param/estim/stk_param_relik.m
+++ b/inst/param/estim/stk_param_relik.m
@@ -26,7 +26,7 @@
% This file is part of
%
% STK: a Small (Matlab/Octave) Toolbox for Kriging
-% (http://sourceforge.net/projects/kriging)
+% (https://github.com/stk-kriging/stk/)
%
% 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
@@ -82,7 +82,7 @@ end
if ~ simple_kriging
% Construct a "filtering matrix" A = W'
- [Q, R_ignored] = qr (P); %#ok<NASGU> %the second argument *must* be here
+ [Q, R_ignored] = qr (P); %#ok<ASGLU> %the second argument *must* be here
W = Q(:, (q+1):n);
% Compute G = W' * K * W, the covariance matrix of filtered observations
@@ -198,8 +198,8 @@ end % function
%! NU = 4.0; % regularity parameter
%! RHO1 = 0.4; % scale (range) parameter
%!
-%! model = stk_model('stk_materncov_aniso');
-%! model.param = log([SIGMA2; NU; 1/RHO1 * ones(DIM, 1)]);
+%! model = stk_model (@stk_materncov_aniso);
+%! model.param = log ([SIGMA2; NU; 1/RHO1 * ones(DIM, 1)]);
%!error [C, dC1, dC2] = stk_param_relik ();
%!error [C, dC1, dC2] = stk_param_relik (model);
@@ -215,7 +215,7 @@ end % function
%!shared xi, zi, model, TOL_REL
%! xi = [-1 -.6 -.2 .2 .6 1]';
%! zi = [-0.11 1.30 0.23 -1.14 0.36 -0.37]';
-%! model = stk_model ('stk_materncov_iso');
+%! model = stk_model (@stk_materncov_iso);
%! model.param = log ([1.0 4.0 2.5]);
%! model.lognoisevariance = log (0.01);
%! TOL_REL = 0.01;
@@ -242,14 +242,16 @@ end % function
%! TOL_REL = 1e-2;
%! DELTA = 1e-6;
%!
-%! model = stk_model ('stk_materncov52_iso', DIM);
-%! xi = stk_sampling_halton_rr2 (NI, DIM, BOX);
-%! zi = stk_feval (f, xi);
-%!
+%! model = stk_model (@stk_materncov52_iso, DIM);
%! model.param = [1 1];
-%! [C1 dC] = stk_param_relik (model, xi, zi);
%!
-%! model.param = model.param + DELTA * [0 1];
-%! C2 = stk_param_relik (model, xi, zi);
+%! xi = stk_sampling_halton_rr2 (NI, DIM, BOX);
+%! zi = stk_feval (f, xi);
%!
-%! assert (stk_isequal_tolrel (dC(2), (C2 - C1) / DELTA, TOL_REL));
+%! for range = [0.3 2 10]
+%! model.param(2) = - log (range);
+%! for diff = 1:2
+%! assert (stk_test_critgrad ...
+%! (@stk_param_relik, model, xi, zi, diff, 1e-6));
+%! end
+%! end