IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
pre_flip_refmean.m
Go to the documentation of this file.
1 %> @brief Flips the means around a reference class
2 %>
3 %> This tool was derived from discussions with Valon. He wanted to have a quantitative measurement of effect for his dose-response papers.
4 %> However, sometimes the CONTROL class was in the middle of the scatter plots.
5 %>
6 %> It translates each class to the positive side, maintaining the same class structure, by making <code>X_class = X_class-class_mean+abs(class_mean)</code>
7 %>
8 %> @sa uip_pre_sub_refmean.m
9 classdef pre_flip_refmean < pre
10  properties
11  %> =1. Index of reference class (1-based = first class is class "1")
12  idx_refclass = 1;
13  end;
14 
15  methods
16  function o = pre_flip_refmean(o)
17  o.classtitle = 'Flip means around a reference class';
18  end;
19  end;
20 
21  methods(Access=protected)
22  function data = do_use(o, data)
23  me = mean(data.X(data.classes == (o.idx_refclass-1), :));
24 
25  data.X = data.X-repmat(me, data.no, 1);
26 
27  for i = 1:data.nc
28  idxs = data.classes == i-1; % Indexes of spectra from class i-1
29  Xtemp = data.X(idxs, :);
30 
31  no = size(Xtemp, 1);
32  me = mean(Xtemp);
33 
34  % Translates the whole class to the positive side, maintaining the same
35  data.X(idxs, :) = Xtemp-repmat(me, no, 1)+repmat(abs(me), no, 1);
36  end;
37  end;
38  end;
39 end
Flips the means around a reference class.
Pre-processing block base class.
Definition: pre.m:2