HARK
HARK copied to clipboard
Why doesn't checkConditions() work in ConsPortfolioModel?
My understanding is that ConsPortfolioModel should just build on top of everything in ConsIndShockConsumerType, which would include the .checkConditions() method. While the method seems to be there, e.g. in the pcct instance of PortfolioConsumerType in ConsPortfolioModelDoc, it doesn't do anything. (I was looking at this because the conditions actually should be adjusted when the rate of return is risky).
@pkofod @mnwhite probably know the answer ...
There are two AgentTypes defined in ConsPortfolioModel
- PortfolioConsumerType
- LogNormalPortfolioConsumerType
(1) subclasses IndShockConsumerType, but its initializer does not use super() to get the superclass; instead it calls the initializer of PerfForesightConsumerType. I expect that this is an error.
https://github.com/econ-ark/HARK/blob/d1a8eb90ebe34a93801ead8655b5e29ef9d1e3eb/HARK/ConsumptionSaving/ConsPortfolioModel.py#L409
(2) Subclasses PerfForesightConsumerType and then uses the PerfForesightConsumerType initializer.
https://github.com/econ-ark/HARK/blob/d1a8eb90ebe34a93801ead8655b5e29ef9d1e3eb/HARK/ConsumptionSaving/ConsPortfolioModel.py#L1422
If you can confirm the desired behavior here (subclassing ConsIndShockConsumerType properly at (1).... any change to (2)?) I'll work these changes in to #568
I'm finishing up a wholesale re-write of ConsPortfolioModel right now. From copy-pasting bits of code, I had preserved this weird code blip until just now, but it's not necessary. I've fixed it in my version.
On Fri, Mar 13, 2020 at 5:00 PM Sebastian Benthall [email protected] wrote:
There are two AgentTypes defined in ConsPortfolioModel
- PortfolioConsumerType
- LogNormalPortfolioConsumerType
(1) subclasses IndShockConsumerType, but its initializer does not use super() to get the superclass; instead it calls the initializer of PerfForesightConsumerType. I expect that this is an error.
https://github.com/econ-ark/HARK/blob/d1a8eb90ebe34a93801ead8655b5e29ef9d1e3eb/HARK/ConsumptionSaving/ConsPortfolioModel.py#L409
(2) Subclasses PerfForesightConsumerType and then uses the PerfForesightConsumerType initializer.
https://github.com/econ-ark/HARK/blob/d1a8eb90ebe34a93801ead8655b5e29ef9d1e3eb/HARK/ConsumptionSaving/ConsPortfolioModel.py#L1422
If you can confirm the desired behavior here (subclassing ConsIndShockConsumerType properly at (1).... any change to (2)?) I'll work these changes in to #568 https://github.com/econ-ark/HARK/pull/568
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#issuecomment-598909259, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKRAFKMSCU2NJZ3LRXWSJ3RHKNGTANCNFSM4JF3SSWA .
Ok. I'll reassign this issue to you, since it sounds like it will best be checked/solved in your rewrite. I'm not 100% sure that fixing the superclass initializer issue will fix checkConditions(), so you might want to double check that. (Ideally, with an automated test for it)
Ack, I have no idea about checkConditions, I was just responding to your inheritance comment. I have no idea how checkConditions should work for ConsPortfolioType.
On Fri, Mar 13, 2020 at 5:09 PM Sebastian Benthall [email protected] wrote:
Assigned #416 https://github.com/econ-ark/HARK/issues/416 to @mnwhite https://github.com/mnwhite.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#event-3128211946, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKRAFMD34DEQ75NCWIAIVLRHKOHJANCNFSM4JF3SSWA .
I don’t think anybody has done the theory to determine what the proper conditions are for the version with portfolio choice.
I’m pretty sure it would not be hard, but until it has been done I think we have two options:
- nullify the checkConditions code inherited from ConsIndShockType
- Keep that code, but print a preliminary message from within the Portfolio type warning that the conditions being checked are for the version of the model where the rate of return is the riskless rate.
I’d prefer option 2, because:
- It is likely to be useful to users to know what the properties are of the model without the risky portfolio share;
- It is probably easier than figuring out how to nullify the checkConditions code
On Fri, Mar 13, 2020 at 5:20 PM Matthew N. White [email protected] wrote:
Ack, I have no idea about checkConditions, I was just responding to your inheritance comment. I have no idea how checkConditions should work for ConsPortfolioType.
On Fri, Mar 13, 2020 at 5:09 PM Sebastian Benthall < [email protected]> wrote:
Assigned #416 https://github.com/econ-ark/HARK/issues/416 to @mnwhite https://github.com/mnwhite.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#event-3128211946, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ADKRAFMD34DEQ75NCWIAIVLRHKOHJANCNFSM4JF3SSWA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#issuecomment-598916286, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKCK7ZITBD4BGRRUWSMJZTRHKPSLANCNFSM4JF3SSWA .
--
- Chris Carroll
I'ts trivial to "nullify" checkConditions. We do this for other classes.
On Fri, Mar 13, 2020 at 6:14 PM Christopher Llorracc Carroll < [email protected]> wrote:
I don’t think anybody has done the theory to determine what the proper conditions are for the version with portfolio choice.
I’m pretty sure it would not be hard, but until it has been done I think we have two options:
- nullify the checkConditions code inherited from ConsIndShockType
- Keep that code, but print a preliminary message from within the Portfolio type warning that the conditions being checked are for the version of the model where the rate of return is the riskless rate.
I’d prefer option 2, because:
- It is likely to be useful to users to know what the properties are of the model without the risky portfolio share;
- It is probably easier than figuring out how to nullify the checkConditions code
On Fri, Mar 13, 2020 at 5:20 PM Matthew N. White <[email protected]
wrote:
Ack, I have no idea about checkConditions, I was just responding to your inheritance comment. I have no idea how checkConditions should work for ConsPortfolioType.
On Fri, Mar 13, 2020 at 5:09 PM Sebastian Benthall < [email protected]> wrote:
Assigned #416 https://github.com/econ-ark/HARK/issues/416 to @mnwhite https://github.com/mnwhite.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#event-3128211946, or unsubscribe <
https://github.com/notifications/unsubscribe-auth/ADKRAFMD34DEQ75NCWIAIVLRHKOHJANCNFSM4JF3SSWA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#issuecomment-598916286, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAKCK7ZITBD4BGRRUWSMJZTRHKPSLANCNFSM4JF3SSWA
.
--
- Chris Carroll
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#issuecomment-598951156, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKRAFIR4CU3YVHHJBXKUTLRHKV5RANCNFSM4JF3SSWA .
OK. I still prefer option 2, though -- partly as a reminder that somebody should do the theory!
On Fri, Mar 13, 2020 at 6:16 PM Matthew N. White [email protected] wrote:
I'ts trivial to "nullify" checkConditions. We do this for other classes.
On Fri, Mar 13, 2020 at 6:14 PM Christopher Llorracc Carroll < [email protected]> wrote:
I don’t think anybody has done the theory to determine what the proper conditions are for the version with portfolio choice.
I’m pretty sure it would not be hard, but until it has been done I think we have two options:
- nullify the checkConditions code inherited from ConsIndShockType
- Keep that code, but print a preliminary message from within the Portfolio type warning that the conditions being checked are for the version of the model where the rate of return is the riskless rate.
I’d prefer option 2, because:
- It is likely to be useful to users to know what the properties are of the model without the risky portfolio share;
- It is probably easier than figuring out how to nullify the checkConditions code
On Fri, Mar 13, 2020 at 5:20 PM Matthew N. White < [email protected]
wrote:
Ack, I have no idea about checkConditions, I was just responding to your inheritance comment. I have no idea how checkConditions should work for ConsPortfolioType.
On Fri, Mar 13, 2020 at 5:09 PM Sebastian Benthall < [email protected]> wrote:
Assigned #416 https://github.com/econ-ark/HARK/issues/416 to @mnwhite https://github.com/mnwhite.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#event-3128211946, or unsubscribe <
https://github.com/notifications/unsubscribe-auth/ADKRAFMD34DEQ75NCWIAIVLRHKOHJANCNFSM4JF3SSWA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#issuecomment-598916286, or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AAKCK7ZITBD4BGRRUWSMJZTRHKPSLANCNFSM4JF3SSWA
.
--
- Chris Carroll
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#issuecomment-598951156, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ADKRAFIR4CU3YVHHJBXKUTLRHKV5RANCNFSM4JF3SSWA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/econ-ark/HARK/issues/416#issuecomment-598952562, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKCK72QYJLKHH5GJZBQERDRHKWDBANCNFSM4JF3SSWA .
--
- Chris Carroll
@Mv77
The lecture notes may have the necessary math. http://www.econ2.jhu.edu/people/ccarroll/public/lecturenotes/AssetPricing/C-With-Optimal-Portfolio/
The check_conditions() method has been significantly revised and improved since this issue was last touched. Unfortunately, it's not properly nulled out in child models (like ConsPortfolioModel). This still needs to be fixed, in one of two ways:
-
Add trivial methods to various models that overwrite check_conditions and do nothing.
-
Finish the "de-inheritance" overhaul I was working on a couple months ago