# Portfolio choice with housing (model 35): down payment, mortgage repayment, home equity, and housing value dynamics

**URL:** <https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327>\
**Category:** Uncategorized\
**Created:** [November 4, 2024, 5:09pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327 "2024-11-04T17:09:02Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![robertdkirkby](https://discourse.vfitoolkit.com/user_avatar/discourse.vfitoolkit.com/robertdkirkby/32/287_2.png) [@robertdkirkby](https://discourse.vfitoolkit.com/u/robertdkirkby)\
**Post date:** [March 12, 2025, 11:35pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/21 "2025-03-12T23:35:12Z")

</div>

EZ prefs are coded. Codes in same place as linked above. Cleaned the ReturnFn. I’ll hopefully create pdf explaining model tomorrow.

---

<div class="post-metadata">

**Author:** ![robertdkirkby](https://discourse.vfitoolkit.com/user_avatar/discourse.vfitoolkit.com/robertdkirkby/32/287_2.png) [@robertdkirkby](https://discourse.vfitoolkit.com/u/robertdkirkby)\
**Post date:** [March 13, 2025, 12:58pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/22 "2025-03-13T12:58:46Z")

</div>

pdf explaining the model with Epstein-Zin preferences is now in the repo:  
[https://github.com/robertdkirkby/riskyassetsemiz](https://github.com/robertdkirkby/riskyassetsemiz)

pdf might be missing some detail, let me know if something needs elaboration

---

<div class="post-metadata">

**Author:** ![javier\_fernan](https://discourse.vfitoolkit.com/letter_avatar_proxy/v4/letter/j/77aa72/32.png) [@javier\_fernan](https://discourse.vfitoolkit.com/u/javier_fernan)\
**Post date:** [April 14, 2025, 3:33pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/23 "2025-04-14T15:33:57Z")

</div>

I am working on a similar model: portfolio choice with housing. I am trying to modify the code to allow for two permanent types: fixed education type and fixed patiente types. Education and subjective patiente are both important drivers of financial choices.  
How do I set up this in the toolkit? I have two education types (no college and college) and two patience types (low and high)

---

<div class="post-metadata">

**Author:** ![aledinola](https://discourse.vfitoolkit.com/letter_avatar_proxy/v4/letter/a/3ec8ea/32.png) [@aledinola](https://discourse.vfitoolkit.com/u/aledinola)\
**Post date:** [April 14, 2025, 3:43pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/24 "2025-04-14T15:43:54Z")

</div>

Interesting question! Here is one way of doing it

You combine the two permanent types together, getting 4 permanent types. Specifically, you led education vary first and define

t1: e low, beta low  
t2: e high, beta low  
t3: e low, beta high  
t4: e high, beta high

where e denotes education and \beta denotes patience

Then

```auto
Names_i={'t1','t2','t3','t4'};

```

Then if you have a parameter, say `kappa`, that depends on the fixed types, you can code it as

```auto
kappa.t1 = 0.1;
kappa.t2 = 0.2;
kappa.t3 = 0.3;
kappa.t4 = 0.4;

```

Finally, do not forget to set the probability distribution for the permanent types:

```auto
%% How many of each permanent type are there
PTypeDistParamNames={'alphadist'};
Params.alphadist=[0.25,0.25,0.25,0.25]; % Must sum to one

```

(I copied from one of Robert’s examples)  
Last but not least, you have to invoke all commands with `_Ptype` suffix

Hope this helps!

---

<div class="post-metadata">

**Author:** ![javier\_fernan](https://discourse.vfitoolkit.com/letter_avatar_proxy/v4/letter/j/77aa72/32.png) [@javier\_fernan](https://discourse.vfitoolkit.com/u/javier_fernan)\
**Post date:** [April 14, 2025, 3:51pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/25 "2025-04-14T15:51:55Z")

</div>

Thanks, this is helpful! I have some parameters that depend on education only (i.e. fixed cost of participation) and others that depend only on patience type, i.e. subjective discount factor. I actually don’t have any parameter that depends on both fixed types simulatneously. For the discount factor, for example, can I write

beta.t1 = 0.85;  
beta.t3 = 0.95;  
?

More generally, when I set the initial distribution, I have some statistics like mean and standard deviation for each type and their correlation rho, so I cannot set the discrete mass as your example shows.

---

<div class="post-metadata">

**Author:** ![aledinola](https://discourse.vfitoolkit.com/letter_avatar_proxy/v4/letter/a/3ec8ea/32.png) [@aledinola](https://discourse.vfitoolkit.com/u/aledinola)\
**Post date:** [April 14, 2025, 6:18pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/26 "2025-04-14T18:18:26Z")

</div>

Uhmm I’m not sure. I think that if you follow my method, the toolkit will think that there are always 4 permanent types, so whenever a paramter is type dependent, you have to write 4 different fields

---

<div class="post-metadata">

**Author:** ![robertdkirkby](https://discourse.vfitoolkit.com/user_avatar/discourse.vfitoolkit.com/robertdkirkby/32/287_2.png) [@robertdkirkby](https://discourse.vfitoolkit.com/u/robertdkirkby)\
**Post date:** [April 15, 2025, 6:08am UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/27 "2025-04-15T06:08:31Z")

</div>

As Alessandro described, you have to set this up as four permanent types. This is because VFI Toolkit only understands a single layer/level of permanent types [adding two layers is something I want to do at some point, so you could have e.g., three countries and within each country have five income levels, but is currently not high on my list of things to implement]

If you use the setup described:  
t1: e low, beta low  
t2: e high, beta low  
t3: e low, beta high  
t4: e high, beta high  
where e denotes education and β denotes patience

Then you just set parameters something like

```auto
Params.beta.t1=0.8;
Params.beta.t2=Params.beta.t1;
Params.beta.t3=0.9;
Params.beta.t4=Params.beta.t3;

```

` when I set the initial distribution, I have some statistics like mean and standard deviation for each type and their correlation rho, so I cannot set the discrete mass as your example shows.`  
You can do this by setting up the initial distribution as a multivariate-normal on the grids that you are using. This is done using the command `MVNormal_ProbabilitiesOnGrid()`  
You can see examples using this command in [Life-Cycle Model 46](https://github.com/vfitoolkit/IntroToLifeCycleModels/tree/main/Models45to50) (although it is hidden inside LifeCycleModel46\_InitialDist.m) and also in the example for [Huggett, Ventura & Yaron (2006)](https://github.com/robertdkirkby/LifeCycleOLGReadingList/tree/main/HuggettVenturaYaron2006) (although it is hidden inside HuggettVenturaYaron2006\_jequaloneDistFn.m) and in the example for [Borella, De Nardi & Yang (2018)](https://github.com/robertdkirkby/LifeCycleOLGReadingList/tree/main/BorellaDeNardiYang2018).  
[Note: the ‘hiding’ is because both of those examples calibrate/estimate the parameters of the normal distribution]  
[It is possible I misunderstood what you meant by your comment as I am not entirely certain you asked what I answered, if so please let me know]

---

<div class="post-metadata">

**Author:** ![javier\_fernan](https://discourse.vfitoolkit.com/letter_avatar_proxy/v4/letter/j/77aa72/32.png) [@javier\_fernan](https://discourse.vfitoolkit.com/u/javier_fernan)\
**Post date:** [April 15, 2025, 3:58pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/28 "2025-04-15T15:58:42Z")

</div>

Thanks I will follow this set up

Params.beta.t1=0.8;  
Params.beta.t2=Params.beta.t1;  
Params.beta.t3=0.9;  
Params.beta.t4=Params.beta.t3;

For the initial distribution I cannot set it up as a bivariate normal because education and patience are discrete random variables with two points each (low and high education, low and high patience). I want them to have a certain mean and variance and a given correlation between the two.

---

<div class="post-metadata">

**Author:** ![robertdkirkby](https://discourse.vfitoolkit.com/user_avatar/discourse.vfitoolkit.com/robertdkirkby/32/287_2.png) [@robertdkirkby](https://discourse.vfitoolkit.com/u/robertdkirkby)\
**Post date:** [April 16, 2025, 10:12am UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/29 "2025-04-16T10:12:23Z")

</div>

I think I understand now. What you want are two dimensions of permanent type: e (education) and beta (patience). And the values they take are correlated.

The way to do this is to take your joint distribution over e and beta and discretize it into some values for e and beta, and probabilities for those values. I am going to assume it is bivariate normal for simplicity. So what you want to do then is to discretize the bivariate normal disribution  
[e; beta] \sim N(\mu,\Sigma)  
(where \mu is 2-by-1 and \Sigma is 2-by-2)

VFI Toolkit has two quadrature methods that can do this, Tauchen ( discretizeVAR1\_Tauchen) and Farmer-Toda (discretizeVAR1\_FarmerToda). [Note: bivariate normal is a bivariate VAR with zeros for the coefficents on lags, same as Normal is an AR(1) with zero autocorrelation.]

Either of these two methods will create a grid on e, a grid on beta (possibly a joint-grid on e and beta, depends on which method), and probabilities for (e,beta).

You then use the grid on e as Params.e, and the grid on beta as Params.beta, and use the probabilities on (e,beta) as the distribution over permanent types.

PS. If this is not what you want, please explain the exact equations that e and beta have to follow. [You can email me a pdf of the write up of the model equations if you like.]

PPS. Technically, two points on each with associated probabilities will give a mean, variance and correlation for the two. The approximation would be very poor, but it is possible to perform the approximation. In practice though, you want to use more points.

PPPS. What I just described is unrelated to the initial distribution (there is not point putting permanent types as dimensions of the initial distribution unless you need it for other reasons)

---

<div class="post-metadata">

**Author:** ![ZachFOrlando](https://discourse.vfitoolkit.com/letter_avatar_proxy/v4/letter/z/8edcca/32.png) [@ZachFOrlando](https://discourse.vfitoolkit.com/u/ZachFOrlando)\
**Post date:** [May 28, 2025, 6:33pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/30 "2025-05-28T18:33:29Z")

</div>

I am curious, has someone checked whether the toolkit indeed replicates the key features of Cocco(2005) with the parameters in the paper? E.g. the stock market participation numbers in their Table 5.

---

<div class="post-metadata">

**Author:** ![robertdkirkby](https://discourse.vfitoolkit.com/user_avatar/discourse.vfitoolkit.com/robertdkirkby/32/287_2.png) [@robertdkirkby](https://discourse.vfitoolkit.com/u/robertdkirkby)\
**Post date:** [May 28, 2025, 9:43pm UTC](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327/31 "2025-05-28T21:43:18Z")

</div>

To the best of my knowledge no-one has implemented Cocco (2005) with VFI Toolkit (maybe someone has, just that I haven’t seen it). In principle it should work fine (I’ve been half meaning to do it). If you decide to implement it I’m happy help and to answer any questions.

The closest thing I have done was Cocco, Gomes & Maenhout (2005). But obviously that is without housing.

[Previous page](https://discourse.vfitoolkit.com/t/portfolio-choice-with-housing-model-35-down-payment-mortgage-repayment-home-equity-and-housing-value-dynamics/327.md?page=1)
