Joy Christian wrote:minkwe wrote:As I expected, so for each iteration, the q function is returning the exact same thing when p > f. It is returning 51 numbers. So g= p*q will also be 51 numbers in those cases and also sign(q) will be 51 numbers some -1 other +1 and so will sign(p)*sign(q) etc. Do you see now that this cannot be correct?
Not really. But what is more confusing is: why does the code work at all if q is wrong? If I remove q by setting f = 0, then I get the linear correlations. So somehow the q-factor produces the right correlation. Don't you find that curious? If q is wrong (and I am sure you are right about that), then why does p x q work in place of original g, with linear background restored as expected when q is set to 1 (by setting f =0)?
***
That is why I keep asking for clarity on what the model is because that expresses what the intention is. It is the wrong question to ask why it works. The code is clearly not right (to me at least). There is definitely a reason why the code "works" but that reason has to do with side-effects of the R-language that might take you a long time to figure out. You don't want to waste your time on that.
The real question should be -- does the model say that the q function should produce 51 numbers for a single particle? If the answer is no, then the code is wrong.

