-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOmicsMice.m
30 lines (27 loc) · 858 Bytes
/
OmicsMice.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% OmicsMice(O,[method],[seed])
%
% This function generates a single realization of the mice imputation
% algorithm.
%
% method arguement specifying the mice impuation algorithm.
% Default:
% pmm any Predictive mean matching
% see mice.m for further details
%
% seed is set by default to a fixed number in order ensure
% reproducility
%
% See also mice
function O = OmicsMice(O,method,seed)
if ~exist('method','var') || isempty(method)
method = 'pmm';
end
if ~exist('seed','var') || isempty(seed)
seed = 12345;
end
if min(sum(~isnan(O),2))==0
find(sum(~isnan(O),2)==0)
error('Some rows are only NaN. Remove them e.g. by OmicsRemoveEmptyFeatures.m');
end
dat = mice(get(O,'data'),method,seed);
O = set(O,'data',dat,sprintf('MICE imputation using %s.',method));