« first day    last day (20 days later) » 

9:26 AM
@DeltaIV , sorry about last time. I didn't know about the piniging
 
no problem
just a quick question, then I must go: "In this fit I have fixed the integration parameter by taking the maximum(A) and maximum of (V). It is possible to have this parameter not fixed to this point, and optimize it instead. However, for this clean data with little amount of noise, I guess that it is not so much worth the effort (small improvement but not so much effect). I will leave it as an exercise for others. "
What do you mean? My interpretation: 1) you numerically derived the data, and then fitted the 4 parameters model to (dA/dV, A). You got a set of four coefficients $a,b,c,d$
 
The optimization goes as following (1) I solve the ODE by using a fixed starting condition. (2) repeat changing the coefficient (3) stop when sufficient convergence occurs
 
2) without any fitting, you started integrating this model with theode function. To integrate you need to provide an initial condition, and the condition you provided is that f(max(V))=max(A)
 
I could also change the starting condition in step (2).
 
and then 3) you optimize the resulting model as a function of $a,b,c,d$ using optim
hmmm I understand , yes
You mean that in step 3), also the initial condition could become an additional fitting coefficient
right?
I think we're saying the same thing
 
9:41 AM
Yes, it is not that difficult to implement it (not fixing the starting condition). But it requires writing more code....
.... there are a few catches and the code becomes more verbose (that's why I did not implement it, start simple, make complicated later, but I stopped in between because I saw no point in it, of course if you make a production code you should think about implementing it)....
... one of the catches was that I used the approx(x,y, new_x) function. Which would behave badly if new_x (interpolation) is outside the range. (of course you can catch these exeptions, but it doesn't make the example easier)
 
hmmm you need approx because the model returned by integraal (i.e., by ode ) is evaluated at 19000 points which are not necessarily the points where you have the A data right? But you could eliminate this just by using times <- A
instead than times <- seq(0, 1900, by = 0.1)
right?
PS I'm curious about your attention to production code - I think I read in your profile a few days ago that you to work in academy, but you put a lot of thought about how to make a code deployable. That's commendable, but why? Do you also consult for a private company, or is software engineering just an interest of yours?
 
10:16 AM
IV, good comment but it needs some adjustment (we can not simply selected the times a and need to generate some frame with higher definition, also if we make it flexible it will affect the weights of different regions). We could indeed make the times more flexible instead of a hardcoded sequence from 0 to 1900. I didn't do that because it would make the example cluttered with technical details.
 
I understand
Thanks for all the time you already spent
Hey! I see you answered the question which brought me to ask this question. I was hoping to answer it myself. Well, nice answer anyway. It deserved to be chosen as the correct answer by Ben
Have a nice day
bye!
ps maybe the hybrid approach would be best - you insert in your big times <- seq(0, 1900, by = 0.1) also the vector of "times" A. This is pretty easy in R - for example, you c() the two vectors, and then you sort() the resulting vector. This removes the need for approx() in f. However, I do agree these are technical details - not suitable for CV, but good for chat or for Stack Overflow.
Bye again!
 
Bye, btw your PS comment is difficult to answer. But short: Deployable code is important for academics as well. Imagine your expensive experiment failing because of some bug. Or maybe it was some way to apologize for the code. I saw the flaws (like not using a better way to avoid approx(), which is on the other hand very elegant). My code was a very simplistic example to deal with a single case. I have learned now to not apologize for that (I often do that, trying to catch criticism beforehand).
 

« first day    last day (20 days later) »