Closed gzheng-amplify closed 6 months ago
did you read this https://cran.r-project.org/web/packages/LKT/vignettes/Basic_Operations.html
Exponential decay of proportion (propdec and propdec2) - This expression uses the prior probability correct and was introduced as part of the R-PFA model. This function requires an additional nonlinear parameter to characterize the exponential rate of decay. For propdec, we set the number of ghost successes at 1 and ghost failures at 1 as a modification of Galyardt and Goldin. This modification produces an initial value that can either decrease or increase, unlike the Galyardt and Goldin version (propdec2), which can only increase due to the use of 3 ghost failures and no ghost successes. Our initial comparisons below show that the modified version works as well for tracking subject level variance during learning. Galyardt and Goldin illustrate an extensive number of examples of propdec2s behavior across patterns of successful and unsuccessful trials at various parameter values. The new propdec behaves analogously, except it starts at a value of .5 to represent the different ratio of ghost success to failure at the beginning of practice. As a point of fact, the number of ghost attempts of each type are additional parameters, and we have implemented two settings: 1 ghost success and 1 ghost failure (propdec), or 3 ghost failures (prodec2).
propdec2(1,.8) [1] 0.3387534 1/(1+.8+.8^2+.8^3) [1] 0.3387534
propdec2(0,.8) [1] 0 0/(1+.8+.8^2+.8^3) [1] 0
other cases should follow same pattern and be correct
However, my new function propdec appears to have a slight and consistent positive bias. This is my error and will be corrected.
e.g. > propdec(c(),.8) [1] 0.5555556 error... should be .5
I have debugged it, and it is caused by the unequal numbers of success (1) and failure (2) observations, where the failure observations are decaying more.
.8/(.8+.64) [1] 0.5555556
So the old version produced values like this
propdec(1,.8) [1] 0.7377049 (.8+1)/(1+.8+.64) [1] 0.7377049
1/(1+.8+.8^2+.8^3) [1] 0.3387534 propdec(0,.8) [1] 0.3278689
But the new version is a slightly more correct because it doesn't use unequal length vectors, the cause of the problem resulting in differential decay.
Will replace propdec in next version
propdec <- function(v, d) { w <- length(v) corv <- sum(c(1, v[1:w]) d^(w:0)) incorv <- sum(c(1, abs(v[1:w] - 1)) d^(w:0)) corv / (corv+incorv) }
New version examples
propdec(c(),.8) [1] 0.5 propdec(c(1),.8) [1] 0.6923077 propdec(c(0),.8) [1] 0.3076923
Please ask any follow-up questions as needed. Thanks for helping me see the bug in propdec, which is due to the decay being unbalanced for the 1 ghost success and 2 ghost failures.
If you have more complex examples of the Galyardt and Goldin propdec2 that appear wrong, please send me the vector and decay that is producing the wrong value
propdec2 <- function(v, d) { w <- length(v) sum((v[1:w] * d^((w - 1):0)) / sum(d^((w + 2):0))) }
This answered my questions. Thank you so much for the detailed explanations and the examples. They are very helpful.
Hi Phil, I have a minor question about the propdec function.
In propdec2(), in the denominator, the exponent of d ranges from (w + 2) to 0. In propdec(), however, it ranges from (w+1) to 0. Could you please explain why it starts at (w+1) ? The denominator is the sum of the weights of all the ghost responses plus actual previous responses. So it should be the same between propdec2() and propdec(). Not sure about what I missed here.
Btw, when I think of propdec, I think of the equation (8) in Galyardt's paper, chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://arxiv.org/pdf/1501.02732.pdf
Thank you!