泰勒图--MATLAB实现

0.泰勒图介绍

见参考文献[4]

1.准备步骤

(1)taylordiag.m。
在参考文献【2】下载泰勒图的函数脚本。

表1.函数需要的输入变量如下表

输入变量术语解释
STDs标准差(Standard deviations)
RMSs去中心的均方根误差(Centered Root Mean Square Difference 就是减去平均值再求RMS)
CORs皮尔逊相关系数(Correlation)

(2)allstats.m
在参考文献【1】下载计算输入变量的函数脚本。
为了计算表1.中的参数,可直接利用allstats.m函数计算。如表2,随意设计一组原始数据格式,记为a,第一行为参考序列,第二行为模式1,第二行模式2,依次类推。

表2 原始数据

模式值1值2值3值4值5值6值7
参考序列26475152284732
模式132374052464521
模式249585152384735
模式326475152284732
模式426475122284732
模式526475152384735

下列代码计算表1中的变量

for iserie = 2 : size(a,1)
 		    S = allstats(a(1,:),a(iserie,:));
 		    MYSTATS(iserie,:) = S(:,2); % We get stats versus reference
end       %for iserie
 MYSTATS(1,:) = S(:,1); % We assign reference stats to the first row

2.生成泰勒图

预处理后,直接带入taylordiag函数即可,生成图片如下所示。

taylordiag(MYSTATS(:,2),MYSTATS(:,3),MYSTATS(:,4));

在这里插入图片描述

3.后处理

(1)一般泰勒图都要标准化处理。标准差与均方根误差同时除以参考序列的标准差。

(2)根据数值范围,设置坐标轴参数。具体参数设置参考taylordiag.m的492-523行。

(3)不想看代码,可保存后导入Ai、PS后处理。完毕。

在这里插入图片描述

%%计算输入参数
for iserie = 2 : size(a,1)
 		    S = allstats(a(1,:),a(iserie,:));
 		    MYSTATS(iserie,:) = S(:,2); % We get stats versus reference
end       %for iserie
 MYSTATS(1,:) = S(:,1); % We assign reference stats to the first row
 
%  taylordiag(MYSTATS(:,2),MYSTATS(:,3),MYSTATS(:,4));
stdev=MYSTATS(1,2);

MYSTATS(:,2)=MYSTATS(:,2)/stdev;% 标准化处理
MYSTATS(:,3)=MYSTATS(:,3)/stdev;%标准化处理

 [hp ht axl] =taylordiag(MYSTATS(:,2),MYSTATS(:,3),MYSTATS(:,4), ...
                 'tickrms',[0:.2:1],'titleRMS', 0 ,'showlabelsRMS',1,... 
                 'widthRMS',1,'colRMS','r',...
                 'tickSTD',[0:.25:1.25],'limSTD',1.25,'styleSTD','-',... 
                 'tickCOR',[.1:.1:.9 .95 .99],'showlabelsCOR',1,'titleCOR',1);

注:
①对下面报错

错误使用 taylordiag (line 108)
taylordiag.m : Something's wrong with ALL the datas
You must have:
RMSs - sqrt(STDs.^2 + STDs(1)^2 - 2*STDs*STDs(1).*CORs) = 0 !

不要自己创建输入变量STDs、RMSs、CORs这些,一定要自己利用原始值算出。
②R语言创建泰勒图
? TaylorDiagram {openair}(强烈推荐)
? taylor.diagram {plotrix}
③PeterRochford/Skill​MetricsToolbox
PeterRochford/Skill​MetricsToolbox也可创建泰勒图,但此时注意到的是MATLAB对用的版本要在2016b及以上。否则会报错,"xticks"函数不存在。

4.参考文献

[1]allstats.m下载
[2]taylordiag.m下载
[3]参数设置
[4]Taylor, K. E. (2001). Summarizing multiple aspects of model performance in a single diagram. Journal of Geophysical Research: Atmospheres, 106(D7), 7183-7192.

5 allstats.m代码

% STATM Compute statistics from 2 series
%
% STATM = allstats(Cr,Cf)
%
% Compute statistics from 2 series considering Cr as the reference.
% 
% Inputs:
%	Cr and Cf are of same length and uni-dimensional. They may contain NaNs.
%
% Outputs:
% 	STATM(1,:) => Mean
% 	STATM(2,:) => Standard Deviation (scaled by N)
% 	STATM(3,:) => Centered Root Mean Square Difference (scaled by N)
% 	STATM(4,:) => Correlation
%
% Notes:
%	- N is the number of points where BOTH Cr and Cf are defined
%
% 	- NaN are handled in the following way: because this function
% 		aims to compair 2 series, statistics are computed with indices
%		where both Cr and Cf are defined.
%
% 	- STATM(:,1) are from Cr (ie with C=Cr hereafter)
% 	  STATM(:,2) are from Cf versus Cr (ie with C=Cf hereafter)
%
%	- The MEAN is computed using the Matlab mean function.
%
%	- The STANDARD DEVIATION is computed as:
%			          /  sum[ {C-mean(C)} .^2]  \
%			STD = sqrt|  ---------------------  |
%			          \          N              /
%
%	- The CENTERED ROOT MEAN SQUARE DIFFERENCE is computed as:
%			           /  sum[  { [C-mean(C)] - [Cr-mean(Cr)] }.^2  ]  \
%			RMSD = sqrt|  -------------------------------------------  |
%			           \                      N                        /
%
%	- The CORRELATION is computed as:
%			      sum( [C-mean(C)].*[Cr-mean(Cr)] ) 
%			COR = --------------------------------- 
%			              N*STD(C)*STD(Cr)
%
%	- STATM(3,1) = 0 and STATM(4,1) = 1 by definition !
%
% Created by Guillaume Maze on 2008-10-28.
% Rev. by Guillaume Maze on 2010-02-10: Add NaN values handling, some checking
%				in the inputs and a more complete help
% Copyright (c) 2008 Guillaume Maze. 
% http://codes.guillaumemaze.org




%
% This program 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 any later version.
% This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
%

function STATM = allstats(varargin)
	
Cr = varargin{1}; Cr = Cr(:);
Cf = varargin{2}; Cf = Cf(:);

%%% Check size:
if length(Cr) ~= length(Cf)
	error('Cr and Cf must be of same length');
end

%%% Check NaNs:
iok = find(isnan(Cr)==0 & isnan(Cf)==0);
if length(iok) ~= length(Cr)
	warning('Found NaNs in inputs, removed them to compute statistics');
end
Cr  = Cr(iok);
Cf  = Cf(iok);
N   = length(Cr);

%%% STD:
st(1) = sqrt(sum(  (Cr-mean(Cr) ).^2)  / N );
st(2) = sqrt(sum(  (Cf-mean(Cf) ).^2)  / N );
%st(1) = sqrt(sum(  (Cr-mean(Cr) ).^2)  / (N-1) );
%st(2) = sqrt(sum(  (Cf-mean(Cf) ).^2)  / (N-1) );

%%% MEAN:
me(1) = mean(Cr);
me(2) = mean(Cf);

%%% RMSD:
rms(1) = sqrt(sum(  ( ( Cr-mean(Cr) )-( Cr-mean(Cr) )).^2)  /N);
rms(2) = sqrt(sum(  ( ( Cf-mean(Cf) )-( Cr-mean(Cr) )).^2)  /N);

%%% CORRELATIONS:
co(1) = sum(  ( ( Cr-mean(Cr) ).*( Cr-mean(Cr) )))/N/st(1)/st(1);
co(2) = sum(  ( ( Cf-mean(Cf) ).*( Cr-mean(Cr) )))/N/st(2)/st(1);


%%% OUTPUT
STATM(1,:) = me;
STATM(2,:) = st;
STATM(3,:) = rms;
STATM(4,:) = co;
	
end %function	

6 拓展 MVIETool: 改进的多变量集合评估方法及多模式比较评估工具

Zhang Meng-Zhuo, Zhongfeng Xu*, Ying Han, and Weidong Guo, 2021: An improved multivariable integrated evaluation method and tool (MVIETool) v1.0 for multimodel intercomparison, Geosci. Model Dev., 14, 3079–3094, https://doi.org/10.5194/gmd-14-3079-2021

  • 15
    点赞
  • 69
    收藏
    觉得还不错? 一键收藏
  • 19
    评论
MATLAB可以用于绘制泰勒。你可以使用PeterRochford/SkillMetricsToolbox包来创建泰勒,但需要注意使用的MATLAB版本必须在2016b及以上,否则可能会报错。该包可以用于比较几个模型的模拟能力,常用的精度指标有相关系数、标准差和中心均方根误差。泰勒中的散点代表模型,辐射线代表相关系数,横纵轴代表标准差,虚线代表均方根误差。标准化泰勒是常用的一种形式,它对参考值与变量值的标准差和均方根误差进行标准化,消除了物理量单位。你可以下载PeterRochford/SkillMetricsToolbox包来绘制泰勒。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* [泰勒--MATLAB实现](https://blog.csdn.net/weixin_43948357/article/details/102845560)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [MATLAB绘制泰勒(10个以上model)](https://blog.csdn.net/doublesql/article/details/117409388)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [【MATLAB基础绘第6棒】绘制泰勒(Taylor diagram)](https://blog.csdn.net/qq_44246618/article/details/129209872)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值