# A model with weights

**URL:** <https://forum.dynare.org/t/a-model-with-weights/22683>\
**Category:** ML/Bayesian estimation\
**Created:** [2 July 2023 10:57 UTC](https://forum.dynare.org/t/a-model-with-weights/22683 "2023-07-02T10:57:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaakov](https://forum.dynare.org/user_avatar/forum.dynare.org/yaakov/32/15432_2.png) [@Yaakov](https://forum.dynare.org/u/Yaakov)\
**Post date:** [2 July 2023 10:57 UTC](https://forum.dynare.org/t/a-model-with-weights/22683/1 "2023-07-02T10:57:28Z")

</div>

Greetings,

I am interested in modeling aggregate CPI as the weighted sum of its components. To do so, I need to incorporate the weights, but I am unsure about the best way to implement them in Dynare. One option is to treat them as constant parameters, but then I will ignore the changes that occur every few years. Another option is to make them endogenous variables driven by corresponding shocks, and then use the historical weights as observables. This might work, but it also has several drawbacks. The likelihood will be distorted, the computational cost will be higher, and there might be other issues.

Does anyone have a better suggestion?

Yaakov

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [3 July 2023 20:09 UTC](https://forum.dynare.org/t/a-model-with-weights/22683/2 "2023-07-03T20:09:14Z")

</div>

That’s tricky. Because even if you use time-varying weights, an approximation of the nonlinear system will happen. I think you need to decide which approximation error is more important.

---

<div class="post-metadata">

**Author:** ![Yaakov](https://forum.dynare.org/user_avatar/forum.dynare.org/yaakov/32/15432_2.png) [@Yaakov](https://forum.dynare.org/u/Yaakov)\
**Post date:** [4 July 2023 12:38 UTC](https://forum.dynare.org/t/a-model-with-weights/22683/3 "2023-07-04T12:38:42Z")

</div>

I think I can make the best of both (the least bad). I can make each weight to be:  
wI,t=\mu\_i+ ei,t  
while ei,t is an exogenous shock, and \mu\_i is the sample mean of the weight. That way, the linearization around the steady state will be around the sample mean. right?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [4 July 2023 13:28 UTC](https://forum.dynare.org/t/a-model-with-weights/22683/4 "2023-07-04T13:28:41Z")

</div>

The problem is not the approximation of w\_{l,t}, but of arising products like w\_{l,t}q\_{lt}
