model parameter estimation from RMSE between modeled outputs and observations

8 vues (au cours des 30 derniers jours)
DK
DK le 22 Déc 2020
Commenté : Jeff Miller le 27 Déc 2020
Hello,
I am a hydrologist, and trying to estimate soil parameters by using RMSE between modeled outputs (streamflow) and observed ones.
For example, a watershed model is applied from 1980 to 2000 with an initial set of parameters. RMSE can be calcuated between modeled streamflow and observed ones.
With the RMSE values, is there any matlab function to search a new set of parameters to try to reduce RMSE?
The curve for RMSE over an iteration would be ideally converged in a global minimization point.
Thanks!

Réponses (2)

Jeff Miller
Jeff Miller le 23 Déc 2020
I assume the model is too complex for regression, etc. In that case, you might be able to do this with fminsearch, if there are not too many parameters. You write a function to compute RMSE for any given parameter vector, and fminsearch will try to find the parameter values that will minimize that function.
  3 commentaires
Jeff Miller
Jeff Miller le 24 Déc 2020
This forum seems to have a number of examples using fminsearch in various ways. Not sure if any of them minimize RMSE specifically, but the general principles are the same regardless of what error function you compute.
DK
DK le 26 Déc 2020
Dear Jeff,
Below is my code to conduct a sensitivity test with varying two parameters (dsnowi, grfactor) of the function (msnow). RMSE (YEH, and Tb) is calculated at the end of the loop, but it would be great, preceeding guesses of the parameters help to search the optimized ones with the minimized RMSE.
function rresult = calibgrain(DBn_2,dateob,Tb)
dss = linspace(0.01,3,100);
ggf = linspace(0.5,5,100);
rresult = [];
for ii = 1:length(dss)
for jj = 1:length(ggf)
dsnowi = dss(ii);grfactor = ggf(jj);
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH, YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
rmsecomp = calcrmse(YEH,dateob,Tb);
rresult = [rresult ;dsnowi grfactor rmsecomp];
jj
end
ii
%jj
end

Connectez-vous pour commenter.


Jeff Miller
Jeff Miller le 26 Déc 2020
Something like this. If it is too slow, note that you can use 'optimset' to pass fminsearch options that make it finish faster (at the loss of a little precision in your parameter estimates).
function rresult = calibgrain(DBn_2,dateob,Tb)
dss = linspace(0.01,3,100);
ggf = linspace(0.5,5,100);
rresult = [];
for ii = 1:length(dss)
for jj = 1:length(ggf)
dsnowi = dss(ii);grfactor = ggf(jj);
startparms = [dsnowi,grfactor];
bestparms = fminsearch(@RMSE1,startparms);
dsnowi = bestparms(1);
grfactor = bestparms(2);
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH, YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
rmsecomp = calcrmse(YEH,dateob,Tb);
rresult = [rresult ;dsnowi grfactor rmsecomp];
jj
end
ii
%jj
function thisrmse = RMSE1(parms)
% nest this function inside calibgrain so that it has
% access to all of calibgrain's variables.
dsnowi = parms(1);
grfactor = parms(2);
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH, YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
thisrmse = calcrmse(YEH,dateob,Tb);
end
end
  5 commentaires
DK
DK le 27 Déc 2020
Hi Jeff,
You are very helpful! By the way, I got the error message at 200th line of fminsearch
Not enough input arguments.
Error in calibgrain/RMSE1 (line 25)
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH,
YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Error in calibgrain (line 11)
bestparms = fminsearch(@RMSE1,startparms);
Any solution for this?
Thank you very much!
Jeff Miller
Jeff Miller le 27 Déc 2020
Sorry, I don't see what is causing that. Is it possible that your original call to calibgrain (outside of all this code) did not pass its required 3 parameters?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Oceanography and Hydrology dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by