组内相关系数在脑功能磁共振(fMRI)的应用

组内相关系数(The Intraclass Correlation Coefficient)是测量实验可重复性的指标。例如某项实验有n个测量目标值,重复测量了k次。
举个例子有一个nk的矩阵。BMS表示测量目标(row)之间的组间均方差(mean square)。WMS表示测量目标的组内均方差。JMS表示重复测量(column)之间的组间均方差。EMS表示残差的均方差。
以下是常用的三种ICC的计算方式:
ICC计算公式
假设有一个6
4的矩阵,
在这里插入图片描述

根据公式计算可得,
在这里插入图片描述
因此,有:
在这里插入图片描述
下面贴出ICC的计算matlab脚本。

function [ICC] = ICC(X, model, rating)
% ---------------------------------------------------------------
% Intraclass Correlation Coefficient
%
% [ICC] = ICC(X, model, rating)
%         返回矩阵 X的ICC值
%
% The input X is an n x k matrix, where n is the number of tar-
% gets and k the number of judges. ICCs are divided into three 
% models for two types of ratings.
%
% Model Types:
% '1' = random effects model => a different group of k judges, 
%       who have been selected from a larger population of jud-
%       ges, rate each target
% '2' = mixed effects model => the same group of k judges, who 
%       have been selected from a larger population of judges, 
%       rate each target
% '3' = 固定效应模型 => the same group of k judges, who 
%       are the only judges of interest, rate each targets.
%
% Rating Types:
% '1' = individual rating
% 'k' = mean of several ratings
% ---------------------------------------------------------------
% Script: 
   [n,k] = size(X);
   table = ANOVA_for_ICC(X, 'off');

   BMS = table{6,4}; WMS = table{7,4};
   JMS = table{3,4}; EMS = table{8,4};
   
   if isequal(rating,'1')
        if isequal(model,'1')
             ICC = (BMS - WMS) / ...
                   (BMS + (k-1)*WMS);
        elseif isequal(model,'2')
             ICC = (BMS - EMS) / ...
                   (BMS + (k-1)*EMS + k*(JMS-EMS)/n);
        elseif isequal(model,'3')
             ICC = (BMS - EMS) / ...
                   (BMS + (k-1)*EMS);
        else
             error('Model type does not exist.');
        end     
   elseif isequal(rating,'k')
        if isequal(model,'1')
             ICC = (BMS - WMS) / ...
                    BMS;
        elseif isequal(model,'2')
             ICC = (BMS - EMS) / ...
                   (BMS + (JMS-EMS)/n);
        elseif isequal(model,'3')
             ICC = (BMS - EMS) / ...
                    BMS;
        else
             error('Model type does not exist.');
        end
   else
        error('Rating type does not exist.');
   end
% ---------------------------------------------------------------

调用的函数为:

function [table] = ANOVA_for_ICC(X, displayopt)
% ---------------------------------------------------------------
% Analysis of Variance for Ratings (for Intraclass Correlations)
%
% [table] = ANOVA_for_ICC(X, displayopt)
%           returns the ANOVA summary table as a cell array
%
% The input X is an n x k matrix, where n is the number of tar-
% gets and k is he number of judges. The option of displaying
% an ANOVA summary table is handled by displayopt, which can be
% set to 'on' (default) or 'off.'
% ---------------------------------------------------------------
% Script:
   [m,n] = size(X);
   total = m*n;

   A  = sum(sum(X.^2));
   Bc = sum(sum(X,1).^2)/m;
   Br = sum(sum(X,2).^2)/n;  
   D  = sum(sum(X))^2/total;

   SSbc = Bc-D;
   SSwc = A-Bc;   
   SSbr = Br-D;
   SSwr = A-Br;
   SSe  = A-Br-Bc+D;

   DFbc = n-1;
   DFwc = n*(m-1);
   DFbr = m-1;   
   DFwr = m*(n-1);
   DFe  = DFbc*DFbr;

   MSbc = SSbc/DFbc;
   MSwc = SSwc/DFwc;
   MSbr = SSbr/DFbr;
   MSwr = SSwr/DFwr;
   MSe  = SSe/DFe;

   Fbc = MSbc/MSe; Pbc = 1-fcdf(Fbc, DFbc, DFe);
   Fbr = MSbr/MSe; Pbr = 1-fcdf(Fbr, DFbr, DFe);
       
   table = { 'Source of Variance' 'SS' 'df' 'MS' 'F' 'Prob>F'
             'Columns'             []   []   []   []  []
             '     betweeen'       SSbc DFbc MSbc Fbc Pbc
             '     within'         SSwc DFwc MSwc []  []
             'Rows'                []   []   []   []  []
             '     between'        SSbr DFbr MSbr Fbr Pbr 
             '     within'         SSwr DFwr MSwr []  []
             'Residual'            SSe  DFe  MSe  []  [] };

   if isequal(nargin, 1) || isequal(displayopt, 'on')
        statdisptable(table, 'ANOVA for ICC', ...
                             'ANOVA Summary Table', '');
   end
% ---------------------------------------------------------------

运行结果,如图所示:
在这里插入图片描述
FMRI工具包afni中有命令3dICC3dlme以及3dlmer可计算ICC的值。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值