Closed sbenthall closed 1 year ago
This PR now has an implementation of #178 and #60.
Agents use a Kolmogorov Smirnov test to compare the returns for the days on which they attended with the USUAL expected returns.
Given dividend growth factor $\Gamma$, lognormal dividend shock $\phi$, and price/dividend ration $\mathbf{r}$, let $\mathbf{a} = \Gamma + \Gamma / \mathbf{r}$ the mean and standard deviation of the USUAL returns are $a$ and $\mathbf{a} \sigma_\phi$, respectively.
The KS test returns a $p$-value for the rejection of the null hypothesis that the sample originated from the USUAL distribution. $\zeta$ is the threshold for the $p$-value, beneath which the agent will use STRANGE beliefs.
One small issue with the current implementation is that the STRANGE expectations are computed at the aggregate level, not the individual level, and use all the available data. So, all agents that take the STRANGE expectations on the same day will have the same expectations. However, there will still be variability in expecations because: (a) different agents will use a different Calvo sampling of returns for the KS test, and (b) expectations are formed on Calvo-selected days, and so rarely will agents attend on the same day. If additional variation in STRANGE beliefs is required, it would be easier to just add some (log)normal noise than to retool the finance model to be idiosyncratic.
I would like to add automated tests before merging.
Automated test of InferentialExpectations now included in this PR.
We were not calculating the UsualExpectations properly earlier because of issues like https://github.com/sbenthall/SHARKFin/issues/197#issuecomment-1513194346 and some other subtle issues.
I think it's all settled now; the market class now tracks the dividend shock standard deviation explicitly, and the expected ROR is calculated from this.
The test case shows that changes in $\zeta$, as well as changes in the attention days of the agent computing expectations, can shift the results over the STRANGE/USUAL threshold.
I think this is done, fixing #178 and #60. I'll merge by the end of the week. If somebody wanted to look it over before I do that, more eyeballs are always good.
Implementing individualized inferential expectations, issue #178
First commit : track the days on which an agent pays attention. Doing this as an additional parameter for now.
When this PR is ready I'll ask @alanlujan91 for review as it involves some modifications to the AgentPopulation class.