Closed lhdp0110 closed 2 years ago
It's working as intended :)
The problem is in this line:
A_fit, G_fit, P_fit, bP_fit, bI_fit, RB_fit, RP_fit, RN_fit, bRN_fit, NG1_fit, NG2_fit, = model(t=taxis, **fit_result.params)
The order in which you list the fit components is wrong.
result = model(t=taxis, **fit_result.params)
for compo in result.variables:
print(f'{compo} = {result._asdict()[compo][0]}')
gives
A = 1.0
G = 1.0
NG1 = 1.0
NG2 = 1.0
P = 1.0
RB = 1.0
RN = 0.0
RP = 0.0
bI = 0.0
bP = 0.0
bRN = 0.0
as expected.
The components in a model's output are always sorted alphabetically. See also the last bit of https://symfit.readthedocs.io/en/stable/tutorial.html#named-models
I did not realize that, thank you!
No problem :) Happy fitting!
The graph produced by the program below shows the behavior of all the equations of my model once one of the equations is fitted to data points. However, the initial values on the graph do not match the initial values provided for some of the equations. For example, bP[0] appears to be 1 when it should be 0, same with bI[0], and NG1[0] appears to be 0 when it should be 1.