forked from mgschiavon/GZM_InducibleTF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FN_FitError.m
40 lines (37 loc) · 1.37 KB
/
FN_FitError.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
31
32
33
34
35
36
37
38
39
40
%% [GZM] Inducible Transcription Factors %%
% ------------------------------------------- %
% FUNCTION: Calculate fitting error %
% Created by Mariana Gómez-Schiavon
% August 2019
% FN_FitError : Calculate the sum of square errors between model's
% steady state (given a set of biophysical paramers and
% inducer concentration) and observed data.
%
% Ef = FN_FitError(X,H,p,D)
% X : Vector (array) of TF concentration
% H : Vector of inducer (hormone) concentration
% p : Structure with the kinetic parameters
% M : Transcriptional model to consider
% ('Mechanistic','HillxBasal','SimpleHill')
% D : Measured output (data) matrix [length(H) x length(X)]
%
% OUTPUT Ef : Sum of square errors
%
% See also FN_SS_SimpleHill.m
% See also FN_SS_HillxBasal.m
% See also FN_SS_Mechanistic.m
% See also FN_SS_Allosteric.m
function Ef = FN_FitError(X,H,p,M,D)
if(strcmp(M,'SimpleHill'))
Ye = FN_SS_SimpleHill(X,H,p);
elseif(strcmp(M,'HillxBasal'))
Ye = FN_SS_HillxBasal(X,H,p);
elseif(strcmp(M,'Mechanistic'))
Ye = FN_SS_Mechanistic(X,H,p);
elseif(strcmp(M,'Allosteric'))
Ye = FN_SS_Allosteric(X,H,p);
else
'ERROR: Transcriptional model not defined. Options: SimpleHill, HillxBasal, Mechanistic.'
end
Ef = sum(sum((log10(D)-log10(Ye)).^2)./(2*var(log10(D))));
end