diff --git a/_images/00dbe76962736de2b0f0c0142649afad8a521a38fb9cb20ff0312e342ca00a59.png b/_images/00dbe76962736de2b0f0c0142649afad8a521a38fb9cb20ff0312e342ca00a59.png new file mode 100644 index 00000000..b17237ad Binary files /dev/null and b/_images/00dbe76962736de2b0f0c0142649afad8a521a38fb9cb20ff0312e342ca00a59.png differ diff --git a/_images/02f18694e473b5f71077dd04756511bb267ed908e8f68777ccc103891b6e3636.png b/_images/02f18694e473b5f71077dd04756511bb267ed908e8f68777ccc103891b6e3636.png deleted file mode 100644 index 177e183a..00000000 Binary files a/_images/02f18694e473b5f71077dd04756511bb267ed908e8f68777ccc103891b6e3636.png and /dev/null differ diff --git a/_images/08a58eeb55480a32f702aefd8c9100411bed5003188bd1e4ae03d4636ef2137f.png b/_images/08a58eeb55480a32f702aefd8c9100411bed5003188bd1e4ae03d4636ef2137f.png deleted file mode 100644 index 616c8350..00000000 Binary files a/_images/08a58eeb55480a32f702aefd8c9100411bed5003188bd1e4ae03d4636ef2137f.png and /dev/null differ diff --git a/_images/0eb9e3b295e3289d24b6581c1ff1b5c43916616c326605649489a7720a1c6aec.png b/_images/0eb9e3b295e3289d24b6581c1ff1b5c43916616c326605649489a7720a1c6aec.png new file mode 100644 index 00000000..b8294c6d Binary files /dev/null and b/_images/0eb9e3b295e3289d24b6581c1ff1b5c43916616c326605649489a7720a1c6aec.png differ diff --git a/_images/0ecb102f0160218ebfc03fe2044e9c09e8c723353141f6fb95cecf859d8fed25.png b/_images/0ecb102f0160218ebfc03fe2044e9c09e8c723353141f6fb95cecf859d8fed25.png new file mode 100644 index 00000000..19dcfb7b Binary files /dev/null and b/_images/0ecb102f0160218ebfc03fe2044e9c09e8c723353141f6fb95cecf859d8fed25.png differ diff --git a/_images/12cf5276eb1fe369efd53bf9d233587a9ea325cb7b51da94de7de784caf8aed4.png b/_images/12cf5276eb1fe369efd53bf9d233587a9ea325cb7b51da94de7de784caf8aed4.png new file mode 100644 index 00000000..3a70ef27 Binary files /dev/null and b/_images/12cf5276eb1fe369efd53bf9d233587a9ea325cb7b51da94de7de784caf8aed4.png differ diff --git a/_images/12e4064bf48ee21664b9107c59f738cf5cd7b13b094b0f5ab541338b985d9fde.png b/_images/12e4064bf48ee21664b9107c59f738cf5cd7b13b094b0f5ab541338b985d9fde.png new file mode 100644 index 00000000..6510cbca Binary files /dev/null and b/_images/12e4064bf48ee21664b9107c59f738cf5cd7b13b094b0f5ab541338b985d9fde.png differ diff --git a/_images/15905e33e44102a1b1c6dc8a99eec912db4a197c6820ca5858a8f550977e4b4e.png b/_images/15905e33e44102a1b1c6dc8a99eec912db4a197c6820ca5858a8f550977e4b4e.png deleted file mode 100644 index 808b996b..00000000 Binary files a/_images/15905e33e44102a1b1c6dc8a99eec912db4a197c6820ca5858a8f550977e4b4e.png and /dev/null differ diff --git a/_images/18a6691d740113e2cdcea83a42ddd8dbec4a44fb4c7a3b3727b275815bec3acb.png b/_images/18a6691d740113e2cdcea83a42ddd8dbec4a44fb4c7a3b3727b275815bec3acb.png new file mode 100644 index 00000000..efac7e1b Binary files /dev/null and b/_images/18a6691d740113e2cdcea83a42ddd8dbec4a44fb4c7a3b3727b275815bec3acb.png differ diff --git a/_images/1a0ffc8318f3b862eda5b8ef3d86e7ba8422ff3e1281bffcfd9829f29f9daf86.png b/_images/1a0ffc8318f3b862eda5b8ef3d86e7ba8422ff3e1281bffcfd9829f29f9daf86.png deleted file mode 100644 index c16ad324..00000000 Binary files a/_images/1a0ffc8318f3b862eda5b8ef3d86e7ba8422ff3e1281bffcfd9829f29f9daf86.png and /dev/null differ diff --git a/_images/1e16da16dbc3c714b64b54f20c308134bf087802863d9a3a7a4d950ee16959d5.png b/_images/1e16da16dbc3c714b64b54f20c308134bf087802863d9a3a7a4d950ee16959d5.png deleted file mode 100644 index 1476881b..00000000 Binary files a/_images/1e16da16dbc3c714b64b54f20c308134bf087802863d9a3a7a4d950ee16959d5.png and /dev/null differ diff --git a/_images/1f38dd8613e8b3e32d95d7f9d52189bfb4fb3e217012a3e3b7f0973eb3097293.png b/_images/1f38dd8613e8b3e32d95d7f9d52189bfb4fb3e217012a3e3b7f0973eb3097293.png new file mode 100644 index 00000000..47256640 Binary files /dev/null and b/_images/1f38dd8613e8b3e32d95d7f9d52189bfb4fb3e217012a3e3b7f0973eb3097293.png differ diff --git a/_images/2166ccc06ddd2e3824a256d19c45880836d9434b4a3b840c7f0d7cccab843130.png b/_images/2166ccc06ddd2e3824a256d19c45880836d9434b4a3b840c7f0d7cccab843130.png new file mode 100644 index 00000000..c721136c Binary files /dev/null and b/_images/2166ccc06ddd2e3824a256d19c45880836d9434b4a3b840c7f0d7cccab843130.png differ diff --git a/_images/246fa16300a5dc92dc2e45e0331c6d7fdcda694a062c3b80a8cb662b4ad7993b.png b/_images/246fa16300a5dc92dc2e45e0331c6d7fdcda694a062c3b80a8cb662b4ad7993b.png new file mode 100644 index 00000000..3f4f4701 Binary files /dev/null and b/_images/246fa16300a5dc92dc2e45e0331c6d7fdcda694a062c3b80a8cb662b4ad7993b.png differ diff --git a/_images/24c839c790c6591d72c0b829de99218a71719fcd4d01ff376719aab143c12643.png b/_images/24c839c790c6591d72c0b829de99218a71719fcd4d01ff376719aab143c12643.png new file mode 100644 index 00000000..e951abfe Binary files /dev/null and b/_images/24c839c790c6591d72c0b829de99218a71719fcd4d01ff376719aab143c12643.png differ diff --git a/_images/26f814ce589e0b3711cdd52871f4d4148ce5f010a55074f9d8c8f922b0176b6d.png b/_images/26f814ce589e0b3711cdd52871f4d4148ce5f010a55074f9d8c8f922b0176b6d.png new file mode 100644 index 00000000..6fb95b06 Binary files /dev/null and b/_images/26f814ce589e0b3711cdd52871f4d4148ce5f010a55074f9d8c8f922b0176b6d.png differ diff --git a/_images/2ab6d0b2cbb1643d758df10ddb2f0bffc0affa6a28667eebd0d46be341c349aa.png b/_images/2ab6d0b2cbb1643d758df10ddb2f0bffc0affa6a28667eebd0d46be341c349aa.png deleted file mode 100644 index a703f631..00000000 Binary files a/_images/2ab6d0b2cbb1643d758df10ddb2f0bffc0affa6a28667eebd0d46be341c349aa.png and /dev/null differ diff --git a/_images/2b5e91534f12ea67bf130d7c601bf898c468d47ed47df29d0b348a1958f6e362.png b/_images/2b5e91534f12ea67bf130d7c601bf898c468d47ed47df29d0b348a1958f6e362.png deleted file mode 100644 index d0cf690d..00000000 Binary files a/_images/2b5e91534f12ea67bf130d7c601bf898c468d47ed47df29d0b348a1958f6e362.png and /dev/null differ diff --git a/_images/2f61a4594756ef9fb2daeb5d18cfda1f5815604627c2304557ddf0fe44b39951.png b/_images/2f61a4594756ef9fb2daeb5d18cfda1f5815604627c2304557ddf0fe44b39951.png deleted file mode 100644 index 04d350d3..00000000 Binary files a/_images/2f61a4594756ef9fb2daeb5d18cfda1f5815604627c2304557ddf0fe44b39951.png and /dev/null differ diff --git a/_images/378f1f550bc2a9497c64a705d68b1bd5add4d54411f40d923c6350d92f2d02cd.png b/_images/378f1f550bc2a9497c64a705d68b1bd5add4d54411f40d923c6350d92f2d02cd.png new file mode 100644 index 00000000..3f48ed2d Binary files /dev/null and b/_images/378f1f550bc2a9497c64a705d68b1bd5add4d54411f40d923c6350d92f2d02cd.png differ diff --git a/_images/38be9421a7d217d689f2d97960d68381126c2c9d6fb71fadac6d6c1753dcbae8.png b/_images/38be9421a7d217d689f2d97960d68381126c2c9d6fb71fadac6d6c1753dcbae8.png new file mode 100644 index 00000000..fe274ca2 Binary files /dev/null and b/_images/38be9421a7d217d689f2d97960d68381126c2c9d6fb71fadac6d6c1753dcbae8.png differ diff --git a/_images/38fac6d1de1a388c8949dd265e2f4ceae9b11ab2a715940ed6ebbd2676134fa9.png b/_images/38fac6d1de1a388c8949dd265e2f4ceae9b11ab2a715940ed6ebbd2676134fa9.png new file mode 100644 index 00000000..0e5f4c08 Binary files /dev/null and b/_images/38fac6d1de1a388c8949dd265e2f4ceae9b11ab2a715940ed6ebbd2676134fa9.png differ diff --git a/_images/3d839e736b7224893f9ac42cd500b99bbfbae557026adab4435c2a4593b41cbd.png b/_images/3d839e736b7224893f9ac42cd500b99bbfbae557026adab4435c2a4593b41cbd.png new file mode 100644 index 00000000..4785b110 Binary files /dev/null and b/_images/3d839e736b7224893f9ac42cd500b99bbfbae557026adab4435c2a4593b41cbd.png differ diff --git a/_images/40394e1462b200d8ccd4caecf45a6865b6700df871ea1e47d8fdd80bb14edac8.png b/_images/40394e1462b200d8ccd4caecf45a6865b6700df871ea1e47d8fdd80bb14edac8.png deleted file mode 100644 index 4424c62a..00000000 Binary files a/_images/40394e1462b200d8ccd4caecf45a6865b6700df871ea1e47d8fdd80bb14edac8.png and /dev/null differ diff --git a/_images/408b0a1a52d8a0d2e59039a251ee58982ded57183a74188aa9095a25552f1d66.png b/_images/408b0a1a52d8a0d2e59039a251ee58982ded57183a74188aa9095a25552f1d66.png new file mode 100644 index 00000000..fdc9dfb7 Binary files /dev/null and b/_images/408b0a1a52d8a0d2e59039a251ee58982ded57183a74188aa9095a25552f1d66.png differ diff --git a/_images/41500f8d74fae082517b751bd9530c541b9f46ebda39e81eb3e2a5771bd9eb45.png b/_images/41500f8d74fae082517b751bd9530c541b9f46ebda39e81eb3e2a5771bd9eb45.png deleted file mode 100644 index 2ac37bb0..00000000 Binary files a/_images/41500f8d74fae082517b751bd9530c541b9f46ebda39e81eb3e2a5771bd9eb45.png and /dev/null differ diff --git a/_images/476aad7f3181795e3b3c020ad530012d345586c4fc52dd1bbce4948a6a362f0c.png b/_images/476aad7f3181795e3b3c020ad530012d345586c4fc52dd1bbce4948a6a362f0c.png deleted file mode 100644 index fe325ad3..00000000 Binary files a/_images/476aad7f3181795e3b3c020ad530012d345586c4fc52dd1bbce4948a6a362f0c.png and /dev/null differ diff --git a/_images/5001236c9acd66a174bf8994879f2e86bcf78ff973e4ed84e3e122499c3b0e2f.png b/_images/5001236c9acd66a174bf8994879f2e86bcf78ff973e4ed84e3e122499c3b0e2f.png deleted file mode 100644 index a8429ac4..00000000 Binary files a/_images/5001236c9acd66a174bf8994879f2e86bcf78ff973e4ed84e3e122499c3b0e2f.png and /dev/null differ diff --git a/_images/558ea33869a232c7653b977fa6f684167d9f235ba966ad72bfab1a5d407a340e.png b/_images/558ea33869a232c7653b977fa6f684167d9f235ba966ad72bfab1a5d407a340e.png deleted file mode 100644 index 3e2e4157..00000000 Binary files a/_images/558ea33869a232c7653b977fa6f684167d9f235ba966ad72bfab1a5d407a340e.png and /dev/null differ diff --git a/_images/58db15e63caa6ca689b07e189ae7e954af5108cddc6a3f0b13a20d0b464ec666.png b/_images/58db15e63caa6ca689b07e189ae7e954af5108cddc6a3f0b13a20d0b464ec666.png new file mode 100644 index 00000000..b3eb85dd Binary files /dev/null and b/_images/58db15e63caa6ca689b07e189ae7e954af5108cddc6a3f0b13a20d0b464ec666.png differ diff --git a/_images/59dc2a8ddc27e7a042928ff933a8e2eba03a793f8e8478f6db6bdb4434c2da5d.png b/_images/59dc2a8ddc27e7a042928ff933a8e2eba03a793f8e8478f6db6bdb4434c2da5d.png deleted file mode 100644 index 0d2237f2..00000000 Binary files a/_images/59dc2a8ddc27e7a042928ff933a8e2eba03a793f8e8478f6db6bdb4434c2da5d.png and /dev/null differ diff --git a/_images/6294c83139a08690b025232fd9d0c486d741c88d6f0fba32313ff95f4806739e.png b/_images/6294c83139a08690b025232fd9d0c486d741c88d6f0fba32313ff95f4806739e.png new file mode 100644 index 00000000..f2f5f0a8 Binary files /dev/null and b/_images/6294c83139a08690b025232fd9d0c486d741c88d6f0fba32313ff95f4806739e.png differ diff --git a/_images/66b3d1d6e939dd6c960eb47d3b945a50c467eeb0796d8863604ef446eae5db32.png b/_images/66b3d1d6e939dd6c960eb47d3b945a50c467eeb0796d8863604ef446eae5db32.png new file mode 100644 index 00000000..2deb57c1 Binary files /dev/null and b/_images/66b3d1d6e939dd6c960eb47d3b945a50c467eeb0796d8863604ef446eae5db32.png differ diff --git a/_images/6890861cf91198b7bd517cc653f857314dfa015b47ebb27736d0fe66a7782601.png b/_images/6890861cf91198b7bd517cc653f857314dfa015b47ebb27736d0fe66a7782601.png new file mode 100644 index 00000000..0d385cd2 Binary files /dev/null and b/_images/6890861cf91198b7bd517cc653f857314dfa015b47ebb27736d0fe66a7782601.png differ diff --git a/_images/69c922aeea51af52c311d0b0e8bc00b92b40b08ac90b71b0c7d278a136fbdf58.png b/_images/69c922aeea51af52c311d0b0e8bc00b92b40b08ac90b71b0c7d278a136fbdf58.png new file mode 100644 index 00000000..ec3d7f66 Binary files /dev/null and b/_images/69c922aeea51af52c311d0b0e8bc00b92b40b08ac90b71b0c7d278a136fbdf58.png differ diff --git a/_images/6c6b76debaac2e0b838f3b7072159ddec9c36e9755323e2aa30ee146030fa4a0.png b/_images/6c6b76debaac2e0b838f3b7072159ddec9c36e9755323e2aa30ee146030fa4a0.png deleted file mode 100644 index 784dc271..00000000 Binary files a/_images/6c6b76debaac2e0b838f3b7072159ddec9c36e9755323e2aa30ee146030fa4a0.png and /dev/null differ diff --git a/_images/70af53c0bf215c2b7d9e1c636d5fef18f05b0079ecd906932dcc7696d34f78ab.png b/_images/70af53c0bf215c2b7d9e1c636d5fef18f05b0079ecd906932dcc7696d34f78ab.png new file mode 100644 index 00000000..b6824a00 Binary files /dev/null and b/_images/70af53c0bf215c2b7d9e1c636d5fef18f05b0079ecd906932dcc7696d34f78ab.png differ diff --git a/_images/7102832793aa4db2eaeca1f9778052e0172065edb3b2ec6fdad72e2215badb8e.png b/_images/7102832793aa4db2eaeca1f9778052e0172065edb3b2ec6fdad72e2215badb8e.png deleted file mode 100644 index 8787b85f..00000000 Binary files a/_images/7102832793aa4db2eaeca1f9778052e0172065edb3b2ec6fdad72e2215badb8e.png and /dev/null differ diff --git a/_images/7444483b6c0f74206982addad799336ebbb6782f3aa30ea52e8721fed8071538.png b/_images/7444483b6c0f74206982addad799336ebbb6782f3aa30ea52e8721fed8071538.png new file mode 100644 index 00000000..ba0a6783 Binary files /dev/null and b/_images/7444483b6c0f74206982addad799336ebbb6782f3aa30ea52e8721fed8071538.png differ diff --git a/_images/7b3abbc7cf613fbb53f9373467772e551aab58c6cb117eac3c1ccba57703c802.png b/_images/7b3abbc7cf613fbb53f9373467772e551aab58c6cb117eac3c1ccba57703c802.png new file mode 100644 index 00000000..852739c8 Binary files /dev/null and b/_images/7b3abbc7cf613fbb53f9373467772e551aab58c6cb117eac3c1ccba57703c802.png differ diff --git a/_images/859101bc8f28d2b47194badccd3d13d89da4865dcbcd6ca58b97b86f35e9dca0.png b/_images/859101bc8f28d2b47194badccd3d13d89da4865dcbcd6ca58b97b86f35e9dca0.png deleted file mode 100644 index 5b4fe75d..00000000 Binary files a/_images/859101bc8f28d2b47194badccd3d13d89da4865dcbcd6ca58b97b86f35e9dca0.png and /dev/null differ diff --git a/_images/885f032beca97d01fe69e05b7e709c46911da5e8ce98ddf1405eaf4c26b20ba4.png b/_images/885f032beca97d01fe69e05b7e709c46911da5e8ce98ddf1405eaf4c26b20ba4.png deleted file mode 100644 index af9dae1d..00000000 Binary files a/_images/885f032beca97d01fe69e05b7e709c46911da5e8ce98ddf1405eaf4c26b20ba4.png and /dev/null differ diff --git a/_images/897611d95bf0d400b510bcf64427158096adbf0ccf2063012159118eb431b12c.png b/_images/897611d95bf0d400b510bcf64427158096adbf0ccf2063012159118eb431b12c.png new file mode 100644 index 00000000..38ae074c Binary files /dev/null and b/_images/897611d95bf0d400b510bcf64427158096adbf0ccf2063012159118eb431b12c.png differ diff --git a/_images/8bc7cadab13137675f0908b0cd753fbf92b4391957bf094143783e13c19ccf95.png b/_images/8bc7cadab13137675f0908b0cd753fbf92b4391957bf094143783e13c19ccf95.png deleted file mode 100644 index dd540d05..00000000 Binary files a/_images/8bc7cadab13137675f0908b0cd753fbf92b4391957bf094143783e13c19ccf95.png and /dev/null differ diff --git a/_images/8c444c1fae4af39911951603ab71de4d831940430f3e2d09f25585a120981e4d.png b/_images/8c444c1fae4af39911951603ab71de4d831940430f3e2d09f25585a120981e4d.png new file mode 100644 index 00000000..74357887 Binary files /dev/null and b/_images/8c444c1fae4af39911951603ab71de4d831940430f3e2d09f25585a120981e4d.png differ diff --git a/_images/8dec4d0b1f838937dc63917e55e55a87711ee9fca5baac895d91b29777a433ac.png b/_images/8dec4d0b1f838937dc63917e55e55a87711ee9fca5baac895d91b29777a433ac.png new file mode 100644 index 00000000..a2b06e1f Binary files /dev/null and b/_images/8dec4d0b1f838937dc63917e55e55a87711ee9fca5baac895d91b29777a433ac.png differ diff --git a/_images/9346f22c645d44920f17bf4c2bd79632a9cbb0822a9465f5460bdf14d416ddc9.png b/_images/9346f22c645d44920f17bf4c2bd79632a9cbb0822a9465f5460bdf14d416ddc9.png new file mode 100644 index 00000000..f74774a0 Binary files /dev/null and b/_images/9346f22c645d44920f17bf4c2bd79632a9cbb0822a9465f5460bdf14d416ddc9.png differ diff --git a/_images/93c96f46b6ec9278b845d9c14d9fc48f880c803c94546e4a2c388b432f15fa01.png b/_images/93c96f46b6ec9278b845d9c14d9fc48f880c803c94546e4a2c388b432f15fa01.png deleted file mode 100644 index 900e1db8..00000000 Binary files a/_images/93c96f46b6ec9278b845d9c14d9fc48f880c803c94546e4a2c388b432f15fa01.png and /dev/null differ diff --git a/_images/96091aca837e27b7047c63c0d4493d5c31fea9655e9a94fc00e01bf2da94faf8.png b/_images/96091aca837e27b7047c63c0d4493d5c31fea9655e9a94fc00e01bf2da94faf8.png new file mode 100644 index 00000000..2154db27 Binary files /dev/null and b/_images/96091aca837e27b7047c63c0d4493d5c31fea9655e9a94fc00e01bf2da94faf8.png differ diff --git a/_images/98c1a4e68931e109ccf1efa3dda8036773475903e7e8389e82f6a3cc21349834.png b/_images/98c1a4e68931e109ccf1efa3dda8036773475903e7e8389e82f6a3cc21349834.png deleted file mode 100644 index 6a3c45cd..00000000 Binary files a/_images/98c1a4e68931e109ccf1efa3dda8036773475903e7e8389e82f6a3cc21349834.png and /dev/null differ diff --git a/_images/9dd0b1a0e8077b9657d997f17873b02bdeaa5ff4c622d08b6ff345ac509124e3.png b/_images/9dd0b1a0e8077b9657d997f17873b02bdeaa5ff4c622d08b6ff345ac509124e3.png new file mode 100644 index 00000000..9440dee1 Binary files /dev/null and b/_images/9dd0b1a0e8077b9657d997f17873b02bdeaa5ff4c622d08b6ff345ac509124e3.png differ diff --git a/_images/9e3a62660c09d893c337f0cff90db3120b464906b5af0307990e9de3a654529f.png b/_images/9e3a62660c09d893c337f0cff90db3120b464906b5af0307990e9de3a654529f.png deleted file mode 100644 index ba1c5a1c..00000000 Binary files a/_images/9e3a62660c09d893c337f0cff90db3120b464906b5af0307990e9de3a654529f.png and /dev/null differ diff --git a/_images/9e8861b02db097e1a6a9e6a03d45b058ef6edf46e29556a3a483d5aa00ad4195.png b/_images/9e8861b02db097e1a6a9e6a03d45b058ef6edf46e29556a3a483d5aa00ad4195.png deleted file mode 100644 index 1f229491..00000000 Binary files a/_images/9e8861b02db097e1a6a9e6a03d45b058ef6edf46e29556a3a483d5aa00ad4195.png and /dev/null differ diff --git a/_images/9ef50a94edfb2a15fb72afae40cdc5b3e4f51491a948d43456d04d55cf7366ad.png b/_images/9ef50a94edfb2a15fb72afae40cdc5b3e4f51491a948d43456d04d55cf7366ad.png new file mode 100644 index 00000000..57e3cf7b Binary files /dev/null and b/_images/9ef50a94edfb2a15fb72afae40cdc5b3e4f51491a948d43456d04d55cf7366ad.png differ diff --git a/_images/9fdb4c9a8a1d62f6f538e9d91b83dcadfab946695a3ec0cb5e0090b9f14f5ba8.png b/_images/9fdb4c9a8a1d62f6f538e9d91b83dcadfab946695a3ec0cb5e0090b9f14f5ba8.png new file mode 100644 index 00000000..56d05e27 Binary files /dev/null and b/_images/9fdb4c9a8a1d62f6f538e9d91b83dcadfab946695a3ec0cb5e0090b9f14f5ba8.png differ diff --git a/_images/a00a5bda5992334267ac477283bb35b9db38f96fb0ec2b51a5ceebee54c52600.png b/_images/a00a5bda5992334267ac477283bb35b9db38f96fb0ec2b51a5ceebee54c52600.png deleted file mode 100644 index 089a73c0..00000000 Binary files a/_images/a00a5bda5992334267ac477283bb35b9db38f96fb0ec2b51a5ceebee54c52600.png and /dev/null differ diff --git a/_images/a2c3bf5dd7b96aac8bec19ce7e7fb7ca04e5e9e02d532f097d886d6c19441f15.png b/_images/a2c3bf5dd7b96aac8bec19ce7e7fb7ca04e5e9e02d532f097d886d6c19441f15.png new file mode 100644 index 00000000..2dc88852 Binary files /dev/null and b/_images/a2c3bf5dd7b96aac8bec19ce7e7fb7ca04e5e9e02d532f097d886d6c19441f15.png differ diff --git a/_images/a525029539727cb1482ff64d454e1b879396928a3a3498099a800b84b69606d1.png b/_images/a525029539727cb1482ff64d454e1b879396928a3a3498099a800b84b69606d1.png new file mode 100644 index 00000000..7821164c Binary files /dev/null and b/_images/a525029539727cb1482ff64d454e1b879396928a3a3498099a800b84b69606d1.png differ diff --git a/_images/a69438d3b47f67fd9908f2bc634ae1eef34a82a4652c80114d9f1b49201fa452.png b/_images/a69438d3b47f67fd9908f2bc634ae1eef34a82a4652c80114d9f1b49201fa452.png deleted file mode 100644 index ac8ba5a8..00000000 Binary files a/_images/a69438d3b47f67fd9908f2bc634ae1eef34a82a4652c80114d9f1b49201fa452.png and /dev/null differ diff --git a/_images/a76c5a27fe5d438dfdcead922989b13347d3c9e601b5b345844c4d161453c592.png b/_images/a76c5a27fe5d438dfdcead922989b13347d3c9e601b5b345844c4d161453c592.png new file mode 100644 index 00000000..c0f83f83 Binary files /dev/null and b/_images/a76c5a27fe5d438dfdcead922989b13347d3c9e601b5b345844c4d161453c592.png differ diff --git a/_images/a863413a096b25d56ed5c82bebbb960c256ca1f31e4ecff1285c846df23b348c.png b/_images/a863413a096b25d56ed5c82bebbb960c256ca1f31e4ecff1285c846df23b348c.png deleted file mode 100644 index cbd9e0a2..00000000 Binary files a/_images/a863413a096b25d56ed5c82bebbb960c256ca1f31e4ecff1285c846df23b348c.png and /dev/null differ diff --git a/_images/aacf5afa35216a05a81309e36f895b4f4f0831d19b0a53f213681d0470ba2e0d.png b/_images/aacf5afa35216a05a81309e36f895b4f4f0831d19b0a53f213681d0470ba2e0d.png new file mode 100644 index 00000000..783a1978 Binary files /dev/null and b/_images/aacf5afa35216a05a81309e36f895b4f4f0831d19b0a53f213681d0470ba2e0d.png differ diff --git a/_images/aadefc78024d299c03ddd051c519ebde8472a6225f44c8c08b43c49e75a9d617.png b/_images/aadefc78024d299c03ddd051c519ebde8472a6225f44c8c08b43c49e75a9d617.png deleted file mode 100644 index aad20489..00000000 Binary files a/_images/aadefc78024d299c03ddd051c519ebde8472a6225f44c8c08b43c49e75a9d617.png and /dev/null differ diff --git a/_images/b0988ff0315c05011b2605382b48a5ac1cef60bd5afd35b9a74aaaee8cd4282f.png b/_images/b0988ff0315c05011b2605382b48a5ac1cef60bd5afd35b9a74aaaee8cd4282f.png new file mode 100644 index 00000000..c143c614 Binary files /dev/null and b/_images/b0988ff0315c05011b2605382b48a5ac1cef60bd5afd35b9a74aaaee8cd4282f.png differ diff --git a/_images/b240f1f854cdd94467db006f30a82191607cf0485bacb4c40bd0d02c4f2e6825.png b/_images/b240f1f854cdd94467db006f30a82191607cf0485bacb4c40bd0d02c4f2e6825.png new file mode 100644 index 00000000..b0b2e1e2 Binary files /dev/null and b/_images/b240f1f854cdd94467db006f30a82191607cf0485bacb4c40bd0d02c4f2e6825.png differ diff --git a/_images/b5d125fbaed54fbada921e936021321dffe7098a8a14580364ac5ecfd659ecef.png b/_images/b5d125fbaed54fbada921e936021321dffe7098a8a14580364ac5ecfd659ecef.png deleted file mode 100644 index 741f98d5..00000000 Binary files a/_images/b5d125fbaed54fbada921e936021321dffe7098a8a14580364ac5ecfd659ecef.png and /dev/null differ diff --git a/_images/b9b4ba0445ed2db7447913c26862041ffd3e8e31e58e8f472336729c85905b66.png b/_images/b9b4ba0445ed2db7447913c26862041ffd3e8e31e58e8f472336729c85905b66.png deleted file mode 100644 index 67d5177a..00000000 Binary files a/_images/b9b4ba0445ed2db7447913c26862041ffd3e8e31e58e8f472336729c85905b66.png and /dev/null differ diff --git a/_images/b9d2935233357238452a18171d9b01490d5a35f31c4b03703163d71b38f9490b.png b/_images/b9d2935233357238452a18171d9b01490d5a35f31c4b03703163d71b38f9490b.png deleted file mode 100644 index 39397a20..00000000 Binary files a/_images/b9d2935233357238452a18171d9b01490d5a35f31c4b03703163d71b38f9490b.png and /dev/null differ diff --git a/_images/bb384dad949a853d36e8cc728ed3d94752fbdce7e378cd238893d0b9b118b021.png b/_images/bb384dad949a853d36e8cc728ed3d94752fbdce7e378cd238893d0b9b118b021.png new file mode 100644 index 00000000..94d08cd4 Binary files /dev/null and b/_images/bb384dad949a853d36e8cc728ed3d94752fbdce7e378cd238893d0b9b118b021.png differ diff --git a/_images/c137f129e42d154dea69b9b6b0fe7e19fca5988d79c684d4abd80e9648d50971.png b/_images/c137f129e42d154dea69b9b6b0fe7e19fca5988d79c684d4abd80e9648d50971.png new file mode 100644 index 00000000..4d735a87 Binary files /dev/null and b/_images/c137f129e42d154dea69b9b6b0fe7e19fca5988d79c684d4abd80e9648d50971.png differ diff --git a/_images/c21b3bc61831611fce4a51a5cdb3cccaf77c933985ee28b69ca0988d3728279a.png b/_images/c21b3bc61831611fce4a51a5cdb3cccaf77c933985ee28b69ca0988d3728279a.png deleted file mode 100644 index 41e0da00..00000000 Binary files a/_images/c21b3bc61831611fce4a51a5cdb3cccaf77c933985ee28b69ca0988d3728279a.png and /dev/null differ diff --git a/_images/c46903780b3cd97238eab93960d02b1b24b871265b64e854e0e4946dfe11d058.png b/_images/c46903780b3cd97238eab93960d02b1b24b871265b64e854e0e4946dfe11d058.png deleted file mode 100644 index ac92f7d1..00000000 Binary files a/_images/c46903780b3cd97238eab93960d02b1b24b871265b64e854e0e4946dfe11d058.png and /dev/null differ diff --git a/_images/cd1e915461e2da75af481219f24595ab83c3e1f9975b44afa9ad88036694f57d.png b/_images/cd1e915461e2da75af481219f24595ab83c3e1f9975b44afa9ad88036694f57d.png new file mode 100644 index 00000000..1fcfd314 Binary files /dev/null and b/_images/cd1e915461e2da75af481219f24595ab83c3e1f9975b44afa9ad88036694f57d.png differ diff --git a/_images/cf2edd07a83e60158352bda5027bc41a9857a429d0072d584bb8adcf5f344f4e.png b/_images/cf2edd07a83e60158352bda5027bc41a9857a429d0072d584bb8adcf5f344f4e.png deleted file mode 100644 index afbd11c7..00000000 Binary files a/_images/cf2edd07a83e60158352bda5027bc41a9857a429d0072d584bb8adcf5f344f4e.png and /dev/null differ diff --git a/_images/d1932b9e7f422c1e216f030f644ac593e4d2d9f597d5bcb52ca74a26bcc97b65.png b/_images/d1932b9e7f422c1e216f030f644ac593e4d2d9f597d5bcb52ca74a26bcc97b65.png deleted file mode 100644 index 05904e3e..00000000 Binary files a/_images/d1932b9e7f422c1e216f030f644ac593e4d2d9f597d5bcb52ca74a26bcc97b65.png and /dev/null differ diff --git a/_images/d413d6f044e9935b895c5c60b92d2574dae0444472988142b9e518948a9f3f5f.png b/_images/d413d6f044e9935b895c5c60b92d2574dae0444472988142b9e518948a9f3f5f.png deleted file mode 100644 index 2db47d00..00000000 Binary files a/_images/d413d6f044e9935b895c5c60b92d2574dae0444472988142b9e518948a9f3f5f.png and /dev/null differ diff --git a/_images/d4ef67d9d5c4e546cbcb79a3e89ced1a87d769263af51afe001ab99911cb5c10.png b/_images/d4ef67d9d5c4e546cbcb79a3e89ced1a87d769263af51afe001ab99911cb5c10.png deleted file mode 100644 index cfd99e32..00000000 Binary files a/_images/d4ef67d9d5c4e546cbcb79a3e89ced1a87d769263af51afe001ab99911cb5c10.png and /dev/null differ diff --git a/_images/d6671415d8eaa21456fa30383f741a2b4614241793b781e93026c2a9033ba566.png b/_images/d6671415d8eaa21456fa30383f741a2b4614241793b781e93026c2a9033ba566.png deleted file mode 100644 index 31c20096..00000000 Binary files a/_images/d6671415d8eaa21456fa30383f741a2b4614241793b781e93026c2a9033ba566.png and /dev/null differ diff --git a/_images/da9c408af1b9ddacf8412d1b9d9c989865ca228d93c8122fd9d00c05aac2bdf5.png b/_images/da9c408af1b9ddacf8412d1b9d9c989865ca228d93c8122fd9d00c05aac2bdf5.png deleted file mode 100644 index c786541e..00000000 Binary files a/_images/da9c408af1b9ddacf8412d1b9d9c989865ca228d93c8122fd9d00c05aac2bdf5.png and /dev/null differ diff --git a/_images/dc3de6804558ed64db983d1e15da2efb636404464bb6b21fc1e54300ce38d88d.png b/_images/dc3de6804558ed64db983d1e15da2efb636404464bb6b21fc1e54300ce38d88d.png new file mode 100644 index 00000000..4c264406 Binary files /dev/null and b/_images/dc3de6804558ed64db983d1e15da2efb636404464bb6b21fc1e54300ce38d88d.png differ diff --git a/_images/dd8a37aa36569d6eddc83d275718bc43ecc91c18a917d871a0572dd4361f2988.png b/_images/dd8a37aa36569d6eddc83d275718bc43ecc91c18a917d871a0572dd4361f2988.png new file mode 100644 index 00000000..d25a1385 Binary files /dev/null and b/_images/dd8a37aa36569d6eddc83d275718bc43ecc91c18a917d871a0572dd4361f2988.png differ diff --git a/_images/debe3fbd91c6cd823eda10cba453f2729c6c35d21bbb1a396d0b6a09fdec4356.png b/_images/debe3fbd91c6cd823eda10cba453f2729c6c35d21bbb1a396d0b6a09fdec4356.png new file mode 100644 index 00000000..e3ae9d7c Binary files /dev/null and b/_images/debe3fbd91c6cd823eda10cba453f2729c6c35d21bbb1a396d0b6a09fdec4356.png differ diff --git a/_images/e2aaad87326c65aff2ffe3ae50794a150221a70e13358ba1866fc0848421be8e.png b/_images/e2aaad87326c65aff2ffe3ae50794a150221a70e13358ba1866fc0848421be8e.png new file mode 100644 index 00000000..280ecdbf Binary files /dev/null and b/_images/e2aaad87326c65aff2ffe3ae50794a150221a70e13358ba1866fc0848421be8e.png differ diff --git a/_images/e2b01ff8a337806724167d49ce6a618cd529a554e3222053948bc551e9f9f666.png b/_images/e2b01ff8a337806724167d49ce6a618cd529a554e3222053948bc551e9f9f666.png new file mode 100644 index 00000000..c15eefb6 Binary files /dev/null and b/_images/e2b01ff8a337806724167d49ce6a618cd529a554e3222053948bc551e9f9f666.png differ diff --git a/_images/e3b3d72d362a0d653bb4924cc5c35870c812305b8211153d86251ffaa76ed870.png b/_images/e3b3d72d362a0d653bb4924cc5c35870c812305b8211153d86251ffaa76ed870.png deleted file mode 100644 index a8be37c2..00000000 Binary files a/_images/e3b3d72d362a0d653bb4924cc5c35870c812305b8211153d86251ffaa76ed870.png and /dev/null differ diff --git a/_images/e47235b4ab1e7d6656c08d63b27cd843cb8f16b7d8334cca5d064fb606d8d463.png b/_images/e47235b4ab1e7d6656c08d63b27cd843cb8f16b7d8334cca5d064fb606d8d463.png deleted file mode 100644 index 003263fb..00000000 Binary files a/_images/e47235b4ab1e7d6656c08d63b27cd843cb8f16b7d8334cca5d064fb606d8d463.png and /dev/null differ diff --git a/_images/e6cf9072b816135d4d31fcb40297471a40772148fb0affc67ecb5fc7ef01a834.png b/_images/e6cf9072b816135d4d31fcb40297471a40772148fb0affc67ecb5fc7ef01a834.png deleted file mode 100644 index dfb153d1..00000000 Binary files a/_images/e6cf9072b816135d4d31fcb40297471a40772148fb0affc67ecb5fc7ef01a834.png and /dev/null differ diff --git a/_images/e8991c7e1cc42f750a9b8a89aed5465b68175a72e97de9ae627147ccb4098b05.png b/_images/e8991c7e1cc42f750a9b8a89aed5465b68175a72e97de9ae627147ccb4098b05.png new file mode 100644 index 00000000..646f4930 Binary files /dev/null and b/_images/e8991c7e1cc42f750a9b8a89aed5465b68175a72e97de9ae627147ccb4098b05.png differ diff --git a/_images/e9651ed79029ddfdf62eaefafd1dff7e7de36f85e3f4ca0ae0c18680db1a10cf.png b/_images/e9651ed79029ddfdf62eaefafd1dff7e7de36f85e3f4ca0ae0c18680db1a10cf.png deleted file mode 100644 index fef85c28..00000000 Binary files a/_images/e9651ed79029ddfdf62eaefafd1dff7e7de36f85e3f4ca0ae0c18680db1a10cf.png and /dev/null differ diff --git a/_images/f23eeb251fa18ea34878cf0f937c2da945c1bb778afa3c6edf62796a78e8b9b0.png b/_images/f23eeb251fa18ea34878cf0f937c2da945c1bb778afa3c6edf62796a78e8b9b0.png deleted file mode 100644 index 41f02615..00000000 Binary files a/_images/f23eeb251fa18ea34878cf0f937c2da945c1bb778afa3c6edf62796a78e8b9b0.png and /dev/null differ diff --git a/_images/f2684e0373223b3837c3d3605d5a8fc8f9cf1bbc27e4cb1d5d894bc1bfa446bd.png b/_images/f2684e0373223b3837c3d3605d5a8fc8f9cf1bbc27e4cb1d5d894bc1bfa446bd.png deleted file mode 100644 index 1e582d16..00000000 Binary files a/_images/f2684e0373223b3837c3d3605d5a8fc8f9cf1bbc27e4cb1d5d894bc1bfa446bd.png and /dev/null differ diff --git a/_images/f383f06dd3363b6f9ce2011a3acf6862cae9e4c321045f814ace298b3bf37360.png b/_images/f383f06dd3363b6f9ce2011a3acf6862cae9e4c321045f814ace298b3bf37360.png deleted file mode 100644 index 90ef6c7f..00000000 Binary files a/_images/f383f06dd3363b6f9ce2011a3acf6862cae9e4c321045f814ace298b3bf37360.png and /dev/null differ diff --git a/_images/f546f63cf04660228e827e7068b6a2eb0ffe3fea086cf0f002384466baf12231.png b/_images/f546f63cf04660228e827e7068b6a2eb0ffe3fea086cf0f002384466baf12231.png deleted file mode 100644 index fe4fc9ed..00000000 Binary files a/_images/f546f63cf04660228e827e7068b6a2eb0ffe3fea086cf0f002384466baf12231.png and /dev/null differ diff --git a/_images/fcffda07c45d491e689c61d9cab070f8f079a614525143493f59c66fc8096cad.png b/_images/fcffda07c45d491e689c61d9cab070f8f079a614525143493f59c66fc8096cad.png deleted file mode 100644 index 3357d803..00000000 Binary files a/_images/fcffda07c45d491e689c61d9cab070f8f079a614525143493f59c66fc8096cad.png and /dev/null differ diff --git a/_notebooks/about.ipynb b/_notebooks/about.ipynb index e2025738..02df4be1 100644 --- a/_notebooks/about.ipynb +++ b/_notebooks/about.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "ca17ea17", + "id": "a41110f4", "metadata": {}, "source": [ "# About These Lectures" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "5387edbc", + "id": "67c0a355", "metadata": {}, "source": [ "## About\n", @@ -41,7 +41,7 @@ }, { "cell_type": "markdown", - "id": "db295b9c", + "id": "3be293ca", "metadata": {}, "source": [ "## Level\n", @@ -71,7 +71,7 @@ }, { "cell_type": "markdown", - "id": "34ce644a", + "id": "9550fccb", "metadata": {}, "source": [ "## Credits\n", @@ -96,7 +96,7 @@ } ], "metadata": { - "date": 1712122261.9337194, + "date": 1712983675.5954692, "filename": "about.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/ar1_processes.ipynb b/_notebooks/ar1_processes.ipynb index 7961b8fb..bdd4f1c5 100644 --- a/_notebooks/ar1_processes.ipynb +++ b/_notebooks/ar1_processes.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "a764f923", + "id": "5dbf5954", "metadata": {}, "source": [ "\n", @@ -13,7 +13,7 @@ }, { "cell_type": "markdown", - "id": "952824e5", + "id": "0e13d9b2", "metadata": {}, "source": [ "# AR1 Processes" @@ -21,7 +21,7 @@ }, { "cell_type": "markdown", - "id": "3f1ee208", + "id": "37105763", "metadata": {}, "source": [ "# Migrated lecture\n", @@ -34,7 +34,7 @@ }, { "cell_type": "markdown", - "id": "7ff94b33", + "id": "d54b7465", "metadata": {}, "source": [ "## Overview\n", @@ -60,7 +60,7 @@ { "cell_type": "code", "execution_count": null, - "id": "000022c0", + "id": "1bb63311", "metadata": { "hide-output": false }, @@ -74,7 +74,7 @@ }, { "cell_type": "markdown", - "id": "5018d858", + "id": "340a930b", "metadata": {}, "source": [ "## The AR(1) Model\n", @@ -103,7 +103,7 @@ }, { "cell_type": "markdown", - "id": "e23e8b01", + "id": "3bea7f64", "metadata": {}, "source": [ "### Moving Average Representation\n", @@ -138,7 +138,7 @@ }, { "cell_type": "markdown", - "id": "34d008c3", + "id": "1055eb58", "metadata": {}, "source": [ "### Distribution Dynamics\n", @@ -191,7 +191,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f45eac2d", + "id": "39e246c0", "metadata": { "hide-output": false }, @@ -204,7 +204,7 @@ }, { "cell_type": "markdown", - "id": "dbb403e4", + "id": "e43099c2", "metadata": {}, "source": [ "Here’s the sequence of distributions:" @@ -213,7 +213,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1aa3874a", + "id": "97581636", "metadata": { "hide-output": false }, @@ -240,7 +240,7 @@ }, { "cell_type": "markdown", - "id": "3544e411", + "id": "14bcdf4f", "metadata": {}, "source": [ "## Stationarity and Asymptotic Stability\n", @@ -253,7 +253,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53aac33f", + "id": "c951ba9d", "metadata": { "hide-output": false }, @@ -275,7 +275,7 @@ }, { "cell_type": "markdown", - "id": "5a78814a", + "id": "88c44aa2", "metadata": {}, "source": [ "Moreover, the limit does not depend on the initial condition.\n", @@ -286,7 +286,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7705fb79", + "id": "73946f07", "metadata": { "hide-output": false }, @@ -299,7 +299,7 @@ }, { "cell_type": "markdown", - "id": "d9dfb78a", + "id": "9be76970", "metadata": {}, "source": [ "In fact it’s easy to show that such convergence will occur, regardless of the initial condition, whenever $ |a| < 1 $.\n", @@ -335,7 +335,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c612f52d", + "id": "0e128d7b", "metadata": { "hide-output": false }, @@ -355,7 +355,7 @@ }, { "cell_type": "markdown", - "id": "1e815dad", + "id": "6c2c4736", "metadata": {}, "source": [ "As claimed, the sequence $ \\{ \\psi_t \\} $ converges to $ \\psi^* $." @@ -363,7 +363,7 @@ }, { "cell_type": "markdown", - "id": "b29ff6f0", + "id": "cebe0578", "metadata": {}, "source": [ "### Stationary Distributions\n", @@ -396,7 +396,7 @@ }, { "cell_type": "markdown", - "id": "3d4c26fe", + "id": "50fb9963", "metadata": {}, "source": [ "## Ergodicity\n", @@ -444,7 +444,7 @@ }, { "cell_type": "markdown", - "id": "f3972adb", + "id": "7872beef", "metadata": {}, "source": [ "## Exercises" @@ -452,7 +452,7 @@ }, { "cell_type": "markdown", - "id": "65b7e09b", + "id": "d213e15c", "metadata": {}, "source": [ "## Exercise 30.1\n", @@ -492,7 +492,7 @@ }, { "cell_type": "markdown", - "id": "ef365fa8", + "id": "b6bbbe27", "metadata": {}, "source": [ "## Solution to[ Exercise 30.1](https://intro.quantecon.org/#ar1p_ex1)\n", @@ -503,7 +503,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b3d8f6e9", + "id": "a20693b9", "metadata": { "hide-output": false }, @@ -546,7 +546,7 @@ }, { "cell_type": "markdown", - "id": "cf7ba7ff", + "id": "2150c235", "metadata": {}, "source": [ "## Exercise 30.2\n", @@ -597,7 +597,7 @@ }, { "cell_type": "markdown", - "id": "6457ee6a", + "id": "75290ce2", "metadata": {}, "source": [ "## Solution to[ Exercise 30.2](https://intro.quantecon.org/#ar1p_ex2)\n", @@ -608,7 +608,7 @@ { "cell_type": "code", "execution_count": null, - "id": "70200314", + "id": "95d62e07", "metadata": { "hide-output": false }, @@ -640,7 +640,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6712558c", + "id": "2f576419", "metadata": { "hide-output": false }, @@ -661,7 +661,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44e1ba41", + "id": "3e7b1118", "metadata": { "hide-output": false }, @@ -677,7 +677,7 @@ }, { "cell_type": "markdown", - "id": "fda40784", + "id": "505b3455", "metadata": {}, "source": [ "We see that the kernel density estimator is effective when the underlying\n", @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "a07a2d56", + "id": "3c199784", "metadata": {}, "source": [ "## Exercise 30.3\n", @@ -734,7 +734,7 @@ }, { "cell_type": "markdown", - "id": "ac2d97bc", + "id": "0a7105ce", "metadata": {}, "source": [ "## Solution to[ Exercise 30.3](https://intro.quantecon.org/#ar1p_ex3)\n", @@ -745,7 +745,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4b5c4a1a", + "id": "a91e167d", "metadata": { "hide-output": false }, @@ -761,7 +761,7 @@ { "cell_type": "code", "execution_count": null, - "id": "648239b6", + "id": "a2e5a2e7", "metadata": { "hide-output": false }, @@ -774,7 +774,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7053d0bf", + "id": "fd568c27", "metadata": { "hide-output": false }, @@ -787,7 +787,7 @@ { "cell_type": "code", "execution_count": null, - "id": "96d02b2c", + "id": "62cd87d3", "metadata": { "hide-output": false }, @@ -800,7 +800,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e092b8e2", + "id": "7fd45286", "metadata": { "hide-output": false }, @@ -824,7 +824,7 @@ }, { "cell_type": "markdown", - "id": "8aacd8d0", + "id": "8f2b438f", "metadata": {}, "source": [ "The simulated distribution approximately coincides with the theoretical\n", @@ -833,7 +833,7 @@ } ], "metadata": { - "date": 1712122261.9617279, + "date": 1712983675.6213908, "filename": "ar1_processes.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/business_cycle.ipynb b/_notebooks/business_cycle.ipynb index 21a197fa..cc49e047 100644 --- a/_notebooks/business_cycle.ipynb +++ b/_notebooks/business_cycle.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "2bc3a85f", + "id": "4bae0eff", "metadata": {}, "source": [ "# Business Cycles" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "ff1bcd9f", + "id": "0899a18c", "metadata": {}, "source": [ "## Overview\n", @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f3500517", + "id": "8522c43b", "metadata": { "hide-output": false }, @@ -41,7 +41,7 @@ }, { "cell_type": "markdown", - "id": "c4445bea", + "id": "ff5e662e", "metadata": {}, "source": [ "We use the following imports" @@ -50,7 +50,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a8acdc2c", + "id": "0fae6230", "metadata": { "hide-output": false }, @@ -65,7 +65,7 @@ }, { "cell_type": "markdown", - "id": "69a9c732", + "id": "7a6ed83b", "metadata": {}, "source": [ "Here’s some minor code to help with colors in our plots." @@ -74,7 +74,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c76fe27", + "id": "0ba17ccd", "metadata": { "hide-output": false }, @@ -88,7 +88,7 @@ }, { "cell_type": "markdown", - "id": "caca6777", + "id": "e3216cfc", "metadata": {}, "source": [ "## Data acquisition\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9ff68a22", + "id": "c2c43dfc", "metadata": { "hide-output": false }, @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "ebf4120a", + "id": "642512a2", "metadata": {}, "source": [ "Now we use this series ID to obtain the data." @@ -124,7 +124,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e575bcf3", + "id": "71f66b30", "metadata": { "hide-output": false }, @@ -138,7 +138,7 @@ }, { "cell_type": "markdown", - "id": "3ea153b6", + "id": "05cf62ca", "metadata": {}, "source": [ "We can look at the series’ metadata to learn more about the series (click to expand)." @@ -147,7 +147,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8cf85de6", + "id": "a482b95e", "metadata": { "hide-output": false }, @@ -158,7 +158,7 @@ }, { "cell_type": "markdown", - "id": "6a715cf0", + "id": "6e69dd2b", "metadata": {}, "source": [ "\n", @@ -167,7 +167,7 @@ }, { "cell_type": "markdown", - "id": "f2c5a781", + "id": "8ef657da", "metadata": {}, "source": [ "## GDP growth rate\n", @@ -180,7 +180,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fdbb18f0", + "id": "8b3527e3", "metadata": { "hide-output": false }, @@ -196,7 +196,7 @@ }, { "cell_type": "markdown", - "id": "0b895b9f", + "id": "03e0b1b6", "metadata": {}, "source": [ "Here’s a first look at the data" @@ -205,7 +205,7 @@ { "cell_type": "code", "execution_count": null, - "id": "98ce8370", + "id": "8263845e", "metadata": { "hide-output": false }, @@ -216,7 +216,7 @@ }, { "cell_type": "markdown", - "id": "d43a6226", + "id": "18e030f4", "metadata": {}, "source": [ "We write a function to generate plots for individual countries taking into account the recessions." @@ -225,7 +225,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f27508c7", + "id": "4d2e0942", "metadata": { "hide-output": false }, @@ -304,7 +304,7 @@ }, { "cell_type": "markdown", - "id": "0e7ffd2d", + "id": "84c3ab6d", "metadata": {}, "source": [ "Let’s start with the United States." @@ -313,7 +313,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9f399099", + "id": "da6fb91d", "metadata": { "hide-output": false }, @@ -331,7 +331,7 @@ }, { "cell_type": "markdown", - "id": "e94a0944", + "id": "f31eb0fd", "metadata": {}, "source": [ "GDP growth is positive on average and trending slightly downward over time.\n", @@ -349,7 +349,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fb5cb7b3", + "id": "082b310b", "metadata": { "hide-output": false }, @@ -366,7 +366,7 @@ }, { "cell_type": "markdown", - "id": "b0fb990d", + "id": "e7257a07", "metadata": {}, "source": [ "Now let’s consider Japan, which experienced rapid growth in the 1960s and\n", @@ -379,7 +379,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b892b489", + "id": "9977d2cf", "metadata": { "hide-output": false }, @@ -396,7 +396,7 @@ }, { "cell_type": "markdown", - "id": "700b188e", + "id": "6510b528", "metadata": {}, "source": [ "Now let’s study Greece." @@ -405,7 +405,7 @@ { "cell_type": "code", "execution_count": null, - "id": "86240e1e", + "id": "b3bbde40", "metadata": { "hide-output": false }, @@ -422,7 +422,7 @@ }, { "cell_type": "markdown", - "id": "061f35df", + "id": "f519876e", "metadata": {}, "source": [ "Greece experienced a very large drop in GDP growth around 2010-2011, during the peak\n", @@ -434,7 +434,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16e723e6", + "id": "c66b1f01", "metadata": { "hide-output": false }, @@ -451,7 +451,7 @@ }, { "cell_type": "markdown", - "id": "feb15af4", + "id": "2b735630", "metadata": {}, "source": [ "Notice that Argentina has experienced far more volatile cycles than\n", @@ -463,7 +463,7 @@ }, { "cell_type": "markdown", - "id": "4952452e", + "id": "6341e5fb", "metadata": {}, "source": [ "## Unemployment\n", @@ -476,7 +476,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1b182dda", + "id": "184b4f14", "metadata": { "hide-output": false }, @@ -499,7 +499,7 @@ }, { "cell_type": "markdown", - "id": "e7f00b17", + "id": "1ad1b992", "metadata": {}, "source": [ "Let’s plot the unemployment rate in the US from 1929 to 2022 with recessions\n", @@ -509,7 +509,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4c6792a2", + "id": "54be2edb", "metadata": { "hide-output": false }, @@ -559,7 +559,7 @@ }, { "cell_type": "markdown", - "id": "c39c9e17", + "id": "b0316728", "metadata": {}, "source": [ "The plot shows that\n", @@ -581,7 +581,7 @@ }, { "cell_type": "markdown", - "id": "ee43ae21", + "id": "409634c5", "metadata": {}, "source": [ "## Synchronization\n", @@ -600,7 +600,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0cdcd98f", + "id": "3fd952ee", "metadata": { "hide-output": false }, @@ -680,7 +680,7 @@ }, { "cell_type": "markdown", - "id": "08dd7402", + "id": "a3d84163", "metadata": {}, "source": [ "Here we compare the GDP growth rate of developed economies and developing economies." @@ -689,7 +689,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cdb58cbc", + "id": "7117fc8c", "metadata": { "hide-output": false }, @@ -705,7 +705,7 @@ }, { "cell_type": "markdown", - "id": "2d154d7d", + "id": "47f22bc6", "metadata": {}, "source": [ "We use the United Kingdom, United States, Germany, and Japan as examples of developed economies." @@ -714,7 +714,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b621e58d", + "id": "225007f5", "metadata": { "hide-output": false }, @@ -732,7 +732,7 @@ }, { "cell_type": "markdown", - "id": "09ab407c", + "id": "78f80e60", "metadata": {}, "source": [ "We choose Brazil, China, Argentina, and Mexico as representative developing economies." @@ -741,7 +741,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ec279a3", + "id": "0c772c81", "metadata": { "hide-output": false }, @@ -758,7 +758,7 @@ }, { "cell_type": "markdown", - "id": "bf3c3575", + "id": "bf7c3abd", "metadata": {}, "source": [ "The comparison of GDP growth rates above suggests that\n", @@ -780,7 +780,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e03211c7", + "id": "58b85750", "metadata": { "hide-output": false }, @@ -803,7 +803,7 @@ }, { "cell_type": "markdown", - "id": "fe546fc0", + "id": "4679d15f", "metadata": {}, "source": [ "We see that France, with its strong labor unions, typically experiences\n", @@ -814,7 +814,7 @@ }, { "cell_type": "markdown", - "id": "5e567cc7", + "id": "eb5314c3", "metadata": {}, "source": [ "## Leading indicators and correlated factors\n", @@ -828,7 +828,7 @@ }, { "cell_type": "markdown", - "id": "a10c3238", + "id": "3933c3e6", "metadata": {}, "source": [ "### Consumption\n", @@ -848,7 +848,7 @@ { "cell_type": "code", "execution_count": null, - "id": "46d2c1e0", + "id": "5ec56466", "metadata": { "hide-output": false }, @@ -907,7 +907,7 @@ }, { "cell_type": "markdown", - "id": "e9e1caa4", + "id": "4697ae68", "metadata": {}, "source": [ "We see that\n", @@ -924,7 +924,7 @@ }, { "cell_type": "markdown", - "id": "aee241a6", + "id": "e08f0070", "metadata": {}, "source": [ "### Production\n", @@ -941,7 +941,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4cabbadb", + "id": "24d39985", "metadata": { "hide-output": false }, @@ -972,7 +972,7 @@ }, { "cell_type": "markdown", - "id": "9adcbf9d", + "id": "03bac718", "metadata": {}, "source": [ "We observe the delayed contraction in the plot across recessions." @@ -980,7 +980,7 @@ }, { "cell_type": "markdown", - "id": "7f4af7a3", + "id": "6d060583", "metadata": {}, "source": [ "### Credit level\n", @@ -1000,7 +1000,7 @@ { "cell_type": "code", "execution_count": null, - "id": "206fd779", + "id": "e2384513", "metadata": { "hide-output": false }, @@ -1023,7 +1023,7 @@ }, { "cell_type": "markdown", - "id": "d5e1a1d0", + "id": "4235004e", "metadata": {}, "source": [ "Note that the credit rises during economic expansions\n", @@ -1032,7 +1032,7 @@ } ], "metadata": { - "date": 1712122261.9873269, + "date": 1712983675.6455753, "filename": "business_cycle.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/cagan_adaptive.ipynb b/_notebooks/cagan_adaptive.ipynb index 952219af..948c5e1a 100644 --- a/_notebooks/cagan_adaptive.ipynb +++ b/_notebooks/cagan_adaptive.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "77722fac", + "id": "aa9e513b", "metadata": {}, "source": [ "# Monetarist Theory of Price Levels with Adaptive Expectations" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "d923f9fc", + "id": "0c50ed97", "metadata": {}, "source": [ "## Overview\n", @@ -41,7 +41,7 @@ }, { "cell_type": "markdown", - "id": "b0b8d510", + "id": "806f34ea", "metadata": {}, "source": [ "## Structure of the model\n", @@ -106,7 +106,7 @@ }, { "cell_type": "markdown", - "id": "b1530b31", + "id": "b15e5a03", "metadata": {}, "source": [ "## Representing key equations with linear algebra\n", @@ -183,7 +183,7 @@ }, { "cell_type": "markdown", - "id": "8f1eca3c", + "id": "58af0f92", "metadata": {}, "source": [ "## Harvesting insights from our matrix formulation\n", @@ -295,7 +295,7 @@ }, { "cell_type": "markdown", - "id": "b3508953", + "id": "61d3ae41", "metadata": {}, "source": [ "## Forecast errors and model computation\n", @@ -328,7 +328,7 @@ { "cell_type": "code", "execution_count": null, - "id": "06688aaa", + "id": "f18282cf", "metadata": { "hide-output": false }, @@ -342,7 +342,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36039ccd", + "id": "b336fe45", "metadata": { "hide-output": false }, @@ -359,7 +359,7 @@ }, { "cell_type": "markdown", - "id": "6da0dc2a", + "id": "ef3bb853", "metadata": {}, "source": [ "We solve the model and plot variables of interests using the following functions." @@ -368,7 +368,7 @@ { "cell_type": "code", "execution_count": null, - "id": "987352f5", + "id": "978d8dd1", "metadata": { "hide-output": false }, @@ -405,7 +405,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ba296661", + "id": "d95a4f66", "metadata": { "hide-output": false }, @@ -442,7 +442,7 @@ }, { "cell_type": "markdown", - "id": "681d855d", + "id": "cf6d28f2", "metadata": {}, "source": [ "## Technical condition for stability\n", @@ -471,7 +471,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d960be8c", + "id": "44f0d5bf", "metadata": { "hide-output": false }, @@ -482,7 +482,7 @@ }, { "cell_type": "markdown", - "id": "6e9ede28", + "id": "c0e2a0c1", "metadata": {}, "source": [ "## Experiments\n", @@ -492,7 +492,7 @@ }, { "cell_type": "markdown", - "id": "0ef59490", + "id": "a5aa5d4d", "metadata": {}, "source": [ "### Experiment 1\n", @@ -519,7 +519,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b461c3d6", + "id": "fd943f04", "metadata": { "hide-output": false }, @@ -538,7 +538,7 @@ }, { "cell_type": "markdown", - "id": "a98a6397", + "id": "f1a8546c", "metadata": {}, "source": [ "We invite the reader to compare outcomes with those under rational expectations studied in [A Monetarist Theory of Price Levels](https://intro.quantecon.org/cagan_ree.html).\n", @@ -550,7 +550,7 @@ }, { "cell_type": "markdown", - "id": "77f21cf8", + "id": "f3e1f312", "metadata": {}, "source": [ "### Experiment 2\n", @@ -566,7 +566,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5d680745", + "id": "b3d07557", "metadata": { "hide-output": false }, @@ -584,7 +584,7 @@ } ], "metadata": { - "date": 1712122262.0105002, + "date": 1712983675.6674275, "filename": "cagan_adaptive.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/cagan_ree.ipynb b/_notebooks/cagan_ree.ipynb index b677e817..52500ea4 100644 --- a/_notebooks/cagan_ree.ipynb +++ b/_notebooks/cagan_ree.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "41c68cb6", + "id": "02efa782", "metadata": {}, "source": [ "# A Monetarist Theory of Price Levels" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "1fa681e1", + "id": "6b34d1f0", "metadata": {}, "source": [ "## Overview\n", @@ -65,7 +65,7 @@ }, { "cell_type": "markdown", - "id": "c27c1168", + "id": "ce69fdc9", "metadata": {}, "source": [ "## Structure of the model\n", @@ -223,7 +223,7 @@ }, { "cell_type": "markdown", - "id": "94275ac5", + "id": "77841f1d", "metadata": {}, "source": [ "## Continuation values\n", @@ -261,7 +261,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45a96706", + "id": "f64b36f2", "metadata": { "hide-output": false }, @@ -274,7 +274,7 @@ }, { "cell_type": "markdown", - "id": "3c9c6eee", + "id": "68baf81c", "metadata": {}, "source": [ "First, we store parameters in a `namedtuple`:" @@ -283,7 +283,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a703d35d", + "id": "a1da6cd6", "metadata": { "hide-output": false }, @@ -306,7 +306,7 @@ }, { "cell_type": "markdown", - "id": "3ce5ed9b", + "id": "ce787451", "metadata": {}, "source": [ "Now we can solve the model to compute $ \\pi_t $, $ m_t $ and $ p_t $ for $ t =1, \\ldots, T+1 $ using the matrix equation above" @@ -315,7 +315,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8800c12", + "id": "376765fb", "metadata": { "hide-output": false }, @@ -345,7 +345,7 @@ }, { "cell_type": "markdown", - "id": "812d4118", + "id": "92ad494f", "metadata": {}, "source": [ "### Some quantitative experiments\n", @@ -368,7 +368,7 @@ }, { "cell_type": "markdown", - "id": "6c69ed54", + "id": "71a5639e", "metadata": {}, "source": [ "#### Experiment 1: Foreseen sudden stabilization\n", @@ -397,7 +397,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2c4b0806", + "id": "9466b7c9", "metadata": { "hide-output": false }, @@ -418,7 +418,7 @@ }, { "cell_type": "markdown", - "id": "da3ef9ac", + "id": "098a43eb", "metadata": {}, "source": [ "Now we use the following function to plot the result" @@ -427,7 +427,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bbe3dbd6", + "id": "01c392e6", "metadata": { "hide-output": false }, @@ -449,7 +449,7 @@ }, { "cell_type": "markdown", - "id": "9b86d4fc", + "id": "2ef1811a", "metadata": {}, "source": [ "The plot of the money growth rate $ \\mu_t $ in the top level panel portrays\n", @@ -471,7 +471,7 @@ }, { "cell_type": "markdown", - "id": "b2f4f000", + "id": "da3d3a2b", "metadata": {}, "source": [ "### The log price level\n", @@ -507,7 +507,7 @@ }, { "cell_type": "markdown", - "id": "9e6bc9a1", + "id": "e2514428", "metadata": {}, "source": [ "### What jumps?\n", @@ -540,7 +540,7 @@ }, { "cell_type": "markdown", - "id": "f0d522f8", + "id": "f9faf029", "metadata": {}, "source": [ "#### Technical details about whether $ p $ or $ m $ jumps at $ T_1 $\n", @@ -554,7 +554,7 @@ }, { "cell_type": "markdown", - "id": "b12d48c8", + "id": "2e90ef63", "metadata": {}, "source": [ "#### $ m_{T_{1}} $ does not jump.\n", @@ -570,7 +570,7 @@ }, { "cell_type": "markdown", - "id": "b557910f", + "id": "fddb96c9", "metadata": {}, "source": [ "#### $ m_{T_{1}} $ jumps.\n", @@ -590,7 +590,7 @@ }, { "cell_type": "markdown", - "id": "67178177", + "id": "d68c25f8", "metadata": {}, "source": [ "#### Experiment 2: an unforeseen sudden stabilization\n", @@ -631,7 +631,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3426d34e", + "id": "1ec06854", "metadata": { "hide-output": false }, @@ -676,7 +676,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5b456107", + "id": "cd1bc47b", "metadata": { "hide-output": false }, @@ -720,7 +720,7 @@ }, { "cell_type": "markdown", - "id": "588555b4", + "id": "187dfb48", "metadata": {}, "source": [ "We invite you to compare these graphs with corresponding ones for the foreseen stabilization analyzed in experiment 1 above.\n", @@ -748,7 +748,7 @@ { "cell_type": "code", "execution_count": null, - "id": "666d2360", + "id": "cb42c614", "metadata": { "hide-output": false }, @@ -776,7 +776,7 @@ }, { "cell_type": "markdown", - "id": "499427c4", + "id": "6e74dd8c", "metadata": {}, "source": [ "It is instructive to compare the preceding graphs with graphs of log price levels and inflation rates for data from four big inflations described in\n", @@ -793,7 +793,7 @@ }, { "cell_type": "markdown", - "id": "77ce196c", + "id": "d03edab2", "metadata": {}, "source": [ "#### Experiment 3\n", @@ -817,7 +817,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db976fef", + "id": "98cc474c", "metadata": { "hide-output": false }, @@ -840,7 +840,7 @@ }, { "cell_type": "markdown", - "id": "1316c8de", + "id": "2ebc55c7", "metadata": {}, "source": [ "## Sequel\n", @@ -854,7 +854,7 @@ } ], "metadata": { - "date": 1712122262.0421054, + "date": 1712983675.696842, "filename": "cagan_ree.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/cobweb.ipynb b/_notebooks/cobweb.ipynb index ed6d16f4..2b55c63e 100644 --- a/_notebooks/cobweb.ipynb +++ b/_notebooks/cobweb.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "3bbd34e2", + "id": "a01a7dfc", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "5ff7696c", + "id": "7f43dfde", "metadata": {}, "source": [ "# The Cobweb Model\n", @@ -21,7 +21,7 @@ }, { "cell_type": "markdown", - "id": "aa854fd9", + "id": "38c65fc6", "metadata": {}, "source": [ "## Overview\n", @@ -69,7 +69,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7d122d31", + "id": "09fa16b5", "metadata": { "hide-output": false }, @@ -81,7 +81,7 @@ }, { "cell_type": "markdown", - "id": "369023e8", + "id": "fe655613", "metadata": {}, "source": [ "## History\n", @@ -98,7 +98,7 @@ { "cell_type": "code", "execution_count": null, - "id": "106257e8", + "id": "4e0a8c23", "metadata": { "hide-output": false }, @@ -119,7 +119,7 @@ }, { "cell_type": "markdown", - "id": "f62a1f76", + "id": "c3c04057", "metadata": {}, "source": [ "## The model\n", @@ -154,7 +154,7 @@ { "cell_type": "code", "execution_count": null, - "id": "74a3871d", + "id": "e906dc0b", "metadata": { "hide-output": false }, @@ -182,7 +182,7 @@ }, { "cell_type": "markdown", - "id": "55de3e03", + "id": "656e6ebc", "metadata": {}, "source": [ "Now let’s plot." @@ -191,7 +191,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bfb1dfa5", + "id": "5e51c33f", "metadata": { "hide-output": false }, @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "9313080e", + "id": "58cf05af", "metadata": {}, "source": [ "Market equilibrium requires that supply equals demand, or\n", @@ -258,7 +258,7 @@ }, { "cell_type": "markdown", - "id": "a90a729d", + "id": "b4873996", "metadata": {}, "source": [ "## Naive expectations\n", @@ -299,7 +299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1b3fbd1", + "id": "8209467a", "metadata": { "hide-output": false }, @@ -317,7 +317,7 @@ }, { "cell_type": "markdown", - "id": "e8a14c9c", + "id": "e3dc6428", "metadata": {}, "source": [ "Let’s try to understand how prices will evolve using a 45 degree diagram, which is a tool for studying one-dimensional dynamics.\n", @@ -328,7 +328,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2f580176", + "id": "2bfc5c65", "metadata": { "hide-output": false }, @@ -406,7 +406,7 @@ }, { "cell_type": "markdown", - "id": "cdc9e4b0", + "id": "9598a519", "metadata": {}, "source": [ "Now we can set up a market and plot the 45 degree diagram." @@ -415,7 +415,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3cf491f5", + "id": "d848070b", "metadata": { "hide-output": false }, @@ -427,7 +427,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d1454ba8", + "id": "ffa894eb", "metadata": { "hide-output": false }, @@ -438,7 +438,7 @@ }, { "cell_type": "markdown", - "id": "45256e0e", + "id": "09708293", "metadata": {}, "source": [ "The plot shows the function $ g $ defined in [(23.3)](#equation-def-g) and the $ 45 $ degree line.\n", @@ -468,7 +468,7 @@ { "cell_type": "code", "execution_count": null, - "id": "695dbca0", + "id": "211cbfd1", "metadata": { "hide-output": false }, @@ -504,7 +504,7 @@ { "cell_type": "code", "execution_count": null, - "id": "82810422", + "id": "6b52cc3c", "metadata": { "hide-output": false }, @@ -515,7 +515,7 @@ }, { "cell_type": "markdown", - "id": "25edce8d", + "id": "eb46b3ca", "metadata": {}, "source": [ "We see that a cycle has formed and the cycle is persistent.\n", @@ -530,7 +530,7 @@ { "cell_type": "code", "execution_count": null, - "id": "81bdf0c6", + "id": "e58db7ef", "metadata": { "hide-output": false }, @@ -541,7 +541,7 @@ }, { "cell_type": "markdown", - "id": "b5f5c5e4", + "id": "696ab7e4", "metadata": {}, "source": [ "## Adaptive expectations\n", @@ -591,7 +591,7 @@ { "cell_type": "code", "execution_count": null, - "id": "870ea75b", + "id": "a71c9788", "metadata": { "hide-output": false }, @@ -607,7 +607,7 @@ }, { "cell_type": "markdown", - "id": "64687164", + "id": "919e01c2", "metadata": {}, "source": [ "The function below plots price dynamics under adaptive expectations for different values of $ \\alpha $." @@ -616,7 +616,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ea72db0", + "id": "85904010", "metadata": { "hide-output": false }, @@ -641,7 +641,7 @@ }, { "cell_type": "markdown", - "id": "bab64f54", + "id": "1f4f36d1", "metadata": {}, "source": [ "Let’s call the function with prices starting at $ p_0 = 5 $.\n", @@ -652,7 +652,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e4601775", + "id": "7e56c692", "metadata": { "hide-output": false }, @@ -663,7 +663,7 @@ }, { "cell_type": "markdown", - "id": "5658f85e", + "id": "a1793d5e", "metadata": {}, "source": [ "Note that if $ \\alpha=1 $, then adaptive expectations are just naive expectation.\n", @@ -678,7 +678,7 @@ }, { "cell_type": "markdown", - "id": "00682cdf", + "id": "c5dcb5e4", "metadata": {}, "source": [ "## Exercises" @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "909c4356", + "id": "562edaa0", "metadata": {}, "source": [ "## Exercise 23.1\n", @@ -698,7 +698,7 @@ }, { "cell_type": "markdown", - "id": "ff6ad610", + "id": "ee92f2da", "metadata": {}, "source": [ "## Solution to[ Exercise 23.1](https://intro.quantecon.org/#cobweb_ex1)" @@ -707,7 +707,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1ba144eb", + "id": "c5752f4e", "metadata": { "hide-output": false }, @@ -745,7 +745,7 @@ { "cell_type": "code", "execution_count": null, - "id": "990f8dcd", + "id": "ffdf52cd", "metadata": { "hide-output": false }, @@ -757,7 +757,7 @@ }, { "cell_type": "markdown", - "id": "35bfe5dd", + "id": "2b3a1e3b", "metadata": {}, "source": [ "## Exercise 23.2\n", @@ -781,7 +781,7 @@ }, { "cell_type": "markdown", - "id": "5d627703", + "id": "b743e61e", "metadata": {}, "source": [ "## Solution to[ Exercise 23.2](https://intro.quantecon.org/#cobweb_ex2)" @@ -790,7 +790,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ab66603f", + "id": "9d9f7451", "metadata": { "hide-output": false }, @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "64a1fbbb", + "id": "dfaa8b66", "metadata": { "hide-output": false }, @@ -841,7 +841,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4d53f366", + "id": "5eb99418", "metadata": { "hide-output": false }, @@ -857,7 +857,7 @@ } ], "metadata": { - "date": 1712122262.0678048, + "date": 1712983675.72058, "filename": "cobweb.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/commod_price.ipynb b/_notebooks/commod_price.ipynb index e794e1ad..f23b165d 100644 --- a/_notebooks/commod_price.ipynb +++ b/_notebooks/commod_price.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "d71c86d2", + "id": "4ef0de87", "metadata": {}, "source": [ "# Commodity Prices" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "54980db4", + "id": "f5d48ed7", "metadata": {}, "source": [ "## Outline\n", @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f9d1161d", + "id": "5534b5eb", "metadata": { "hide-output": false }, @@ -51,7 +51,7 @@ }, { "cell_type": "markdown", - "id": "ae74fb4b", + "id": "b3f50b5f", "metadata": {}, "source": [ "We will use the following imports" @@ -60,7 +60,7 @@ { "cell_type": "code", "execution_count": null, - "id": "173ee82f", + "id": "2a39658e", "metadata": { "hide-output": false }, @@ -76,7 +76,7 @@ }, { "cell_type": "markdown", - "id": "94595f8c", + "id": "5b901ba2", "metadata": {}, "source": [ "## Data\n", @@ -87,7 +87,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b3830f5a", + "id": "9676dda4", "metadata": { "hide-output": false }, @@ -99,7 +99,7 @@ { "cell_type": "code", "execution_count": null, - "id": "76bc8559", + "id": "55997b32", "metadata": { "hide-output": false }, @@ -116,7 +116,7 @@ }, { "cell_type": "markdown", - "id": "5d72c1c1", + "id": "b53ecabf", "metadata": {}, "source": [ "The figure shows surprisingly large movements in the price of cotton.\n", @@ -144,7 +144,7 @@ }, { "cell_type": "markdown", - "id": "b11e1cd4", + "id": "8d55e4fa", "metadata": {}, "source": [ "## The competitive storage model\n", @@ -176,7 +176,7 @@ }, { "cell_type": "markdown", - "id": "64970e5e", + "id": "7a18adb1", "metadata": {}, "source": [ "## The model\n", @@ -208,7 +208,7 @@ }, { "cell_type": "markdown", - "id": "aab5e5cb", + "id": "8000b475", "metadata": {}, "source": [ "## Equilibrium\n", @@ -218,7 +218,7 @@ }, { "cell_type": "markdown", - "id": "e9d928cd", + "id": "3da30d94", "metadata": {}, "source": [ "### Equilibrium conditions\n", @@ -278,7 +278,7 @@ }, { "cell_type": "markdown", - "id": "78526dbc", + "id": "12f4cd5b", "metadata": {}, "source": [ "### An equilibrium function\n", @@ -363,7 +363,7 @@ }, { "cell_type": "markdown", - "id": "5e9869e6", + "id": "ba9b1a2b", "metadata": {}, "source": [ "### Computing the equilibrium\n", @@ -424,7 +424,7 @@ }, { "cell_type": "markdown", - "id": "a4f4e96b", + "id": "decb9d5d", "metadata": {}, "source": [ "## Code\n", @@ -440,7 +440,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e6a26ca", + "id": "16155522", "metadata": { "hide-output": false }, @@ -497,7 +497,7 @@ }, { "cell_type": "markdown", - "id": "d2f90f54", + "id": "7839c232", "metadata": {}, "source": [ "The figure above shows the inverse demand curve $ P $, which is also $ p_0 $, as\n", @@ -510,7 +510,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8b146d5f", + "id": "f9e3798e", "metadata": { "hide-output": false }, @@ -542,7 +542,7 @@ } ], "metadata": { - "date": 1712122262.1038785, + "date": 1712983675.7542555, "filename": "commod_price.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/complex_and_trig.ipynb b/_notebooks/complex_and_trig.ipynb index f1802eca..1fe8e61d 100644 --- a/_notebooks/complex_and_trig.ipynb +++ b/_notebooks/complex_and_trig.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "2facbfb9", + "id": "4a1f08a1", "metadata": {}, "source": [ "\n", @@ -13,7 +13,7 @@ }, { "cell_type": "markdown", - "id": "2d1f4fc2", + "id": "131613be", "metadata": {}, "source": [ "# Complex Numbers and Trigonometry" @@ -21,7 +21,7 @@ }, { "cell_type": "markdown", - "id": "e94be9e4", + "id": "53ab205a", "metadata": {}, "source": [ "# Migrated lecture\n", @@ -31,7 +31,7 @@ }, { "cell_type": "markdown", - "id": "2dfc8d15", + "id": "8dd50d04", "metadata": {}, "source": [ "## Overview\n", @@ -55,7 +55,7 @@ }, { "cell_type": "markdown", - "id": "1cc239ee", + "id": "a51cee4e", "metadata": {}, "source": [ "### Complex Numbers\n", @@ -115,7 +115,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5c14fc3", + "id": "34f7eb96", "metadata": { "hide-output": false }, @@ -130,7 +130,7 @@ }, { "cell_type": "markdown", - "id": "69fb6998", + "id": "129c9b0c", "metadata": {}, "source": [ "### An Example\n", @@ -149,7 +149,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ecb737dd", + "id": "1943f9bf", "metadata": { "hide-output": false }, @@ -196,7 +196,7 @@ }, { "cell_type": "markdown", - "id": "9e3dcd2e", + "id": "91c01148", "metadata": {}, "source": [ "## De Moivre’s Theorem\n", @@ -220,7 +220,7 @@ }, { "cell_type": "markdown", - "id": "ca4ea6b6", + "id": "8a9c7bc4", "metadata": {}, "source": [ "## Applications of de Moivre’s Theorem" @@ -228,7 +228,7 @@ }, { "cell_type": "markdown", - "id": "8cbcbd80", + "id": "01bbd1c1", "metadata": {}, "source": [ "### Example 1\n", @@ -259,7 +259,7 @@ }, { "cell_type": "markdown", - "id": "e060bc23", + "id": "e1ac0c70", "metadata": {}, "source": [ "### Example 2\n", @@ -291,7 +291,7 @@ }, { "cell_type": "markdown", - "id": "2acaff0b", + "id": "24485073", "metadata": {}, "source": [ "### Example 3\n", @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "232e4c6e", + "id": "c0f98dc3", "metadata": { "hide-output": false }, @@ -394,7 +394,7 @@ }, { "cell_type": "markdown", - "id": "3daa9f4c", + "id": "b9e83449", "metadata": {}, "source": [ "Using the code above, we compute that\n", @@ -407,7 +407,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e443a8b3", + "id": "40045008", "metadata": { "hide-output": false }, @@ -447,7 +447,7 @@ }, { "cell_type": "markdown", - "id": "5a0feab5", + "id": "d637519f", "metadata": {}, "source": [ "### Trigonometric Identities\n", @@ -506,7 +506,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4472dd93", + "id": "81f84309", "metadata": { "hide-output": false }, @@ -524,7 +524,7 @@ }, { "cell_type": "markdown", - "id": "516a3678", + "id": "4dfaa7b6", "metadata": {}, "source": [ "### Trigonometric Integrals\n", @@ -581,7 +581,7 @@ { "cell_type": "code", "execution_count": null, - "id": "06d629f4", + "id": "59fb46b4", "metadata": { "hide-output": false }, @@ -598,7 +598,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0cb1289d", + "id": "b78c3d9c", "metadata": { "hide-output": false }, @@ -611,7 +611,7 @@ }, { "cell_type": "markdown", - "id": "ed68400e", + "id": "0492bec4", "metadata": {}, "source": [ "### Exercises" @@ -619,7 +619,7 @@ }, { "cell_type": "markdown", - "id": "c0e9ef3d", + "id": "1b00fde2", "metadata": {}, "source": [ "### Exercise 8.1\n", @@ -637,7 +637,7 @@ }, { "cell_type": "markdown", - "id": "043ed510", + "id": "8565c4fe", "metadata": {}, "source": [ "### Solution to[ Exercise 8.1](https://intro.quantecon.org/#complex_ex1)\n", @@ -648,7 +648,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0f06aa19", + "id": "942a74fa", "metadata": { "hide-output": false }, @@ -661,7 +661,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8c267678", + "id": "76f77763", "metadata": { "hide-output": false }, @@ -676,7 +676,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6cd3b12e", + "id": "f8825761", "metadata": { "hide-output": false }, @@ -690,7 +690,7 @@ } ], "metadata": { - "date": 1712122262.1259174, + "date": 1712983675.7741365, "filename": "complex_and_trig.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/cons_smooth.ipynb b/_notebooks/cons_smooth.ipynb index f8cf1932..0eb73f86 100644 --- a/_notebooks/cons_smooth.ipynb +++ b/_notebooks/cons_smooth.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "269efe1b", + "id": "65a3be58", "metadata": {}, "source": [ "# Consumption Smoothing" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "64733d65", + "id": "664c802e", "metadata": {}, "source": [ "## Overview\n", @@ -37,7 +37,7 @@ }, { "cell_type": "markdown", - "id": "43d0c719", + "id": "3b909b6e", "metadata": {}, "source": [ "## Analysis\n", @@ -48,7 +48,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bf953664", + "id": "a2d92596", "metadata": { "hide-output": false }, @@ -61,7 +61,7 @@ }, { "cell_type": "markdown", - "id": "23b494cd", + "id": "f1dd9bba", "metadata": {}, "source": [ "The model describes a consumer who lives from time $ t=0, 1, \\ldots, T $, receives a stream $ \\{y_t\\}_{t=0}^T $ of non-financial income and chooses a consumption stream $ \\{c_t\\}_{t=0}^T $.\n", @@ -156,7 +156,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f64a958b", + "id": "aa37a772", "metadata": { "hide-output": false }, @@ -174,7 +174,7 @@ }, { "cell_type": "markdown", - "id": "2598393d", + "id": "63f46857", "metadata": {}, "source": [ "## Friedman-Hall consumption-smoothing model\n", @@ -230,7 +230,7 @@ }, { "cell_type": "markdown", - "id": "53bfbe4b", + "id": "9f5dfdb7", "metadata": {}, "source": [ "## Mechanics of Consumption smoothing model\n", @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "883f21e2", + "id": "020a27ee", "metadata": {}, "source": [ "### Step 1\n", @@ -257,7 +257,7 @@ }, { "cell_type": "markdown", - "id": "c5a05e78", + "id": "7f0c3a7c", "metadata": {}, "source": [ "### Step 2\n", @@ -271,7 +271,7 @@ }, { "cell_type": "markdown", - "id": "3776d4b1", + "id": "13e98352", "metadata": {}, "source": [ "### Step 3\n", @@ -317,7 +317,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cb62bbeb", + "id": "4914267c", "metadata": { "hide-output": false }, @@ -346,7 +346,7 @@ }, { "cell_type": "markdown", - "id": "7ef7e7e6", + "id": "67abf451", "metadata": {}, "source": [ "We use an example where the consumer inherits $ a_0<0 $.\n", @@ -361,7 +361,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d55f9f80", + "id": "bebf60be", "metadata": { "hide-output": false }, @@ -382,7 +382,7 @@ }, { "cell_type": "markdown", - "id": "4ab3a2ef", + "id": "ec452be7", "metadata": {}, "source": [ "The graphs below show paths of non-financial income, consumption, and financial assets." @@ -391,7 +391,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1d15704e", + "id": "37cd3c2a", "metadata": { "hide-output": false }, @@ -413,7 +413,7 @@ }, { "cell_type": "markdown", - "id": "ad348dcd", + "id": "cb2592d6", "metadata": {}, "source": [ "Note that $ a_{T+1} = 0 $, as anticipated.\n", @@ -424,7 +424,7 @@ { "cell_type": "code", "execution_count": null, - "id": "57a9fbf4", + "id": "c5098134", "metadata": { "hide-output": false }, @@ -441,7 +441,7 @@ }, { "cell_type": "markdown", - "id": "b5e159f0", + "id": "274fe730", "metadata": {}, "source": [ "### Experiments\n", @@ -456,7 +456,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3e419911", + "id": "d10bca38", "metadata": { "hide-output": false }, @@ -487,7 +487,7 @@ }, { "cell_type": "markdown", - "id": "39b1cbfc", + "id": "1e17a435", "metadata": {}, "source": [ "In the experiments below, please study how consumption and financial asset sequences vary accross different sequences for non-financial income." @@ -495,7 +495,7 @@ }, { "cell_type": "markdown", - "id": "97e8738f", + "id": "eb7d3532", "metadata": {}, "source": [ "#### Experiment 1: one-time gain/loss\n", @@ -508,7 +508,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53553ca2", + "id": "93f3a4b2", "metadata": { "hide-output": false }, @@ -523,7 +523,7 @@ { "cell_type": "code", "execution_count": null, - "id": "78a7c104", + "id": "07de56d8", "metadata": { "hide-output": false }, @@ -537,7 +537,7 @@ }, { "cell_type": "markdown", - "id": "3af257af", + "id": "49a25ed8", "metadata": {}, "source": [ "#### Experiment 2: permanent wage gain/loss\n", @@ -550,7 +550,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c3be49f9", + "id": "f2bfb8d2", "metadata": { "hide-output": false }, @@ -566,7 +566,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a3b5e61c", + "id": "540d3f38", "metadata": { "hide-output": false }, @@ -581,7 +581,7 @@ }, { "cell_type": "markdown", - "id": "fb20295b", + "id": "5f4eac14", "metadata": {}, "source": [ "#### Experiment 3: a late starter\n", @@ -592,7 +592,7 @@ { "cell_type": "code", "execution_count": null, - "id": "94a66358", + "id": "1e829ea1", "metadata": { "hide-output": false }, @@ -607,7 +607,7 @@ }, { "cell_type": "markdown", - "id": "b1bc4c1b", + "id": "040daf6d", "metadata": {}, "source": [ "#### Experiment 4: geometric earner\n", @@ -620,7 +620,7 @@ { "cell_type": "code", "execution_count": null, - "id": "886f95ed", + "id": "d7a5e4ce", "metadata": { "hide-output": false }, @@ -641,7 +641,7 @@ }, { "cell_type": "markdown", - "id": "2d9e0a01", + "id": "83938284", "metadata": {}, "source": [ "Now we show the behavior when $ \\lambda = 0.95 $" @@ -650,7 +650,7 @@ { "cell_type": "code", "execution_count": null, - "id": "98cf3e30", + "id": "a9653392", "metadata": { "hide-output": false }, @@ -667,7 +667,7 @@ }, { "cell_type": "markdown", - "id": "82f9b540", + "id": "69c5e369", "metadata": {}, "source": [ "What happens when $ \\lambda $ is negative" @@ -676,7 +676,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce5fe6c6", + "id": "1d87592c", "metadata": { "hide-output": false }, @@ -693,7 +693,7 @@ }, { "cell_type": "markdown", - "id": "d9d6557d", + "id": "5b8dab03", "metadata": {}, "source": [ "### Feasible consumption variations\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "793d980f", + "id": "d7c4257f", "metadata": { "hide-output": false }, @@ -793,7 +793,7 @@ }, { "cell_type": "markdown", - "id": "5f4d029f", + "id": "791e62f2", "metadata": {}, "source": [ "We visualize variations for $ \\xi_1 \\in \\{.01, .05\\} $ and $ \\phi \\in \\{.95, 1.02\\} $" @@ -802,7 +802,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10227338", + "id": "3d65afd7", "metadata": { "hide-output": false }, @@ -843,7 +843,7 @@ }, { "cell_type": "markdown", - "id": "6f9faa3f", + "id": "b712cde1", "metadata": {}, "source": [ "We can even use the Python `np.gradient` command to compute derivatives of welfare with respect to our two parameters.\n", @@ -856,7 +856,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b38563e5", + "id": "cac74e78", "metadata": { "hide-output": false }, @@ -880,7 +880,7 @@ }, { "cell_type": "markdown", - "id": "5d14cb76", + "id": "f45d5c0a", "metadata": {}, "source": [ "Then we can visualize the relationship between welfare and $ \\xi_1 $ and compute its derivatives" @@ -889,7 +889,7 @@ { "cell_type": "code", "execution_count": null, - "id": "afb76383", + "id": "e253799d", "metadata": { "hide-output": false }, @@ -912,7 +912,7 @@ }, { "cell_type": "markdown", - "id": "85fb7e06", + "id": "ce1efb20", "metadata": {}, "source": [ "The same can be done on $ \\phi $" @@ -921,7 +921,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22907042", + "id": "ab2e2fba", "metadata": { "hide-output": false }, @@ -944,7 +944,7 @@ }, { "cell_type": "markdown", - "id": "5ba7bbaf", + "id": "d61b7e91", "metadata": {}, "source": [ "## Wrapping up the consumption-smoothing model\n", @@ -961,7 +961,7 @@ }, { "cell_type": "markdown", - "id": "a7529685", + "id": "416c25fa", "metadata": {}, "source": [ "## Appendix: solving difference equations with linear algebra\n", @@ -980,7 +980,7 @@ }, { "cell_type": "markdown", - "id": "f5a5faa6", + "id": "f6526072", "metadata": {}, "source": [ "### First-order difference equation\n", @@ -1038,7 +1038,7 @@ }, { "cell_type": "markdown", - "id": "a87ade61", + "id": "c6db9976", "metadata": {}, "source": [ "### Exercise 11.1\n", @@ -1060,7 +1060,7 @@ }, { "cell_type": "markdown", - "id": "183d8a0a", + "id": "8b5b06d9", "metadata": {}, "source": [ "### Second order difference equation\n", @@ -1097,7 +1097,7 @@ }, { "cell_type": "markdown", - "id": "83973ec6", + "id": "f7b5331b", "metadata": {}, "source": [ "### Exercise 11.2\n", @@ -1108,7 +1108,7 @@ } ], "metadata": { - "date": 1712122262.1658618, + "date": 1712983675.997845, "filename": "cons_smooth.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/eigen_I.ipynb b/_notebooks/eigen_I.ipynb index d1867b73..a742b872 100644 --- a/_notebooks/eigen_I.ipynb +++ b/_notebooks/eigen_I.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "3f235f48", + "id": "4e62b9e5", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "b2e0b0f0", + "id": "3613306d", "metadata": {}, "source": [ "# Eigenvalues and Eigenvectors\n", @@ -22,7 +22,7 @@ }, { "cell_type": "markdown", - "id": "d2bec812", + "id": "2ac6e401", "metadata": {}, "source": [ "## Overview\n", @@ -49,7 +49,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ac7d006", + "id": "e7db96a7", "metadata": { "hide-output": false }, @@ -65,7 +65,7 @@ }, { "cell_type": "markdown", - "id": "cc56f021", + "id": "2d4c17f0", "metadata": {}, "source": [ "\n", @@ -74,7 +74,7 @@ }, { "cell_type": "markdown", - "id": "55f36210", + "id": "95217129", "metadata": {}, "source": [ "## Matrices as transformations\n", @@ -84,7 +84,7 @@ }, { "cell_type": "markdown", - "id": "62411bdf", + "id": "9d96d78b", "metadata": {}, "source": [ "### Mapping vectors to vectors\n", @@ -116,7 +116,7 @@ }, { "cell_type": "markdown", - "id": "2784755b", + "id": "c620ade7", "metadata": {}, "source": [ "### Square matrices\n", @@ -164,7 +164,7 @@ { "cell_type": "code", "execution_count": null, - "id": "069c9d8f", + "id": "a068680f", "metadata": { "hide-output": false }, @@ -177,7 +177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "af96adb8", + "id": "2d452c78", "metadata": { "hide-output": false }, @@ -224,7 +224,7 @@ }, { "cell_type": "markdown", - "id": "2638fe18", + "id": "37a60b2e", "metadata": {}, "source": [ "One way to understand this transformation is that $ A $\n", @@ -235,7 +235,7 @@ }, { "cell_type": "markdown", - "id": "3f010972", + "id": "de78d2f9", "metadata": {}, "source": [ "## Types of transformations\n", @@ -259,7 +259,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee4624bb", + "id": "ae642d25", "metadata": { "hide-output": false }, @@ -355,7 +355,7 @@ }, { "cell_type": "markdown", - "id": "5af1875d", + "id": "d2118e84", "metadata": {}, "source": [ "### Scaling\n", @@ -378,7 +378,7 @@ { "cell_type": "code", "execution_count": null, - "id": "41179346", + "id": "f640a3ad", "metadata": { "hide-output": false }, @@ -392,7 +392,7 @@ }, { "cell_type": "markdown", - "id": "2255a1b5", + "id": "f92f2137", "metadata": {}, "source": [ "### Shearing\n", @@ -413,7 +413,7 @@ { "cell_type": "code", "execution_count": null, - "id": "158e4f3a", + "id": "4da3e439", "metadata": { "hide-output": false }, @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "016120d7", + "id": "d5801c63", "metadata": {}, "source": [ "### Rotation\n", @@ -449,7 +449,7 @@ { "cell_type": "code", "execution_count": null, - "id": "61ceefcf", + "id": "777b72e2", "metadata": { "hide-output": false }, @@ -463,7 +463,7 @@ }, { "cell_type": "markdown", - "id": "49c744cc", + "id": "2fa96187", "metadata": {}, "source": [ "### Permutation\n", @@ -483,7 +483,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8860a64a", + "id": "52f63237", "metadata": { "hide-output": false }, @@ -495,7 +495,7 @@ }, { "cell_type": "markdown", - "id": "740a1c9b", + "id": "6f20e18a", "metadata": {}, "source": [ "More examples of common transition matrices can be found [here](https://en.wikipedia.org/wiki/Transformation_matrix#Examples_in_2_dimensions)." @@ -503,7 +503,7 @@ }, { "cell_type": "markdown", - "id": "4286d667", + "id": "597ee2c5", "metadata": {}, "source": [ "## Matrix multiplication as composition\n", @@ -514,7 +514,7 @@ }, { "cell_type": "markdown", - "id": "80e2db38", + "id": "4c6a25a6", "metadata": {}, "source": [ "### Linear compositions\n", @@ -645,7 +645,7 @@ }, { "cell_type": "markdown", - "id": "421a9efe", + "id": "690dc838", "metadata": {}, "source": [ "### Examples\n", @@ -661,7 +661,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4815607b", + "id": "b0745682", "metadata": { "hide-output": false }, @@ -706,7 +706,7 @@ { "cell_type": "code", "execution_count": null, - "id": "274c3b86", + "id": "794ad775", "metadata": { "hide-output": false }, @@ -720,7 +720,7 @@ }, { "cell_type": "markdown", - "id": "de9fea69", + "id": "be719411", "metadata": {}, "source": [ "#### Shear then rotate" @@ -729,7 +729,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2bf710c0", + "id": "64036e56", "metadata": { "hide-output": false }, @@ -740,7 +740,7 @@ }, { "cell_type": "markdown", - "id": "3cee7dc8", + "id": "e77a222b", "metadata": {}, "source": [ "#### Rotate then shear" @@ -749,7 +749,7 @@ { "cell_type": "code", "execution_count": null, - "id": "93e3ea05", + "id": "202b4950", "metadata": { "hide-output": false }, @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "9912d9bd", + "id": "e565f40e", "metadata": {}, "source": [ "It is evident that the transformation $ AB $ is not the same as the transformation $ BA $." @@ -768,7 +768,7 @@ }, { "cell_type": "markdown", - "id": "a9c53b6e", + "id": "66fd2c6e", "metadata": {}, "source": [ "## Iterating on a fixed map\n", @@ -795,7 +795,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3de42f28", + "id": "6a957ad5", "metadata": { "hide-output": false }, @@ -848,7 +848,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4568a02b", + "id": "9f06d3fa", "metadata": { "hide-output": false }, @@ -865,7 +865,7 @@ }, { "cell_type": "markdown", - "id": "3cc29970", + "id": "e4a83630", "metadata": {}, "source": [ "Here with each iteration the vectors get shorter, i.e., move closer to the origin.\n", @@ -876,7 +876,7 @@ { "cell_type": "code", "execution_count": null, - "id": "572fcba8", + "id": "a1627d0c", "metadata": { "hide-output": false }, @@ -893,7 +893,7 @@ }, { "cell_type": "markdown", - "id": "20ee4434", + "id": "cd3c6915", "metadata": {}, "source": [ "Here with each iteration vectors do not tend to get longer or shorter.\n", @@ -905,7 +905,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df10738b", + "id": "63350003", "metadata": { "hide-output": false }, @@ -922,7 +922,7 @@ }, { "cell_type": "markdown", - "id": "1d0825ab", + "id": "9cec04fb", "metadata": {}, "source": [ "Here with each iteration vectors tend to get longer, i.e., farther from the\n", @@ -940,7 +940,7 @@ }, { "cell_type": "markdown", - "id": "6abbd9d5", + "id": "4f6247ce", "metadata": {}, "source": [ "## Eigenvalues\n", @@ -952,7 +952,7 @@ }, { "cell_type": "markdown", - "id": "f0366dbb", + "id": "11922580", "metadata": {}, "source": [ "### Definitions\n", @@ -979,7 +979,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0a96db6c", + "id": "64dbee8e", "metadata": { "hide-output": false }, @@ -1033,7 +1033,7 @@ }, { "cell_type": "markdown", - "id": "c8d75bf9", + "id": "2b1823e5", "metadata": {}, "source": [ "### Complex values\n", @@ -1053,7 +1053,7 @@ }, { "cell_type": "markdown", - "id": "52579d78", + "id": "df39691a", "metadata": {}, "source": [ "### Some mathematical details\n", @@ -1080,7 +1080,7 @@ }, { "cell_type": "markdown", - "id": "1e2ea48b", + "id": "a14b1688", "metadata": {}, "source": [ "### Facts\n", @@ -1098,7 +1098,7 @@ }, { "cell_type": "markdown", - "id": "26422bbf", + "id": "156cc9f4", "metadata": {}, "source": [ "### Computation\n", @@ -1109,7 +1109,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e97747d3", + "id": "2474723f", "metadata": { "hide-output": false }, @@ -1128,7 +1128,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7b15970a", + "id": "4d979778", "metadata": { "hide-output": false }, @@ -1139,7 +1139,7 @@ }, { "cell_type": "markdown", - "id": "8f192f9c", + "id": "57a3ebd7", "metadata": {}, "source": [ "Note that the *columns* of `evecs` are the eigenvectors.\n", @@ -1158,7 +1158,7 @@ }, { "cell_type": "markdown", - "id": "4386a368", + "id": "a60a4445", "metadata": {}, "source": [ "## The Neumann Series Lemma\n", @@ -1171,7 +1171,7 @@ }, { "cell_type": "markdown", - "id": "12aa5d4d", + "id": "3835dde4", "metadata": {}, "source": [ "### Scalar series\n", @@ -1195,7 +1195,7 @@ }, { "cell_type": "markdown", - "id": "8286216d", + "id": "4a387fc9", "metadata": {}, "source": [ "### Matrix series\n", @@ -1225,7 +1225,7 @@ }, { "cell_type": "markdown", - "id": "b31af43f", + "id": "436b7448", "metadata": {}, "source": [ "### (Neumann Series Lemma)\n", @@ -1250,7 +1250,7 @@ { "cell_type": "code", "execution_count": null, - "id": "68417a7b", + "id": "70013d2b", "metadata": { "hide-output": false }, @@ -1267,7 +1267,7 @@ }, { "cell_type": "markdown", - "id": "8dcd091a", + "id": "3f62ceae", "metadata": {}, "source": [ "The spectral radius $ r(A) $ obtained is less than 1.\n", @@ -1278,7 +1278,7 @@ { "cell_type": "code", "execution_count": null, - "id": "59df3132", + "id": "db8691f7", "metadata": { "hide-output": false }, @@ -1291,7 +1291,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6f72d599", + "id": "98ad9d89", "metadata": { "hide-output": false }, @@ -1303,7 +1303,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df7cf39b", + "id": "8b3e4e4b", "metadata": { "hide-output": false }, @@ -1318,7 +1318,7 @@ }, { "cell_type": "markdown", - "id": "07a536bc", + "id": "28ddd268", "metadata": {}, "source": [ "Let’s check equality between the sum and the inverse methods." @@ -1327,7 +1327,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5318737b", + "id": "b596f3db", "metadata": { "hide-output": false }, @@ -1338,7 +1338,7 @@ }, { "cell_type": "markdown", - "id": "2ba75b67", + "id": "3f9324d0", "metadata": {}, "source": [ "Although we truncate the infinite sum at $ k = 50 $, both methods give us the same\n", @@ -1347,7 +1347,7 @@ }, { "cell_type": "markdown", - "id": "7307c3af", + "id": "e1dea574", "metadata": {}, "source": [ "## Exercises" @@ -1355,7 +1355,7 @@ }, { "cell_type": "markdown", - "id": "651b6bf6", + "id": "4ec5888e", "metadata": {}, "source": [ "## Exercise 15.1\n", @@ -1377,7 +1377,7 @@ }, { "cell_type": "markdown", - "id": "7298fe91", + "id": "09c35e06", "metadata": {}, "source": [ "## Solution to[ Exercise 15.1](https://intro.quantecon.org/#eig1_ex1)\n", @@ -1390,7 +1390,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ce65d40", + "id": "0a662d75", "metadata": { "hide-output": false }, @@ -1438,7 +1438,7 @@ }, { "cell_type": "markdown", - "id": "20e28f85", + "id": "f80e0100", "metadata": {}, "source": [ "Then we can look at the trajectory of the eigenvector approximation." @@ -1447,7 +1447,7 @@ { "cell_type": "code", "execution_count": null, - "id": "08cb1b3b", + "id": "3157af8a", "metadata": { "hide-output": false }, @@ -1485,7 +1485,7 @@ }, { "cell_type": "markdown", - "id": "46d54d1d", + "id": "67a5bef0", "metadata": {}, "source": [ "## Exercise 15.2\n", @@ -1499,7 +1499,7 @@ }, { "cell_type": "markdown", - "id": "eeac58f9", + "id": "f2a135f2", "metadata": {}, "source": [ "## Solution to[ Exercise 15.2](https://intro.quantecon.org/#eig1_ex2)" @@ -1508,7 +1508,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5814ce98", + "id": "6f83a077", "metadata": { "hide-output": false }, @@ -1530,7 +1530,7 @@ }, { "cell_type": "markdown", - "id": "d1e972ec", + "id": "972877e2", "metadata": {}, "source": [ "The result seems to converge to the eigenvector of $ A $ with the largest eigenvalue.\n", @@ -1543,7 +1543,7 @@ { "cell_type": "code", "execution_count": null, - "id": "580a16b0", + "id": "17444941", "metadata": { "hide-output": false }, @@ -1587,7 +1587,7 @@ }, { "cell_type": "markdown", - "id": "70b0ce46", + "id": "3b525993", "metadata": {}, "source": [ "Note that the vector field converges to the eigenvector of $ A $ with the largest eigenvalue and diverges from the eigenvector of $ A $ with the smallest eigenvalue.\n", @@ -1601,7 +1601,7 @@ }, { "cell_type": "markdown", - "id": "08f6d86a", + "id": "3f3d7af1", "metadata": {}, "source": [ "## Exercise 15.3\n", @@ -1613,7 +1613,7 @@ }, { "cell_type": "markdown", - "id": "6ecc573d", + "id": "e304c2bb", "metadata": {}, "source": [ "## Solution to[ Exercise 15.3](https://intro.quantecon.org/#eig1_ex3)\n", @@ -1624,7 +1624,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2f1eec57", + "id": "aa96b067", "metadata": { "hide-output": false }, @@ -1693,7 +1693,7 @@ }, { "cell_type": "markdown", - "id": "a10a9dad", + "id": "49d47bb2", "metadata": {}, "source": [ "The vector fields explain why we observed the trajectories of the vector $ v $ multiplied by $ A $ iteratively before.\n", @@ -1706,7 +1706,7 @@ { "cell_type": "code", "execution_count": null, - "id": "99f25fc9", + "id": "9f3f65f7", "metadata": { "hide-output": false }, @@ -1770,7 +1770,7 @@ } ], "metadata": { - "date": 1712122262.4654882, + "date": 1712983676.041033, "filename": "eigen_I.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/eigen_II.ipynb b/_notebooks/eigen_II.ipynb index ba99b0aa..09895956 100644 --- a/_notebooks/eigen_II.ipynb +++ b/_notebooks/eigen_II.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "deb5c33d", + "id": "5878a741", "metadata": {}, "source": [ "# The Perron-Frobenius Theorem\n", @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "516dca46", + "id": "262b7d84", "metadata": { "hide-output": false }, @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "d8f1cf07", + "id": "3f62006a", "metadata": {}, "source": [ "In this lecture we will begin with the foundational concepts in spectral theory.\n", @@ -39,7 +39,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bcf71043", + "id": "80b44445", "metadata": { "hide-output": false }, @@ -53,7 +53,7 @@ }, { "cell_type": "markdown", - "id": "63704d4f", + "id": "e1557027", "metadata": {}, "source": [ "## Nonnegative matrices\n", @@ -76,7 +76,7 @@ }, { "cell_type": "markdown", - "id": "c868b218", + "id": "fbe67dfd", "metadata": {}, "source": [ "### Irreducible matrices\n", @@ -125,7 +125,7 @@ }, { "cell_type": "markdown", - "id": "b1eebb4c", + "id": "31fa92b3", "metadata": {}, "source": [ "### Left eigenvectors\n", @@ -154,7 +154,7 @@ { "cell_type": "code", "execution_count": null, - "id": "817df6f7", + "id": "ef0dd81c", "metadata": { "hide-output": false }, @@ -179,7 +179,7 @@ }, { "cell_type": "markdown", - "id": "00debccd", + "id": "7f9bb763", "metadata": {}, "source": [ "We can also use `scipy.linalg.eig` with argument `left=True` to find left eigenvectors directly" @@ -188,7 +188,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9c30a5c4", + "id": "ab788cb5", "metadata": { "hide-output": false }, @@ -203,7 +203,7 @@ }, { "cell_type": "markdown", - "id": "4911634d", + "id": "cd6b2f15", "metadata": {}, "source": [ "The eigenvalues are the same while the eigenvectors themselves are different.\n", @@ -220,7 +220,7 @@ }, { "cell_type": "markdown", - "id": "c46c26fd", + "id": "4f21d2c0", "metadata": {}, "source": [ "### The Perron-Frobenius theorem\n", @@ -234,7 +234,7 @@ }, { "cell_type": "markdown", - "id": "44dc412c", + "id": "f7b97487", "metadata": {}, "source": [ "### (Perron-Frobenius Theorem)\n", @@ -266,7 +266,7 @@ }, { "cell_type": "markdown", - "id": "59b909e2", + "id": "f7ad3b8d", "metadata": {}, "source": [ "#### Example: Irreducible matrix\n", @@ -277,7 +277,7 @@ { "cell_type": "code", "execution_count": null, - "id": "240c8b08", + "id": "b4ad2c63", "metadata": { "hide-output": false }, @@ -290,7 +290,7 @@ }, { "cell_type": "markdown", - "id": "2e61741c", + "id": "2345f494", "metadata": {}, "source": [ "We can compute the dominant eigenvalue and the corresponding eigenvector" @@ -299,7 +299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3e989b2a", + "id": "ef2bbfb3", "metadata": { "hide-output": false }, @@ -310,7 +310,7 @@ }, { "cell_type": "markdown", - "id": "c410c1c4", + "id": "84279031", "metadata": {}, "source": [ "Now we can see the claims of the Perron-Frobenius Theorem holds for the irreducible matrix $ A $:\n", @@ -328,7 +328,7 @@ }, { "cell_type": "markdown", - "id": "2f2cf467", + "id": "5a1ef74d", "metadata": {}, "source": [ "### Primitive matrices\n", @@ -370,7 +370,7 @@ }, { "cell_type": "markdown", - "id": "b9ee598e", + "id": "d51424a2", "metadata": {}, "source": [ "### (Continous of Perron-Frobenius Theorem)\n", @@ -384,7 +384,7 @@ }, { "cell_type": "markdown", - "id": "0ced9b55", + "id": "5bd430f3", "metadata": {}, "source": [ "#### Example 1: Primitive matrix\n", @@ -395,7 +395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "258a84f1", + "id": "389a4188", "metadata": { "hide-output": false }, @@ -410,7 +410,7 @@ }, { "cell_type": "markdown", - "id": "a6eaa350", + "id": "78e3eacb", "metadata": {}, "source": [ "We compute the dominant eigenvalue and the corresponding eigenvector" @@ -419,7 +419,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ec825e4b", + "id": "0628379c", "metadata": { "hide-output": false }, @@ -430,7 +430,7 @@ }, { "cell_type": "markdown", - "id": "4679007c", + "id": "3db71b1e", "metadata": {}, "source": [ "Now let’s give some examples to see if the claims of the Perron-Frobenius Theorem hold for the primitive matrix $ B $:\n", @@ -449,7 +449,7 @@ { "cell_type": "code", "execution_count": null, - "id": "48e5e17b", + "id": "e7ea2728", "metadata": { "hide-output": false }, @@ -521,7 +521,7 @@ }, { "cell_type": "markdown", - "id": "0a9d02a5", + "id": "cf08f730", "metadata": {}, "source": [ "The convergence is not observed in cases of non-primitive matrices.\n", @@ -532,7 +532,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df2da2e6", + "id": "64bc0a63", "metadata": { "hide-output": false }, @@ -553,7 +553,7 @@ }, { "cell_type": "markdown", - "id": "e7eeed7d", + "id": "74e7342e", "metadata": {}, "source": [ "The result shows that the matrix is not primitive as it is not everywhere positive.\n", @@ -568,7 +568,7 @@ }, { "cell_type": "markdown", - "id": "2ebbdee4", + "id": "7cd20579", "metadata": {}, "source": [ "#### Example 2: Connection to Markov chains\n", @@ -583,7 +583,7 @@ { "cell_type": "code", "execution_count": null, - "id": "853f4022", + "id": "7110c22a", "metadata": { "hide-output": false }, @@ -599,7 +599,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d6a13447", + "id": "58e65b79", "metadata": { "hide-output": false }, @@ -613,7 +613,7 @@ { "cell_type": "code", "execution_count": null, - "id": "052c6dc7", + "id": "fe801cad", "metadata": { "hide-output": false }, @@ -629,7 +629,7 @@ { "cell_type": "code", "execution_count": null, - "id": "546b0c52", + "id": "26140d00", "metadata": { "hide-output": false }, @@ -642,7 +642,7 @@ }, { "cell_type": "markdown", - "id": "b9b8d066", + "id": "06d8f969", "metadata": {}, "source": [ "We can also verify other properties hinted by Perron-Frobenius in these stochastic matrices.\n", @@ -691,7 +691,7 @@ }, { "cell_type": "markdown", - "id": "5a262a77", + "id": "73c8e2ae", "metadata": {}, "source": [ "## Exercises" @@ -699,7 +699,7 @@ }, { "cell_type": "markdown", - "id": "4ae67060", + "id": "df18ed14", "metadata": {}, "source": [ "## (Leontief’s Input-Output Model)Exercise 36.1\n", @@ -766,7 +766,7 @@ }, { "cell_type": "markdown", - "id": "bec49123", + "id": "1d1e0408", "metadata": {}, "source": [ "## Solution to[ Exercise 36.1 (Leontief’s Input-Output Model)](https://intro.quantecon.org/#eig_ex1)" @@ -775,7 +775,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1e9c2359", + "id": "c4fc7df2", "metadata": { "hide-output": false }, @@ -793,7 +793,7 @@ }, { "cell_type": "markdown", - "id": "c06023f1", + "id": "5bc26c70", "metadata": {}, "source": [ "Since we have $ r(A) < 1 $ we can thus find the solution using the Neumann Series Lemma." @@ -802,7 +802,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7bd4b1fc", + "id": "5b5233c0", "metadata": { "hide-output": false }, @@ -821,7 +821,7 @@ } ], "metadata": { - "date": 1712122262.5010786, + "date": 1712983676.074003, "filename": "eigen_II.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/equalizing_difference.ipynb b/_notebooks/equalizing_difference.ipynb index 808e67e2..8de0a0ed 100644 --- a/_notebooks/equalizing_difference.ipynb +++ b/_notebooks/equalizing_difference.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "fbcbe394", + "id": "9e2b5bc2", "metadata": {}, "source": [ "# Equalizing Difference Model" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "1b2f5c40", + "id": "d78f3fad", "metadata": {}, "source": [ "## Overview\n", @@ -49,7 +49,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f636eaf0", + "id": "a04126ba", "metadata": { "hide-output": false }, @@ -63,7 +63,7 @@ }, { "cell_type": "markdown", - "id": "54936119", + "id": "c58e2157", "metadata": {}, "source": [ "## The indifference condition\n", @@ -93,7 +93,7 @@ }, { "cell_type": "markdown", - "id": "eb64f9c1", + "id": "8349ef86", "metadata": {}, "source": [ "### Present value of a high school educated worker\n", @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "68233620", + "id": "38f25355", "metadata": {}, "source": [ "### Present value of a college-bound new high school graduate\n", @@ -190,7 +190,7 @@ }, { "cell_type": "markdown", - "id": "41a34907", + "id": "15d314d0", "metadata": {}, "source": [ "## Computations\n", @@ -204,7 +204,7 @@ { "cell_type": "code", "execution_count": null, - "id": "38801a9b", + "id": "7ee46945", "metadata": { "hide-output": false }, @@ -235,7 +235,7 @@ }, { "cell_type": "markdown", - "id": "eb4a37b4", + "id": "153574d4", "metadata": {}, "source": [ "Using vectorization instead of loops,\n", @@ -249,7 +249,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10d3a87e", + "id": "052befd3", "metadata": { "hide-output": false }, @@ -263,7 +263,7 @@ }, { "cell_type": "markdown", - "id": "e12433eb", + "id": "a4ff13b6", "metadata": {}, "source": [ "Let’s not charge for college and recompute $ \\phi $.\n", @@ -274,7 +274,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d9a48da3", + "id": "a8ed950c", "metadata": { "hide-output": false }, @@ -288,7 +288,7 @@ }, { "cell_type": "markdown", - "id": "66be64f4", + "id": "9c1524c2", "metadata": {}, "source": [ "Let us construct some graphs that show us how the initial college-high-school wage ratio $ \\phi $ would change if one of its determinants were to change.\n", @@ -299,7 +299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0c8cde1b", + "id": "207742e8", "metadata": { "hide-output": false }, @@ -317,7 +317,7 @@ }, { "cell_type": "markdown", - "id": "4d3b7cf7", + "id": "ed08ffd7", "metadata": {}, "source": [ "Evidently, the initial wage ratio $ \\phi $ must rise to compensate a prospective high school student for **waiting** to start receiving income – remember that while she is earning nothing in years $ t=0, 1, 2, 3 $, the high school worker is earning a salary.\n", @@ -329,7 +329,7 @@ { "cell_type": "code", "execution_count": null, - "id": "56ce7570", + "id": "e1e2d624", "metadata": { "hide-output": false }, @@ -347,7 +347,7 @@ }, { "cell_type": "markdown", - "id": "23f7ad80", + "id": "18548855", "metadata": {}, "source": [ "Notice how the intitial wage gap falls when the rate of growth $ \\gamma_c $ of college wages rises.\n", @@ -362,7 +362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c678bbe2", + "id": "687c382a", "metadata": { "hide-output": false }, @@ -380,7 +380,7 @@ }, { "cell_type": "markdown", - "id": "30d39d6a", + "id": "31cc3724", "metadata": {}, "source": [ "## Entrepreneur-worker interpretation\n", @@ -413,7 +413,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72f38899", + "id": "041dd2c8", "metadata": { "hide-output": false }, @@ -449,7 +449,7 @@ }, { "cell_type": "markdown", - "id": "d9b68095", + "id": "b12f63c2", "metadata": {}, "source": [ "If the probability that a new business succeeds is $ 0.2 $, let’s compute the initial wage premium for successful entrepreneurs." @@ -458,7 +458,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ab916d4d", + "id": "f24d5b83", "metadata": { "hide-output": false }, @@ -472,7 +472,7 @@ }, { "cell_type": "markdown", - "id": "326c2854", + "id": "1f7d7153", "metadata": {}, "source": [ "Now let’s study how the initial wage premium for successful entrepreneurs depend on the success probability." @@ -481,7 +481,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fae15a84", + "id": "2a57ddd7", "metadata": { "hide-output": false }, @@ -499,7 +499,7 @@ }, { "cell_type": "markdown", - "id": "88f06d56", + "id": "f6432448", "metadata": {}, "source": [ "Does the graph make sense to you?" @@ -507,7 +507,7 @@ }, { "cell_type": "markdown", - "id": "4d65b73c", + "id": "db506f6a", "metadata": {}, "source": [ "## An application of calculus\n", @@ -530,7 +530,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7664f9fd", + "id": "e99a8501", "metadata": { "hide-output": false }, @@ -542,7 +542,7 @@ }, { "cell_type": "markdown", - "id": "36ce08d5", + "id": "602c3dd4", "metadata": {}, "source": [ "Define function $ A_h $" @@ -551,7 +551,7 @@ { "cell_type": "code", "execution_count": null, - "id": "053624f2", + "id": "a7c0b1b8", "metadata": { "hide-output": false }, @@ -563,7 +563,7 @@ }, { "cell_type": "markdown", - "id": "c85c8262", + "id": "5d2c43c7", "metadata": {}, "source": [ "Define function $ A_c $" @@ -572,7 +572,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce03e46b", + "id": "f1788002", "metadata": { "hide-output": false }, @@ -584,7 +584,7 @@ }, { "cell_type": "markdown", - "id": "04522e52", + "id": "6f07f5da", "metadata": {}, "source": [ "Now, define $ \\phi $" @@ -593,7 +593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3b59bfc4", + "id": "d2eca3c9", "metadata": { "hide-output": false }, @@ -605,7 +605,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0d366d94", + "id": "7aa1f8e1", "metadata": { "hide-output": false }, @@ -616,7 +616,7 @@ }, { "cell_type": "markdown", - "id": "4f6790a6", + "id": "dd8a907a", "metadata": {}, "source": [ "We begin by setting default parameter values." @@ -625,7 +625,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29ca5e98", + "id": "1ff87141", "metadata": { "hide-output": false }, @@ -640,7 +640,7 @@ }, { "cell_type": "markdown", - "id": "5971bc54", + "id": "1b48409c", "metadata": {}, "source": [ "Now let’s compute $ \\frac{\\partial \\phi}{\\partial D} $ and then evaluate it at the default values" @@ -649,7 +649,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5eb2e09a", + "id": "61ec9aeb", "metadata": { "hide-output": false }, @@ -662,7 +662,7 @@ { "cell_type": "code", "execution_count": null, - "id": "576b26f9", + "id": "3cb1bb19", "metadata": { "hide-output": false }, @@ -675,7 +675,7 @@ }, { "cell_type": "markdown", - "id": "2f4b5b30", + "id": "e767df90", "metadata": {}, "source": [ "Thus, as with our earlier graph, we find that raising $ R $ increases the initial college wage premium $ \\phi $.\n", @@ -686,7 +686,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3e668e0b", + "id": "598883a7", "metadata": { "hide-output": false }, @@ -699,7 +699,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1b874cf", + "id": "e807cd1c", "metadata": { "hide-output": false }, @@ -712,7 +712,7 @@ }, { "cell_type": "markdown", - "id": "673ed491", + "id": "3c89366f", "metadata": {}, "source": [ "We find that raising $ T $ decreases the initial college wage premium $ \\phi $.\n", @@ -725,7 +725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b381d695", + "id": "8f6ce0fc", "metadata": { "hide-output": false }, @@ -738,7 +738,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2db9b4ab", + "id": "61b6e970", "metadata": { "hide-output": false }, @@ -751,7 +751,7 @@ }, { "cell_type": "markdown", - "id": "a3b59e4f", + "id": "4d16207b", "metadata": {}, "source": [ "We find that raising $ \\gamma_h $ increases the initial college wage premium $ \\phi $, in line with our earlier graphical analysis.\n", @@ -762,7 +762,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37ff7f54", + "id": "644a45d2", "metadata": { "hide-output": false }, @@ -775,7 +775,7 @@ { "cell_type": "code", "execution_count": null, - "id": "da4610de", + "id": "e02ece5b", "metadata": { "hide-output": false }, @@ -788,7 +788,7 @@ }, { "cell_type": "markdown", - "id": "71822975", + "id": "b5c303a7", "metadata": {}, "source": [ "We find that raising $ \\gamma_c $ decreases the initial college wage premium $ \\phi $, in line with our earlier graphical analysis.\n", @@ -799,7 +799,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5c990fe3", + "id": "5139421d", "metadata": { "hide-output": false }, @@ -812,7 +812,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2323e25f", + "id": "fe00a485", "metadata": { "hide-output": false }, @@ -825,7 +825,7 @@ }, { "cell_type": "markdown", - "id": "8750575f", + "id": "5f5ad605", "metadata": {}, "source": [ "We find that raising the gross interest rate $ R $ increases the initial college wage premium $ \\phi $, in line with our earlier graphical analysis." @@ -833,7 +833,7 @@ } ], "metadata": { - "date": 1712122262.532427, + "date": 1712983676.1032033, "filename": "equalizing_difference.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/geom_series.ipynb b/_notebooks/geom_series.ipynb index fd4480ef..f16ba6e2 100644 --- a/_notebooks/geom_series.ipynb +++ b/_notebooks/geom_series.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "08fd6464", + "id": "54f4cbc2", "metadata": {}, "source": [ "\n", @@ -19,7 +19,7 @@ }, { "cell_type": "markdown", - "id": "1186bbf8", + "id": "fa6f6ae7", "metadata": {}, "source": [ "# Geometric Series for Elementary Economics" @@ -27,7 +27,7 @@ }, { "cell_type": "markdown", - "id": "542f3414", + "id": "4c05f518", "metadata": {}, "source": [ "# Migrated lecture\n", @@ -37,7 +37,7 @@ }, { "cell_type": "markdown", - "id": "7ef50cfc", + "id": "d9f172e8", "metadata": {}, "source": [ "## Overview\n", @@ -65,7 +65,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36a9bb60", + "id": "2fbf531d", "metadata": { "hide-output": false }, @@ -82,7 +82,7 @@ }, { "cell_type": "markdown", - "id": "3fd6beb1", + "id": "338a250d", "metadata": {}, "source": [ "## Key formulas\n", @@ -101,7 +101,7 @@ }, { "cell_type": "markdown", - "id": "955b513b", + "id": "720ac6d5", "metadata": {}, "source": [ "### Infinite geometric series\n", @@ -129,7 +129,7 @@ }, { "cell_type": "markdown", - "id": "ba9e7791", + "id": "c72777c2", "metadata": {}, "source": [ "### Finite geometric series\n", @@ -158,7 +158,7 @@ }, { "cell_type": "markdown", - "id": "d1283abc", + "id": "f27c995b", "metadata": {}, "source": [ "## Example: The Money Multiplier in Fractional Reserve Banking\n", @@ -195,7 +195,7 @@ }, { "cell_type": "markdown", - "id": "4d334dfa", + "id": "a8f86fe2", "metadata": {}, "source": [ "### A simple model\n", @@ -309,7 +309,7 @@ }, { "cell_type": "markdown", - "id": "3fb15954", + "id": "bb084d6e", "metadata": {}, "source": [ "### Money multiplier\n", @@ -329,7 +329,7 @@ }, { "cell_type": "markdown", - "id": "5fde36f2", + "id": "7e30c158", "metadata": {}, "source": [ "## Example: The Keynesian Multiplier\n", @@ -347,7 +347,7 @@ }, { "cell_type": "markdown", - "id": "4b31f904", + "id": "aebd8bdd", "metadata": {}, "source": [ "### Static version\n", @@ -416,7 +416,7 @@ }, { "cell_type": "markdown", - "id": "1370799b", + "id": "e410ef9b", "metadata": {}, "source": [ "### Dynamic version\n", @@ -519,7 +519,7 @@ }, { "cell_type": "markdown", - "id": "42e134f9", + "id": "5892c12a", "metadata": {}, "source": [ "## Example: Interest Rates and Present Values\n", @@ -591,7 +591,7 @@ }, { "cell_type": "markdown", - "id": "744df569", + "id": "e4be71b3", "metadata": {}, "source": [ "### Accumulation\n", @@ -623,7 +623,7 @@ }, { "cell_type": "markdown", - "id": "e5743143", + "id": "69cc18f9", "metadata": {}, "source": [ "### Discounting\n", @@ -647,7 +647,7 @@ }, { "cell_type": "markdown", - "id": "f1008b73", + "id": "2cc2ce74", "metadata": {}, "source": [ "### Application to asset pricing\n", @@ -765,7 +765,7 @@ { "cell_type": "code", "execution_count": null, - "id": "def7cd1e", + "id": "ba3b5d91", "metadata": { "hide-output": false }, @@ -795,7 +795,7 @@ }, { "cell_type": "markdown", - "id": "6856b4f2", + "id": "b64cdbdf", "metadata": {}, "source": [ "Now that we have defined our functions, we can plot some outcomes.\n", @@ -806,7 +806,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2858c45a", + "id": "770d7660", "metadata": { "hide-output": false }, @@ -839,7 +839,7 @@ }, { "cell_type": "markdown", - "id": "1e66ccef", + "id": "d83db26e", "metadata": {}, "source": [ "Evidently our approximations perform well for small values of $ T $.\n", @@ -853,7 +853,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3333c5b8", + "id": "52114f3b", "metadata": { "hide-output": false }, @@ -875,7 +875,7 @@ }, { "cell_type": "markdown", - "id": "0b60df3b", + "id": "f11b8d95", "metadata": {}, "source": [ "The graph above shows how as duration $ T \\rightarrow +\\infty $,\n", @@ -889,7 +889,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c464c5a4", + "id": "b62dd94a", "metadata": { "hide-output": false }, @@ -914,7 +914,7 @@ }, { "cell_type": "markdown", - "id": "a42d6c9f", + "id": "ade4f083", "metadata": {}, "source": [ "This graph gives a big hint for why the condition $ r > g $ is\n", @@ -931,7 +931,7 @@ { "cell_type": "code", "execution_count": null, - "id": "59ec9356", + "id": "b1fcb7ed", "metadata": { "hide-output": false }, @@ -962,7 +962,7 @@ }, { "cell_type": "markdown", - "id": "389d8f11", + "id": "8d30b182", "metadata": {}, "source": [ "We can use a little calculus to study how the present value $ p_0 $\n", @@ -982,7 +982,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a7636adb", + "id": "fa8bda32", "metadata": { "hide-output": false }, @@ -1001,7 +1001,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fc3db92b", + "id": "f97f036c", "metadata": { "hide-output": false }, @@ -1015,7 +1015,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ed1f820d", + "id": "8b50bc12", "metadata": { "hide-output": false }, @@ -1028,7 +1028,7 @@ }, { "cell_type": "markdown", - "id": "fdd718a7", + "id": "d483fa62", "metadata": {}, "source": [ "We can see that for $ \\frac{\\partial p_0}{\\partial r}<0 $ as long as\n", @@ -1041,7 +1041,7 @@ }, { "cell_type": "markdown", - "id": "61f7db5a", + "id": "c4060e16", "metadata": {}, "source": [ "## Back to the Keynesian multiplier\n", @@ -1054,7 +1054,7 @@ { "cell_type": "code", "execution_count": null, - "id": "74d70d95", + "id": "cb87089a", "metadata": { "hide-output": false }, @@ -1087,7 +1087,7 @@ }, { "cell_type": "markdown", - "id": "b9acc315", + "id": "f74bf4ee", "metadata": {}, "source": [ "In this model, income grows over time, until it gradually converges to\n", @@ -1101,7 +1101,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14d8f26c", + "id": "24f6e861", "metadata": { "hide-output": false }, @@ -1122,7 +1122,7 @@ }, { "cell_type": "markdown", - "id": "26765d41", + "id": "a6dc1f94", "metadata": {}, "source": [ "Increasing the marginal propensity to consume $ b $ increases the\n", @@ -1134,7 +1134,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12ba2d6d", + "id": "ad9fd315", "metadata": { "hide-output": false }, @@ -1165,7 +1165,7 @@ }, { "cell_type": "markdown", - "id": "632e38d5", + "id": "4de6e855", "metadata": {}, "source": [ "Notice here, whether government spending increases from 0.3 to 0.4 or\n", @@ -1175,7 +1175,7 @@ } ], "metadata": { - "date": 1712122262.5789564, + "date": 1712983676.144466, "filename": "geom_series.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/heavy_tails.ipynb b/_notebooks/heavy_tails.ipynb index 57e8fa7d..62da5ed8 100644 --- a/_notebooks/heavy_tails.ipynb +++ b/_notebooks/heavy_tails.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "d5ba6a73", + "id": "e9b4803d", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "a9a3624b", + "id": "19cc888c", "metadata": {}, "source": [ "# Heavy-Tailed Distributions\n", @@ -22,7 +22,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bb6614c0", + "id": "6e9a2bb8", "metadata": { "hide-output": false }, @@ -33,7 +33,7 @@ }, { "cell_type": "markdown", - "id": "696a96e4", + "id": "d90ab021", "metadata": {}, "source": [ "We use the following imports." @@ -42,7 +42,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e008a02a", + "id": "59e95020", "metadata": { "hide-output": false }, @@ -62,7 +62,7 @@ }, { "cell_type": "markdown", - "id": "fcaf397c", + "id": "f93a2cc8", "metadata": {}, "source": [ "## Overview\n", @@ -72,7 +72,7 @@ }, { "cell_type": "markdown", - "id": "37e234f2", + "id": "5ea2fc0b", "metadata": {}, "source": [ "### Introduction: light tails\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0e6d68a8", + "id": "5c7043f0", "metadata": { "hide-output": false }, @@ -121,7 +121,7 @@ }, { "cell_type": "markdown", - "id": "822c544b", + "id": "a8370465", "metadata": {}, "source": [ "Notice how\n", @@ -136,7 +136,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c31c132f", + "id": "cb39e4c7", "metadata": { "hide-output": false }, @@ -147,7 +147,7 @@ }, { "cell_type": "markdown", - "id": "fa1bf52c", + "id": "2cf02fbf", "metadata": {}, "source": [ "Here’s another view of draws from the same distribution:" @@ -156,7 +156,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eed43d09", + "id": "e2cb21a0", "metadata": { "hide-output": false }, @@ -175,7 +175,7 @@ }, { "cell_type": "markdown", - "id": "d548c953", + "id": "2c9b5113", "metadata": {}, "source": [ "We have plotted each individual draw $ X_i $ against $ i $.\n", @@ -199,7 +199,7 @@ }, { "cell_type": "markdown", - "id": "5825b83a", + "id": "8ee5a015", "metadata": {}, "source": [ "### When are light tails valid?\n", @@ -228,7 +228,7 @@ }, { "cell_type": "markdown", - "id": "68a305bf", + "id": "d4e49b41", "metadata": {}, "source": [ "### Returns on assets\n", @@ -248,7 +248,7 @@ { "cell_type": "code", "execution_count": null, - "id": "49192804", + "id": "18a92349", "metadata": { "hide-output": false }, @@ -269,7 +269,7 @@ }, { "cell_type": "markdown", - "id": "07eb05de", + "id": "543c1722", "metadata": {}, "source": [ "This data looks different to the draws from the normal distribution we saw above.\n", @@ -282,7 +282,7 @@ { "cell_type": "code", "execution_count": null, - "id": "00d8ebbe", + "id": "70746341", "metadata": { "hide-output": false }, @@ -303,7 +303,7 @@ }, { "cell_type": "markdown", - "id": "2694a98b", + "id": "667b3ad7", "metadata": {}, "source": [ "The histogram also looks different to the histogram of the normal\n", @@ -313,7 +313,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9ef41dff", + "id": "b2d70fcf", "metadata": { "hide-output": false }, @@ -327,7 +327,7 @@ }, { "cell_type": "markdown", - "id": "102a0164", + "id": "7c8f6fef", "metadata": {}, "source": [ "If we look at higher frequency returns data (e.g., tick-by-tick), we often see\n", @@ -338,7 +338,7 @@ }, { "cell_type": "markdown", - "id": "69830554", + "id": "21d6feee", "metadata": {}, "source": [ "### Other data\n", @@ -372,7 +372,7 @@ }, { "cell_type": "markdown", - "id": "19e59976", + "id": "f66f479b", "metadata": {}, "source": [ "### Why should we care?\n", @@ -394,7 +394,7 @@ }, { "cell_type": "markdown", - "id": "a4c66f25", + "id": "33be495d", "metadata": {}, "source": [ "## Visual comparisons\n", @@ -408,7 +408,7 @@ }, { "cell_type": "markdown", - "id": "0f2c1b39", + "id": "d2547e19", "metadata": {}, "source": [ "### Simulations\n", @@ -426,7 +426,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aa11f9f5", + "id": "4eedb0ee", "metadata": { "hide-output": false }, @@ -462,7 +462,7 @@ }, { "cell_type": "markdown", - "id": "6ab4b911", + "id": "ea6f46e3", "metadata": {}, "source": [ "In the top subfigure, the standard deviation of the normal distribution is 2,\n", @@ -480,7 +480,7 @@ }, { "cell_type": "markdown", - "id": "3ce3091d", + "id": "9ba28b87", "metadata": {}, "source": [ "### Nonnegative distributions\n", @@ -497,7 +497,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fb6dd89d", + "id": "228c5ae6", "metadata": { "hide-output": false }, @@ -518,7 +518,7 @@ }, { "cell_type": "markdown", - "id": "7b408bcb", + "id": "dcefe24a", "metadata": {}, "source": [ "Another nonnegative distribution is the [Pareto distribution](https://en.wikipedia.org/wiki/Pareto_distribution).\n", @@ -562,7 +562,7 @@ { "cell_type": "code", "execution_count": null, - "id": "89c8d993", + "id": "5d78c5ea", "metadata": { "hide-output": false }, @@ -583,7 +583,7 @@ }, { "cell_type": "markdown", - "id": "a3942608", + "id": "d710b39a", "metadata": {}, "source": [ "Notice how extreme outcomes are more common." @@ -591,7 +591,7 @@ }, { "cell_type": "markdown", - "id": "e92d506b", + "id": "1cd475b2", "metadata": {}, "source": [ "### Counter CDFs\n", @@ -629,7 +629,7 @@ }, { "cell_type": "markdown", - "id": "918ed633", + "id": "5a1ce3b1", "metadata": {}, "source": [ "### Exercise 19.1\n", @@ -639,7 +639,7 @@ }, { "cell_type": "markdown", - "id": "5139dd52", + "id": "859b55de", "metadata": {}, "source": [ "### Solution to[ Exercise 19.1](https://intro.quantecon.org/#ht_ex_x1)\n", @@ -664,7 +664,7 @@ { "cell_type": "code", "execution_count": null, - "id": "896c7c29", + "id": "4baa0ec9", "metadata": { "hide-output": false }, @@ -681,7 +681,7 @@ }, { "cell_type": "markdown", - "id": "5d429f0e", + "id": "dc8fef05", "metadata": {}, "source": [ "Here’s a log-log plot of the same functions, which makes visual comparison\n", @@ -691,7 +691,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f94f25ed", + "id": "fb8e11b5", "metadata": { "hide-output": false }, @@ -707,7 +707,7 @@ }, { "cell_type": "markdown", - "id": "5d514a0a", + "id": "b43dff66", "metadata": {}, "source": [ "In the log-log plot, the Pareto CCDF is linear, while the exponential one is\n", @@ -719,7 +719,7 @@ }, { "cell_type": "markdown", - "id": "15455f79", + "id": "81a623d7", "metadata": {}, "source": [ "### Empirical CCDFs\n", @@ -740,7 +740,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3bc395ca", + "id": "e5def76c", "metadata": { "hide-output": false }, @@ -782,7 +782,7 @@ }, { "cell_type": "markdown", - "id": "800bc1fb", + "id": "9a8f5fcf", "metadata": {}, "source": [ "As with the CCDF, the empirical CCDF from the Pareto distributions is\n", @@ -793,7 +793,7 @@ }, { "cell_type": "markdown", - "id": "7ecfb841", + "id": "17766687", "metadata": {}, "source": [ "### Power laws\n", @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "d24a8692", + "id": "a442d1ec", "metadata": {}, "source": [ "## Heavy tails in economic cross-sections\n", @@ -855,7 +855,7 @@ { "cell_type": "code", "execution_count": null, - "id": "244c44ea", + "id": "83a687a9", "metadata": { "hide-output": false }, @@ -921,7 +921,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30141ec5", + "id": "dc5ce420", "metadata": { "hide-output": false }, @@ -950,7 +950,7 @@ }, { "cell_type": "markdown", - "id": "f3767ded", + "id": "4ca65540", "metadata": {}, "source": [ "### Firm size\n", @@ -961,7 +961,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f2dd00eb", + "id": "5896d9fe", "metadata": { "hide-output": false }, @@ -981,7 +981,7 @@ }, { "cell_type": "markdown", - "id": "81193b02", + "id": "664fc4aa", "metadata": {}, "source": [ "### City size\n", @@ -994,7 +994,7 @@ { "cell_type": "code", "execution_count": null, - "id": "81bdf273", + "id": "9acd81e0", "metadata": { "hide-output": false }, @@ -1014,7 +1014,7 @@ }, { "cell_type": "markdown", - "id": "e1cd95e4", + "id": "5173e21b", "metadata": {}, "source": [ "### Wealth\n", @@ -1027,7 +1027,7 @@ { "cell_type": "code", "execution_count": null, - "id": "81a2c249", + "id": "3d199732", "metadata": { "hide-output": false }, @@ -1060,7 +1060,7 @@ }, { "cell_type": "markdown", - "id": "272bb1ed", + "id": "7b4abd23", "metadata": {}, "source": [ "### GDP\n", @@ -1073,7 +1073,7 @@ { "cell_type": "code", "execution_count": null, - "id": "851fbf94", + "id": "e1c27147", "metadata": { "hide-output": false }, @@ -1095,7 +1095,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9f747924", + "id": "fffa68b2", "metadata": { "hide-output": false }, @@ -1111,7 +1111,7 @@ }, { "cell_type": "markdown", - "id": "1c070c52", + "id": "3ea277be", "metadata": {}, "source": [ "The plot is concave rather than linear, so the distribution has light tails.\n", @@ -1124,7 +1124,7 @@ }, { "cell_type": "markdown", - "id": "c622950a", + "id": "58ae36db", "metadata": {}, "source": [ "## Failure of the LLN\n", @@ -1158,7 +1158,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3547a3fc", + "id": "40789c1e", "metadata": { "hide-output": false }, @@ -1190,7 +1190,7 @@ }, { "cell_type": "markdown", - "id": "948a67d5", + "id": "86a25483", "metadata": {}, "source": [ "The sequence shows no sign of converging.\n", @@ -1200,7 +1200,7 @@ }, { "cell_type": "markdown", - "id": "55dc7573", + "id": "0bf21987", "metadata": {}, "source": [ "## Why do heavy tails matter?\n", @@ -1218,7 +1218,7 @@ }, { "cell_type": "markdown", - "id": "f72da4ae", + "id": "4b79602c", "metadata": {}, "source": [ "### Diversification\n", @@ -1265,7 +1265,7 @@ }, { "cell_type": "markdown", - "id": "d93a786b", + "id": "7c8fcc11", "metadata": {}, "source": [ "### Fiscal policy\n", @@ -1283,7 +1283,7 @@ }, { "cell_type": "markdown", - "id": "787ce424", + "id": "87d75ef3", "metadata": {}, "source": [ "## Classifying tail properties\n", @@ -1302,7 +1302,7 @@ }, { "cell_type": "markdown", - "id": "9053c024", + "id": "47add208", "metadata": {}, "source": [ "### Light and heavy tails\n", @@ -1353,7 +1353,7 @@ }, { "cell_type": "markdown", - "id": "a778e554", + "id": "a4f8a144", "metadata": {}, "source": [ "## Further reading\n", @@ -1374,7 +1374,7 @@ }, { "cell_type": "markdown", - "id": "ffbc5477", + "id": "b94ac7e9", "metadata": {}, "source": [ "## Exercises" @@ -1382,7 +1382,7 @@ }, { "cell_type": "markdown", - "id": "c29351c7", + "id": "3d6a44de", "metadata": {}, "source": [ "## Exercise 19.2\n", @@ -1393,7 +1393,7 @@ }, { "cell_type": "markdown", - "id": "44c8f1c4", + "id": "3a550f41", "metadata": {}, "source": [ "## Solution to[ Exercise 19.2](https://intro.quantecon.org/#ht_ex2)\n", @@ -1424,7 +1424,7 @@ }, { "cell_type": "markdown", - "id": "0081a372", + "id": "b39aad42", "metadata": {}, "source": [ "## Exercise 19.3\n", @@ -1440,7 +1440,7 @@ }, { "cell_type": "markdown", - "id": "13632372", + "id": "8f216684", "metadata": {}, "source": [ "## Solution to[ Exercise 19.3](https://intro.quantecon.org/#ht_ex3)" @@ -1449,7 +1449,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5059180a", + "id": "4d1b20ce", "metadata": { "hide-output": false }, @@ -1478,7 +1478,7 @@ }, { "cell_type": "markdown", - "id": "56ef2dcd", + "id": "33c2b0f3", "metadata": {}, "source": [ "## Exercise 19.4\n", @@ -1540,7 +1540,7 @@ }, { "cell_type": "markdown", - "id": "601e28ac", + "id": "e0a85985", "metadata": {}, "source": [ "## Solution to[ Exercise 19.4](https://intro.quantecon.org/#ht_ex5)\n", @@ -1579,7 +1579,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1258888a", + "id": "a4088236", "metadata": { "hide-output": false }, @@ -1604,7 +1604,7 @@ }, { "cell_type": "markdown", - "id": "d7227857", + "id": "24cc5284", "metadata": {}, "source": [ "Let’s compute the lognormal parameters:" @@ -1613,7 +1613,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9118837", + "id": "4ad37ce5", "metadata": { "hide-output": false }, @@ -1626,7 +1626,7 @@ }, { "cell_type": "markdown", - "id": "15ce2767", + "id": "90aae376", "metadata": {}, "source": [ "Here’s a function to compute a single estimate of tax revenue for a particular\n", @@ -1636,7 +1636,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f6ddf5f0", + "id": "9b9df921", "metadata": { "hide-output": false }, @@ -1655,7 +1655,7 @@ }, { "cell_type": "markdown", - "id": "bca3a2c7", + "id": "940f1937", "metadata": {}, "source": [ "Now let’s generate the violin plot." @@ -1664,7 +1664,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a706129f", + "id": "9dce1f7b", "metadata": { "hide-output": false }, @@ -1691,7 +1691,7 @@ }, { "cell_type": "markdown", - "id": "c002baf2", + "id": "70ea1700", "metadata": {}, "source": [ "Finally, let’s print the means and standard deviations." @@ -1700,7 +1700,7 @@ { "cell_type": "code", "execution_count": null, - "id": "75d64617", + "id": "1214094f", "metadata": { "hide-output": false }, @@ -1712,7 +1712,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b3855b7c", + "id": "dba2228b", "metadata": { "hide-output": false }, @@ -1723,7 +1723,7 @@ }, { "cell_type": "markdown", - "id": "943aaffd", + "id": "136a5846", "metadata": {}, "source": [ "Looking at the output of the code, our main conclusion is that the Pareto\n", @@ -1732,7 +1732,7 @@ }, { "cell_type": "markdown", - "id": "5d3ba389", + "id": "22ca19d4", "metadata": {}, "source": [ "## Exercise 19.5\n", @@ -1754,7 +1754,7 @@ }, { "cell_type": "markdown", - "id": "afd58620", + "id": "1691c28e", "metadata": {}, "source": [ "## Solution to[ Exercise 19.5](https://intro.quantecon.org/#ht_ex_cauchy)\n", @@ -1780,7 +1780,7 @@ } ], "metadata": { - "date": 1712122262.6431856, + "date": 1712983676.2037644, "filename": "heavy_tails.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/inequality.ipynb b/_notebooks/inequality.ipynb index bb6c89bd..db778fd2 100644 --- a/_notebooks/inequality.ipynb +++ b/_notebooks/inequality.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "331fa89b", + "id": "33458a12", "metadata": {}, "source": [ "# Income and Wealth Inequality" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "0476e07a", + "id": "3aecd6bf", "metadata": {}, "source": [ "## Overview\n", @@ -23,7 +23,7 @@ }, { "cell_type": "markdown", - "id": "4297213f", + "id": "a6a4611c", "metadata": {}, "source": [ "### Some history\n", @@ -51,7 +51,7 @@ }, { "cell_type": "markdown", - "id": "37125775", + "id": "4d8f27a1", "metadata": {}, "source": [ "### Measurement\n", @@ -74,7 +74,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0226b542", + "id": "30dcda10", "metadata": { "hide-output": false }, @@ -85,7 +85,7 @@ }, { "cell_type": "markdown", - "id": "59a4addb", + "id": "fd5ffb6d", "metadata": {}, "source": [ "We will also use the following imports." @@ -94,7 +94,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7a01e15a", + "id": "682d1257", "metadata": { "hide-output": false }, @@ -110,7 +110,7 @@ }, { "cell_type": "markdown", - "id": "ee28bad1", + "id": "1e7a9a23", "metadata": {}, "source": [ "## The Lorenz curve\n", @@ -122,7 +122,7 @@ }, { "cell_type": "markdown", - "id": "556af8c7", + "id": "7e3e5cb7", "metadata": {}, "source": [ "### Definition\n", @@ -144,7 +144,7 @@ }, { "cell_type": "markdown", - "id": "f0914ad7", + "id": "a20d5590", "metadata": {}, "source": [ "### \n", @@ -173,7 +173,7 @@ }, { "cell_type": "markdown", - "id": "843cbf64", + "id": "de89d294", "metadata": {}, "source": [ "### Lorenz curves of simulated data\n", @@ -191,7 +191,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1597b07f", + "id": "33d83d60", "metadata": { "hide-output": false }, @@ -245,7 +245,7 @@ }, { "cell_type": "markdown", - "id": "25b09761", + "id": "f9ed1a2f", "metadata": {}, "source": [ "In the next figure, we generate $ n=2000 $ draws from a lognormal\n", @@ -263,7 +263,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5a615d2f", + "id": "6d5ccf04", "metadata": { "hide-output": false }, @@ -290,7 +290,7 @@ }, { "cell_type": "markdown", - "id": "701a9d98", + "id": "70e9f9d6", "metadata": {}, "source": [ "### Lorenz curves for US data\n", @@ -306,7 +306,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f170be9a", + "id": "1e5a67c5", "metadata": { "hide-output": false }, @@ -320,7 +320,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d7959435", + "id": "b3a21669", "metadata": { "hide-output": false }, @@ -331,7 +331,7 @@ }, { "cell_type": "markdown", - "id": "a6b374e0", + "id": "3bd5ab6b", "metadata": {}, "source": [ "The next code block uses data stored in dataframe `df_income_wealth` to generate the Lorenz curves.\n", @@ -343,7 +343,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4adbff36", + "id": "4aaa4c6d", "metadata": { "hide-output": false }, @@ -389,7 +389,7 @@ }, { "cell_type": "markdown", - "id": "18f9e874", + "id": "83cb704d", "metadata": {}, "source": [ "Now we plot Lorenz curves for net wealth, total income and labor income in the\n", @@ -403,7 +403,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8c7b4f7d", + "id": "83814b47", "metadata": { "hide-output": false }, @@ -422,7 +422,7 @@ }, { "cell_type": "markdown", - "id": "4e4683cd", + "id": "bde6c794", "metadata": {}, "source": [ "One key finding from this figure is that wealth inequality is more extreme than income inequality." @@ -430,7 +430,7 @@ }, { "cell_type": "markdown", - "id": "aa3fca3f", + "id": "53844877", "metadata": {}, "source": [ "## The Gini coefficient\n", @@ -445,7 +445,7 @@ }, { "cell_type": "markdown", - "id": "4a18bee0", + "id": "1407b17d", "metadata": {}, "source": [ "### Definition\n", @@ -457,7 +457,7 @@ }, { "cell_type": "markdown", - "id": "471e6501", + "id": "c7bcea5d", "metadata": {}, "source": [ "### \n", @@ -479,7 +479,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f4396ca6", + "id": "cfe79527", "metadata": { "hide-output": false }, @@ -503,7 +503,7 @@ }, { "cell_type": "markdown", - "id": "46fd12bd", + "id": "a16927b8", "metadata": {}, "source": [ "In fact the Gini coefficient can also be expressed as\n", @@ -519,7 +519,7 @@ { "cell_type": "code", "execution_count": null, - "id": "807265b9", + "id": "fee32469", "metadata": { "hide-output": false }, @@ -543,7 +543,7 @@ }, { "cell_type": "markdown", - "id": "753b5c96", + "id": "e1250fec", "metadata": {}, "source": [ "The World in Data project has a [nice graphical exploration of the Lorenz curve and the Gini coefficient](https://ourworldindata.org/what-is-the-gini-coefficient)" @@ -551,7 +551,7 @@ }, { "cell_type": "markdown", - "id": "5693406a", + "id": "f70f1e20", "metadata": {}, "source": [ "### Gini coefficient of simulated data\n", @@ -564,7 +564,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1a866203", + "id": "8fc6861c", "metadata": { "hide-output": false }, @@ -600,7 +600,7 @@ }, { "cell_type": "markdown", - "id": "c7241a31", + "id": "2e8fb121", "metadata": {}, "source": [ "Now we can compute the Gini coefficients for five different populations.\n", @@ -622,7 +622,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ae36852", + "id": "8bcaa53b", "metadata": { "hide-output": false }, @@ -642,7 +642,7 @@ }, { "cell_type": "markdown", - "id": "fcc92449", + "id": "4bdeeda6", "metadata": {}, "source": [ "Let’s build a function that returns a figure (so that we can use it later in the lecture)." @@ -651,7 +651,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a153faa3", + "id": "762efd04", "metadata": { "hide-output": false }, @@ -669,7 +669,7 @@ { "cell_type": "code", "execution_count": null, - "id": "595fa235", + "id": "97cf99e7", "metadata": { "hide-output": false }, @@ -685,7 +685,7 @@ }, { "cell_type": "markdown", - "id": "c27d31c5", + "id": "f8afcc3f", "metadata": {}, "source": [ "The plots show that inequality rises with $ \\sigma $, according to the Gini\n", @@ -694,7 +694,7 @@ }, { "cell_type": "markdown", - "id": "6d541c80", + "id": "651f2289", "metadata": {}, "source": [ "### Gini coefficient for income (US data)\n", @@ -709,7 +709,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8af1015", + "id": "923ec8e9", "metadata": { "hide-output": false }, @@ -720,7 +720,7 @@ }, { "cell_type": "markdown", - "id": "de5c7306", + "id": "c38334c6", "metadata": {}, "source": [ "We now know the series ID is `SI.POV.GINI`.\n", @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26098afb", + "id": "7aa2781a", "metadata": { "hide-output": false }, @@ -756,7 +756,7 @@ }, { "cell_type": "markdown", - "id": "2eeb1513", + "id": "d007d3cb", "metadata": {}, "source": [ "We can see in Fig. 5.6 that across 50 years of data and all countries the measure varies between 20 and 65.\n", @@ -767,7 +767,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bbec98e9", + "id": "eb3cdd8b", "metadata": { "hide-output": false }, @@ -781,7 +781,7 @@ }, { "cell_type": "markdown", - "id": "83ec7f99", + "id": "cefb8b1f", "metadata": {}, "source": [ "(This package often returns data with year information contained in the columns. This is not always convenient for simple plotting with pandas so it can be useful to transpose the results before plotting.)" @@ -790,7 +790,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f793d9a", + "id": "078d7af9", "metadata": { "hide-output": false }, @@ -802,7 +802,7 @@ }, { "cell_type": "markdown", - "id": "33baedcd", + "id": "d377ff3b", "metadata": {}, "source": [ "Let us take a look at the data for the US." @@ -811,7 +811,7 @@ { "cell_type": "code", "execution_count": null, - "id": "00244599", + "id": "302f98f5", "metadata": { "hide-output": false }, @@ -827,7 +827,7 @@ }, { "cell_type": "markdown", - "id": "f735c91a", + "id": "a16f1be9", "metadata": {}, "source": [ "As can be seen in Fig. 5.7, the income Gini\n", @@ -839,7 +839,7 @@ }, { "cell_type": "markdown", - "id": "57e8d39e", + "id": "b16c8872", "metadata": {}, "source": [ "### Gini coefficient for wealth (US data)\n", @@ -855,7 +855,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a6f18924", + "id": "0c1a97ac", "metadata": { "hide-output": false }, @@ -866,7 +866,7 @@ }, { "cell_type": "markdown", - "id": "68079897", + "id": "3e19740a", "metadata": {}, "source": [ "**Note:** This code can be used to compute this information over the full dataset." @@ -875,7 +875,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bd0e30b9", + "id": "14081a6d", "metadata": { "hide-output": false }, @@ -917,7 +917,7 @@ }, { "cell_type": "markdown", - "id": "ba534e09", + "id": "2f373779", "metadata": {}, "source": [ "However, to speed up execution we will import a pre-computed dataset from the lecture repository." @@ -926,7 +926,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4700fa21", + "id": "342e297f", "metadata": { "hide-output": false }, @@ -938,7 +938,7 @@ }, { "cell_type": "markdown", - "id": "712bf09e", + "id": "5c8cdfee", "metadata": {}, "source": [ "Let’s plot the Gini coefficients for net wealth." @@ -947,7 +947,7 @@ { "cell_type": "code", "execution_count": null, - "id": "836c37f3", + "id": "5dcc08bf", "metadata": { "hide-output": false }, @@ -962,7 +962,7 @@ }, { "cell_type": "markdown", - "id": "f36da953", + "id": "73895d10", "metadata": {}, "source": [ "The time series for the wealth Gini exhibits a U-shape, falling until the early\n", @@ -975,7 +975,7 @@ }, { "cell_type": "markdown", - "id": "5592d539", + "id": "94473cb8", "metadata": {}, "source": [ "### Cross-country comparisons of income inequality\n", @@ -989,7 +989,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9014dc88", + "id": "2e70e526", "metadata": { "hide-output": false }, @@ -1001,7 +1001,7 @@ }, { "cell_type": "markdown", - "id": "c57a6c15", + "id": "08496668", "metadata": {}, "source": [ "There are 167 countries represented in this dataset.\n", @@ -1012,7 +1012,7 @@ { "cell_type": "code", "execution_count": null, - "id": "91c0e5af", + "id": "65889a7a", "metadata": { "hide-output": false }, @@ -1027,7 +1027,7 @@ }, { "cell_type": "markdown", - "id": "bbf63494", + "id": "19aa05a2", "metadata": {}, "source": [ "We see that Norway has a shorter time series.\n", @@ -1038,7 +1038,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c09f3911", + "id": "359270b6", "metadata": { "hide-output": false }, @@ -1049,7 +1049,7 @@ }, { "cell_type": "markdown", - "id": "c9ee1887", + "id": "df8bb156", "metadata": {}, "source": [ "The data for Norway in this dataset goes back to 1979 but there are gaps in the time series and matplotlib is not showing those data points.\n", @@ -1060,7 +1060,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4d2c0df1", + "id": "45d375aa", "metadata": { "hide-output": false }, @@ -1076,7 +1076,7 @@ }, { "cell_type": "markdown", - "id": "5a41e4a1", + "id": "dc847eb5", "metadata": {}, "source": [ "From this plot we can observe that the US has a higher Gini coefficient (i.e.\n", @@ -1088,7 +1088,7 @@ }, { "cell_type": "markdown", - "id": "a91691f1", + "id": "33274684", "metadata": {}, "source": [ "### Gini Coefficient and GDP per capita (over time)\n", @@ -1101,7 +1101,7 @@ { "cell_type": "code", "execution_count": null, - "id": "159487f4", + "id": "eadb5b39", "metadata": { "hide-output": false }, @@ -1116,7 +1116,7 @@ }, { "cell_type": "markdown", - "id": "c608aba5", + "id": "63190c30", "metadata": {}, "source": [ "We can rearrange the data so that we can plot GDP per capita and the Gini coefficient across years" @@ -1125,7 +1125,7 @@ { "cell_type": "code", "execution_count": null, - "id": "176ff8a7", + "id": "a566981f", "metadata": { "hide-output": false }, @@ -1138,7 +1138,7 @@ }, { "cell_type": "markdown", - "id": "5dadefc8", + "id": "70dfc18c", "metadata": {}, "source": [ "Now we can get the GDP per capita data into a shape that can be merged with `plot_data`" @@ -1147,7 +1147,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2309fb94", + "id": "516a4d2f", "metadata": { "hide-output": false }, @@ -1162,7 +1162,7 @@ }, { "cell_type": "markdown", - "id": "4dd60871", + "id": "61cec1b5", "metadata": {}, "source": [ "Now we use Plotly to build a plot with GDP per capita on the y-axis and the Gini coefficient on the x-axis." @@ -1171,7 +1171,7 @@ { "cell_type": "code", "execution_count": null, - "id": "75ea5a65", + "id": "829f171d", "metadata": { "hide-output": false }, @@ -1183,7 +1183,7 @@ }, { "cell_type": "markdown", - "id": "f4efd633", + "id": "26d2ef53", "metadata": {}, "source": [ "The time series for all three countries start and stop in different years. We will add a year mask to the data to\n", @@ -1193,7 +1193,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9ebc40af", + "id": "9a0a7f75", "metadata": { "hide-output": false }, @@ -1206,7 +1206,7 @@ }, { "cell_type": "markdown", - "id": "b4a6b5c3", + "id": "263f60b3", "metadata": {}, "source": [ "\n", @@ -1216,7 +1216,7 @@ { "cell_type": "code", "execution_count": null, - "id": "66f2c671", + "id": "3ddf76e9", "metadata": { "hide-output": false }, @@ -1236,7 +1236,7 @@ }, { "cell_type": "markdown", - "id": "3d1f148f", + "id": "67a06599", "metadata": {}, "source": [ "This plot shows that all three Western economies GDP per capita has grown over\n", @@ -1251,7 +1251,7 @@ }, { "cell_type": "markdown", - "id": "4610c087", + "id": "764acb16", "metadata": {}, "source": [ "## Top shares\n", @@ -1263,7 +1263,7 @@ }, { "cell_type": "markdown", - "id": "0756fe3d", + "id": "013a3200", "metadata": {}, "source": [ "### Definition\n", @@ -1276,7 +1276,7 @@ }, { "cell_type": "markdown", - "id": "fa64ffed", + "id": "d254cc1f", "metadata": {}, "source": [ "### \n", @@ -1299,7 +1299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bc4bde65", + "id": "cb81047b", "metadata": { "hide-output": false }, @@ -1347,7 +1347,7 @@ }, { "cell_type": "markdown", - "id": "84f5111e", + "id": "cfb5ef61", "metadata": {}, "source": [ "Then let’s plot the top shares." @@ -1356,7 +1356,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4ccd2532", + "id": "6ac0e314", "metadata": { "hide-output": false }, @@ -1377,7 +1377,7 @@ }, { "cell_type": "markdown", - "id": "b0ba380e", + "id": "82cbc41a", "metadata": {}, "source": [ "## Exercises" @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "f318643b", + "id": "dbfd042b", "metadata": {}, "source": [ "## Exercise 5.1\n", @@ -1409,7 +1409,7 @@ }, { "cell_type": "markdown", - "id": "1cf4567c", + "id": "2fca86b5", "metadata": {}, "source": [ "## Solution to[ Exercise 5.1](https://intro.quantecon.org/#inequality_ex1)\n", @@ -1420,7 +1420,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a925c3c0", + "id": "2007a50d", "metadata": { "hide-output": false }, @@ -1437,7 +1437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fd85c13a", + "id": "3efc4f4f", "metadata": { "hide-output": false }, @@ -1465,7 +1465,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8167ead2", + "id": "5574fc87", "metadata": { "hide-output": false }, @@ -1482,7 +1482,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b0e96f09", + "id": "d34b9a0f", "metadata": { "hide-output": false }, @@ -1499,7 +1499,7 @@ { "cell_type": "code", "execution_count": null, - "id": "54296289", + "id": "88a90542", "metadata": { "hide-output": false }, @@ -1515,7 +1515,7 @@ }, { "cell_type": "markdown", - "id": "7d800833", + "id": "02f1b7e0", "metadata": {}, "source": [ "## Exercise 5.2\n", @@ -1529,7 +1529,7 @@ }, { "cell_type": "markdown", - "id": "298c5c6e", + "id": "5c228c59", "metadata": {}, "source": [ "## Solution to[ Exercise 5.2](https://intro.quantecon.org/#inequality_ex2)\n", @@ -1540,7 +1540,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f6d1d972", + "id": "979deae5", "metadata": { "hide-output": false }, @@ -1554,7 +1554,7 @@ { "cell_type": "code", "execution_count": null, - "id": "89435ca9", + "id": "2087ab61", "metadata": { "hide-output": false }, @@ -1568,7 +1568,7 @@ { "cell_type": "code", "execution_count": null, - "id": "03d53546", + "id": "d690519f", "metadata": { "hide-output": false }, @@ -1588,7 +1588,7 @@ } ], "metadata": { - "date": 1712122262.714818, + "date": 1712983676.2694461, "filename": "inequality.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/inflation_history.ipynb b/_notebooks/inflation_history.ipynb index 5a6c0e57..792caf55 100644 --- a/_notebooks/inflation_history.ipynb +++ b/_notebooks/inflation_history.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "8f100e53", + "id": "f60dac96", "metadata": {}, "source": [ "# Price Level Histories\n", @@ -17,7 +17,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ae7152c", + "id": "953dd00a", "metadata": { "hide-output": false }, @@ -28,7 +28,7 @@ }, { "cell_type": "markdown", - "id": "3958737a", + "id": "0302687e", "metadata": {}, "source": [ "We can then import the Python modules we will use." @@ -37,7 +37,7 @@ { "cell_type": "code", "execution_count": null, - "id": "78ec8647", + "id": "cbf24c66", "metadata": { "hide-output": false }, @@ -51,7 +51,7 @@ }, { "cell_type": "markdown", - "id": "2ecbb357", + "id": "a1404494", "metadata": {}, "source": [ "The rate of growth of the price level is called **inflation** in the popular press and in discussions among central bankers and treasury officials.\n", @@ -73,7 +73,7 @@ }, { "cell_type": "markdown", - "id": "64d6ce48", + "id": "58712f77", "metadata": {}, "source": [ "## Four centuries of price levels\n", @@ -98,7 +98,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f36ce53", + "id": "80105a94", "metadata": { "hide-output": false }, @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "f800c47d", + "id": "5ab250d4", "metadata": {}, "source": [ "We first plot price levels over the period 1600-1914.\n", @@ -126,7 +126,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36cf8e4b", + "id": "0b8956b4", "metadata": { "hide-output": false }, @@ -153,7 +153,7 @@ }, { "cell_type": "markdown", - "id": "4f4022c7", + "id": "b56a6680", "metadata": {}, "source": [ "We say “most years” because there were temporary lapses from the gold or silver standard.\n", @@ -210,7 +210,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f4fdde18", + "id": "73186ca4", "metadata": { "hide-output": false }, @@ -234,7 +234,7 @@ }, { "cell_type": "markdown", - "id": "91e2de79", + "id": "81d6512d", "metadata": {}, "source": [ "Fig. 4.2 shows that paper-money-printing central banks didn’t do as well as the gold and standard silver standard in anchoring price levels.\n", @@ -254,7 +254,7 @@ }, { "cell_type": "markdown", - "id": "27d55d80", + "id": "27b72bb7", "metadata": {}, "source": [ "## Four big inflations\n", @@ -283,7 +283,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aa751119", + "id": "56d4bb80", "metadata": { "hide-output": false }, @@ -347,7 +347,7 @@ }, { "cell_type": "markdown", - "id": "befe9e5b", + "id": "076d9f88", "metadata": {}, "source": [ "Now we write plotting functions `pe_plot` and `pr_plot` that will build figures that show the price level, exchange rates,\n", @@ -357,7 +357,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b9e046e9", + "id": "1f276a99", "metadata": { "hide-output": false }, @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "aa353909", + "id": "4100f8de", "metadata": {}, "source": [ "We prepare the data for each country" @@ -436,7 +436,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26164187", + "id": "8307fc0c", "metadata": { "hide-output": false }, @@ -479,7 +479,7 @@ }, { "cell_type": "markdown", - "id": "358e6a6d", + "id": "16dc4cff", "metadata": {}, "source": [ "Now let’s construct graphs for our four countries.\n", @@ -499,7 +499,7 @@ }, { "cell_type": "markdown", - "id": "aee7c5a7", + "id": "0d11aa4c", "metadata": {}, "source": [ "### Austria\n", @@ -513,7 +513,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3f91ad47", + "id": "f414ba6a", "metadata": { "hide-output": false }, @@ -535,7 +535,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee18713c", + "id": "c2a2d7ee", "metadata": { "hide-output": false }, @@ -550,7 +550,7 @@ }, { "cell_type": "markdown", - "id": "37e61cd6", + "id": "aee8729d", "metadata": {}, "source": [ "Staring at Fig. 4.3 and Fig. 4.4 conveys the following impressions to the authors of this lecture at QuantEcon.\n", @@ -565,7 +565,7 @@ }, { "cell_type": "markdown", - "id": "614e17e2", + "id": "5148426b", "metadata": {}, "source": [ "### Hungary\n", @@ -578,7 +578,7 @@ { "cell_type": "code", "execution_count": null, - "id": "34d3f06a", + "id": "9241c32b", "metadata": { "hide-output": false }, @@ -601,7 +601,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72d25372", + "id": "af299e71", "metadata": { "hide-output": false }, @@ -616,7 +616,7 @@ }, { "cell_type": "markdown", - "id": "2e458a53", + "id": "f8946749", "metadata": {}, "source": [ "### Poland\n", @@ -636,7 +636,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee7b57fa", + "id": "57224906", "metadata": { "hide-output": false }, @@ -670,7 +670,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01f211f4", + "id": "1628a1cd", "metadata": { "hide-output": false }, @@ -689,7 +689,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad2f73b2", + "id": "63306feb", "metadata": { "hide-output": false }, @@ -704,7 +704,7 @@ }, { "cell_type": "markdown", - "id": "c8defbf8", + "id": "9b1f9ee0", "metadata": {}, "source": [ "### Germany\n", @@ -718,7 +718,7 @@ { "cell_type": "code", "execution_count": null, - "id": "460f8839", + "id": "6d3486fb", "metadata": { "hide-output": false }, @@ -741,7 +741,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7b775e9e", + "id": "9431b045", "metadata": { "hide-output": false }, @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6be05436", + "id": "74713b80", "metadata": { "hide-output": false }, @@ -785,7 +785,7 @@ }, { "cell_type": "markdown", - "id": "52862e75", + "id": "db2db45d", "metadata": {}, "source": [ "## Starting and stopping big inflations\n", @@ -835,7 +835,7 @@ } ], "metadata": { - "date": 1712122262.7548175, + "date": 1712983676.5052295, "filename": "inflation_history.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/input_output.ipynb b/_notebooks/input_output.ipynb index 0518a1ec..1cec4ef3 100644 --- a/_notebooks/input_output.ipynb +++ b/_notebooks/input_output.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "816b7641", + "id": "97eb95ba", "metadata": {}, "source": [ "# Input-Output Models" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "47f37368", + "id": "92ddaa99", "metadata": {}, "source": [ "## Overview\n", @@ -21,7 +21,7 @@ { "cell_type": "code", "execution_count": null, - "id": "79dc41fb", + "id": "fc38f0c8", "metadata": { "hide-output": false }, @@ -35,7 +35,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b828f833", + "id": "18e69d4a", "metadata": { "hide-output": false }, @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "c41d1d7b", + "id": "d473cb36", "metadata": {}, "source": [ "The following figure illustrates a network of linkages among 15 sectors\n", @@ -68,7 +68,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73d67e46", + "id": "018a1e8b", "metadata": { "hide-output": false }, @@ -101,7 +101,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5e43ef7", + "id": "21075289", "metadata": { "hide-output": false }, @@ -128,7 +128,7 @@ }, { "cell_type": "markdown", - "id": "882fcc2c", + "id": "2463bc36", "metadata": {}, "source": [ "|Label|Sector|Label|Sector|Label|Sector|\n", @@ -150,7 +150,7 @@ }, { "cell_type": "markdown", - "id": "aabaa92e", + "id": "86c9da9e", "metadata": {}, "source": [ "## Input output analysis\n", @@ -176,7 +176,7 @@ }, { "cell_type": "markdown", - "id": "dfbcaeec", + "id": "0c94fc49", "metadata": {}, "source": [ "### Two goods\n", @@ -188,7 +188,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5264094", + "id": "41bb2450", "metadata": { "hide-output": false }, @@ -231,7 +231,7 @@ }, { "cell_type": "markdown", - "id": "6441413b", + "id": "97bb0993", "metadata": {}, "source": [ "**Feasible allocations must satisfy**\n", @@ -250,7 +250,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22536a1e", + "id": "a6314f3c", "metadata": { "hide-output": false }, @@ -287,7 +287,7 @@ }, { "cell_type": "markdown", - "id": "8b5e839c", + "id": "6ce22aa0", "metadata": {}, "source": [ "More generally, constraints on production are\n", @@ -344,7 +344,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eb0a4180", + "id": "d1fdb1b9", "metadata": { "hide-output": false }, @@ -358,7 +358,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b776d2af", + "id": "b3b406d0", "metadata": { "hide-output": false }, @@ -371,7 +371,7 @@ }, { "cell_type": "markdown", - "id": "487f9dd7", + "id": "1395c26f", "metadata": {}, "source": [ "Let’s check the **Hawkins-Simon conditions**" @@ -380,7 +380,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8763e9cd", + "id": "0c9143d7", "metadata": { "hide-output": false }, @@ -391,7 +391,7 @@ }, { "cell_type": "markdown", - "id": "72ebb4f1", + "id": "7fb63400", "metadata": {}, "source": [ "Now, let’s compute the **Leontief inverse** matrix" @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e61ee5d9", + "id": "6040014f", "metadata": { "hide-output": false }, @@ -413,7 +413,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fdf3c82b", + "id": "85a69436", "metadata": { "hide-output": false }, @@ -425,7 +425,7 @@ }, { "cell_type": "markdown", - "id": "04c06e8a", + "id": "a7dda931", "metadata": {}, "source": [ "## Production possibility frontier\n", @@ -470,7 +470,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0531bd87", + "id": "a2aabb7b", "metadata": { "hide-output": false }, @@ -483,7 +483,7 @@ }, { "cell_type": "markdown", - "id": "8e2a907b", + "id": "46f1e944", "metadata": {}, "source": [ "Thus, the production possibility frontier for this economy is\n", @@ -495,7 +495,7 @@ }, { "cell_type": "markdown", - "id": "35941870", + "id": "cf1c3463", "metadata": {}, "source": [ "## Prices\n", @@ -542,7 +542,7 @@ }, { "cell_type": "markdown", - "id": "7472eb83", + "id": "b702ffa3", "metadata": {}, "source": [ "## Linear programs\n", @@ -590,7 +590,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2bd367b2", + "id": "07dc80a6", "metadata": { "hide-output": false }, @@ -626,7 +626,7 @@ }, { "cell_type": "markdown", - "id": "9a39f6f1", + "id": "1da6230a", "metadata": {}, "source": [ "## Leontief inverse\n", @@ -644,7 +644,7 @@ }, { "cell_type": "markdown", - "id": "18e724a6", + "id": "4a87615a", "metadata": {}, "source": [ "### Demand shocks\n", @@ -664,7 +664,7 @@ }, { "cell_type": "markdown", - "id": "39aecaf7", + "id": "a735a5c3", "metadata": {}, "source": [ "## Applications of graph theory\n", @@ -686,7 +686,7 @@ }, { "cell_type": "markdown", - "id": "55419d6a", + "id": "e44240a9", "metadata": {}, "source": [ "### Eigenvector centrality\n", @@ -705,7 +705,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a7d44e9f", + "id": "4a5f8e87", "metadata": { "hide-output": false }, @@ -719,7 +719,7 @@ }, { "cell_type": "markdown", - "id": "663a72e4", + "id": "608149e9", "metadata": {}, "source": [ "A higher measure indicates higher importance as a supplier.\n", @@ -731,7 +731,7 @@ }, { "cell_type": "markdown", - "id": "2f9172e8", + "id": "9cf1f606", "metadata": {}, "source": [ "### Output multipliers\n", @@ -769,7 +769,7 @@ { "cell_type": "code", "execution_count": null, - "id": "63482538", + "id": "4a2c8e04", "metadata": { "hide-output": false }, @@ -787,7 +787,7 @@ }, { "cell_type": "markdown", - "id": "5ba2fec7", + "id": "7ab59f8a", "metadata": {}, "source": [ "We observe that manufacturing and agriculture are highest ranking sectors." @@ -795,7 +795,7 @@ }, { "cell_type": "markdown", - "id": "bfc6b06a", + "id": "19d6c135", "metadata": {}, "source": [ "## Exercises" @@ -803,7 +803,7 @@ }, { "cell_type": "markdown", - "id": "b6760142", + "id": "b3a709e8", "metadata": {}, "source": [ "## Exercise 37.1\n", @@ -844,7 +844,7 @@ }, { "cell_type": "markdown", - "id": "0d10b91d", + "id": "a6a8026d", "metadata": {}, "source": [ "## Solution to[ Exercise 37.1](https://intro.quantecon.org/#io_ex1)\n", @@ -858,7 +858,7 @@ }, { "cell_type": "markdown", - "id": "28f2d8f8", + "id": "1a6886d9", "metadata": {}, "source": [ "## Exercise 37.2\n", @@ -868,7 +868,7 @@ }, { "cell_type": "markdown", - "id": "67d154c0", + "id": "d71bac50", "metadata": {}, "source": [ "## Solution to[ Exercise 37.2](https://intro.quantecon.org/#io_ex2)" @@ -877,7 +877,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2af012a9", + "id": "1f3c6865", "metadata": { "hide-output": false }, @@ -891,7 +891,7 @@ { "cell_type": "code", "execution_count": null, - "id": "95358f3e", + "id": "e016a13c", "metadata": { "hide-output": false }, @@ -905,7 +905,7 @@ { "cell_type": "code", "execution_count": null, - "id": "846b875d", + "id": "49ca2a3e", "metadata": { "hide-output": false }, @@ -917,7 +917,7 @@ }, { "cell_type": "markdown", - "id": "1ec798e6", + "id": "1f9491af", "metadata": {}, "source": [ "Thus the production possibility frontier is given by\n", @@ -929,7 +929,7 @@ } ], "metadata": { - "date": 1712122263.0601902, + "date": 1712983676.544073, "filename": "input_output.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/intro.ipynb b/_notebooks/intro.ipynb index c40c4dda..51db96ed 100644 --- a/_notebooks/intro.ipynb +++ b/_notebooks/intro.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "2e211059", + "id": "a2126e84", "metadata": {}, "source": [ "# A First Course in Quantitative Economics with Python\n", @@ -12,7 +12,7 @@ }, { "cell_type": "markdown", - "id": "a0f3c114", + "id": "4376e6a9", "metadata": {}, "source": [ "# Introduction\n", @@ -22,7 +22,7 @@ }, { "cell_type": "markdown", - "id": "08e4ddb0", + "id": "02cb7674", "metadata": {}, "source": [ "# Economic Data\n", @@ -35,7 +35,7 @@ }, { "cell_type": "markdown", - "id": "fa22c63b", + "id": "5777f3e7", "metadata": {}, "source": [ "# Foundations\n", @@ -48,7 +48,7 @@ }, { "cell_type": "markdown", - "id": "fd038d86", + "id": "f9dd9980", "metadata": {}, "source": [ "# Linear Dynamics: Finite Horizons\n", @@ -62,7 +62,7 @@ }, { "cell_type": "markdown", - "id": "55ed13da", + "id": "8182fd68", "metadata": {}, "source": [ "# Linear Dynamics: Infinite Horizons\n", @@ -72,7 +72,7 @@ }, { "cell_type": "markdown", - "id": "02b75da7", + "id": "e86245a7", "metadata": {}, "source": [ "# Probability and Distributions\n", @@ -86,7 +86,7 @@ }, { "cell_type": "markdown", - "id": "d9c42728", + "id": "4344c7ae", "metadata": {}, "source": [ "# Nonlinear Dynamics\n", @@ -100,7 +100,7 @@ }, { "cell_type": "markdown", - "id": "92f88674", + "id": "ffc64e1d", "metadata": {}, "source": [ "# Monetary-Fiscal Policy Interactions\n", @@ -113,7 +113,7 @@ }, { "cell_type": "markdown", - "id": "c50c02de", + "id": "f334e9fb", "metadata": {}, "source": [ "# Stochastic Dynamics\n", @@ -126,7 +126,7 @@ }, { "cell_type": "markdown", - "id": "ed7c1a8d", + "id": "9a2610f9", "metadata": {}, "source": [ "# Optimization\n", @@ -137,7 +137,7 @@ }, { "cell_type": "markdown", - "id": "7176a322", + "id": "c505f52e", "metadata": {}, "source": [ "# Modeling in Higher Dimensions\n", @@ -150,7 +150,7 @@ }, { "cell_type": "markdown", - "id": "dde9c267", + "id": "8128af2f", "metadata": {}, "source": [ "# Markets and Competitive Equilibrium\n", @@ -161,7 +161,7 @@ }, { "cell_type": "markdown", - "id": "7c317479", + "id": "651d5039", "metadata": {}, "source": [ "# Estimation\n", @@ -172,7 +172,7 @@ }, { "cell_type": "markdown", - "id": "e5bdd62c", + "id": "9feea957", "metadata": {}, "source": [ "# Other\n", @@ -184,7 +184,7 @@ } ], "metadata": { - "date": 1712122263.0908306, + "date": 1712983676.5713587, "filename": "intro.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/intro_supply_demand.ipynb b/_notebooks/intro_supply_demand.ipynb index b4a287af..c86febf9 100644 --- a/_notebooks/intro_supply_demand.ipynb +++ b/_notebooks/intro_supply_demand.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "538f7643", + "id": "a75f9467", "metadata": {}, "source": [ "# Introduction to Supply and Demand" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "88c060c9", + "id": "e70cb4ed", "metadata": {}, "source": [ "## Overview\n", @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "a2b6eca5", + "id": "79a2f252", "metadata": {}, "source": [ "### Why does this model matter?\n", @@ -46,7 +46,7 @@ }, { "cell_type": "markdown", - "id": "2381db20", + "id": "a9dc72eb", "metadata": {}, "source": [ "### Topics and infrastructure\n", @@ -68,7 +68,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aaf76ec9", + "id": "c355ea43", "metadata": { "hide-output": false }, @@ -81,7 +81,7 @@ }, { "cell_type": "markdown", - "id": "e67c52f9", + "id": "733a2be3", "metadata": {}, "source": [ "## Consumer surplus\n", @@ -93,7 +93,7 @@ }, { "cell_type": "markdown", - "id": "512025f1", + "id": "bdf76621", "metadata": {}, "source": [ "### A discrete example\n", @@ -133,7 +133,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b3506658", + "id": "1a7c48e7", "metadata": { "hide-output": false }, @@ -157,7 +157,7 @@ }, { "cell_type": "markdown", - "id": "818b92f4", + "id": "8133b198", "metadata": {}, "source": [ "The total consumer surplus in this market is\n", @@ -174,7 +174,7 @@ }, { "cell_type": "markdown", - "id": "9dd9559b", + "id": "122ea9ec", "metadata": {}, "source": [ "### A comment on quantity.\n", @@ -190,7 +190,7 @@ }, { "cell_type": "markdown", - "id": "ccebadc2", + "id": "9125e143", "metadata": {}, "source": [ "### A continuous approximation\n", @@ -213,7 +213,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8ea8724d", + "id": "d6f24aaa", "metadata": { "hide-output": false }, @@ -241,7 +241,7 @@ }, { "cell_type": "markdown", - "id": "cb4de575", + "id": "34ef771f", "metadata": {}, "source": [ "Reasoning by analogy with the discrete case, the area under the demand curve and above the price is called the **consumer surplus**, and is a measure of total gains from trade on the part of consumers.\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b78e7ce5", + "id": "fcb7df1e", "metadata": { "hide-output": false }, @@ -281,7 +281,7 @@ }, { "cell_type": "markdown", - "id": "348eee90", + "id": "dda25974", "metadata": {}, "source": [ "The value $ q^* $ is where the inverse demand curve meets price." @@ -289,7 +289,7 @@ }, { "cell_type": "markdown", - "id": "d8fb7e5e", + "id": "25b5bf16", "metadata": {}, "source": [ "## Producer surplus\n", @@ -299,7 +299,7 @@ }, { "cell_type": "markdown", - "id": "66cc7390", + "id": "1071e6c9", "metadata": {}, "source": [ "### The discrete case\n", @@ -310,7 +310,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e3973b1c", + "id": "1bde5fdb", "metadata": { "hide-output": false }, @@ -332,7 +332,7 @@ }, { "cell_type": "markdown", - "id": "3e1b0157", + "id": "cfef48cc", "metadata": {}, "source": [ "Let $ v_i $ be the price at which producer $ i $ is willing to sell the good.\n", @@ -364,7 +364,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10de6347", + "id": "675411ac", "metadata": { "hide-output": false }, @@ -398,7 +398,7 @@ }, { "cell_type": "markdown", - "id": "8f02d5f2", + "id": "5792c68c", "metadata": {}, "source": [ "\n", @@ -407,7 +407,7 @@ }, { "cell_type": "markdown", - "id": "12597cc6", + "id": "6dfc6c1c", "metadata": {}, "source": [ "## Integration\n", @@ -428,7 +428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ecd334ec", + "id": "c3cc950c", "metadata": { "hide-output": false }, @@ -452,7 +452,7 @@ }, { "cell_type": "markdown", - "id": "1b707878", + "id": "6eebcb55", "metadata": {}, "source": [ "There are many rules for calculating integrals, with different rules applying to different choices of $ f $.\n", @@ -474,7 +474,7 @@ }, { "cell_type": "markdown", - "id": "05a24610", + "id": "548efbdd", "metadata": {}, "source": [ "## Supply and demand\n", @@ -515,7 +515,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11977601", + "id": "ccd378c4", "metadata": { "hide-output": false }, @@ -530,7 +530,7 @@ }, { "cell_type": "markdown", - "id": "79766e65", + "id": "218dfe88", "metadata": {}, "source": [ "The function below creates an instance of a Market namedtuple with default values." @@ -539,7 +539,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a91b0cc9", + "id": "4457debf", "metadata": { "hide-output": false }, @@ -551,7 +551,7 @@ }, { "cell_type": "markdown", - "id": "f99e5235", + "id": "4a93de57", "metadata": {}, "source": [ "This `market` can then be used by our `inverse_demand` and `inverse_supply` functions." @@ -560,7 +560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8769f3e", + "id": "df28064c", "metadata": { "hide-output": false }, @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "32441388", + "id": "f3e3977b", "metadata": {}, "source": [ "Here is a plot of these two functions using `market`." @@ -584,7 +584,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4f232202", + "id": "ea3868e3", "metadata": { "hide-output": false }, @@ -611,7 +611,7 @@ }, { "cell_type": "markdown", - "id": "fa232b0c", + "id": "70501873", "metadata": {}, "source": [ "In the above graph, an **equilibrium** price-quantity pair occurs at the intersection of the supply and demand curves." @@ -619,7 +619,7 @@ }, { "cell_type": "markdown", - "id": "0ef0af1b", + "id": "a6103aeb", "metadata": {}, "source": [ "### Consumer surplus\n", @@ -643,7 +643,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36cd3f5c", + "id": "f14509d3", "metadata": { "hide-output": false }, @@ -677,7 +677,7 @@ }, { "cell_type": "markdown", - "id": "f2cd0c5d", + "id": "978c3e4b", "metadata": {}, "source": [ "Consumer surplus provides a measure of total consumer welfare at quantity $ q $.\n", @@ -700,7 +700,7 @@ }, { "cell_type": "markdown", - "id": "95ee8111", + "id": "a6733197", "metadata": {}, "source": [ "### Producer surplus\n", @@ -723,7 +723,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c352b87a", + "id": "ccefa410", "metadata": { "hide-output": false }, @@ -757,7 +757,7 @@ }, { "cell_type": "markdown", - "id": "ba5fc732", + "id": "76848310", "metadata": {}, "source": [ "Producer surplus measures total producer welfare at quantity $ q $\n", @@ -780,7 +780,7 @@ }, { "cell_type": "markdown", - "id": "8e42dd8e", + "id": "6b89c8c6", "metadata": {}, "source": [ "### Social welfare\n", @@ -807,7 +807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1823c4c3", + "id": "38d826c8", "metadata": { "hide-output": false }, @@ -820,7 +820,7 @@ }, { "cell_type": "markdown", - "id": "1cfc877b", + "id": "f2cb426e", "metadata": {}, "source": [ "The next figure plots welfare as a function of $ q $." @@ -829,7 +829,7 @@ { "cell_type": "code", "execution_count": null, - "id": "69a8984e", + "id": "e40e1daf", "metadata": { "hide-output": false }, @@ -845,7 +845,7 @@ }, { "cell_type": "markdown", - "id": "0af3c014", + "id": "03ccd62b", "metadata": {}, "source": [ "Let’s now give a social planner the task of maximizing social welfare.\n", @@ -872,7 +872,7 @@ }, { "cell_type": "markdown", - "id": "30b5ebe9", + "id": "e14b5a57", "metadata": {}, "source": [ "### Competitive equilibrium\n", @@ -912,7 +912,7 @@ }, { "cell_type": "markdown", - "id": "642a95f7", + "id": "c1a807c8", "metadata": {}, "source": [ "## Generalizations\n", @@ -932,7 +932,7 @@ }, { "cell_type": "markdown", - "id": "a850f048", + "id": "d81e0760", "metadata": {}, "source": [ "## Exercises\n", @@ -953,7 +953,7 @@ }, { "cell_type": "markdown", - "id": "7bb8526d", + "id": "d8f440d0", "metadata": {}, "source": [ "## Exercise 6.1\n", @@ -966,7 +966,7 @@ }, { "cell_type": "markdown", - "id": "abda5d79", + "id": "17ce7453", "metadata": {}, "source": [ "## Solution to[ Exercise 6.1](https://intro.quantecon.org/#isd_ex1)\n", @@ -977,7 +977,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7928dcda", + "id": "6675c5e2", "metadata": { "hide-output": false }, @@ -992,7 +992,7 @@ }, { "cell_type": "markdown", - "id": "a0812663", + "id": "0cca5eff", "metadata": {}, "source": [ "Here is a plot of inverse supply and demand." @@ -1001,7 +1001,7 @@ { "cell_type": "code", "execution_count": null, - "id": "382d2198", + "id": "b44f174e", "metadata": { "hide-output": false }, @@ -1027,7 +1027,7 @@ }, { "cell_type": "markdown", - "id": "ba0c4d00", + "id": "490558cb", "metadata": {}, "source": [ "## Exercise 6.2\n", @@ -1067,7 +1067,7 @@ }, { "cell_type": "markdown", - "id": "9fd449ce", + "id": "25740851", "metadata": {}, "source": [ "## Solution to[ Exercise 6.2](https://intro.quantecon.org/#isd_ex2)\n", @@ -1086,7 +1086,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c05d8348", + "id": "3650a28e", "metadata": { "hide-output": false }, @@ -1101,7 +1101,7 @@ }, { "cell_type": "markdown", - "id": "0893e5d6", + "id": "ece99388", "metadata": {}, "source": [ "The next figure plots welfare as a function of $ q $." @@ -1110,7 +1110,7 @@ { "cell_type": "code", "execution_count": null, - "id": "528e3fb3", + "id": "a23a55f1", "metadata": { "hide-output": false }, @@ -1125,7 +1125,7 @@ }, { "cell_type": "markdown", - "id": "88c266c9", + "id": "b6a635a8", "metadata": {}, "source": [ "## Exercise 6.3\n", @@ -1142,7 +1142,7 @@ }, { "cell_type": "markdown", - "id": "ae436a2d", + "id": "71a3e638", "metadata": {}, "source": [ "## Solution to[ Exercise 6.3](https://intro.quantecon.org/#isd_ex3)" @@ -1151,7 +1151,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df4c0f47", + "id": "d473280b", "metadata": { "hide-output": false }, @@ -1169,7 +1169,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2eb56164", + "id": "8cbdfc55", "metadata": { "hide-output": false }, @@ -1181,7 +1181,7 @@ }, { "cell_type": "markdown", - "id": "78313d54", + "id": "6abb09f1", "metadata": {}, "source": [ "## Exercise 6.4\n", @@ -1211,7 +1211,7 @@ }, { "cell_type": "markdown", - "id": "25ecea40", + "id": "1dbe875c", "metadata": {}, "source": [ "## Solution to[ Exercise 6.4](https://intro.quantecon.org/#isd_ex4)" @@ -1220,7 +1220,7 @@ { "cell_type": "code", "execution_count": null, - "id": "55c006df", + "id": "95433d56", "metadata": { "hide-output": false }, @@ -1237,7 +1237,7 @@ } ], "metadata": { - "date": 1712122263.1309066, + "date": 1712983676.608014, "filename": "intro_supply_demand.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/laffer_adaptive.ipynb b/_notebooks/laffer_adaptive.ipynb index 4260eab0..2bd4d078 100644 --- a/_notebooks/laffer_adaptive.ipynb +++ b/_notebooks/laffer_adaptive.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "ec00fa84", + "id": "7e0bd953", "metadata": {}, "source": [ "# Laffer Curves with Adaptive Expectations" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "be025c70", + "id": "669b9d82", "metadata": {}, "source": [ "## Overview\n", @@ -56,7 +56,7 @@ }, { "cell_type": "markdown", - "id": "a3ee08ed", + "id": "0b4d0bd3", "metadata": {}, "source": [ "## The Model\n", @@ -109,7 +109,7 @@ }, { "cell_type": "markdown", - "id": "b627fb58", + "id": "0ebc97a7", "metadata": {}, "source": [ "## Computing An Equilibrium Sequence\n", @@ -140,7 +140,7 @@ }, { "cell_type": "markdown", - "id": "87f1402e", + "id": "9465f2ad", "metadata": {}, "source": [ "## Claims or Conjectures\n", @@ -157,7 +157,7 @@ }, { "cell_type": "markdown", - "id": "ec72ad04", + "id": "92db5411", "metadata": {}, "source": [ "## Limiting Values of Inflation Rate\n", @@ -205,7 +205,7 @@ { "cell_type": "code", "execution_count": null, - "id": "108e1e6b", + "id": "e6f40a57", "metadata": { "hide-output": false }, @@ -223,7 +223,7 @@ }, { "cell_type": "markdown", - "id": "2ae00b33", + "id": "4978c69f", "metadata": {}, "source": [ "Let’s create a `namedtuple` to store the parameters of the model" @@ -232,7 +232,7 @@ { "cell_type": "code", "execution_count": null, - "id": "92b7cc36", + "id": "abf861e3", "metadata": { "hide-output": false }, @@ -253,7 +253,7 @@ }, { "cell_type": "markdown", - "id": "24dceadb", + "id": "2183bb8c", "metadata": {}, "source": [ "Now we write code that computes steady-state $ \\bar \\pi $s." @@ -262,7 +262,7 @@ { "cell_type": "code", "execution_count": null, - "id": "02a41059", + "id": "d41e64c4", "metadata": { "hide-output": false }, @@ -284,7 +284,7 @@ }, { "cell_type": "markdown", - "id": "9532c525", + "id": "50fb1e23", "metadata": {}, "source": [ "We find two steady state $ \\bar \\pi $ values" @@ -292,7 +292,7 @@ }, { "cell_type": "markdown", - "id": "fe1586ec", + "id": "7a46f15a", "metadata": {}, "source": [ "## Steady State Laffer Curve\n", @@ -303,7 +303,7 @@ { "cell_type": "code", "execution_count": null, - "id": "03a2fdde", + "id": "ce308262", "metadata": { "hide-output": false }, @@ -343,7 +343,7 @@ }, { "cell_type": "markdown", - "id": "d703133b", + "id": "48672349", "metadata": {}, "source": [ "## Associated Initial Price Levels\n", @@ -360,7 +360,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5adbecef", + "id": "5bb35465", "metadata": { "hide-output": false }, @@ -378,7 +378,7 @@ }, { "cell_type": "markdown", - "id": "361217b3", + "id": "fb111b42", "metadata": {}, "source": [ "### Verification\n", @@ -391,7 +391,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e0b60254", + "id": "964fff12", "metadata": { "hide-output": false }, @@ -431,7 +431,7 @@ }, { "cell_type": "markdown", - "id": "b2fbc454", + "id": "7b8d5425", "metadata": {}, "source": [ "Compute limiting values starting from $ p_{-1} $ associated with $ \\pi_l $" @@ -440,7 +440,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a89dfa4c", + "id": "77c95c9c", "metadata": { "hide-output": false }, @@ -460,7 +460,7 @@ }, { "cell_type": "markdown", - "id": "4e4fdf19", + "id": "3197a79c", "metadata": {}, "source": [ "Compute limiting values starting from $ p_{-1} $ associated with $ \\pi_u $" @@ -469,7 +469,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5909fb9c", + "id": "f561c578", "metadata": { "hide-output": false }, @@ -489,7 +489,7 @@ }, { "cell_type": "markdown", - "id": "f4a9b808", + "id": "79808b7c", "metadata": {}, "source": [ "## Slippery Side of Laffer Curve Dynamics\n", @@ -507,7 +507,7 @@ { "cell_type": "code", "execution_count": null, - "id": "845e89fa", + "id": "4fda3a30", "metadata": { "hide-output": false }, @@ -548,7 +548,7 @@ }, { "cell_type": "markdown", - "id": "884a9634", + "id": "f9724063", "metadata": {}, "source": [ "Let’s simulate the result generated by varying the initial $ \\pi_{-1} $ and corresponding $ p_{-1} $" @@ -557,7 +557,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b5c45ed3", + "id": "99cf3b1c", "metadata": { "hide-output": false }, @@ -575,7 +575,7 @@ } ], "metadata": { - "date": 1712122263.1588862, + "date": 1712983676.6340554, "filename": "laffer_adaptive.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/lake_model.ipynb b/_notebooks/lake_model.ipynb index 27fb31b4..5fc74552 100644 --- a/_notebooks/lake_model.ipynb +++ b/_notebooks/lake_model.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c655baea", + "id": "5e1e935c", "metadata": {}, "source": [ "# A Lake Model of Employment" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "b768066f", + "id": "80cc50f1", "metadata": {}, "source": [ "## Outline\n", @@ -21,7 +21,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1b161a5", + "id": "dc6c3885", "metadata": { "hide-output": false }, @@ -33,7 +33,7 @@ }, { "cell_type": "markdown", - "id": "5dc76362", + "id": "15aaeb88", "metadata": {}, "source": [ "## The Lake model\n", @@ -61,7 +61,7 @@ }, { "cell_type": "markdown", - "id": "8fbe9c24", + "id": "1fb94625", "metadata": {}, "source": [ "## Dynamics\n", @@ -119,7 +119,7 @@ }, { "cell_type": "markdown", - "id": "c3178feb", + "id": "c6f94350", "metadata": {}, "source": [ "### Visualising the long-run outcomes\n", @@ -130,7 +130,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5e48881", + "id": "381c3e56", "metadata": { "hide-output": false }, @@ -196,7 +196,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b7e597fa", + "id": "9d29838f", "metadata": { "hide-output": false }, @@ -233,7 +233,7 @@ }, { "cell_type": "markdown", - "id": "31cc42e4", + "id": "33220260", "metadata": {}, "source": [ "Not surprisingly, we observe that labor force $ n_t $ increases at a constant rate.\n", @@ -264,7 +264,7 @@ }, { "cell_type": "markdown", - "id": "a2718e54", + "id": "c63ba32b", "metadata": {}, "source": [ "### The application of Perron-Frobenius theorem\n", @@ -289,7 +289,7 @@ }, { "cell_type": "markdown", - "id": "3f0fe5f5", + "id": "3f7ae20c", "metadata": {}, "source": [ "#### Dominant eigenvector\n", @@ -358,7 +358,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e4a61eaf", + "id": "677724d3", "metadata": { "hide-output": false }, @@ -439,7 +439,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fba31721", + "id": "03e1d5bc", "metadata": { "hide-output": false }, @@ -452,7 +452,7 @@ }, { "cell_type": "markdown", - "id": "bb1d57d1", + "id": "41e8d52c", "metadata": {}, "source": [ "Since $ \\bar{x} $ is an eigenvector corresponding to the eigenvalue $ r(A) $, all the vectors in the set\n", @@ -468,7 +468,7 @@ }, { "cell_type": "markdown", - "id": "32aa4e6a", + "id": "fe0af314", "metadata": {}, "source": [ "#### Negative growth rate\n", @@ -487,7 +487,7 @@ { "cell_type": "code", "execution_count": null, - "id": "82a616a8", + "id": "97850a89", "metadata": { "hide-output": false }, @@ -499,7 +499,7 @@ }, { "cell_type": "markdown", - "id": "a810dad6", + "id": "80958a76", "metadata": {}, "source": [ "Thus, while the sequence of iterates still moves towards the dominant eigenvector $ \\bar{x} $, in this case\n", @@ -513,7 +513,7 @@ }, { "cell_type": "markdown", - "id": "047255f8", + "id": "edf003f8", "metadata": {}, "source": [ "### Properties\n", @@ -572,7 +572,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0bd9d389", + "id": "5984d114", "metadata": { "hide-output": false }, @@ -614,7 +614,7 @@ }, { "cell_type": "markdown", - "id": "1c0a6328", + "id": "98aa1523", "metadata": {}, "source": [ "To provide more intuition for convergence, we further explain the convergence below without the Perron-Frobenius theorem.\n", @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "b46c42d5", + "id": "141b3ff9", "metadata": {}, "source": [ "## Exercise" @@ -657,7 +657,7 @@ }, { "cell_type": "markdown", - "id": "b0d042ef", + "id": "1fe3e9c2", "metadata": {}, "source": [ "## (Evolution of unemployment and employment rate)Exercise 38.1\n", @@ -673,7 +673,7 @@ }, { "cell_type": "markdown", - "id": "4c0ce7f3", + "id": "76c56efb", "metadata": {}, "source": [ "## Solution to[ Exercise 38.1 (Evolution of unemployment and employment rate)](https://intro.quantecon.org/#lake_model_ex1)\n", @@ -691,7 +691,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e98b608", + "id": "89d11ccb", "metadata": { "hide-output": false }, @@ -714,7 +714,7 @@ } ], "metadata": { - "date": 1712122263.1819725, + "date": 1712983676.655531, "filename": "lake_model.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/linear_equations.ipynb b/_notebooks/linear_equations.ipynb index 97e1ae4b..62712220 100644 --- a/_notebooks/linear_equations.ipynb +++ b/_notebooks/linear_equations.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "de445c88", + "id": "2ac407f0", "metadata": {}, "source": [ "# Linear Equations and Matrix Algebra\n", @@ -13,7 +13,7 @@ }, { "cell_type": "markdown", - "id": "25f734b1", + "id": "632a435d", "metadata": {}, "source": [ "## Overview\n", @@ -46,7 +46,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6c43fa37", + "id": "bc304e3a", "metadata": { "hide-output": false }, @@ -58,7 +58,7 @@ }, { "cell_type": "markdown", - "id": "2ab0beac", + "id": "b7613bad", "metadata": {}, "source": [ "## A two good example\n", @@ -74,7 +74,7 @@ }, { "cell_type": "markdown", - "id": "ed365b65", + "id": "e284111f", "metadata": {}, "source": [ "### Pencil and paper methods\n", @@ -141,7 +141,7 @@ }, { "cell_type": "markdown", - "id": "0dbe6ad8", + "id": "a9f77cc1", "metadata": {}, "source": [ "### Looking forward\n", @@ -158,7 +158,7 @@ }, { "cell_type": "markdown", - "id": "3b8d3311", + "id": "7c8df9e1", "metadata": {}, "source": [ "## Vectors\n", @@ -188,7 +188,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b36eebe1", + "id": "67c2f787", "metadata": { "hide-output": false }, @@ -216,7 +216,7 @@ }, { "cell_type": "markdown", - "id": "a80549a4", + "id": "643369b7", "metadata": {}, "source": [ "### Vector operations\n", @@ -284,7 +284,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0fc85779", + "id": "6c7faba1", "metadata": { "hide-output": false }, @@ -325,7 +325,7 @@ }, { "cell_type": "markdown", - "id": "329bb623", + "id": "9ce4ae7d", "metadata": {}, "source": [ "Scalar multiplication is an operation that multiplies a vector $ x $ with a scalar elementwise.\n", @@ -368,7 +368,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6fc2b5aa", + "id": "1b011e4d", "metadata": { "hide-output": false }, @@ -406,7 +406,7 @@ }, { "cell_type": "markdown", - "id": "1fe6df16", + "id": "5267edd2", "metadata": {}, "source": [ "In Python, a vector can be represented as a list or tuple,\n", @@ -422,7 +422,7 @@ { "cell_type": "code", "execution_count": null, - "id": "846f2ed7", + "id": "7dc9e939", "metadata": { "hide-output": false }, @@ -436,7 +436,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dc7ced00", + "id": "96623ce8", "metadata": { "hide-output": false }, @@ -447,7 +447,7 @@ }, { "cell_type": "markdown", - "id": "4f46a040", + "id": "ecb3170b", "metadata": {}, "source": [ "### Inner product and norm\n", @@ -486,7 +486,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e2f18d77", + "id": "fb3b0dff", "metadata": { "hide-output": false }, @@ -498,7 +498,7 @@ { "cell_type": "code", "execution_count": null, - "id": "be986e76", + "id": "4ee178a3", "metadata": { "hide-output": false }, @@ -510,7 +510,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bc4eecca", + "id": "adc56eba", "metadata": { "hide-output": false }, @@ -522,7 +522,7 @@ { "cell_type": "code", "execution_count": null, - "id": "860db55b", + "id": "2c8f791a", "metadata": { "hide-output": false }, @@ -533,7 +533,7 @@ }, { "cell_type": "markdown", - "id": "2c61fbc9", + "id": "68eb19f4", "metadata": {}, "source": [ "## Matrix operations\n", @@ -549,7 +549,7 @@ }, { "cell_type": "markdown", - "id": "31d1a763", + "id": "ce041867", "metadata": {}, "source": [ "### Addition and scalar multiplication\n", @@ -637,7 +637,7 @@ }, { "cell_type": "markdown", - "id": "8972df66", + "id": "e369fc2b", "metadata": {}, "source": [ "### Matrix multiplication\n", @@ -752,7 +752,7 @@ }, { "cell_type": "markdown", - "id": "a7f3e845", + "id": "0b4aa74f", "metadata": {}, "source": [ "### Matrices in NumPy\n", @@ -767,7 +767,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c720d941", + "id": "f0c2c638", "metadata": { "hide-output": false }, @@ -782,7 +782,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72de1563", + "id": "277498bf", "metadata": { "hide-output": false }, @@ -796,7 +796,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c6e8a4c", + "id": "7bd10505", "metadata": { "hide-output": false }, @@ -807,7 +807,7 @@ }, { "cell_type": "markdown", - "id": "7953b681", + "id": "15eea1e4", "metadata": {}, "source": [ "The `shape` attribute is a tuple giving the number of rows and columns —\n", @@ -825,7 +825,7 @@ { "cell_type": "code", "execution_count": null, - "id": "95e488f8", + "id": "6b480f41", "metadata": { "hide-output": false }, @@ -839,7 +839,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11c240ba", + "id": "9c1b63c2", "metadata": { "hide-output": false }, @@ -850,7 +850,7 @@ }, { "cell_type": "markdown", - "id": "08652514", + "id": "1c9e510c", "metadata": {}, "source": [ "To multiply matrices we use the `@` symbol.\n", @@ -862,7 +862,7 @@ }, { "cell_type": "markdown", - "id": "fa5a0cb2", + "id": "027b800b", "metadata": {}, "source": [ "### Two good model in matrix form\n", @@ -952,7 +952,7 @@ }, { "cell_type": "markdown", - "id": "ae9036d5", + "id": "5792303e", "metadata": {}, "source": [ "### More goods\n", @@ -1000,7 +1000,7 @@ }, { "cell_type": "markdown", - "id": "73ca6e27", + "id": "b637373d", "metadata": {}, "source": [ "### General linear systems\n", @@ -1070,7 +1070,7 @@ }, { "cell_type": "markdown", - "id": "94882d4b", + "id": "1c617001", "metadata": {}, "source": [ "## Solving systems of equations\n", @@ -1095,7 +1095,7 @@ }, { "cell_type": "markdown", - "id": "e032ebc5", + "id": "dcd2dce1", "metadata": {}, "source": [ "### No solution\n", @@ -1117,7 +1117,7 @@ { "cell_type": "code", "execution_count": null, - "id": "59c7bf7a", + "id": "c54744e7", "metadata": { "hide-output": false }, @@ -1133,7 +1133,7 @@ }, { "cell_type": "markdown", - "id": "51b055cf", + "id": "d0c4254f", "metadata": {}, "source": [ "Clearly, these are parallel lines and hence we will never find a point $ x \\in \\mathbb{R}^2 $\n", @@ -1175,7 +1175,7 @@ }, { "cell_type": "markdown", - "id": "74cb9d3f", + "id": "60dc91a0", "metadata": {}, "source": [ "### Many solutions\n", @@ -1212,7 +1212,7 @@ }, { "cell_type": "markdown", - "id": "59c91172", + "id": "9098dc30", "metadata": {}, "source": [ "### Nonsingular matrices\n", @@ -1262,7 +1262,7 @@ }, { "cell_type": "markdown", - "id": "33c93dfc", + "id": "305abc67", "metadata": {}, "source": [ "### Linear equations with NumPy\n", @@ -1287,7 +1287,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35844766", + "id": "9cb648cd", "metadata": { "hide-output": false }, @@ -1299,7 +1299,7 @@ }, { "cell_type": "markdown", - "id": "cbce0a32", + "id": "ace88e60", "metadata": {}, "source": [ "Now we change this to a NumPy array." @@ -1308,7 +1308,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20f0fada", + "id": "42d0aba2", "metadata": { "hide-output": false }, @@ -1320,7 +1320,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1d98995", + "id": "cc8a644c", "metadata": { "hide-output": false }, @@ -1334,7 +1334,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bbbd6636", + "id": "af39ccba", "metadata": { "hide-output": false }, @@ -1347,7 +1347,7 @@ { "cell_type": "code", "execution_count": null, - "id": "92e657bf", + "id": "10faeb9b", "metadata": { "hide-output": false }, @@ -1362,7 +1362,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fbfaaa08", + "id": "24d02ea9", "metadata": { "hide-output": false }, @@ -1375,7 +1375,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5610416b", + "id": "214731a0", "metadata": { "hide-output": false }, @@ -1388,7 +1388,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d73fb1d0", + "id": "46262b06", "metadata": { "hide-output": false }, @@ -1400,7 +1400,7 @@ }, { "cell_type": "markdown", - "id": "417387a2", + "id": "86ce66be", "metadata": {}, "source": [ "Notice that we get the same solutions as the pencil and paper case.\n", @@ -1411,7 +1411,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9071a036", + "id": "1e21db5f", "metadata": { "hide-output": false }, @@ -1425,7 +1425,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b2a9bac6", + "id": "626191e6", "metadata": { "hide-output": false }, @@ -1437,7 +1437,7 @@ }, { "cell_type": "markdown", - "id": "74771e07", + "id": "bc274d70", "metadata": {}, "source": [ "Observe how we can solve for $ x = A^{-1} y $ by either via `inv(A) @ y`, or using `solve(A, y)`.\n", @@ -1447,7 +1447,7 @@ }, { "cell_type": "markdown", - "id": "210d3caa", + "id": "3232518c", "metadata": {}, "source": [ "## Exercises" @@ -1455,7 +1455,7 @@ }, { "cell_type": "markdown", - "id": "c1c85256", + "id": "27b28f68", "metadata": {}, "source": [ "## Exercise 7.1\n", @@ -1493,7 +1493,7 @@ }, { "cell_type": "markdown", - "id": "15e3e9e6", + "id": "9cf7db2d", "metadata": {}, "source": [ "## Solution to[ Exercise 7.1](https://intro.quantecon.org/#lin_eqs_ex1)\n", @@ -1538,7 +1538,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1186248", + "id": "2bb8b075", "metadata": { "hide-output": false }, @@ -1560,7 +1560,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f8f4b26d", + "id": "375889f3", "metadata": { "hide-output": false }, @@ -1578,7 +1578,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6b0a67d4", + "id": "319a8b1c", "metadata": { "hide-output": false }, @@ -1592,7 +1592,7 @@ }, { "cell_type": "markdown", - "id": "e918199b", + "id": "e28f7852", "metadata": {}, "source": [ "The solution is given by:\n", @@ -1601,7 +1601,7 @@ }, { "cell_type": "markdown", - "id": "0aee5ad2", + "id": "7d61cce9", "metadata": {}, "source": [ "## Exercise 7.2\n", @@ -1689,7 +1689,7 @@ }, { "cell_type": "markdown", - "id": "33e27aa5", + "id": "f7f7a70e", "metadata": {}, "source": [ "## Solution to[ Exercise 7.2](https://intro.quantecon.org/#lin_eqs_ex2)" @@ -1698,7 +1698,7 @@ { "cell_type": "code", "execution_count": null, - "id": "370ea9e6", + "id": "7a499c8a", "metadata": { "hide-output": false }, @@ -1711,7 +1711,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42663f51", + "id": "5f1dc30d", "metadata": { "hide-output": false }, @@ -1734,7 +1734,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28ead59d", + "id": "65a0ba48", "metadata": { "hide-output": false }, @@ -1747,7 +1747,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bd54a4f1", + "id": "19fb9f81", "metadata": { "hide-output": false }, @@ -1759,7 +1759,7 @@ }, { "cell_type": "markdown", - "id": "27034293", + "id": "81cc11b4", "metadata": {}, "source": [ "Here is a visualization of how the least squares method approximates the equation of a line connecting a set of points.\n", @@ -1770,7 +1770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9d7c48b7", + "id": "aa1a49a6", "metadata": { "hide-output": false }, @@ -1792,7 +1792,7 @@ }, { "cell_type": "markdown", - "id": "171c5ed1", + "id": "44c95713", "metadata": {}, "source": [ "### Further reading\n", @@ -1804,7 +1804,7 @@ } ], "metadata": { - "date": 1712122263.2327423, + "date": 1712983676.7015846, "filename": "linear_equations.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/lln_clt.ipynb b/_notebooks/lln_clt.ipynb index d355b1f1..11ab9225 100644 --- a/_notebooks/lln_clt.ipynb +++ b/_notebooks/lln_clt.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "3539cee3", + "id": "da83e11c", "metadata": {}, "source": [ "# LLN and CLT" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "215f6563", + "id": "be6c2712", "metadata": {}, "source": [ "## Overview\n", @@ -37,7 +37,7 @@ { "cell_type": "code", "execution_count": null, - "id": "43ed0b6c", + "id": "b2af7195", "metadata": { "hide-output": false }, @@ -50,7 +50,7 @@ }, { "cell_type": "markdown", - "id": "78029d58", + "id": "367cb288", "metadata": {}, "source": [ "\n", @@ -59,7 +59,7 @@ }, { "cell_type": "markdown", - "id": "2a076cd0", + "id": "5e7708d4", "metadata": {}, "source": [ "## The law of large numbers\n", @@ -72,7 +72,7 @@ }, { "cell_type": "markdown", - "id": "d5506190", + "id": "990bf5e8", "metadata": {}, "source": [ "### The LLN in action\n", @@ -104,7 +104,7 @@ { "cell_type": "code", "execution_count": null, - "id": "76bb56df", + "id": "0ac2ce42", "metadata": { "hide-output": false }, @@ -117,19 +117,21 @@ }, { "cell_type": "markdown", - "id": "2da341f9", + "id": "223f5d5a", "metadata": {}, "source": [ "In this setting, the LLN tells us if we flip the coin many times, the fraction\n", "of heads that we see will be close to the mean $ p $.\n", "\n", + "We use $ n $ to represent the number of times the coin is flipped.\n", + "\n", "Let’s check this:" ] }, { "cell_type": "code", "execution_count": null, - "id": "c566533b", + "id": "b632de70", "metadata": { "hide-output": false }, @@ -142,7 +144,7 @@ }, { "cell_type": "markdown", - "id": "9d2e1384", + "id": "c6db7893", "metadata": {}, "source": [ "If we change $ p $ the claim still holds:" @@ -151,7 +153,7 @@ { "cell_type": "code", "execution_count": null, - "id": "556215be", + "id": "0dfa686c", "metadata": { "hide-output": false }, @@ -164,7 +166,7 @@ }, { "cell_type": "markdown", - "id": "958c759a", + "id": "d58a8fa4", "metadata": {}, "source": [ "Let’s connect this to the discussion above, where we said the sample average\n", @@ -200,7 +202,7 @@ }, { "cell_type": "markdown", - "id": "38c20225", + "id": "d3251221", "metadata": {}, "source": [ "### Statement of the LLN\n", @@ -247,7 +249,7 @@ }, { "cell_type": "markdown", - "id": "c2a56e98", + "id": "f5dd4250", "metadata": {}, "source": [ "### \n", @@ -268,7 +270,7 @@ }, { "cell_type": "markdown", - "id": "64da60b6", + "id": "53011e59", "metadata": {}, "source": [ "### Comments on the theorem\n", @@ -288,7 +290,7 @@ }, { "cell_type": "markdown", - "id": "895a1584", + "id": "23220c03", "metadata": {}, "source": [ "### Illustration\n", @@ -334,7 +336,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5527cdce", + "id": "f08dd92c", "metadata": { "hide-output": false }, @@ -352,7 +354,7 @@ }, { "cell_type": "markdown", - "id": "842a3fc8", + "id": "768ac5d6", "metadata": {}, "source": [ "Now we write a function to generate $ m $ sample means and histogram them." @@ -361,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "329931fd", + "id": "c1d9590f", "metadata": { "hide-output": false }, @@ -392,7 +394,7 @@ }, { "cell_type": "markdown", - "id": "ddea3774", + "id": "4b578685", "metadata": {}, "source": [ "Now we call the function." @@ -401,7 +403,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7d695501", + "id": "fac77167", "metadata": { "hide-output": false }, @@ -415,7 +417,7 @@ }, { "cell_type": "markdown", - "id": "cf6cb007", + "id": "4554fd60", "metadata": {}, "source": [ "We can see that the distribution of $ \\bar X $ is clustered around $ \\mathbb E X $\n", @@ -423,7 +425,7 @@ "\n", "Let’s vary `n` to see how the distribution of the sample mean changes.\n", "\n", - "We will use a violin plot to show the different distributions.\n", + "We will use a [violin plot](https://intro.quantecon.org/prob_dist.html#violin-plots) to show the different distributions.\n", "\n", "Each distribution in the violin plot represents the distribution of $ X_n $ for some $ n $, calculated by simulation." ] @@ -431,7 +433,7 @@ { "cell_type": "code", "execution_count": null, - "id": "126b9ed2", + "id": "19acf16a", "metadata": { "hide-output": false }, @@ -467,7 +469,7 @@ }, { "cell_type": "markdown", - "id": "e2dc7104", + "id": "1bd60f59", "metadata": {}, "source": [ "Let’s try with a normal distribution." @@ -476,7 +478,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bccc475b", + "id": "deff6f52", "metadata": { "hide-output": false }, @@ -487,7 +489,7 @@ }, { "cell_type": "markdown", - "id": "afe1ded4", + "id": "d3b4bff8", "metadata": {}, "source": [ "As $ n $ gets large, more probability mass clusters around the population mean $ \\mu $.\n", @@ -498,7 +500,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b4693ac4", + "id": "c2e5fa9b", "metadata": { "hide-output": false }, @@ -509,7 +511,7 @@ }, { "cell_type": "markdown", - "id": "c573094c", + "id": "964cbfea", "metadata": {}, "source": [ "We get a similar result." @@ -517,7 +519,7 @@ }, { "cell_type": "markdown", - "id": "08525409", + "id": "27dae1ab", "metadata": {}, "source": [ "## Breaking the LLN\n", @@ -529,7 +531,7 @@ }, { "cell_type": "markdown", - "id": "a1ff8d17", + "id": "9aac968c", "metadata": {}, "source": [ "### Infinite first moment\n", @@ -546,12 +548,12 @@ "\n", "Hence the LLN does not hold.\n", "\n", - "The LLN fails to hold here because the assumption $ \\mathbb E|X| = \\infty $ is violated by the Cauchy distribution." + "The LLN fails to hold here because the assumption $ \\mathbb E|X| < \\infty $ is violated by the Cauchy distribution." ] }, { "cell_type": "markdown", - "id": "d66a33ed", + "id": "165cc2e8", "metadata": {}, "source": [ "### Failure of the IID condition\n", @@ -592,7 +594,7 @@ }, { "cell_type": "markdown", - "id": "297287c3", + "id": "5f97d724", "metadata": {}, "source": [ "## Central limit theorem\n", @@ -605,7 +607,7 @@ }, { "cell_type": "markdown", - "id": "7055ccdc", + "id": "f3e7bf8a", "metadata": {}, "source": [ "### Statement of the theorem\n", @@ -617,7 +619,7 @@ }, { "cell_type": "markdown", - "id": "9d1da41e", + "id": "658762a3", "metadata": {}, "source": [ "### \n", @@ -637,12 +639,12 @@ "\n", "The striking implication of the CLT is that for **any** distribution with\n", "finite [second moment](https://en.wikipedia.org/wiki/Moment_%28mathematics%29), the simple operation of adding independent\n", - "copies **always** leads to a Gaussian curve." + "copies **always** leads to a Gaussian(Normal) curve." ] }, { "cell_type": "markdown", - "id": "6660b37c", + "id": "3c08133d", "metadata": {}, "source": [ "### Simulation 1\n", @@ -669,7 +671,7 @@ { "cell_type": "code", "execution_count": null, - "id": "08220d80", + "id": "79400ff4", "metadata": { "hide-output": false }, @@ -706,7 +708,7 @@ }, { "cell_type": "markdown", - "id": "cadafbae", + "id": "67f88833", "metadata": {}, "source": [ "(Notice the absence of for loops — every operation is vectorized, meaning that the major calculations are all shifted to fast C code.)\n", @@ -716,7 +718,7 @@ }, { "cell_type": "markdown", - "id": "a628a8b2", + "id": "c52ca524", "metadata": {}, "source": [ "## Exercises" @@ -724,19 +726,19 @@ }, { "cell_type": "markdown", - "id": "c45e0b61", + "id": "a5810b44", "metadata": {}, "source": [ "## Exercise 17.1\n", "\n", - "Repeat the simulation [above1](#sim-one) with the [Beta distribution](https://en.wikipedia.org/wiki/Beta_distribution).\n", + "Repeat the simulation [above](#sim-one) with the [Beta distribution](https://en.wikipedia.org/wiki/Beta_distribution).\n", "\n", "You can choose any $ \\alpha > 0 $ and $ \\beta > 0 $." ] }, { "cell_type": "markdown", - "id": "a1fe7acc", + "id": "2bf3c020", "metadata": {}, "source": [ "## Solution to[ Exercise 17.1](https://intro.quantecon.org/#lln_ex1)" @@ -745,7 +747,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f646fa3c", + "id": "526a55a7", "metadata": { "hide-output": false }, @@ -780,7 +782,7 @@ }, { "cell_type": "markdown", - "id": "98659e7d", + "id": "456c7e5f", "metadata": {}, "source": [ "## Exercise 17.2\n", @@ -795,7 +797,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07b3e108", + "id": "fbb83090", "metadata": { "hide-output": false }, @@ -808,7 +810,7 @@ }, { "cell_type": "markdown", - "id": "1d7d7922", + "id": "6ad7a20f", "metadata": {}, "source": [ "Explain why this provides a random variable $ X $ with the right distribution." @@ -816,7 +818,7 @@ }, { "cell_type": "markdown", - "id": "37d7c2d8", + "id": "583df616", "metadata": {}, "source": [ "## Solution to[ Exercise 17.2](https://intro.quantecon.org/#lln_ex2)\n", @@ -836,7 +838,7 @@ }, { "cell_type": "markdown", - "id": "210e39b5", + "id": "e11db4bd", "metadata": {}, "source": [ "## Exercise 17.3\n", @@ -872,7 +874,7 @@ }, { "cell_type": "markdown", - "id": "1994b96d", + "id": "64b62012", "metadata": {}, "source": [ "## Solution to[ Exercise 17.3](https://intro.quantecon.org/#lln_ex3)\n", @@ -926,7 +928,7 @@ { "cell_type": "code", "execution_count": null, - "id": "560b2960", + "id": "d680cdac", "metadata": { "hide-output": false }, @@ -963,7 +965,7 @@ }, { "cell_type": "markdown", - "id": "b89506f6", + "id": "2efd82d6", "metadata": {}, "source": [ "We see the convergence of $ \\bar x $ around $ \\mu $ even when the independence assumption is violated." @@ -971,7 +973,7 @@ } ], "metadata": { - "date": 1712122263.267836, + "date": 1712983676.733303, "filename": "lln_clt.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/long_run_growth.ipynb b/_notebooks/long_run_growth.ipynb index f26c0a31..a65782ee 100644 --- a/_notebooks/long_run_growth.ipynb +++ b/_notebooks/long_run_growth.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "792f0f58", + "id": "85d9251e", "metadata": {}, "source": [ "# Long-Run Growth" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "275e0046", + "id": "d1c1a2ac", "metadata": {}, "source": [ "## Overview\n", @@ -65,7 +65,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e89b9b2", + "id": "2d408191", "metadata": { "hide-output": false }, @@ -80,7 +80,7 @@ }, { "cell_type": "markdown", - "id": "9ae4c4ce", + "id": "58048b25", "metadata": {}, "source": [ "## Setting up\n", @@ -100,7 +100,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce515678", + "id": "a4c207b2", "metadata": { "hide-output": false }, @@ -114,7 +114,7 @@ }, { "cell_type": "markdown", - "id": "c30850a4", + "id": "8303c034", "metadata": {}, "source": [ "We can see that this dataset contains GDP per capita (`gdppc`) and population (pop) for many countries and years.\n", @@ -125,7 +125,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cf102d2c", + "id": "02d49943", "metadata": { "hide-output": false }, @@ -137,7 +137,7 @@ }, { "cell_type": "markdown", - "id": "c2df9a24", + "id": "9ffce7a8", "metadata": {}, "source": [ "We can now explore some of the 169 countries that are available.\n", @@ -148,7 +148,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07731a6b", + "id": "f3c6452e", "metadata": { "hide-output": false }, @@ -166,7 +166,7 @@ }, { "cell_type": "markdown", - "id": "4619e50b", + "id": "bb9787b7", "metadata": {}, "source": [ "Let’s now reshape the original data into some convenient variables to enable quicker access to countries’ time series data.\n", @@ -177,7 +177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d2e05e60", + "id": "2ae7859c", "metadata": { "hide-output": false }, @@ -189,7 +189,7 @@ }, { "cell_type": "markdown", - "id": "b03e5efa", + "id": "35b98839", "metadata": {}, "source": [ "Now we can focus on GDP per capita (`gdppc`) and generate a wide data format" @@ -198,7 +198,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c22bc1cc", + "id": "d835ac3c", "metadata": { "hide-output": false }, @@ -211,7 +211,7 @@ { "cell_type": "code", "execution_count": null, - "id": "334ceb88", + "id": "896a9d7f", "metadata": { "hide-output": false }, @@ -222,7 +222,7 @@ }, { "cell_type": "markdown", - "id": "a0b05623", + "id": "01f9c4a3", "metadata": {}, "source": [ "We create a variable `color_mapping` to store a map between country codes and colors for consistency" @@ -231,7 +231,7 @@ { "cell_type": "code", "execution_count": null, - "id": "98e5ef75", + "id": "90936964", "metadata": { "hide-output": false }, @@ -249,7 +249,7 @@ }, { "cell_type": "markdown", - "id": "a68da21d", + "id": "68ad4c3f", "metadata": {}, "source": [ "## GDP per capita\n", @@ -259,7 +259,7 @@ }, { "cell_type": "markdown", - "id": "e6900919", + "id": "e4acdb9e", "metadata": {}, "source": [ "### United Kingdom\n", @@ -270,7 +270,7 @@ { "cell_type": "code", "execution_count": null, - "id": "af52e962", + "id": "248beb83", "metadata": { "hide-output": false }, @@ -288,7 +288,7 @@ }, { "cell_type": "markdown", - "id": "e3bef432", + "id": "c79f104a", "metadata": {}, "source": [ ">**Note**\n", @@ -303,7 +303,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a7fd9386", + "id": "e9d4e609", "metadata": { "hide-output": false }, @@ -326,7 +326,7 @@ }, { "cell_type": "markdown", - "id": "b454f84a", + "id": "c5054965", "metadata": {}, "source": [ "### Comparing the US, UK, and China\n", @@ -339,7 +339,7 @@ { "cell_type": "code", "execution_count": null, - "id": "314c174a", + "id": "1e16d2db", "metadata": { "hide-output": false }, @@ -386,7 +386,7 @@ }, { "cell_type": "markdown", - "id": "c71361b1", + "id": "c538e603", "metadata": {}, "source": [ "As you can see from this chart, economic growth started in earnest in the 18th century and continued for the next two hundred years.\n", @@ -399,7 +399,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c8eeadf7", + "id": "779a7ed9", "metadata": { "hide-output": false }, @@ -465,7 +465,7 @@ }, { "cell_type": "markdown", - "id": "413f06cb", + "id": "dcd76df8", "metadata": {}, "source": [ "The preceding graph of per capita GDP strikingly reveals how the spread of the Industrial Revolution has over time gradually lifted the living standards of substantial\n", @@ -479,7 +479,7 @@ }, { "cell_type": "markdown", - "id": "cd3b640e", + "id": "85afc84a", "metadata": {}, "source": [ "### Focusing on China\n", @@ -499,7 +499,7 @@ { "cell_type": "code", "execution_count": null, - "id": "00a9f44c", + "id": "01168d0c", "metadata": { "hide-output": false }, @@ -549,7 +549,7 @@ }, { "cell_type": "markdown", - "id": "11a66120", + "id": "e54c8aca", "metadata": {}, "source": [ "### Focusing on the US and UK\n", @@ -568,7 +568,7 @@ { "cell_type": "code", "execution_count": null, - "id": "abf596e0", + "id": "66bc41f0", "metadata": { "hide-output": false }, @@ -619,7 +619,7 @@ }, { "cell_type": "markdown", - "id": "fe445073", + "id": "c772818c", "metadata": {}, "source": [ "## GDP growth\n", @@ -632,7 +632,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db195577", + "id": "73b5788e", "metadata": { "hide-output": false }, @@ -646,7 +646,7 @@ }, { "cell_type": "markdown", - "id": "b2ab3bc8", + "id": "8763f77a", "metadata": {}, "source": [ "### Early industrialization (1820 to 1940)\n", @@ -663,7 +663,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fb2b40d2", + "id": "f06442ed", "metadata": { "hide-output": false }, @@ -680,7 +680,7 @@ }, { "cell_type": "markdown", - "id": "37814154", + "id": "c6f96d08", "metadata": {}, "source": [ "#### Constructing a plot similar to Tooze’s\n", @@ -693,7 +693,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8b245f6c", + "id": "dd768f51", "metadata": { "hide-output": false }, @@ -706,7 +706,7 @@ }, { "cell_type": "markdown", - "id": "e3d45b77", + "id": "788f9c4d", "metadata": {}, "source": [ "Now let’s assemble our series and get ready to plot them." @@ -715,7 +715,7 @@ { "cell_type": "code", "execution_count": null, - "id": "141fc1eb", + "id": "538a7a32", "metadata": { "hide-output": false }, @@ -732,7 +732,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fbf9ea3e", + "id": "c7e7350d", "metadata": { "hide-output": false }, @@ -753,7 +753,7 @@ }, { "cell_type": "markdown", - "id": "258057ce", + "id": "321852e6", "metadata": {}, "source": [ "At the start of this lecture, we noted how US GDP came from “nowhere” at the start of the 19th century to rival and then overtake the GDP of the British Empire\n", @@ -766,7 +766,7 @@ }, { "cell_type": "markdown", - "id": "c59a7de5", + "id": "bc0af384", "metadata": {}, "source": [ "### The modern era (1950 to 2020)\n", @@ -777,7 +777,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eaec9901", + "id": "d709efa5", "metadata": { "hide-output": false }, @@ -794,7 +794,7 @@ }, { "cell_type": "markdown", - "id": "56641f11", + "id": "bc842501", "metadata": {}, "source": [ "It is tempting to compare this graph with figure Fig. 2.6 that showed the US overtaking the UK near the start of the “American Century”, a version of the graph featured in chapter 1 of [[Tooze, 2014](https://intro.quantecon.org/zreferences.html#id11)]." @@ -802,7 +802,7 @@ }, { "cell_type": "markdown", - "id": "602945d8", + "id": "92489555", "metadata": {}, "source": [ "## Regional analysis\n", @@ -815,7 +815,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7fe8ccc9", + "id": "1407f33b", "metadata": { "hide-output": false }, @@ -830,7 +830,7 @@ }, { "cell_type": "markdown", - "id": "dbf0ed63", + "id": "9e32942f", "metadata": {}, "source": [ "We can save the raw data in a more convenient format to build a single table of regional GDP per capita" @@ -839,7 +839,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01274f5c", + "id": "04ed7868", "metadata": { "hide-output": false }, @@ -851,7 +851,7 @@ }, { "cell_type": "markdown", - "id": "a2399df4", + "id": "2dd9d58c", "metadata": {}, "source": [ "Let’s interpolate based on time to fill in any gaps in the dataset for the purpose of plotting" @@ -860,7 +860,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c2938c3a", + "id": "4a4ed6e8", "metadata": { "hide-output": false }, @@ -871,7 +871,7 @@ }, { "cell_type": "markdown", - "id": "6bddc183", + "id": "2a2ddd40", "metadata": {}, "source": [ "Looking more closely, let’s compare the time series for `Western Offshoots` and `Sub-Saharan Africa` with a number of different regions around the world.\n", @@ -882,7 +882,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4bb8f3fd", + "id": "d7d62af4", "metadata": { "hide-output": false }, @@ -900,7 +900,7 @@ } ], "metadata": { - "date": 1712122263.3003094, + "date": 1712983676.762995, "filename": "long_run_growth.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/lp_intro.ipynb b/_notebooks/lp_intro.ipynb index fa140ad0..a4a1140e 100644 --- a/_notebooks/lp_intro.ipynb +++ b/_notebooks/lp_intro.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "e2f8233a", + "id": "f3abfd48", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "971f1b3f", + "id": "6b70f722", "metadata": {}, "source": [ "# Linear Programming" @@ -19,7 +19,7 @@ }, { "cell_type": "markdown", - "id": "5935a95d", + "id": "b5330a37", "metadata": {}, "source": [ "# Migrated lecture\n", @@ -32,7 +32,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d712e2dd", + "id": "a07397c3", "metadata": { "hide-output": false }, @@ -43,7 +43,7 @@ }, { "cell_type": "markdown", - "id": "6be83370", + "id": "872b8c13", "metadata": {}, "source": [ "## Overview\n", @@ -73,7 +73,7 @@ { "cell_type": "code", "execution_count": null, - "id": "34c45222", + "id": "2ea1874e", "metadata": { "hide-output": false }, @@ -89,7 +89,7 @@ }, { "cell_type": "markdown", - "id": "ebe111c7", + "id": "55f04ef7", "metadata": {}, "source": [ "Let’s start with some examples of linear programming problem." @@ -97,7 +97,7 @@ }, { "cell_type": "markdown", - "id": "961b10a9", + "id": "4c3aeee6", "metadata": {}, "source": [ "## Example 1: Production Problem\n", @@ -140,7 +140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "55203a24", + "id": "1a35d598", "metadata": { "hide-output": false }, @@ -183,7 +183,7 @@ }, { "cell_type": "markdown", - "id": "64cd2452", + "id": "5511abc4", "metadata": {}, "source": [ "The blue region is the feasible set within which all constraints are satisfied.\n", @@ -199,7 +199,7 @@ }, { "cell_type": "markdown", - "id": "f1fb6f17", + "id": "9df8815f", "metadata": {}, "source": [ "### Computation: Using OR-Tools\n", @@ -212,7 +212,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ba0174e8", + "id": "895ab465", "metadata": { "hide-output": false }, @@ -224,7 +224,7 @@ }, { "cell_type": "markdown", - "id": "2689ab5d", + "id": "4328034c", "metadata": {}, "source": [ "Let’s us create two variables $ x_1 $ and $ x_2 $ such that they can only have nonnegative values." @@ -233,7 +233,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4cb911d9", + "id": "34680dc5", "metadata": { "hide-output": false }, @@ -246,7 +246,7 @@ }, { "cell_type": "markdown", - "id": "660d3d9b", + "id": "4451d796", "metadata": {}, "source": [ "Add the constraints to the problem." @@ -255,7 +255,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a25e22eb", + "id": "a3dd6fa4", "metadata": { "hide-output": false }, @@ -270,7 +270,7 @@ }, { "cell_type": "markdown", - "id": "a5d3c2b3", + "id": "97403eb4", "metadata": {}, "source": [ "Let’s specify the objective function. We use `solver.Maximize` method in the case when we want to maximize the objective function and in the case of minimization we can use `solver.Minimize`." @@ -279,7 +279,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8d166cc5", + "id": "4074dce3", "metadata": { "hide-output": false }, @@ -291,7 +291,7 @@ }, { "cell_type": "markdown", - "id": "1df236c2", + "id": "53047508", "metadata": {}, "source": [ "Once we solve the problem, we can check whether the solver was successful in solving the problem using it’s status. If it’s successful, then the status will be equal to `pywraplp.Solver.OPTIMAL`." @@ -300,7 +300,7 @@ { "cell_type": "code", "execution_count": null, - "id": "502f606d", + "id": "d56dce81", "metadata": { "hide-output": false }, @@ -320,7 +320,7 @@ }, { "cell_type": "markdown", - "id": "77ff3084", + "id": "d7e1f014", "metadata": {}, "source": [ "## Example 2: Investment Problem\n", @@ -400,7 +400,7 @@ }, { "cell_type": "markdown", - "id": "baccd6a6", + "id": "16e5e027", "metadata": {}, "source": [ "### Computation: Using OR-Tools\n", @@ -413,7 +413,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e10de0c8", + "id": "20c937ff", "metadata": { "hide-output": false }, @@ -425,7 +425,7 @@ }, { "cell_type": "markdown", - "id": "9e12fe43", + "id": "d5f84c10", "metadata": {}, "source": [ "Let’s us create five variables $ x_1, x_2, x_3, x_4, $ and $ x_5 $ such that they can only have the values defined in the above constraints." @@ -434,7 +434,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23f2c41e", + "id": "ce7fe7dd", "metadata": { "hide-output": false }, @@ -450,7 +450,7 @@ }, { "cell_type": "markdown", - "id": "49304674", + "id": "655a7e23", "metadata": {}, "source": [ "Add the constraints to the problem." @@ -459,7 +459,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4821b36f", + "id": "ec659ee2", "metadata": { "hide-output": false }, @@ -477,7 +477,7 @@ }, { "cell_type": "markdown", - "id": "2af13374", + "id": "7dbc3e7d", "metadata": {}, "source": [ "Let’s specify the objective function." @@ -486,7 +486,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d94a9b0a", + "id": "2366a7ce", "metadata": { "hide-output": false }, @@ -498,7 +498,7 @@ }, { "cell_type": "markdown", - "id": "d030e6c0", + "id": "e89ec34d", "metadata": {}, "source": [ "Let’s solve the problem and check the status using `pywraplp.Solver.OPTIMAL`." @@ -507,7 +507,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19d58113", + "id": "00389b27", "metadata": { "hide-output": false }, @@ -530,7 +530,7 @@ }, { "cell_type": "markdown", - "id": "3090be9e", + "id": "4ffc3482", "metadata": {}, "source": [ "OR-Tools tells us that the best investment strategy is:\n", @@ -543,7 +543,7 @@ }, { "cell_type": "markdown", - "id": "1bd31de5", + "id": "c14ebc14", "metadata": {}, "source": [ "## Standard form\n", @@ -602,7 +602,7 @@ }, { "cell_type": "markdown", - "id": "801486e1", + "id": "70de8982", "metadata": {}, "source": [ "### Useful transformations\n", @@ -621,7 +621,7 @@ }, { "cell_type": "markdown", - "id": "e0b460fb", + "id": "92c1d169", "metadata": {}, "source": [ "### Example 1: Production Problem\n", @@ -651,7 +651,7 @@ }, { "cell_type": "markdown", - "id": "5e8c5f4e", + "id": "3140d43f", "metadata": {}, "source": [ "### Computation: Using SciPy\n", @@ -677,7 +677,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16000897", + "id": "72b5f94c", "metadata": { "hide-output": false }, @@ -694,7 +694,7 @@ }, { "cell_type": "markdown", - "id": "40b239ec", + "id": "3d5f6fb1", "metadata": {}, "source": [ "Once we solve the problem, we can check whether the solver was successful in solving the problem using the boolean attribute `success`. If it’s successful, then the `success` attribute is set to `True`." @@ -703,7 +703,7 @@ { "cell_type": "code", "execution_count": null, - "id": "990b57e7", + "id": "4f6718cc", "metadata": { "hide-output": false }, @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "b7039f99", + "id": "832a2184", "metadata": {}, "source": [ "The optimal plan tells the factory to produce $ 2.5 $ units of Product 1 and $ 5 $ units of Product 2; that generates a maximizing value of revenue of $ 27.5 $.\n", @@ -745,7 +745,7 @@ }, { "cell_type": "markdown", - "id": "61b53ec0", + "id": "30634550", "metadata": {}, "source": [ "### Example 2: Investment Problem\n", @@ -789,7 +789,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad2ab7dd", + "id": "0c402f89", "metadata": { "hide-output": false }, @@ -817,7 +817,7 @@ }, { "cell_type": "markdown", - "id": "e676e7f1", + "id": "eb5dd00d", "metadata": {}, "source": [ "Let’s solve the problem and check the status using `success` attribute." @@ -826,7 +826,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5092ed3c", + "id": "e261b0a1", "metadata": { "hide-output": false }, @@ -851,7 +851,7 @@ }, { "cell_type": "markdown", - "id": "c7660ab3", + "id": "500dced8", "metadata": {}, "source": [ "SciPy tells us that the best investment strategy is:\n", @@ -869,7 +869,7 @@ }, { "cell_type": "markdown", - "id": "6b04fe78", + "id": "d6953acf", "metadata": {}, "source": [ "## Exercises" @@ -877,7 +877,7 @@ }, { "cell_type": "markdown", - "id": "5ef8c664", + "id": "fa261b71", "metadata": {}, "source": [ "## Exercise 34.1\n", @@ -887,7 +887,7 @@ }, { "cell_type": "markdown", - "id": "1604b638", + "id": "1f866f54", "metadata": {}, "source": [ "## Solution to[ Exercise 34.1](https://intro.quantecon.org/#lp_intro_ex1)\n", @@ -908,7 +908,7 @@ { "cell_type": "code", "execution_count": null, - "id": "43da350d", + "id": "d9da81de", "metadata": { "hide-output": false }, @@ -925,7 +925,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f432e698", + "id": "9375c265", "metadata": { "hide-output": false }, @@ -944,7 +944,7 @@ { "cell_type": "code", "execution_count": null, - "id": "834de6d5", + "id": "13771b04", "metadata": { "hide-output": false }, @@ -957,7 +957,7 @@ { "cell_type": "code", "execution_count": null, - "id": "224bd4e9", + "id": "0e49a23a", "metadata": { "hide-output": false }, @@ -977,7 +977,7 @@ }, { "cell_type": "markdown", - "id": "f4931afb", + "id": "baabe8e2", "metadata": {}, "source": [ "## Exercise 34.2\n", @@ -995,7 +995,7 @@ }, { "cell_type": "markdown", - "id": "8088aa4d", + "id": "6a9bc22f", "metadata": {}, "source": [ "## Solution to[ Exercise 34.2](https://intro.quantecon.org/#lp_intro_ex2)\n", @@ -1016,7 +1016,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e3ae1ea7", + "id": "901e1a2f", "metadata": { "hide-output": false }, @@ -1028,7 +1028,7 @@ }, { "cell_type": "markdown", - "id": "46dfa541", + "id": "56c828d8", "metadata": {}, "source": [ "Let’s us create two variables $ x_1 $ and $ x_2 $ such that they can only have nonnegative values." @@ -1037,7 +1037,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9c7384b9", + "id": "5610bf6e", "metadata": { "hide-output": false }, @@ -1051,7 +1051,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fa101d33", + "id": "10b7de7d", "metadata": { "hide-output": false }, @@ -1067,7 +1067,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3890cbbb", + "id": "c0f01ae6", "metadata": { "hide-output": false }, @@ -1080,7 +1080,7 @@ { "cell_type": "code", "execution_count": null, - "id": "63f642ac", + "id": "453e03d9", "metadata": { "hide-output": false }, @@ -1100,7 +1100,7 @@ } ], "metadata": { - "date": 1712122263.3382359, + "date": 1712983676.7976134, "filename": "lp_intro.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/markov_chains_I.ipynb b/_notebooks/markov_chains_I.ipynb index d611af3b..ccfe833a 100644 --- a/_notebooks/markov_chains_I.ipynb +++ b/_notebooks/markov_chains_I.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "61433dee", + "id": "a248c01c", "metadata": {}, "source": [ "# Markov Chains: Basic Concepts\n", @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47aba9b4", + "id": "da0aa25e", "metadata": { "hide-output": false }, @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "0e1a191f", + "id": "32138ba7", "metadata": {}, "source": [ "## Overview\n", @@ -60,7 +60,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30e7d620", + "id": "d236ec99", "metadata": { "hide-output": false }, @@ -76,7 +76,7 @@ }, { "cell_type": "markdown", - "id": "961cf56e", + "id": "d4194bc2", "metadata": {}, "source": [ "## Definitions and examples\n", @@ -89,7 +89,7 @@ }, { "cell_type": "markdown", - "id": "e8362b85", + "id": "0144a3b7", "metadata": {}, "source": [ "### Stochastic matrices\n", @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "5135d0b9", + "id": "8e3e7172", "metadata": {}, "source": [ "### Markov chains\n", @@ -132,7 +132,7 @@ }, { "cell_type": "markdown", - "id": "3ff5c92f", + "id": "96e9e82a", "metadata": {}, "source": [ "#### Example 1\n", @@ -211,7 +211,7 @@ }, { "cell_type": "markdown", - "id": "83bbed05", + "id": "25bd7613", "metadata": {}, "source": [ "#### Example 2\n", @@ -269,7 +269,7 @@ }, { "cell_type": "markdown", - "id": "43921733", + "id": "8ee34a5e", "metadata": {}, "source": [ "#### Example 3\n", @@ -299,7 +299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53c8682a", + "id": "394efaeb", "metadata": { "hide-output": false }, @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "2d3bf0b2", + "id": "5ab2634c", "metadata": {}, "source": [ "Here is a visualization, with darker colors indicating higher probability." @@ -325,7 +325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73e98efa", + "id": "41cacdf2", "metadata": { "hide-output": false }, @@ -361,7 +361,7 @@ }, { "cell_type": "markdown", - "id": "5becc5a0", + "id": "deb3d966", "metadata": {}, "source": [ "Looking at the data, we see that democracies tend to have longer-lasting growth\n", @@ -373,7 +373,7 @@ }, { "cell_type": "markdown", - "id": "502e02ec", + "id": "8c805886", "metadata": {}, "source": [ "### Defining Markov chains\n", @@ -436,7 +436,7 @@ }, { "cell_type": "markdown", - "id": "c91e19c3", + "id": "abead4aa", "metadata": {}, "source": [ "## Simulation\n", @@ -455,7 +455,7 @@ }, { "cell_type": "markdown", - "id": "e1ce6995", + "id": "b33517f7", "metadata": {}, "source": [ "### Writing our own simulation code\n", @@ -486,7 +486,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fae9d25a", + "id": "06c9cf23", "metadata": { "hide-output": false }, @@ -499,7 +499,7 @@ }, { "cell_type": "markdown", - "id": "931bffaf", + "id": "78b65026", "metadata": {}, "source": [ "We’ll write our code as a function that accepts the following three arguments\n", @@ -512,7 +512,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c4997241", + "id": "b3203734", "metadata": { "hide-output": false }, @@ -543,7 +543,7 @@ }, { "cell_type": "markdown", - "id": "21d9e2c8", + "id": "02080764", "metadata": {}, "source": [ "Let’s see how it works using the small matrix" @@ -552,7 +552,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b1e7d11", + "id": "f42161e4", "metadata": { "hide-output": false }, @@ -564,7 +564,7 @@ }, { "cell_type": "markdown", - "id": "0e8233f3", + "id": "cd37feda", "metadata": {}, "source": [ "Here’s a short time series." @@ -573,7 +573,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9fb1f768", + "id": "ce91d34e", "metadata": { "hide-output": false }, @@ -584,7 +584,7 @@ }, { "cell_type": "markdown", - "id": "f20705bd", + "id": "a95beb96", "metadata": {}, "source": [ "It can be shown that for a long series drawn from `P`, the fraction of the\n", @@ -601,7 +601,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90e8cec3", + "id": "d0899fbe", "metadata": { "hide-output": false }, @@ -613,7 +613,7 @@ }, { "cell_type": "markdown", - "id": "a08cec15", + "id": "f34185e3", "metadata": {}, "source": [ "You can try changing the initial distribution to confirm that the output is\n", @@ -622,7 +622,7 @@ }, { "cell_type": "markdown", - "id": "3e10c140", + "id": "92c8b764", "metadata": {}, "source": [ "### Using QuantEcon’s routines\n", @@ -635,7 +635,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e261369", + "id": "c7147d6c", "metadata": { "hide-output": false }, @@ -648,7 +648,7 @@ }, { "cell_type": "markdown", - "id": "d1fa46b0", + "id": "07c7fd83", "metadata": {}, "source": [ "The `simulate` routine is faster (because it is [JIT compiled](https://python-programming.quantecon.org/numba.html#numba-link))." @@ -657,7 +657,7 @@ { "cell_type": "code", "execution_count": null, - "id": "69f0c642", + "id": "cc287512", "metadata": { "hide-output": false }, @@ -669,7 +669,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72dca4bd", + "id": "801e0b04", "metadata": { "hide-output": false }, @@ -680,7 +680,7 @@ }, { "cell_type": "markdown", - "id": "785fc670", + "id": "35703bd9", "metadata": {}, "source": [ "#### Adding state values and initial conditions\n", @@ -695,7 +695,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e69e2d2c", + "id": "673a9643", "metadata": { "hide-output": false }, @@ -708,7 +708,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29f9d9e5", + "id": "ec2dd1e5", "metadata": { "hide-output": false }, @@ -720,7 +720,7 @@ { "cell_type": "code", "execution_count": null, - "id": "540a3262", + "id": "6af9a09d", "metadata": { "hide-output": false }, @@ -731,7 +731,7 @@ }, { "cell_type": "markdown", - "id": "b636244d", + "id": "1f99aa62", "metadata": {}, "source": [ "If we want to see indices rather than state values as outputs as we can use" @@ -740,7 +740,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4577e31e", + "id": "bb72cce4", "metadata": { "hide-output": false }, @@ -751,7 +751,7 @@ }, { "cell_type": "markdown", - "id": "2927d230", + "id": "2e195832", "metadata": {}, "source": [ "\n", @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "eb8c3ffd", + "id": "8bc5deb9", "metadata": {}, "source": [ "## Distributions over time\n", @@ -842,7 +842,7 @@ }, { "cell_type": "markdown", - "id": "0dc7aa07", + "id": "1c925fb6", "metadata": {}, "source": [ "### Multiple step transition probabilities\n", @@ -869,7 +869,7 @@ }, { "cell_type": "markdown", - "id": "6edb7ffc", + "id": "bfee2571", "metadata": {}, "source": [ "### Example: probability of recession\n", @@ -894,7 +894,7 @@ }, { "cell_type": "markdown", - "id": "d0361f88", + "id": "16932f5c", "metadata": {}, "source": [ "### Example 2: Cross-sectional distributions\n", @@ -943,7 +943,7 @@ }, { "cell_type": "markdown", - "id": "8da83c0c", + "id": "c18355fb", "metadata": {}, "source": [ "## Stationary distributions\n", @@ -957,7 +957,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c9b2d611", + "id": "34d04f2e", "metadata": { "hide-output": false }, @@ -971,7 +971,7 @@ }, { "cell_type": "markdown", - "id": "b08e72f0", + "id": "43ad4530", "metadata": {}, "source": [ "Notice that `ψ @ P` is the same as `ψ`.\n", @@ -993,7 +993,7 @@ }, { "cell_type": "markdown", - "id": "309a36f0", + "id": "e9fc5f77", "metadata": {}, "source": [ "## \n", @@ -1014,7 +1014,7 @@ }, { "cell_type": "markdown", - "id": "bbfb9b61", + "id": "93b839b3", "metadata": {}, "source": [ "## \n", @@ -1027,7 +1027,7 @@ }, { "cell_type": "markdown", - "id": "38f90478", + "id": "4fac948a", "metadata": {}, "source": [ "### Example\n", @@ -1052,7 +1052,7 @@ }, { "cell_type": "markdown", - "id": "f6d2852a", + "id": "36b130eb", "metadata": {}, "source": [ "### Calculating stationary distributions\n", @@ -1065,7 +1065,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ce6fc3e", + "id": "2455970b", "metadata": { "hide-output": false }, @@ -1080,7 +1080,7 @@ }, { "cell_type": "markdown", - "id": "faeb6b29", + "id": "7a72bf4e", "metadata": {}, "source": [ "### Asymptotic stationarity\n", @@ -1097,7 +1097,7 @@ }, { "cell_type": "markdown", - "id": "e7c89b8b", + "id": "a1c8bee1", "metadata": {}, "source": [ "### \n", @@ -1118,7 +1118,7 @@ }, { "cell_type": "markdown", - "id": "0f22659f", + "id": "7ba02941", "metadata": {}, "source": [ "#### Example: Hamilton’s chain\n", @@ -1129,7 +1129,7 @@ { "cell_type": "code", "execution_count": null, - "id": "409f7460", + "id": "4cf98a93", "metadata": { "hide-output": false }, @@ -1143,7 +1143,7 @@ }, { "cell_type": "markdown", - "id": "f0d88277", + "id": "25f3529d", "metadata": {}, "source": [ "Let’s pick an initial distribution $ \\psi_0 $ and trace out the sequence of distributions $ \\psi_0 P^t $ for $ t = 0, 1, 2, \\ldots $\n", @@ -1154,7 +1154,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1fe4aece", + "id": "d2a24cf1", "metadata": { "hide-output": false }, @@ -1172,7 +1172,7 @@ }, { "cell_type": "markdown", - "id": "c54ebe76", + "id": "e322c7fe", "metadata": {}, "source": [ "Now we plot the sequence" @@ -1181,7 +1181,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ba2314ed", + "id": "c367e7f1", "metadata": { "hide-output": false }, @@ -1211,7 +1211,7 @@ }, { "cell_type": "markdown", - "id": "8f12aa41", + "id": "6eaecc2a", "metadata": {}, "source": [ "Here\n", @@ -1227,7 +1227,7 @@ }, { "cell_type": "markdown", - "id": "208afe56", + "id": "f54b8e31", "metadata": {}, "source": [ "#### An alternative illustration\n", @@ -1240,7 +1240,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cbad3b1f", + "id": "daeedf8d", "metadata": { "hide-output": false }, @@ -1261,7 +1261,7 @@ }, { "cell_type": "markdown", - "id": "e48fd7fb", + "id": "9127d619", "metadata": {}, "source": [ "We then write a function to plot the dynamics of $ (\\psi_0 P^t)(i) $ as $ t $ gets large, for each state $ i $ with different initial distributions" @@ -1270,7 +1270,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c2a6df28", + "id": "5276e0c7", "metadata": { "hide-output": false }, @@ -1310,7 +1310,7 @@ }, { "cell_type": "markdown", - "id": "2a3140aa", + "id": "01327ef8", "metadata": {}, "source": [ "The following figure shows" @@ -1319,7 +1319,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8b5b4701", + "id": "8d33d9ad", "metadata": { "hide-output": false }, @@ -1339,7 +1339,7 @@ }, { "cell_type": "markdown", - "id": "4272f823", + "id": "7e932362", "metadata": {}, "source": [ "The convergence to $ \\psi^* $ holds for different initial distributions." @@ -1347,7 +1347,7 @@ }, { "cell_type": "markdown", - "id": "a9ad3178", + "id": "b5967162", "metadata": {}, "source": [ "#### Example: Failure of convergence\n", @@ -1368,7 +1368,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e65b013e", + "id": "86f88d84", "metadata": { "hide-output": false }, @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "397ea47d", + "id": "84f83fe6", "metadata": {}, "source": [ "Indeed, this $ P $ fails our asymptotic stationarity condition, since, as you can\n", @@ -1397,7 +1397,7 @@ }, { "cell_type": "markdown", - "id": "93987f38", + "id": "0d2f25df", "metadata": {}, "source": [ "## Computing expectations\n", @@ -1470,7 +1470,7 @@ }, { "cell_type": "markdown", - "id": "b9fb66fe", + "id": "d2460c09", "metadata": {}, "source": [ "### Expectations of geometric sums\n", @@ -1500,7 +1500,7 @@ }, { "cell_type": "markdown", - "id": "e89a29c7", + "id": "01489d22", "metadata": {}, "source": [ "### Exercise 31.1\n", @@ -1530,7 +1530,7 @@ }, { "cell_type": "markdown", - "id": "0e1a07f9", + "id": "b97d0f68", "metadata": {}, "source": [ "### Solution to[ Exercise 31.1](https://intro.quantecon.org/#mc1_ex_1)\n", @@ -1549,7 +1549,7 @@ { "cell_type": "code", "execution_count": null, - "id": "74afa732", + "id": "14a581a6", "metadata": { "hide-output": false }, @@ -1564,7 +1564,7 @@ }, { "cell_type": "markdown", - "id": "9686abea", + "id": "076e7e3b", "metadata": {}, "source": [ "Note that rows of the transition matrix converge to the stationary distribution." @@ -1573,7 +1573,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2262bc79", + "id": "8535cf63", "metadata": { "hide-output": false }, @@ -1586,7 +1586,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b3f71cdb", + "id": "29f5e6c8", "metadata": { "hide-output": false }, @@ -1599,7 +1599,7 @@ }, { "cell_type": "markdown", - "id": "5a6f99eb", + "id": "2aab9ac9", "metadata": {}, "source": [ "Solution 3:\n", @@ -1610,7 +1610,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5a5530da", + "id": "ca55d30d", "metadata": { "hide-output": false }, @@ -1623,7 +1623,7 @@ }, { "cell_type": "markdown", - "id": "6964ff0e", + "id": "7cd16554", "metadata": {}, "source": [ "In fact, the rate of convergence is governed by [eigenvalues](https://intro.quantecon.org/eigen_I.html#eigen) [[Sargent and Stachurski, 2023](https://intro.quantecon.org/zreferences.html#id19)]." @@ -1632,7 +1632,7 @@ { "cell_type": "code", "execution_count": null, - "id": "99474a7a", + "id": "ee8d96ea", "metadata": { "hide-output": false }, @@ -1645,7 +1645,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8f62944b", + "id": "e805fcbd", "metadata": { "hide-output": false }, @@ -1661,7 +1661,7 @@ }, { "cell_type": "markdown", - "id": "631916c9", + "id": "b6c8b371", "metadata": {}, "source": [ "More specifically, it is governed by the spectral gap, the difference between the largest and the second largest eigenvalue." @@ -1670,7 +1670,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2c9e408b", + "id": "22b3aabc", "metadata": { "hide-output": false }, @@ -1684,7 +1684,7 @@ }, { "cell_type": "markdown", - "id": "59b03d82", + "id": "41469fea", "metadata": {}, "source": [ "We will come back to this when we discuss [spectral theory](https://intro.quantecon.org/eigen_II.html#spec-markov)." @@ -1692,7 +1692,7 @@ }, { "cell_type": "markdown", - "id": "78701ee4", + "id": "980d7266", "metadata": {}, "source": [ "### Exercise 31.2\n", @@ -1703,7 +1703,7 @@ { "cell_type": "code", "execution_count": null, - "id": "953d2a39", + "id": "6a91ae77", "metadata": { "hide-output": false }, @@ -1720,7 +1720,7 @@ }, { "cell_type": "markdown", - "id": "86adaca3", + "id": "c6f3a417", "metadata": {}, "source": [ "In this exercise,\n", @@ -1732,7 +1732,7 @@ }, { "cell_type": "markdown", - "id": "819c56af", + "id": "2f65765d", "metadata": {}, "source": [ "### Solution to[ Exercise 31.2](https://intro.quantecon.org/#mc1_ex_2)\n", @@ -1745,7 +1745,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee182570", + "id": "3ef1dc2f", "metadata": { "hide-output": false }, @@ -1763,7 +1763,7 @@ }, { "cell_type": "markdown", - "id": "f7d14902", + "id": "e3f441df", "metadata": {}, "source": [ "So it satisfies the requirement.\n", @@ -1776,7 +1776,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5eac22c3", + "id": "af76da00", "metadata": { "hide-output": false }, @@ -1810,7 +1810,7 @@ }, { "cell_type": "markdown", - "id": "10d8bf57", + "id": "7a082f85", "metadata": {}, "source": [ "### Exercise 31.3\n", @@ -1821,7 +1821,7 @@ }, { "cell_type": "markdown", - "id": "9b65597f", + "id": "cba9c494", "metadata": {}, "source": [ "### Solution to[ Exercise 31.3](https://intro.quantecon.org/#mc1_ex_3)\n", @@ -1847,7 +1847,7 @@ } ], "metadata": { - "date": 1712122263.6717458, + "date": 1712983677.078465, "filename": "markov_chains_I.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/markov_chains_II.ipynb b/_notebooks/markov_chains_II.ipynb index 73d8672c..b9797e38 100644 --- a/_notebooks/markov_chains_II.ipynb +++ b/_notebooks/markov_chains_II.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c0a90e96", + "id": "f6ebc5a6", "metadata": {}, "source": [ "# Markov Chains: Irreducibility and Ergodicity\n", @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "41503379", + "id": "324e7c5d", "metadata": { "hide-output": false }, @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "eab9eea3", + "id": "3b4015e1", "metadata": {}, "source": [ "## Overview\n", @@ -54,7 +54,7 @@ { "cell_type": "code", "execution_count": null, - "id": "033cdb43", + "id": "35c5d3d0", "metadata": { "hide-output": false }, @@ -67,7 +67,7 @@ }, { "cell_type": "markdown", - "id": "86fe5a48", + "id": "844eff7c", "metadata": {}, "source": [ "\n", @@ -76,7 +76,7 @@ }, { "cell_type": "markdown", - "id": "5fd6c9bf", + "id": "1ac484ff", "metadata": {}, "source": [ "## Irreducibility\n", @@ -128,7 +128,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6bcc4182", + "id": "6cc4bd47", "metadata": { "hide-output": false }, @@ -144,7 +144,7 @@ }, { "cell_type": "markdown", - "id": "dc61897f", + "id": "93630430", "metadata": {}, "source": [ "Here’s a more pessimistic scenario in which poor people remain poor forever\n", @@ -160,7 +160,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1410efb", + "id": "84ef3a4e", "metadata": { "hide-output": false }, @@ -176,7 +176,7 @@ }, { "cell_type": "markdown", - "id": "9ac97acc", + "id": "1d82cdd3", "metadata": {}, "source": [ "It might be clear to you already that irreducibility is going to be important\n", @@ -189,7 +189,7 @@ }, { "cell_type": "markdown", - "id": "d7c8e71b", + "id": "4440057c", "metadata": {}, "source": [ "### Irreducibility and stationarity\n", @@ -203,7 +203,7 @@ }, { "cell_type": "markdown", - "id": "5bd9a0bb", + "id": "1f5fb436", "metadata": {}, "source": [ "### \n", @@ -220,7 +220,7 @@ }, { "cell_type": "markdown", - "id": "d667123f", + "id": "ce7b49d8", "metadata": {}, "source": [ "## Ergodicity\n", @@ -230,7 +230,7 @@ }, { "cell_type": "markdown", - "id": "7c0e166c", + "id": "322f5501", "metadata": {}, "source": [ "## \n", @@ -274,7 +274,7 @@ }, { "cell_type": "markdown", - "id": "6122527b", + "id": "4f8e0cc2", "metadata": {}, "source": [ "### Example: Ergodicity and unemployment\n", @@ -303,7 +303,7 @@ }, { "cell_type": "markdown", - "id": "fd94128d", + "id": "bccf6676", "metadata": {}, "source": [ "### Example: Hamilton dynamics\n", @@ -332,7 +332,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3e72c677", + "id": "f17c40fd", "metadata": { "hide-output": false }, @@ -362,7 +362,7 @@ }, { "cell_type": "markdown", - "id": "e501f60d", + "id": "74af4e4d", "metadata": {}, "source": [ "You might like to try changing $ x=1 $ to either $ x=0 $ or $ x=2 $.\n", @@ -372,7 +372,7 @@ }, { "cell_type": "markdown", - "id": "6836fe0b", + "id": "9e65c9a2", "metadata": {}, "source": [ "### Example: a periodic chain\n", @@ -404,7 +404,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e74ebc3", + "id": "9cf9d1e0", "metadata": { "hide-output": false }, @@ -438,7 +438,7 @@ }, { "cell_type": "markdown", - "id": "0dd757d2", + "id": "00021479", "metadata": {}, "source": [ "This example helps to emphasize that asymptotic stationarity is about the distribution, while ergodicity is about the sample path.\n", @@ -450,7 +450,7 @@ }, { "cell_type": "markdown", - "id": "144b1704", + "id": "197b46f5", "metadata": {}, "source": [ "### Example: political institutions\n", @@ -482,7 +482,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7628c77b", + "id": "69106a16", "metadata": { "hide-output": false }, @@ -518,7 +518,7 @@ }, { "cell_type": "markdown", - "id": "4492b3bd", + "id": "7e8e0fe6", "metadata": {}, "source": [ "### Expectations of geometric sums\n", @@ -546,7 +546,7 @@ }, { "cell_type": "markdown", - "id": "d99b2af2", + "id": "46487677", "metadata": {}, "source": [ "## Exercises" @@ -554,7 +554,7 @@ }, { "cell_type": "markdown", - "id": "167449d0", + "id": "b736271d", "metadata": {}, "source": [ "## Exercise 32.1\n", @@ -587,7 +587,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f6063398", + "id": "5ba8df95", "metadata": { "hide-output": false }, @@ -610,7 +610,7 @@ }, { "cell_type": "markdown", - "id": "ef96fff7", + "id": "f0c6fad8", "metadata": {}, "source": [ "1. Show this process is asymptotically stationary and calculate an approximation to the stationary distribution. \n", @@ -619,7 +619,7 @@ }, { "cell_type": "markdown", - "id": "be365d21", + "id": "e3268a74", "metadata": {}, "source": [ "## Solution to[ Exercise 32.1](https://intro.quantecon.org/#mc_ex1)\n", @@ -632,7 +632,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ccb78db", + "id": "a0dbde54", "metadata": { "hide-output": false }, @@ -655,7 +655,7 @@ }, { "cell_type": "markdown", - "id": "101cff83", + "id": "c24e03d1", "metadata": {}, "source": [ "For this model, rows of $ P^n $ converge to the stationary distribution as $ n \\to\n", @@ -665,7 +665,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d1008244", + "id": "af014641", "metadata": { "hide-output": false }, @@ -678,7 +678,7 @@ }, { "cell_type": "markdown", - "id": "910caa33", + "id": "fa370bd2", "metadata": {}, "source": [ "Part 2:" @@ -687,7 +687,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3ad8f933", + "id": "24ad6de0", "metadata": { "hide-output": false }, @@ -713,7 +713,7 @@ }, { "cell_type": "markdown", - "id": "e6d95db2", + "id": "89fe79b6", "metadata": {}, "source": [ "Note that the fraction of time spent at each state converges to the probability\n", @@ -722,7 +722,7 @@ }, { "cell_type": "markdown", - "id": "7cc40b04", + "id": "fa5e140b", "metadata": {}, "source": [ "## Exercise 32.2\n", @@ -764,7 +764,7 @@ }, { "cell_type": "markdown", - "id": "81c5acd1", + "id": "884ea8e2", "metadata": {}, "source": [ "## Solution to[ Exercise 32.2](https://intro.quantecon.org/#mc_ex2)\n", @@ -780,7 +780,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff7fa4dc", + "id": "b8fbf94b", "metadata": { "hide-output": false }, @@ -817,7 +817,7 @@ }, { "cell_type": "markdown", - "id": "031d17bb", + "id": "7d4bf890", "metadata": {}, "source": [ "## Exercise 32.3\n", @@ -836,7 +836,7 @@ }, { "cell_type": "markdown", - "id": "0e3095aa", + "id": "a73e0880", "metadata": {}, "source": [ "## Solution to[ Exercise 32.3](https://intro.quantecon.org/#mc_ex3)" @@ -845,7 +845,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1642bc26", + "id": "2413eefb", "metadata": { "hide-output": false }, @@ -861,7 +861,7 @@ }, { "cell_type": "markdown", - "id": "2c2659c4", + "id": "64b39985", "metadata": {}, "source": [ "Let’s try it." @@ -870,7 +870,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ef461736", + "id": "9c65763b", "metadata": { "hide-output": false }, @@ -892,7 +892,7 @@ } ], "metadata": { - "date": 1712122263.709051, + "date": 1712983677.1116986, "filename": "markov_chains_II.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/mle.ipynb b/_notebooks/mle.ipynb index 279e083f..d270dda6 100644 --- a/_notebooks/mle.ipynb +++ b/_notebooks/mle.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "978db574", + "id": "245adb63", "metadata": {}, "source": [ "# Maximum Likelihood Estimation" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "92c46249", + "id": "4c060c7e", "metadata": { "hide-output": false }, @@ -27,7 +27,7 @@ }, { "cell_type": "markdown", - "id": "daf1597b", + "id": "6e306b52", "metadata": {}, "source": [ "## Introduction\n", @@ -61,7 +61,7 @@ { "cell_type": "code", "execution_count": null, - "id": "97f3b6a0", + "id": "baf44a89", "metadata": { "hide-output": false }, @@ -76,7 +76,7 @@ }, { "cell_type": "markdown", - "id": "8f88e75f", + "id": "af50fbd7", "metadata": {}, "source": [ "For a population of size $ N $, where individual $ i $ has wealth $ w_i $, total revenue raised by\n", @@ -101,7 +101,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d16dff73", + "id": "70aa8625", "metadata": { "hide-output": false }, @@ -112,7 +112,7 @@ }, { "cell_type": "markdown", - "id": "7181908a", + "id": "6893221d", "metadata": {}, "source": [ "The data is derived from the\n", @@ -124,7 +124,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37f7b05e", + "id": "6bc0b778", "metadata": { "hide-output": false }, @@ -142,7 +142,7 @@ }, { "cell_type": "markdown", - "id": "d2350aae", + "id": "f1b79756", "metadata": {}, "source": [ "Let’s histogram this sample." @@ -151,7 +151,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d498e22f", + "id": "04413e19", "metadata": { "hide-output": false }, @@ -170,7 +170,7 @@ }, { "cell_type": "markdown", - "id": "e4a10072", + "id": "e2c112a4", "metadata": {}, "source": [ "The histogram shows that many people have very low wealth and a few people have\n", @@ -182,7 +182,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7dfab823", + "id": "90946bd5", "metadata": { "hide-output": false }, @@ -193,7 +193,7 @@ }, { "cell_type": "markdown", - "id": "4ea6d8f3", + "id": "d87f6757", "metadata": {}, "source": [ "How can we estimate total revenue from the full population using only the sample data?\n", @@ -217,7 +217,7 @@ }, { "cell_type": "markdown", - "id": "2096ad15", + "id": "5ac73869", "metadata": {}, "source": [ "## Maximum likelihood estimation\n", @@ -247,7 +247,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d292816a", + "id": "28edc4aa", "metadata": { "hide-output": false }, @@ -261,7 +261,7 @@ }, { "cell_type": "markdown", - "id": "8878eb7a", + "id": "ff314248", "metadata": {}, "source": [ "Now our job is to obtain the maximum likelihood estimates of $ \\mu $ and $ \\sigma $, which\n", @@ -332,7 +332,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d206bd4b", + "id": "894c58a8", "metadata": { "hide-output": false }, @@ -345,7 +345,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ec9c10f1", + "id": "c3d43132", "metadata": { "hide-output": false }, @@ -358,7 +358,7 @@ }, { "cell_type": "markdown", - "id": "9f0b4ca4", + "id": "808b2877", "metadata": {}, "source": [ "Let’s plot the log-normal pdf using the estimated parameters against our sample data." @@ -367,7 +367,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6a403533", + "id": "61f204d7", "metadata": { "hide-output": false }, @@ -387,7 +387,7 @@ }, { "cell_type": "markdown", - "id": "3ca28c35", + "id": "79a35e48", "metadata": {}, "source": [ "Our estimated lognormal distribution appears to be a reasonable fit for the overall data.\n", @@ -402,7 +402,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90cd4393", + "id": "b3bd1725", "metadata": { "hide-output": false }, @@ -417,7 +417,7 @@ { "cell_type": "code", "execution_count": null, - "id": "792a6faf", + "id": "e753c530", "metadata": { "hide-output": false }, @@ -429,7 +429,7 @@ }, { "cell_type": "markdown", - "id": "c1292289", + "id": "9f1df7a9", "metadata": {}, "source": [ "(Our unit was 100,000 dollars, so this means that actual revenue is 100,000\n", @@ -438,7 +438,7 @@ }, { "cell_type": "markdown", - "id": "c92c7672", + "id": "237e4636", "metadata": {}, "source": [ "## Pareto distribution\n", @@ -466,7 +466,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2d29267d", + "id": "e390e6b8", "metadata": { "hide-output": false }, @@ -479,7 +479,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1891dbdf", + "id": "10ac5f54", "metadata": { "hide-output": false }, @@ -492,7 +492,7 @@ }, { "cell_type": "markdown", - "id": "af0bc8c6", + "id": "36da2675", "metadata": {}, "source": [ "Now let’s recompute total revenue." @@ -501,7 +501,7 @@ { "cell_type": "code", "execution_count": null, - "id": "64be3b2e", + "id": "6f4b6bbf", "metadata": { "hide-output": false }, @@ -514,7 +514,7 @@ }, { "cell_type": "markdown", - "id": "e50e4e7f", + "id": "1d9443ba", "metadata": {}, "source": [ "The number is very different!" @@ -523,7 +523,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9d670a25", + "id": "089ce8d1", "metadata": { "hide-output": false }, @@ -534,7 +534,7 @@ }, { "cell_type": "markdown", - "id": "4fffffb6", + "id": "07e83382", "metadata": {}, "source": [ "We see that choosing the right distribution is extremely important.\n", @@ -545,7 +545,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4a7b52f7", + "id": "e11a6ef6", "metadata": { "hide-output": false }, @@ -564,7 +564,7 @@ }, { "cell_type": "markdown", - "id": "c629fffa", + "id": "a40b7601", "metadata": {}, "source": [ "We observe that in this case the fit for the Pareto distribution is not very\n", @@ -573,7 +573,7 @@ }, { "cell_type": "markdown", - "id": "36750bba", + "id": "aae7b495", "metadata": {}, "source": [ "## What is the best distribution?\n", @@ -594,7 +594,7 @@ { "cell_type": "code", "execution_count": null, - "id": "56f08972", + "id": "d7ca20be", "metadata": { "hide-output": false }, @@ -609,7 +609,7 @@ }, { "cell_type": "markdown", - "id": "02c82331", + "id": "3df76024", "metadata": {}, "source": [ "Let’s plot this data." @@ -618,7 +618,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee235f43", + "id": "1a22559b", "metadata": { "hide-output": false }, @@ -632,7 +632,7 @@ }, { "cell_type": "markdown", - "id": "e45f086c", + "id": "336f8618", "metadata": {}, "source": [ "Now let’s try fitting some distributions to this data." @@ -640,7 +640,7 @@ }, { "cell_type": "markdown", - "id": "7be6322b", + "id": "1a4d182d", "metadata": {}, "source": [ "### Lognormal distribution for the right hand tail\n", @@ -653,7 +653,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e96d248b", + "id": "c2c20219", "metadata": { "hide-output": false }, @@ -675,7 +675,7 @@ }, { "cell_type": "markdown", - "id": "75a33a71", + "id": "9f785d51", "metadata": {}, "source": [ "While the lognormal distribution was a good fit for the entire dataset,\n", @@ -684,7 +684,7 @@ }, { "cell_type": "markdown", - "id": "3fe71918", + "id": "3347d637", "metadata": {}, "source": [ "### Pareto distribution for the right hand tail\n", @@ -697,7 +697,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aa6e2f43", + "id": "fce13270", "metadata": { "hide-output": false }, @@ -718,7 +718,7 @@ }, { "cell_type": "markdown", - "id": "77e0ea96", + "id": "480a7462", "metadata": {}, "source": [ "The Pareto distribution is a better fit for the right hand tail of our dataset." @@ -726,7 +726,7 @@ }, { "cell_type": "markdown", - "id": "310ce630", + "id": "aab918d9", "metadata": {}, "source": [ "### So what is the best distribution?\n", @@ -746,7 +746,7 @@ }, { "cell_type": "markdown", - "id": "b1c66de7", + "id": "307390b1", "metadata": {}, "source": [ "## Exercises" @@ -754,7 +754,7 @@ }, { "cell_type": "markdown", - "id": "7c287ad8", + "id": "41606c81", "metadata": {}, "source": [ "## Exercise 43.1\n", @@ -774,7 +774,7 @@ }, { "cell_type": "markdown", - "id": "1e888057", + "id": "7f65d3cf", "metadata": {}, "source": [ "## Solution to[ Exercise 43.1](https://intro.quantecon.org/#mle_ex1)" @@ -783,7 +783,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6b38faff", + "id": "bbb1547a", "metadata": { "hide-output": false }, @@ -796,7 +796,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ed1b71ca", + "id": "73fdc87c", "metadata": { "hide-output": false }, @@ -809,7 +809,7 @@ }, { "cell_type": "markdown", - "id": "e01757fc", + "id": "009a91b4", "metadata": {}, "source": [ "## Exercise 43.2\n", @@ -819,7 +819,7 @@ }, { "cell_type": "markdown", - "id": "504b1046", + "id": "28023102", "metadata": {}, "source": [ "## Solution to[ Exercise 43.2](https://intro.quantecon.org/#mle_ex2)" @@ -828,7 +828,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fb9fea3b", + "id": "411e88b5", "metadata": { "hide-output": false }, @@ -846,7 +846,7 @@ }, { "cell_type": "markdown", - "id": "b03425ef", + "id": "28debc5f", "metadata": {}, "source": [ "Clearly, this distribution is not a good fit for our data." @@ -854,7 +854,7 @@ } ], "metadata": { - "date": 1712122263.7382784, + "date": 1712983677.1380138, "filename": "mle.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/money_inflation.ipynb b/_notebooks/money_inflation.ipynb index 1b5d16b5..fc4d2986 100644 --- a/_notebooks/money_inflation.ipynb +++ b/_notebooks/money_inflation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "3ba0715a", + "id": "ee79829b", "metadata": {}, "source": [ "# Money Financed Government Deficits and Price Levels" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "bcd6cf2a", + "id": "2de58347", "metadata": {}, "source": [ "## Overview\n", @@ -73,7 +73,7 @@ }, { "cell_type": "markdown", - "id": "beb8beca", + "id": "303de78f", "metadata": {}, "source": [ "## Demand for and Supply of Money\n", @@ -145,7 +145,7 @@ }, { "cell_type": "markdown", - "id": "f6bc346a", + "id": "3611e129", "metadata": {}, "source": [ "## Equilibrium price and money supply sequences\n", @@ -210,7 +210,7 @@ }, { "cell_type": "markdown", - "id": "dffbf783", + "id": "ca3eb7a0", "metadata": {}, "source": [ "### Steady States\n", @@ -294,7 +294,7 @@ }, { "cell_type": "markdown", - "id": "e0015f5f", + "id": "4f239f34", "metadata": {}, "source": [ "## Some Code\n", @@ -305,7 +305,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3b43ac94", + "id": "db301cbc", "metadata": { "hide-output": false }, @@ -320,7 +320,7 @@ }, { "cell_type": "markdown", - "id": "1ecd353c", + "id": "13f9c46d", "metadata": {}, "source": [ "Let’s set some parameter values and compute possible steady state rates of return on currency $ \\bar R $, the seigniorage maximizing rate of return on currency, and an object that we’ll discuss later, namely, an initial price level $ p_0 $ associated with the maximum steady state rate of return on currency.\n", @@ -331,7 +331,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e159cd0", + "id": "46269cdb", "metadata": { "hide-output": false }, @@ -354,7 +354,7 @@ }, { "cell_type": "markdown", - "id": "c3039e17", + "id": "ce6fcea3", "metadata": {}, "source": [ "Now we compute the $ \\bar R_{\\rm max} $ and corresponding revenue" @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a62fead3", + "id": "e7d5df12", "metadata": { "hide-output": false }, @@ -387,7 +387,7 @@ }, { "cell_type": "markdown", - "id": "86e08e31", + "id": "cc8fe34d", "metadata": {}, "source": [ "Now let’s plot seigniorage as a function of alternative potential steady-state values of $ R $.\n", @@ -402,7 +402,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6d6faede", + "id": "1aa2bd70", "metadata": { "hide-output": false }, @@ -428,7 +428,7 @@ }, { "cell_type": "markdown", - "id": "5e245059", + "id": "b3d873d5", "metadata": {}, "source": [ "Let’s print the two steady-state rates of return $ \\bar R $ and the associated seigniorage revenues that the government collects.\n", @@ -441,7 +441,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d80dbfd5", + "id": "d6655225", "metadata": { "hide-output": false }, @@ -456,7 +456,7 @@ }, { "cell_type": "markdown", - "id": "8f1b42a7", + "id": "ff6b624e", "metadata": {}, "source": [ "Now let’s compute the maximum steady state amount of seigniorage that could be gathered by printing money and the state state rate of return on money that attains it." @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "b8ec1fcc", + "id": "60d19129", "metadata": {}, "source": [ "## Two Computation Strategies\n", @@ -476,7 +476,7 @@ }, { "cell_type": "markdown", - "id": "42ccdf60", + "id": "b52f2dfb", "metadata": {}, "source": [ "### Method 1\n", @@ -523,7 +523,7 @@ }, { "cell_type": "markdown", - "id": "69f22e1b", + "id": "58f99de7", "metadata": {}, "source": [ "### Method 2\n", @@ -562,7 +562,7 @@ }, { "cell_type": "markdown", - "id": "6bbfd36c", + "id": "ceef6ea2", "metadata": {}, "source": [ "## Computation Method 1\n", @@ -614,7 +614,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dbf709aa", + "id": "c561245b", "metadata": { "hide-output": false }, @@ -642,7 +642,7 @@ }, { "cell_type": "markdown", - "id": "e97b0a67", + "id": "b227d575", "metadata": {}, "source": [ "Let’s write some code plot outcomes for several possible initial values $ R_0 $." @@ -651,7 +651,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11fe2631", + "id": "9ded7841", "metadata": { "hide-output": false }, @@ -700,7 +700,7 @@ }, { "cell_type": "markdown", - "id": "77f8b6a9", + "id": "671e5c95", "metadata": {}, "source": [ "Let’s plot distinct outcomes associated with several $ R_0 \\in [\\frac{\\gamma_2}{\\gamma_1}, R_u] $.\n", @@ -711,7 +711,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40d52297", + "id": "1be68a52", "metadata": { "hide-output": false }, @@ -725,7 +725,7 @@ }, { "cell_type": "markdown", - "id": "c969f94a", + "id": "d7bc1655", "metadata": {}, "source": [ "Notice how sequences that start from $ R_0 $ in the half-open interval $ [R_l, R_u) $ converge to the steady state associated with to $ R_l $." @@ -733,7 +733,7 @@ }, { "cell_type": "markdown", - "id": "bc00d7c4", + "id": "2ebd8f8b", "metadata": {}, "source": [ "## Computation method 2\n", @@ -777,7 +777,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7e785a50", + "id": "9f3868a3", "metadata": { "hide-output": false }, @@ -791,7 +791,7 @@ }, { "cell_type": "markdown", - "id": "17e78a05", + "id": "f459e1bb", "metadata": {}, "source": [ "Define\n", @@ -804,7 +804,7 @@ { "cell_type": "code", "execution_count": null, - "id": "85257566", + "id": "08fe4ada", "metadata": { "hide-output": false }, @@ -816,7 +816,7 @@ }, { "cell_type": "markdown", - "id": "9b6d6a9c", + "id": "c524acec", "metadata": {}, "source": [ "and write the system [(26.12)](#equation-eq-sytem101) as\n", @@ -871,7 +871,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0f27db2", + "id": "215a7e12", "metadata": { "hide-output": false }, @@ -885,7 +885,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4aacb6de", + "id": "31312c87", "metadata": { "hide-output": false }, @@ -900,7 +900,7 @@ }, { "cell_type": "markdown", - "id": "70ba256a", + "id": "e5d8c77b", "metadata": {}, "source": [ "Partition $ Q $ as\n", @@ -956,7 +956,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3610fe69", + "id": "55f60e64", "metadata": { "hide-output": false }, @@ -973,7 +973,7 @@ }, { "cell_type": "markdown", - "id": "ffc8025f", + "id": "ada0d34b", "metadata": {}, "source": [ "For almost all initial vectors $ y_0 $, the gross rate of inflation $ \\frac{p_{t+1}}{p_t} $ eventually converges to the larger eigenvalue $ {R_l}^{-1} $.\n", @@ -1064,7 +1064,7 @@ }, { "cell_type": "markdown", - "id": "4008d617", + "id": "27411402", "metadata": {}, "source": [ "### More convenient formula\n", @@ -1105,7 +1105,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1d1dce7b", + "id": "b1f29a27", "metadata": { "hide-output": false }, @@ -1118,7 +1118,7 @@ }, { "cell_type": "markdown", - "id": "a1c58d49", + "id": "a3c3b27e", "metadata": {}, "source": [ "It can be verified that this formula replicates itself over time in the sense that\n", @@ -1137,7 +1137,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d72255f", + "id": "153c1968", "metadata": { "hide-output": false }, @@ -1189,7 +1189,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7e224973", + "id": "1e837364", "metadata": { "hide-output": false }, @@ -1202,7 +1202,7 @@ }, { "cell_type": "markdown", - "id": "52938885", + "id": "9da53392", "metadata": {}, "source": [ "Please notice that for $ m_t $ and $ p_t $, we have used log scales for the coordinate (i.e., vertical) axes.\n", @@ -1213,7 +1213,7 @@ }, { "cell_type": "markdown", - "id": "9e9b89c4", + "id": "e3fc6e4f", "metadata": {}, "source": [ "## Peculiar stationary outcomes\n", @@ -1240,7 +1240,7 @@ }, { "cell_type": "markdown", - "id": "97c98e36", + "id": "f01669a2", "metadata": {}, "source": [ "## Equilibrium selection\n", @@ -1270,7 +1270,7 @@ } ], "metadata": { - "date": 1712122263.8067644, + "date": 1712983677.1970587, "filename": "money_inflation.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/money_inflation_nonlinear.ipynb b/_notebooks/money_inflation_nonlinear.ipynb index 08c59b93..350baf34 100644 --- a/_notebooks/money_inflation_nonlinear.ipynb +++ b/_notebooks/money_inflation_nonlinear.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "06d7778d", + "id": "27836f1d", "metadata": {}, "source": [ "# Inflation Rate Laffer Curves" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "054b2be7", + "id": "980a928c", "metadata": {}, "source": [ "## Overview\n", @@ -49,7 +49,7 @@ }, { "cell_type": "markdown", - "id": "7152808b", + "id": "518b1540", "metadata": {}, "source": [ "## The Model\n", @@ -85,7 +85,7 @@ }, { "cell_type": "markdown", - "id": "173d2986", + "id": "d82fc4ae", "metadata": {}, "source": [ "## Computing An Equilibrium Sequence\n", @@ -143,7 +143,7 @@ }, { "cell_type": "markdown", - "id": "4da3532c", + "id": "1123cb4a", "metadata": {}, "source": [ "## Limiting Values of Inflation Rate\n", @@ -191,7 +191,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d2e7f293", + "id": "c2d748fe", "metadata": { "hide-output": false }, @@ -206,7 +206,7 @@ }, { "cell_type": "markdown", - "id": "63183e06", + "id": "b14cd021", "metadata": {}, "source": [ "Let’s create a `namedtuple` to store the parameters of the model" @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "39942ec9", + "id": "e1db7663", "metadata": { "hide-output": false }, @@ -236,7 +236,7 @@ }, { "cell_type": "markdown", - "id": "5e6f56cb", + "id": "44803ca5", "metadata": {}, "source": [ "Now we write code that computes steady-state $ \\bar \\pi $s." @@ -245,7 +245,7 @@ { "cell_type": "code", "execution_count": null, - "id": "75cd1580", + "id": "b93b1270", "metadata": { "hide-output": false }, @@ -267,7 +267,7 @@ }, { "cell_type": "markdown", - "id": "d08c5288", + "id": "bf62cbe4", "metadata": {}, "source": [ "We find two steady state $ \\bar \\pi $ values" @@ -275,7 +275,7 @@ }, { "cell_type": "markdown", - "id": "8c4d673b", + "id": "307db86b", "metadata": {}, "source": [ "## Steady State Laffer Curve\n", @@ -286,7 +286,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e90c8156", + "id": "d05e5527", "metadata": { "hide-output": false }, @@ -326,7 +326,7 @@ }, { "cell_type": "markdown", - "id": "84c456a6", + "id": "75d46cdc", "metadata": {}, "source": [ "## Associated Initial Price Levels\n", @@ -337,7 +337,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a8498eed", + "id": "c9bb90dd", "metadata": { "hide-output": false }, @@ -365,7 +365,7 @@ }, { "cell_type": "markdown", - "id": "d425eb9c", + "id": "75c3e3b1", "metadata": {}, "source": [ "### Verification\n", @@ -379,7 +379,7 @@ { "cell_type": "code", "execution_count": null, - "id": "601c43d0", + "id": "e026ed65", "metadata": { "hide-output": false }, @@ -404,7 +404,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d931f259", + "id": "6fef185a", "metadata": { "hide-output": false }, @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "2274fe0c", + "id": "0fa790d5", "metadata": {}, "source": [ "## Slippery Side of Laffer Curve Dynamics\n", @@ -438,7 +438,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73ca67b3", + "id": "90a7db81", "metadata": { "hide-output": false }, @@ -495,7 +495,7 @@ { "cell_type": "code", "execution_count": null, - "id": "783e1cc8", + "id": "ff29b328", "metadata": { "hide-output": false }, @@ -515,7 +515,7 @@ }, { "cell_type": "markdown", - "id": "934ce48d", + "id": "299885b5", "metadata": {}, "source": [ "Staring at the paths of price levels in Fig. 28.2 reveals that almost all paths converge to the **higher** inflation tax rate displayed in the stationary state Laffer curve. displayed in figure Fig. 28.1.\n", @@ -547,7 +547,7 @@ } ], "metadata": { - "date": 1712122263.8345633, + "date": 1712983677.2222955, "filename": "money_inflation_nonlinear.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/monte_carlo.ipynb b/_notebooks/monte_carlo.ipynb index ff9f764b..a0049b80 100644 --- a/_notebooks/monte_carlo.ipynb +++ b/_notebooks/monte_carlo.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "5befa4d0", + "id": "f7da25ef", "metadata": {}, "source": [ "# Monte Carlo and Option Pricing" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "ef762bf3", + "id": "9629a6a9", "metadata": {}, "source": [ "## Overview\n", @@ -46,7 +46,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2a83286e", + "id": "856768b3", "metadata": { "hide-output": false }, @@ -59,7 +59,7 @@ }, { "cell_type": "markdown", - "id": "00a7f03d", + "id": "9bea4889", "metadata": {}, "source": [ "## An introduction to Monte Carlo\n", @@ -70,7 +70,7 @@ }, { "cell_type": "markdown", - "id": "8426b947", + "id": "7b2f084a", "metadata": {}, "source": [ "### Share price with known distribution\n", @@ -104,7 +104,7 @@ "represented by a lognormal distribution with parameters $ \\mu, \\sigma $ .\n", "\n", "- $ S $ has the same distribution as $ \\exp(\\mu + \\sigma Z) $ where $ Z $ is standard normal. \n", - "- we write this statement as $ S \\sim LN(\\mu, \\sigma) $. \n", + "- We write this statement as $ S \\sim LN(\\mu, \\sigma) $. \n", "\n", "\n", "Any good reference on statistics (such as\n", @@ -128,7 +128,7 @@ }, { "cell_type": "markdown", - "id": "bae323f4", + "id": "e98d0ab8", "metadata": {}, "source": [ "### Share price with unknown distribution\n", @@ -161,13 +161,13 @@ "This is the Monte Carlo method, which runs as follows:\n", "\n", "1. Generate $ n $ independent draws of $ X_1 $, $ X_2 $ and $ X_3 $ on a computer, \n", - "1. Use these draws to generate $ n $ independent draws of $ S $, and \n", - "1. Take the average value of these draws of $ S $. \n", + "1. use these draws to generate $ n $ independent draws of $ S $, and \n", + "1. take the average value of these draws of $ S $. \n", "\n", "\n", "This average will be close to the true mean when $ n $ is large.\n", "\n", - "This is due to the law of large numbers, which we discussed in [another lecture](https://intro.quantecon.org/lln_clt.html).\n", + "This is due to the law of large numbers, which we discussed in [LLN and CLT](https://intro.quantecon.org/lln_clt.html).\n", "\n", "We use the following values for $ p $ and each $ \\mu_i $ and $ \\sigma_i $." ] @@ -175,7 +175,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0bf6fc5e", + "id": "ccc434db", "metadata": { "hide-output": false }, @@ -189,7 +189,7 @@ }, { "cell_type": "markdown", - "id": "c532d0a3", + "id": "975f112f", "metadata": {}, "source": [ "#### A routine using loops in python\n", @@ -205,7 +205,7 @@ { "cell_type": "code", "execution_count": null, - "id": "81f6c768", + "id": "31965a98", "metadata": { "hide-output": false }, @@ -224,7 +224,7 @@ }, { "cell_type": "markdown", - "id": "fbc8622b", + "id": "5893611a", "metadata": {}, "source": [ "We can also construct a function that contains these operations:" @@ -233,7 +233,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ed1854ac", + "id": "ae668e01", "metadata": { "hide-output": false }, @@ -251,7 +251,7 @@ }, { "cell_type": "markdown", - "id": "ab783884", + "id": "3734e51b", "metadata": {}, "source": [ "Now let’s call it." @@ -260,7 +260,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fbe92160", + "id": "50a6d239", "metadata": { "hide-output": false }, @@ -271,7 +271,7 @@ }, { "cell_type": "markdown", - "id": "0d676a2c", + "id": "7f8267c6", "metadata": {}, "source": [ "### A vectorized routine\n", @@ -286,7 +286,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c7a40852", + "id": "4fba792f", "metadata": { "hide-output": false }, @@ -303,7 +303,7 @@ { "cell_type": "code", "execution_count": null, - "id": "63b18506", + "id": "277e3edb", "metadata": { "hide-output": false }, @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "a7a3ceb4", + "id": "e9da3cdc", "metadata": {}, "source": [ "Notice that this routine is much faster.\n", @@ -327,7 +327,7 @@ { "cell_type": "code", "execution_count": null, - "id": "96c0b909", + "id": "2e7f16c4", "metadata": { "hide-output": false }, @@ -340,10 +340,10 @@ }, { "cell_type": "markdown", - "id": "27fae758", + "id": "433d0e3d", "metadata": {}, "source": [ - "## Pricing a european call option under risk neutrality\n", + "## Pricing a European call option under risk neutrality\n", "\n", "Next we are going to price a European call option under risk neutrality.\n", "\n", @@ -352,10 +352,10 @@ }, { "cell_type": "markdown", - "id": "e7b8443e", + "id": "00fbbaa8", "metadata": {}, "source": [ - "### Risk-Neutral Pricing\n", + "### Risk-neutral pricing\n", "\n", "When we use risk-neutral pricing, we determine the price of a given asset\n", "according to its expected payoff:\n", @@ -397,7 +397,7 @@ }, { "cell_type": "markdown", - "id": "a4b6fff1", + "id": "e4dad66a", "metadata": {}, "source": [ "### A comment on risk\n", @@ -423,7 +423,7 @@ }, { "cell_type": "markdown", - "id": "983858c6", + "id": "d0101d9b", "metadata": {}, "source": [ "### Discounting\n", @@ -458,7 +458,7 @@ }, { "cell_type": "markdown", - "id": "d26e08c7", + "id": "d20a65d0", "metadata": {}, "source": [ "### European call options\n", @@ -509,7 +509,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6898499c", + "id": "2bf89c9e", "metadata": { "hide-output": false }, @@ -524,7 +524,7 @@ }, { "cell_type": "markdown", - "id": "792a8fd3", + "id": "d41262d1", "metadata": {}, "source": [ "We set the simulation size to" @@ -533,7 +533,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c1dc9dc", + "id": "a9ef33b8", "metadata": { "hide-output": false }, @@ -544,7 +544,7 @@ }, { "cell_type": "markdown", - "id": "02cf80dd", + "id": "02df6b68", "metadata": {}, "source": [ "Here is our code" @@ -553,7 +553,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fa60be74", + "id": "da9dbcbe", "metadata": { "hide-output": false }, @@ -567,7 +567,7 @@ }, { "cell_type": "markdown", - "id": "36c16147", + "id": "91e3c95c", "metadata": {}, "source": [ "## Pricing via a dynamic model\n", @@ -583,7 +583,7 @@ }, { "cell_type": "markdown", - "id": "55d86ffa", + "id": "4acd2062", "metadata": {}, "source": [ "### Simple dynamics\n", @@ -596,7 +596,7 @@ "\n", "where\n", "\n", - "- $ S_0 $ is normally distributed and \n", + "- $ S_0 $ is lognormally distributed and \n", "- $ \\{ \\xi_t \\} $ is IID and standard normal. \n", "\n", "\n", @@ -620,7 +620,7 @@ }, { "cell_type": "markdown", - "id": "7f2ca87f", + "id": "ba95049e", "metadata": {}, "source": [ "### Problems with simple dynamics\n", @@ -638,7 +638,7 @@ }, { "cell_type": "markdown", - "id": "4088fed2", + "id": "951ce912", "metadata": {}, "source": [ "### More realistic dynamics\n", @@ -662,7 +662,7 @@ }, { "cell_type": "markdown", - "id": "c8612512", + "id": "8dbfcb76", "metadata": {}, "source": [ "### Default parameters\n", @@ -673,25 +673,25 @@ { "cell_type": "code", "execution_count": null, - "id": "d61bdbc4", + "id": "c9c91480", "metadata": { "hide-output": false }, "outputs": [], "source": [ - "μ = 0.0001\n", - "ρ = 0.1\n", - "ν = 0.001\n", - "S0 = 10\n", - "h0 = 0" + "default_μ = 0.0001\n", + "default_ρ = 0.1\n", + "default_ν = 0.001\n", + "default_S0 = 10\n", + "default_h0 = 0" ] }, { "cell_type": "markdown", - "id": "adc4122b", + "id": "24f1e1ef", "metadata": {}, "source": [ - "(Here `S0` is $ S_0 $ and `h0` is $ h_0 $.)\n", + "(Here `default_S0` is $ S_0 $ and `default_h0` is $ h_0 $.)\n", "\n", "For the option we use the following defaults." ] @@ -699,20 +699,20 @@ { "cell_type": "code", "execution_count": null, - "id": "2828c7d2", + "id": "b5bf56e1", "metadata": { "hide-output": false }, "outputs": [], "source": [ - "K = 100\n", - "n = 10\n", - "β = 0.95" + "default_K = 100\n", + "default_n = 10\n", + "default_β = 0.95" ] }, { "cell_type": "markdown", - "id": "95c5a738", + "id": "027868c6", "metadata": {}, "source": [ "### Visualizations\n", @@ -729,13 +729,13 @@ { "cell_type": "code", "execution_count": null, - "id": "bf82c4de", + "id": "3e4c0ad4", "metadata": { "hide-output": false }, "outputs": [], "source": [ - "def simulate_asset_price_path(μ=μ, S0=S0, h0=h0, n=n, ρ=ρ, ν=ν):\n", + "def simulate_asset_price_path(μ=default_μ, S0=default_S0, h0=default_h0, n=default_n, ρ=default_ρ, ν=default_ν):\n", " s = np.empty(n+1)\n", " s[0] = np.log(S0)\n", "\n", @@ -749,7 +749,7 @@ }, { "cell_type": "markdown", - "id": "52ced7ea", + "id": "a3734d6c", "metadata": {}, "source": [ "Here we plot the paths and the log of the paths." @@ -758,7 +758,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6df1ef3d", + "id": "a86efab0", "metadata": { "hide-output": false }, @@ -780,7 +780,7 @@ }, { "cell_type": "markdown", - "id": "0064c6de", + "id": "a7c76840", "metadata": {}, "source": [ "### Computing the price\n", @@ -805,20 +805,20 @@ { "cell_type": "code", "execution_count": null, - "id": "b278c850", + "id": "624ff87e", "metadata": { "hide-output": false }, "outputs": [], "source": [ - "def compute_call_price(β=β,\n", - " μ=μ,\n", - " S0=S0,\n", - " h0=h0,\n", - " K=K,\n", - " n=n,\n", - " ρ=ρ,\n", - " ν=ν,\n", + "def compute_call_price(β=default_β,\n", + " μ=default_μ,\n", + " S0=default_S0,\n", + " h0=default_h0,\n", + " K=default_K,\n", + " n=default_n,\n", + " ρ=default_ρ,\n", + " ν=default_ν,\n", " M=10_000):\n", " current_sum = 0.0\n", " # For each sample path\n", @@ -838,7 +838,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0c7b13f4", + "id": "6d4fd96f", "metadata": { "hide-output": false }, @@ -850,7 +850,7 @@ }, { "cell_type": "markdown", - "id": "731f950d", + "id": "d0244a23", "metadata": {}, "source": [ "## Exercises" @@ -858,7 +858,7 @@ }, { "cell_type": "markdown", - "id": "e0ec4833", + "id": "55bf4353", "metadata": {}, "source": [ "## Exercise 18.1\n", @@ -873,7 +873,7 @@ }, { "cell_type": "markdown", - "id": "2f01c8e1", + "id": "c9da6617", "metadata": {}, "source": [ "## Solution to[ Exercise 18.1](https://intro.quantecon.org/#monte_carlo_ex1)" @@ -882,20 +882,20 @@ { "cell_type": "code", "execution_count": null, - "id": "ab152326", + "id": "f2001c9c", "metadata": { "hide-output": false }, "outputs": [], "source": [ - "def compute_call_price(β=β,\n", - " μ=μ,\n", - " S0=S0,\n", - " h0=h0,\n", - " K=K,\n", - " n=n,\n", - " ρ=ρ,\n", - " ν=ν,\n", + "def compute_call_price_vector(β=default_β,\n", + " μ=default_μ,\n", + " S0=default_S0,\n", + " h0=default_h0,\n", + " K=default_K,\n", + " n=default_n,\n", + " ρ=default_ρ,\n", + " ν=default_ν,\n", " M=10_000):\n", "\n", " s = np.full(M, np.log(S0))\n", @@ -912,19 +912,19 @@ { "cell_type": "code", "execution_count": null, - "id": "9afdfe99", + "id": "74f90593", "metadata": { "hide-output": false }, "outputs": [], "source": [ "%%time\n", - "compute_call_price()" + "compute_call_price_vector()" ] }, { "cell_type": "markdown", - "id": "c1d6dbfa", + "id": "bf9442ba", "metadata": {}, "source": [ "Notice that this version is faster than the one using a Python loop.\n", @@ -935,7 +935,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2e10511d", + "id": "d0725e84", "metadata": { "hide-output": false }, @@ -947,7 +947,7 @@ }, { "cell_type": "markdown", - "id": "cb81e04c", + "id": "2e82bbab", "metadata": {}, "source": [ "## Exercise 18.2\n", @@ -963,7 +963,7 @@ }, { "cell_type": "markdown", - "id": "680a6807", + "id": "d92cb2b9", "metadata": {}, "source": [ "## Solution to[ Exercise 18.2](https://intro.quantecon.org/#monte_carlo_ex2)" @@ -972,41 +972,41 @@ { "cell_type": "code", "execution_count": null, - "id": "bb1f12c8", + "id": "00fb27cb", "metadata": { "hide-output": false }, "outputs": [], "source": [ - "μ = 0.0001\n", - "ρ = 0.1\n", - "ν = 0.001\n", - "S0 = 10\n", - "h0 = 0\n", - "K = 100\n", - "n = 10\n", - "β = 0.95\n", - "bp = 120" + "default_μ = 0.0001\n", + "default_ρ = 0.1\n", + "default_ν = 0.001\n", + "default_S0 = 10\n", + "default_h0 = 0\n", + "default_K = 100\n", + "default_n = 10\n", + "default_β = 0.95\n", + "default_bp = 120" ] }, { "cell_type": "code", "execution_count": null, - "id": "01c02c80", + "id": "137aef86", "metadata": { "hide-output": false }, "outputs": [], "source": [ - "def compute_call_price_with_barrier(β=β,\n", - " μ=μ,\n", - " S0=S0,\n", - " h0=h0,\n", - " K=K,\n", - " n=n,\n", - " ρ=ρ,\n", - " ν=ν,\n", - " bp=bp,\n", + "def compute_call_price_with_barrier(β=default_β,\n", + " μ=default_μ,\n", + " S0=default_S0,\n", + " h0=default_h0,\n", + " K=default_K,\n", + " n=default_n,\n", + " ρ=default_ρ,\n", + " ν=default_ν,\n", + " bp=default_bp,\n", " M=50_000):\n", " current_sum = 0.0\n", " # For each sample path\n", @@ -1035,7 +1035,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2f07c37e", + "id": "f8a866f5", "metadata": { "hide-output": false }, @@ -1046,7 +1046,7 @@ }, { "cell_type": "markdown", - "id": "fa434d8f", + "id": "2f0c0f63", "metadata": {}, "source": [ "Let’s look at the vectorized version which is faster than using Python loops." @@ -1055,21 +1055,21 @@ { "cell_type": "code", "execution_count": null, - "id": "a3798ac9", + "id": "c601eb50", "metadata": { "hide-output": false }, "outputs": [], "source": [ - "def compute_call_price_with_barrier_vector(β=β,\n", - " μ=μ,\n", - " S0=S0,\n", - " h0=h0,\n", - " K=K,\n", - " n=n,\n", - " ρ=ρ,\n", - " ν=ν,\n", - " bp=bp,\n", + "def compute_call_price_with_barrier_vector(β=default_β,\n", + " μ=default_μ,\n", + " S0=default_S0,\n", + " h0=default_h0,\n", + " K=default_K,\n", + " n=default_n,\n", + " ρ=default_ρ,\n", + " ν=default_ν,\n", + " bp=default_bp,\n", " M=50_000):\n", " s = np.full(M, np.log(S0))\n", " h = np.full(M, h0)\n", @@ -1090,7 +1090,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31931c89", + "id": "270b4d0a", "metadata": { "hide-output": false }, @@ -1101,7 +1101,7 @@ } ], "metadata": { - "date": 1712122263.8681693, + "date": 1712983677.2537963, "filename": "monte_carlo.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/networks.ipynb b/_notebooks/networks.ipynb index 53729735..2faf1c16 100644 --- a/_notebooks/networks.ipynb +++ b/_notebooks/networks.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "32b1adde", + "id": "06dd8253", "metadata": {}, "source": [ "# Networks" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fd9006a8", + "id": "2f957904", "metadata": { "hide-output": false }, @@ -22,7 +22,7 @@ }, { "cell_type": "markdown", - "id": "87449ee9", + "id": "968515cb", "metadata": {}, "source": [ "## Outline\n", @@ -59,7 +59,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0dab14b2", + "id": "b07abd11", "metadata": { "hide-output": false }, @@ -80,7 +80,7 @@ }, { "cell_type": "markdown", - "id": "cb634b7c", + "id": "6483831f", "metadata": {}, "source": [ "## Economic and financial networks\n", @@ -105,7 +105,7 @@ }, { "cell_type": "markdown", - "id": "b1bd6bee", + "id": "6f236981", "metadata": {}, "source": [ "### Example: Aircraft Exports\n", @@ -116,7 +116,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d36d3cdb", + "id": "40cb84d4", "metadata": { "hide-output": false }, @@ -174,7 +174,7 @@ }, { "cell_type": "markdown", - "id": "cfb7fd8a", + "id": "7145206a", "metadata": {}, "source": [ "The circles in the figure are called **nodes** or **vertices** – in this case they represent countries.\n", @@ -192,7 +192,7 @@ }, { "cell_type": "markdown", - "id": "321146dc", + "id": "74d05905", "metadata": {}, "source": [ "### Example: A Markov Chain\n", @@ -220,7 +220,7 @@ }, { "cell_type": "markdown", - "id": "24a43ae8", + "id": "0b4dbfd8", "metadata": {}, "source": [ "## An introduction to graph theory\n", @@ -254,7 +254,7 @@ }, { "cell_type": "markdown", - "id": "8a9aabd7", + "id": "5e2c08d5", "metadata": {}, "source": [ "### Key definitions\n", @@ -306,7 +306,7 @@ }, { "cell_type": "markdown", - "id": "930a0459", + "id": "aa244f28", "metadata": {}, "source": [ "### Digraphs in Networkx\n", @@ -323,7 +323,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a0e89ec3", + "id": "8279e181", "metadata": { "hide-output": false }, @@ -334,7 +334,7 @@ }, { "cell_type": "markdown", - "id": "633bf06a", + "id": "7c183eab", "metadata": {}, "source": [ "Next we populate it with nodes and edges.\n", @@ -346,7 +346,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20995328", + "id": "5cd7a9e0", "metadata": { "hide-output": false }, @@ -359,7 +359,7 @@ }, { "cell_type": "markdown", - "id": "17d594d3", + "id": "b8134caf", "metadata": {}, "source": [ "Finally, we add the edges to our `DiGraph` object:" @@ -368,7 +368,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72f4c8ba", + "id": "447ee84a", "metadata": { "hide-output": false }, @@ -381,7 +381,7 @@ }, { "cell_type": "markdown", - "id": "ae3eb204", + "id": "2a1f6082", "metadata": {}, "source": [ "Alternatively, we can use the method `add_edges_from`." @@ -390,7 +390,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5f5db1e8", + "id": "568ada92", "metadata": { "hide-output": false }, @@ -401,7 +401,7 @@ }, { "cell_type": "markdown", - "id": "5532275e", + "id": "fa03cfeb", "metadata": {}, "source": [ "Adding the edges automatically adds the nodes, so `G_p` is now a\n", @@ -413,7 +413,7 @@ { "cell_type": "code", "execution_count": null, - "id": "758b98c3", + "id": "96ed09ce", "metadata": { "hide-output": false }, @@ -428,7 +428,7 @@ }, { "cell_type": "markdown", - "id": "b49d3dfe", + "id": "e0e91595", "metadata": {}, "source": [ "The figure obtained above matches the original directed graph in Fig. 39.3.\n", @@ -442,7 +442,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3dba37d4", + "id": "e08bcdb6", "metadata": { "hide-output": false }, @@ -453,7 +453,7 @@ }, { "cell_type": "markdown", - "id": "8fb41813", + "id": "2301c14f", "metadata": {}, "source": [ "\n", @@ -462,7 +462,7 @@ }, { "cell_type": "markdown", - "id": "88a38390", + "id": "5524bc51", "metadata": {}, "source": [ "### Communication\n", @@ -499,7 +499,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3ddcf264", + "id": "90e489f3", "metadata": { "hide-output": false }, @@ -518,7 +518,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15469524", + "id": "2eb14ab1", "metadata": { "hide-output": false }, @@ -530,7 +530,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f630f0d5", + "id": "aae70f0c", "metadata": { "hide-output": false }, @@ -549,7 +549,7 @@ { "cell_type": "code", "execution_count": null, - "id": "461f73c3", + "id": "d65a0409", "metadata": { "hide-output": false }, @@ -560,7 +560,7 @@ }, { "cell_type": "markdown", - "id": "10fb4633", + "id": "a9c557ef", "metadata": {}, "source": [ "## Weighted graphs\n", @@ -571,7 +571,7 @@ }, { "cell_type": "markdown", - "id": "df52e447", + "id": "8f78fb27", "metadata": {}, "source": [ "### International private credit flows by country\n", @@ -583,7 +583,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c83bb53", + "id": "6a4dc2b0", "metadata": { "hide-output": false }, @@ -645,7 +645,7 @@ }, { "cell_type": "markdown", - "id": "ea193761", + "id": "748623f0", "metadata": {}, "source": [ "The country codes are given in the following table\n", @@ -681,7 +681,7 @@ }, { "cell_type": "markdown", - "id": "9ad15828", + "id": "e5b4aeed", "metadata": {}, "source": [ "### Definitions\n", @@ -707,7 +707,7 @@ }, { "cell_type": "markdown", - "id": "9dc0819f", + "id": "5a015665", "metadata": {}, "source": [ "## Adjacency matrices\n", @@ -751,7 +751,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14d70572", + "id": "a7a70647", "metadata": { "hide-output": false }, @@ -766,7 +766,7 @@ }, { "cell_type": "markdown", - "id": "a67d6d2d", + "id": "2cf45106", "metadata": {}, "source": [ "One of the key points to remember about adjacency matrices is that taking the\n", @@ -780,7 +780,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10622abb", + "id": "72cbc38c", "metadata": { "hide-output": false }, @@ -811,7 +811,7 @@ }, { "cell_type": "markdown", - "id": "d1465871", + "id": "97588eaf", "metadata": {}, "source": [ "We see that bank 2 extends a loan of size 200 to bank 3.\n", @@ -850,7 +850,7 @@ { "cell_type": "code", "execution_count": null, - "id": "06b0e41b", + "id": "f127c68e", "metadata": { "hide-output": false }, @@ -880,7 +880,7 @@ }, { "cell_type": "markdown", - "id": "9b5ad6bb", + "id": "74fde469", "metadata": {}, "source": [ "In general, every nonnegative $ n \\times n $ matrix $ A = (a_{ij}) $ can be\n", @@ -896,7 +896,7 @@ }, { "cell_type": "markdown", - "id": "d4f92276", + "id": "45ccf74f", "metadata": {}, "source": [ "## Properties\n", @@ -910,7 +910,7 @@ }, { "cell_type": "markdown", - "id": "f3528e61", + "id": "5eefaa96", "metadata": {}, "source": [ "## \n", @@ -935,7 +935,7 @@ }, { "cell_type": "markdown", - "id": "86f841d4", + "id": "375ae670", "metadata": {}, "source": [ "## \n", @@ -958,7 +958,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4f07b2a0", + "id": "f65c3386", "metadata": { "hide-output": false }, @@ -973,7 +973,7 @@ }, { "cell_type": "markdown", - "id": "7b635d13", + "id": "ea2911af", "metadata": {}, "source": [ "Then we construct the associated adjacency matrix A." @@ -982,7 +982,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dd1ac69b", + "id": "3f74c36c", "metadata": { "hide-output": false }, @@ -996,7 +996,7 @@ { "cell_type": "code", "execution_count": null, - "id": "137ff782", + "id": "7245176a", "metadata": { "hide-output": false }, @@ -1013,7 +1013,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30ec9c83", + "id": "4450c355", "metadata": { "hide-output": false }, @@ -1025,7 +1025,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2e4396d3", + "id": "b4b483c3", "metadata": { "hide-output": false }, @@ -1036,7 +1036,7 @@ }, { "cell_type": "markdown", - "id": "357ccecf", + "id": "d80bbed8", "metadata": {}, "source": [ "## Network centrality\n", @@ -1059,7 +1059,7 @@ }, { "cell_type": "markdown", - "id": "2fc09273", + "id": "a3305596", "metadata": {}, "source": [ "### Degree centrality\n", @@ -1078,7 +1078,7 @@ { "cell_type": "code", "execution_count": null, - "id": "08f24189", + "id": "f4bb060b", "metadata": { "hide-output": false }, @@ -1106,7 +1106,7 @@ }, { "cell_type": "markdown", - "id": "dfe8d47d", + "id": "7f59bf7d", "metadata": {}, "source": [ "The following code displays the in-degree centrality of all nodes." @@ -1115,7 +1115,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10296864", + "id": "87b6a453", "metadata": { "hide-output": false }, @@ -1129,7 +1129,7 @@ }, { "cell_type": "markdown", - "id": "8a853270", + "id": "b8700b3a", "metadata": {}, "source": [ "Consider the international credit network displayed in Fig. 39.4.\n", @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "499873e0", + "id": "05c2141e", "metadata": { "hide-output": false }, @@ -1153,7 +1153,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4600756d", + "id": "2a6059e0", "metadata": { "hide-output": false }, @@ -1170,7 +1170,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fc27f296", + "id": "87519440", "metadata": { "hide-output": false }, @@ -1192,7 +1192,7 @@ }, { "cell_type": "markdown", - "id": "d892e6e5", + "id": "e41d6e23", "metadata": {}, "source": [ "Unfortunately, while in-degree and out-degree centrality are simple to\n", @@ -1234,7 +1234,7 @@ }, { "cell_type": "markdown", - "id": "d0418cb2", + "id": "b0c88354", "metadata": {}, "source": [ "### Eigenvector centrality\n", @@ -1296,7 +1296,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7e26b67c", + "id": "6a1058d2", "metadata": { "hide-output": false }, @@ -1317,7 +1317,7 @@ }, { "cell_type": "markdown", - "id": "b3197cb9", + "id": "58f67637", "metadata": {}, "source": [ "Let’s compute eigenvector centrality for the graph generated in Fig. 39.6." @@ -1326,7 +1326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6cebfaa4", + "id": "07d689b7", "metadata": { "hide-output": false }, @@ -1338,7 +1338,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fa520a32", + "id": "4610f8ea", "metadata": { "hide-output": false }, @@ -1353,7 +1353,7 @@ }, { "cell_type": "markdown", - "id": "600ccd72", + "id": "7347e1d2", "metadata": {}, "source": [ "While nodes $ 2 $ and $ 4 $ had the highest in-degree centrality, we can see that nodes $ 1 $ and $ 2 $ have the\n", @@ -1365,7 +1365,7 @@ { "cell_type": "code", "execution_count": null, - "id": "415e15f4", + "id": "c7fb96b9", "metadata": { "hide-output": false }, @@ -1377,7 +1377,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53322810", + "id": "d3e2637d", "metadata": { "hide-output": false }, @@ -1397,7 +1397,7 @@ }, { "cell_type": "markdown", - "id": "05f6ca1f", + "id": "4d83f37f", "metadata": {}, "source": [ "Countries that are rated highly according to this rank tend to be important\n", @@ -1416,7 +1416,7 @@ }, { "cell_type": "markdown", - "id": "1d42f2ee", + "id": "edd43186", "metadata": {}, "source": [ "### Katz centrality\n", @@ -1472,7 +1472,7 @@ }, { "cell_type": "markdown", - "id": "f96c46a0", + "id": "decdf7e4", "metadata": {}, "source": [ "### Authorities vs hubs\n", @@ -1534,7 +1534,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bcc919e3", + "id": "9f212d4b", "metadata": { "hide-output": false }, @@ -1546,7 +1546,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2d43d4bd", + "id": "b566ff5a", "metadata": { "hide-output": false }, @@ -1566,7 +1566,7 @@ }, { "cell_type": "markdown", - "id": "816db4ca", + "id": "77e4b74d", "metadata": {}, "source": [ "Highly ranked countries are those that attract large inflows of credit, or\n", @@ -1577,7 +1577,7 @@ }, { "cell_type": "markdown", - "id": "0840f920", + "id": "3bfefd1a", "metadata": {}, "source": [ "## Further reading\n", @@ -1595,7 +1595,7 @@ }, { "cell_type": "markdown", - "id": "d25714c3", + "id": "1890d768", "metadata": {}, "source": [ "## Exercises" @@ -1603,7 +1603,7 @@ }, { "cell_type": "markdown", - "id": "879953f4", + "id": "68e733ea", "metadata": {}, "source": [ "## Exercise 39.1\n", @@ -1617,7 +1617,7 @@ }, { "cell_type": "markdown", - "id": "9cdbc317", + "id": "2c3b50fa", "metadata": {}, "source": [ "## Solution to[ Exercise 39.1](https://intro.quantecon.org/#networks_ex1)\n", @@ -1648,7 +1648,7 @@ }, { "cell_type": "markdown", - "id": "b179be3d", + "id": "88c5e8a0", "metadata": {}, "source": [ "## Exercise 39.2\n", @@ -1673,7 +1673,7 @@ }, { "cell_type": "markdown", - "id": "a75aee3e", + "id": "e700caea", "metadata": {}, "source": [ "## Solution to[ Exercise 39.2](https://intro.quantecon.org/#networks_ex2)" @@ -1682,7 +1682,7 @@ { "cell_type": "code", "execution_count": null, - "id": "18c42279", + "id": "23165914", "metadata": { "hide-output": false }, @@ -1711,7 +1711,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3859d309", + "id": "9ce0d159", "metadata": { "hide-output": false }, @@ -1725,7 +1725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "41c68467", + "id": "fd219a19", "metadata": { "hide-output": false }, @@ -1740,7 +1740,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad82e290", + "id": "8bc8f93f", "metadata": { "hide-output": false }, @@ -1755,7 +1755,7 @@ }, { "cell_type": "markdown", - "id": "cb83f264", + "id": "61db112a", "metadata": {}, "source": [ "## Exercise 39.3\n", @@ -1777,7 +1777,7 @@ }, { "cell_type": "markdown", - "id": "998fb479", + "id": "a31b8d80", "metadata": {}, "source": [ "## Solution to[ Exercise 39.3](https://intro.quantecon.org/#networks_ex3)" @@ -1786,7 +1786,7 @@ { "cell_type": "code", "execution_count": null, - "id": "55b31dd3", + "id": "37ed3f06", "metadata": { "hide-output": false }, @@ -1807,7 +1807,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1761e2dd", + "id": "605bedda", "metadata": { "hide-output": false }, @@ -1830,7 +1830,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce316052", + "id": "045bd0ef", "metadata": { "hide-output": false }, @@ -1842,7 +1842,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cb554a3b", + "id": "55a0f261", "metadata": { "hide-output": false }, @@ -1853,7 +1853,7 @@ } ], "metadata": { - "date": 1712122264.587202, + "date": 1712983677.8564138, "filename": "networks.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/olg.ipynb b/_notebooks/olg.ipynb index 8d251099..ee717d21 100644 --- a/_notebooks/olg.ipynb +++ b/_notebooks/olg.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "bce247dd", + "id": "96c1fb7a", "metadata": {}, "source": [ "# The Overlapping Generations Model\n", @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "5b8c32f3", + "id": "dc686736", "metadata": {}, "source": [ "## Overview\n", @@ -66,7 +66,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a58938b8", + "id": "f1459f0e", "metadata": { "hide-output": false }, @@ -80,7 +80,7 @@ }, { "cell_type": "markdown", - "id": "7e3e2a56", + "id": "338e9c43", "metadata": {}, "source": [ "## Environment\n", @@ -118,7 +118,7 @@ }, { "cell_type": "markdown", - "id": "3f660d11", + "id": "49264d92", "metadata": {}, "source": [ "## Supply of capital\n", @@ -128,7 +128,7 @@ }, { "cell_type": "markdown", - "id": "001767c6", + "id": "e7e0cd6b", "metadata": {}, "source": [ "### Consumer’s problem\n", @@ -225,7 +225,7 @@ }, { "cell_type": "markdown", - "id": "ab0b9fc8", + "id": "01af3902", "metadata": {}, "source": [ "### Example: log preferences\n", @@ -246,7 +246,7 @@ }, { "cell_type": "markdown", - "id": "cc7e1cbe", + "id": "a91c0586", "metadata": {}, "source": [ "### Savings and investment\n", @@ -265,7 +265,7 @@ }, { "cell_type": "markdown", - "id": "231ad812", + "id": "530876a8", "metadata": {}, "source": [ "## Demand for capital\n", @@ -276,7 +276,7 @@ }, { "cell_type": "markdown", - "id": "e8ef9fd6", + "id": "5d58cedc", "metadata": {}, "source": [ "### Firm’s problem\n", @@ -314,7 +314,7 @@ }, { "cell_type": "markdown", - "id": "6ead034b", + "id": "16c939b0", "metadata": {}, "source": [ "### Demand\n", @@ -352,7 +352,7 @@ { "cell_type": "code", "execution_count": null, - "id": "865fd690", + "id": "ef6e95db", "metadata": { "hide-output": false }, @@ -365,7 +365,7 @@ { "cell_type": "code", "execution_count": null, - "id": "002129ba", + "id": "3b1370aa", "metadata": { "hide-output": false }, @@ -378,7 +378,7 @@ }, { "cell_type": "markdown", - "id": "9a1089c2", + "id": "553ce715", "metadata": {}, "source": [ "The next figure plots the supply of capital, as in [(24.6)](#equation-saving-log-2-olg), as well as the demand for capital, as in [(24.11)](#equation-aggregate-demand-capital-olg), as functions of the interest rate $ R_{t+1} $.\n", @@ -389,7 +389,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26b483be", + "id": "3392f5fb", "metadata": { "hide-output": false }, @@ -414,7 +414,7 @@ }, { "cell_type": "markdown", - "id": "97c5c067", + "id": "a9d27d33", "metadata": {}, "source": [ "## Equilibrium\n", @@ -424,7 +424,7 @@ }, { "cell_type": "markdown", - "id": "f990a3b5", + "id": "4ddced0a", "metadata": {}, "source": [ "### Equilibrium conditions\n", @@ -455,7 +455,7 @@ }, { "cell_type": "markdown", - "id": "33e33b3c", + "id": "3f920390", "metadata": {}, "source": [ "### Example: log utility\n", @@ -487,7 +487,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9ddd174c", + "id": "9fa5997b", "metadata": { "hide-output": false }, @@ -500,7 +500,7 @@ }, { "cell_type": "markdown", - "id": "490fffc4", + "id": "c9d8ceac", "metadata": {}, "source": [ "In the case of log utility, since capital supply does not depend on the interest rate, the equilibrium quantity is fixed by supply.\n", @@ -519,7 +519,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51c1d51f", + "id": "1effac8a", "metadata": { "hide-output": false }, @@ -557,7 +557,7 @@ }, { "cell_type": "markdown", - "id": "62720a84", + "id": "5b49cfdf", "metadata": {}, "source": [ "## Dynamics\n", @@ -569,7 +569,7 @@ }, { "cell_type": "markdown", - "id": "19eb5298", + "id": "052d6f4b", "metadata": {}, "source": [ "### Evolution of capital\n", @@ -600,7 +600,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0e32060f", + "id": "c8b2c08b", "metadata": { "hide-output": false }, @@ -613,7 +613,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d51e22d4", + "id": "24257f51", "metadata": { "hide-output": false }, @@ -645,7 +645,7 @@ }, { "cell_type": "markdown", - "id": "aa68ab54", + "id": "a7562c40", "metadata": {}, "source": [ "### Steady state (log case)\n", @@ -682,7 +682,7 @@ { "cell_type": "code", "execution_count": null, - "id": "56b25a34", + "id": "f17b4e40", "metadata": { "hide-output": false }, @@ -694,7 +694,7 @@ }, { "cell_type": "markdown", - "id": "24791266", + "id": "f93469c9", "metadata": {}, "source": [ "### Time series\n", @@ -707,7 +707,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5878c58a", + "id": "e6665d98", "metadata": { "hide-output": false }, @@ -731,7 +731,7 @@ }, { "cell_type": "markdown", - "id": "33bfbf71", + "id": "ca9a691e", "metadata": {}, "source": [ "If you experiment with different positive initial conditions, you will see that the series always converges to $ k^* $.\n", @@ -742,7 +742,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4b9acba5", + "id": "05c0ff13", "metadata": { "hide-output": false }, @@ -761,7 +761,7 @@ }, { "cell_type": "markdown", - "id": "e5894ce5", + "id": "6534fd42", "metadata": {}, "source": [ "The interest rate reflects the marginal product of capital, which is high when capital stock is low." @@ -769,7 +769,7 @@ }, { "cell_type": "markdown", - "id": "42d868fc", + "id": "6034a52e", "metadata": {}, "source": [ "## CRRA preferences\n", @@ -791,7 +791,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5f697090", + "id": "217dffc7", "metadata": { "hide-output": false }, @@ -811,7 +811,7 @@ }, { "cell_type": "markdown", - "id": "fa15595b", + "id": "a0f6c5bb", "metadata": {}, "source": [ "Let’s also redefine the capital demand function to work with this `namedtuple`." @@ -820,7 +820,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12136f45", + "id": "0601d7fb", "metadata": { "hide-output": false }, @@ -832,7 +832,7 @@ }, { "cell_type": "markdown", - "id": "5416769b", + "id": "54388650", "metadata": {}, "source": [ "### Supply\n", @@ -863,7 +863,7 @@ { "cell_type": "code", "execution_count": null, - "id": "980a11bf", + "id": "49df24ef", "metadata": { "hide-output": false }, @@ -877,7 +877,7 @@ { "cell_type": "code", "execution_count": null, - "id": "230aed11", + "id": "6f913d21", "metadata": { "hide-output": false }, @@ -902,7 +902,7 @@ }, { "cell_type": "markdown", - "id": "fd7f003d", + "id": "575f2a1e", "metadata": {}, "source": [ "### Equilibrium\n", @@ -936,7 +936,7 @@ }, { "cell_type": "markdown", - "id": "468b6b64", + "id": "362fbadf", "metadata": {}, "source": [ "## Exercises" @@ -944,7 +944,7 @@ }, { "cell_type": "markdown", - "id": "c36d8294", + "id": "9cc4a45f", "metadata": {}, "source": [ "## Exercise 24.1\n", @@ -956,7 +956,7 @@ }, { "cell_type": "markdown", - "id": "61174ba1", + "id": "a494063f", "metadata": {}, "source": [ "## Solution to[ Exercise 24.1](https://intro.quantecon.org/#olg_ex1)\n", @@ -989,7 +989,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff845e19", + "id": "76d18da0", "metadata": { "hide-output": false }, @@ -1006,7 +1006,7 @@ }, { "cell_type": "markdown", - "id": "76323736", + "id": "6eca9c24", "metadata": {}, "source": [ "Now let’s define a function that finds the value of $ k_{t+1} $." @@ -1015,7 +1015,7 @@ { "cell_type": "code", "execution_count": null, - "id": "86528b53", + "id": "bf6df885", "metadata": { "hide-output": false }, @@ -1027,7 +1027,7 @@ }, { "cell_type": "markdown", - "id": "6ca21be5", + "id": "64dfaf7f", "metadata": {}, "source": [ "Finally, here is the 45 degree diagram." @@ -1036,7 +1036,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b362e27", + "id": "65bbf224", "metadata": { "hide-output": false }, @@ -1067,7 +1067,7 @@ }, { "cell_type": "markdown", - "id": "7a785812", + "id": "ec63d8f7", "metadata": {}, "source": [ "## Exercise 24.2\n", @@ -1091,7 +1091,7 @@ }, { "cell_type": "markdown", - "id": "b08e1842", + "id": "58040d76", "metadata": {}, "source": [ "## Solution to[ Exercise 24.2](https://intro.quantecon.org/#olg_ex2)\n", @@ -1114,7 +1114,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ab491c1f", + "id": "92e4c64f", "metadata": { "hide-output": false }, @@ -1131,7 +1131,7 @@ }, { "cell_type": "markdown", - "id": "1c0727b6", + "id": "59d1f232", "metadata": {}, "source": [ "Let’s apply Newton’s method to find the root:" @@ -1140,7 +1140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "baf085af", + "id": "3f7e4b3d", "metadata": { "hide-output": false }, @@ -1152,7 +1152,7 @@ }, { "cell_type": "markdown", - "id": "34c85ee2", + "id": "30ed14a5", "metadata": {}, "source": [ "## Exercise 24.3\n", @@ -1165,7 +1165,7 @@ }, { "cell_type": "markdown", - "id": "d78b1a11", + "id": "f04315fd", "metadata": {}, "source": [ "## Solution to[ Exercise 24.3](https://intro.quantecon.org/#olg_ex3)\n", @@ -1176,7 +1176,7 @@ { "cell_type": "code", "execution_count": null, - "id": "178fa269", + "id": "1519210b", "metadata": { "hide-output": false }, @@ -1189,7 +1189,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee8e5aa8", + "id": "acf9ecdd", "metadata": { "hide-output": false }, @@ -1221,7 +1221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "be507852", + "id": "da5057b8", "metadata": { "hide-output": false }, @@ -1232,7 +1232,7 @@ } ], "metadata": { - "date": 1712122264.6290014, + "date": 1712983677.89653, "filename": "olg.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/prob_dist.ipynb b/_notebooks/prob_dist.ipynb index 04a58f0b..61be1ae4 100644 --- a/_notebooks/prob_dist.ipynb +++ b/_notebooks/prob_dist.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "3740190f", + "id": "4aa568ed", "metadata": {}, "source": [ "# Distributions and Probabilities\n", @@ -13,7 +13,7 @@ }, { "cell_type": "markdown", - "id": "5cda50de", + "id": "37a8ce03", "metadata": {}, "source": [ "## Outline\n", @@ -24,7 +24,7 @@ { "cell_type": "code", "execution_count": null, - "id": "888136f4", + "id": "4a8c9dee", "metadata": { "hide-output": false }, @@ -36,7 +36,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1bdc9b1b", + "id": "869f34ad", "metadata": { "hide-output": false }, @@ -52,7 +52,7 @@ }, { "cell_type": "markdown", - "id": "b71e4de0", + "id": "e98c36b7", "metadata": {}, "source": [ "## Common distributions\n", @@ -62,7 +62,7 @@ }, { "cell_type": "markdown", - "id": "e8633b61", + "id": "b1944eef", "metadata": {}, "source": [ "### Discrete distributions\n", @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "e7fd88f9", + "id": "7250b689", "metadata": {}, "source": [ "#### Uniform distribution\n", @@ -128,7 +128,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f36fc55", + "id": "47e95daf", "metadata": { "hide-output": false }, @@ -140,7 +140,7 @@ }, { "cell_type": "markdown", - "id": "82befcbf", + "id": "acbf1420", "metadata": {}, "source": [ "Here’s the mean and variance:" @@ -149,7 +149,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cca49d13", + "id": "efe8e99a", "metadata": { "hide-output": false }, @@ -160,7 +160,7 @@ }, { "cell_type": "markdown", - "id": "533735fb", + "id": "b41cde94", "metadata": {}, "source": [ "The formula for the mean is $ (n+1)/2 $, and the formula for the variance is $ (n^2 - 1)/12 $.\n", @@ -171,7 +171,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ccd622d3", + "id": "987506b5", "metadata": { "hide-output": false }, @@ -183,7 +183,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9dfa68f5", + "id": "34d2530c", "metadata": { "hide-output": false }, @@ -194,7 +194,7 @@ }, { "cell_type": "markdown", - "id": "37ae7eae", + "id": "f9b79992", "metadata": {}, "source": [ "Here’s a plot of the probability mass function:" @@ -203,7 +203,7 @@ { "cell_type": "code", "execution_count": null, - "id": "24afe606", + "id": "9bfaaa5a", "metadata": { "hide-output": false }, @@ -219,7 +219,7 @@ }, { "cell_type": "markdown", - "id": "0cf68bf8", + "id": "ed761f19", "metadata": {}, "source": [ "Here’s a plot of the CDF:" @@ -228,7 +228,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23705961", + "id": "bfd72071", "metadata": { "hide-output": false }, @@ -244,7 +244,7 @@ }, { "cell_type": "markdown", - "id": "7e01973f", + "id": "08afe03f", "metadata": {}, "source": [ "The CDF jumps up by $ p(x_i) $ at $ x_i $." @@ -252,7 +252,7 @@ }, { "cell_type": "markdown", - "id": "813d8976", + "id": "735f5df4", "metadata": {}, "source": [ "#### Exercise 16.1\n", @@ -265,7 +265,7 @@ }, { "cell_type": "markdown", - "id": "d7178205", + "id": "a5216265", "metadata": {}, "source": [ "#### Bernoulli distribution\n", @@ -288,7 +288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "68c29c83", + "id": "c738e49b", "metadata": { "hide-output": false }, @@ -300,7 +300,7 @@ }, { "cell_type": "markdown", - "id": "8186e2b3", + "id": "62b3ffea", "metadata": {}, "source": [ "Here’s the mean and variance:" @@ -309,7 +309,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b5e9fa34", + "id": "5c058023", "metadata": { "hide-output": false }, @@ -320,7 +320,7 @@ }, { "cell_type": "markdown", - "id": "cf337a6d", + "id": "9e9a9b1d", "metadata": {}, "source": [ "The formula for the mean is $ p $, and the formula for the variance is $ p(1-p) $.\n", @@ -331,7 +331,7 @@ { "cell_type": "code", "execution_count": null, - "id": "249f2e0c", + "id": "c8073b6f", "metadata": { "hide-output": false }, @@ -343,7 +343,7 @@ }, { "cell_type": "markdown", - "id": "dc3eb104", + "id": "4b96b93f", "metadata": {}, "source": [ "#### Binomial distribution\n", @@ -366,7 +366,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9c7de9ce", + "id": "a302fb13", "metadata": { "hide-output": false }, @@ -380,7 +380,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c71a5185", + "id": "4da1b00c", "metadata": { "hide-output": false }, @@ -391,7 +391,7 @@ }, { "cell_type": "markdown", - "id": "565731c6", + "id": "41e66425", "metadata": {}, "source": [ "The formula for the mean is $ n \\theta $ and the formula for the variance is $ n \\theta (1-\\theta) $.\n", @@ -402,7 +402,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e80d412d", + "id": "38575321", "metadata": { "hide-output": false }, @@ -414,7 +414,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6753c5df", + "id": "a74e5d1a", "metadata": { "hide-output": false }, @@ -430,7 +430,7 @@ }, { "cell_type": "markdown", - "id": "1e304d3d", + "id": "31831715", "metadata": {}, "source": [ "Here’s the CDF:" @@ -439,7 +439,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b2c98680", + "id": "d9794a3e", "metadata": { "hide-output": false }, @@ -455,7 +455,7 @@ }, { "cell_type": "markdown", - "id": "6b8afde9", + "id": "39270d55", "metadata": {}, "source": [ "#### Exercise 16.2\n", @@ -465,7 +465,7 @@ }, { "cell_type": "markdown", - "id": "5bcb14c0", + "id": "b3e8c291", "metadata": {}, "source": [ "#### Solution to[ Exercise 16.2](https://intro.quantecon.org/#prob_ex3)\n", @@ -476,7 +476,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2335c259", + "id": "d17eab3b", "metadata": { "hide-output": false }, @@ -493,7 +493,7 @@ }, { "cell_type": "markdown", - "id": "a9a58487", + "id": "b6df5ecf", "metadata": {}, "source": [ "We can see that the output graph is the same as the one above." @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "2f58ab8b", + "id": "6a40e4a4", "metadata": {}, "source": [ "#### Poisson distribution\n", @@ -520,7 +520,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8da41012", + "id": "fad1c5e2", "metadata": { "hide-output": false }, @@ -533,7 +533,7 @@ { "cell_type": "code", "execution_count": null, - "id": "77748968", + "id": "db472888", "metadata": { "hide-output": false }, @@ -544,7 +544,7 @@ }, { "cell_type": "markdown", - "id": "c7dafdbf", + "id": "bd6850e8", "metadata": {}, "source": [ "The the expectation of Poisson distribution is $ \\lambda $ and the variance is also $ \\lambda $.\n", @@ -555,7 +555,7 @@ { "cell_type": "code", "execution_count": null, - "id": "964f85c6", + "id": "752af97c", "metadata": { "hide-output": false }, @@ -568,7 +568,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7a1d5e35", + "id": "c062a1cd", "metadata": { "hide-output": false }, @@ -580,7 +580,7 @@ { "cell_type": "code", "execution_count": null, - "id": "24d647d1", + "id": "c99729c2", "metadata": { "hide-output": false }, @@ -596,7 +596,7 @@ }, { "cell_type": "markdown", - "id": "5e376c4b", + "id": "a57b8fc4", "metadata": {}, "source": [ "### Continuous distributions\n", @@ -633,7 +633,7 @@ }, { "cell_type": "markdown", - "id": "4ae43348", + "id": "56c19648", "metadata": {}, "source": [ "#### Normal distribution\n", @@ -655,7 +655,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7e9d4141", + "id": "a82413bb", "metadata": { "hide-output": false }, @@ -668,7 +668,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1fc69861", + "id": "e14996a0", "metadata": { "hide-output": false }, @@ -679,7 +679,7 @@ }, { "cell_type": "markdown", - "id": "00271bbb", + "id": "4d17c12b", "metadata": {}, "source": [ "Here’s a plot of the density — the famous “bell-shaped curve”:" @@ -688,7 +688,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22b21ae8", + "id": "46f33c69", "metadata": { "hide-output": false }, @@ -711,7 +711,7 @@ }, { "cell_type": "markdown", - "id": "dda9bab4", + "id": "7681a170", "metadata": {}, "source": [ "Here’s a plot of the CDF:" @@ -720,7 +720,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c7788676", + "id": "803d04b1", "metadata": { "hide-output": false }, @@ -739,7 +739,7 @@ }, { "cell_type": "markdown", - "id": "fd42c08d", + "id": "635ed9fb", "metadata": {}, "source": [ "#### Lognormal distribution\n", @@ -765,7 +765,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a3cd3158", + "id": "8887ac3f", "metadata": { "hide-output": false }, @@ -778,7 +778,7 @@ { "cell_type": "code", "execution_count": null, - "id": "86b0bd7e", + "id": "7c554238", "metadata": { "hide-output": false }, @@ -790,7 +790,7 @@ { "cell_type": "code", "execution_count": null, - "id": "987594c9", + "id": "320dfc8f", "metadata": { "hide-output": false }, @@ -814,7 +814,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a6bd97ec", + "id": "5c07bdc6", "metadata": { "hide-output": false }, @@ -835,7 +835,7 @@ }, { "cell_type": "markdown", - "id": "805e80ef", + "id": "0a44cfd1", "metadata": {}, "source": [ "#### Exponential distribution\n", @@ -858,7 +858,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0104bd02", + "id": "46db528e", "metadata": { "hide-output": false }, @@ -871,7 +871,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fbe519af", + "id": "576a1027", "metadata": { "hide-output": false }, @@ -883,7 +883,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40a6b86f", + "id": "dfc3af22", "metadata": { "hide-output": false }, @@ -905,7 +905,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6cf8f235", + "id": "0e492257", "metadata": { "hide-output": false }, @@ -924,7 +924,7 @@ }, { "cell_type": "markdown", - "id": "1209c64a", + "id": "a18cffec", "metadata": {}, "source": [ "#### Beta distribution\n", @@ -952,7 +952,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6f5e2786", + "id": "12900092", "metadata": { "hide-output": false }, @@ -965,7 +965,7 @@ { "cell_type": "code", "execution_count": null, - "id": "77b8eb29", + "id": "cad8484d", "metadata": { "hide-output": false }, @@ -977,7 +977,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c69be3cf", + "id": "24f335c8", "metadata": { "hide-output": false }, @@ -1000,7 +1000,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7164a710", + "id": "16c3cac4", "metadata": { "hide-output": false }, @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "7caeb1a1", + "id": "db4e13e9", "metadata": {}, "source": [ "#### Gamma distribution\n", @@ -1046,7 +1046,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a94e96b0", + "id": "ee5c3a37", "metadata": { "hide-output": false }, @@ -1059,7 +1059,7 @@ { "cell_type": "code", "execution_count": null, - "id": "19a500e3", + "id": "42e7417b", "metadata": { "hide-output": false }, @@ -1071,7 +1071,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1964b8f2", + "id": "b84c1e57", "metadata": { "hide-output": false }, @@ -1094,7 +1094,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25c9974f", + "id": "2930c285", "metadata": { "hide-output": false }, @@ -1113,7 +1113,7 @@ }, { "cell_type": "markdown", - "id": "6b6d0847", + "id": "88415b11", "metadata": {}, "source": [ "## Observed distributions\n", @@ -1126,7 +1126,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8370868a", + "id": "49aae757", "metadata": { "hide-output": false }, @@ -1149,7 +1149,7 @@ }, { "cell_type": "markdown", - "id": "a7cddbe9", + "id": "7b09de33", "metadata": {}, "source": [ "In this situation, we might refer to the set of their incomes as the “income distribution.”\n", @@ -1165,7 +1165,7 @@ }, { "cell_type": "markdown", - "id": "65f0c0af", + "id": "5957d5b4", "metadata": {}, "source": [ "### Summary statistics\n", @@ -1190,7 +1190,7 @@ { "cell_type": "code", "execution_count": null, - "id": "160e0424", + "id": "52f6ba7a", "metadata": { "hide-output": false }, @@ -1202,7 +1202,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0949f95b", + "id": "3d8e6eb8", "metadata": { "hide-output": false }, @@ -1213,7 +1213,7 @@ }, { "cell_type": "markdown", - "id": "2fc8e57f", + "id": "03d6611f", "metadata": {}, "source": [ "### Exercise 16.3\n", @@ -1223,7 +1223,7 @@ }, { "cell_type": "markdown", - "id": "7388c96a", + "id": "6a62cafd", "metadata": {}, "source": [ "### Visualization\n", @@ -1239,7 +1239,7 @@ }, { "cell_type": "markdown", - "id": "6525f4f4", + "id": "dc0d537f", "metadata": {}, "source": [ "#### Histograms\n", @@ -1250,7 +1250,7 @@ { "cell_type": "code", "execution_count": null, - "id": "82294b91", + "id": "04b6d54f", "metadata": { "hide-output": false }, @@ -1264,7 +1264,7 @@ }, { "cell_type": "markdown", - "id": "3a3f9948", + "id": "3b58a7a5", "metadata": {}, "source": [ "Let’s look at a distribution from real data.\n", @@ -1279,7 +1279,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4b7e5447", + "id": "030493c4", "metadata": { "hide-output": false }, @@ -1293,7 +1293,7 @@ }, { "cell_type": "markdown", - "id": "38323306", + "id": "d58c0325", "metadata": {}, "source": [ "The first observation is the monthly return (percent change) over January 2000, which was" @@ -1302,7 +1302,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17e4315b", + "id": "0837f013", "metadata": { "hide-output": false }, @@ -1313,7 +1313,7 @@ }, { "cell_type": "markdown", - "id": "b8e06542", + "id": "4633a1aa", "metadata": {}, "source": [ "Let’s turn the return observations into an array and histogram it." @@ -1322,7 +1322,7 @@ { "cell_type": "code", "execution_count": null, - "id": "699dd35b", + "id": "e7999045", "metadata": { "hide-output": false }, @@ -1334,7 +1334,7 @@ { "cell_type": "code", "execution_count": null, - "id": "087e5668", + "id": "271b023d", "metadata": { "hide-output": false }, @@ -1347,7 +1347,7 @@ }, { "cell_type": "markdown", - "id": "4552a8ec", + "id": "684d1bfc", "metadata": {}, "source": [ "#### Kernel density estimates\n", @@ -1360,7 +1360,7 @@ { "cell_type": "code", "execution_count": null, - "id": "796cf213", + "id": "ab7fe922", "metadata": { "hide-output": false }, @@ -1373,7 +1373,7 @@ }, { "cell_type": "markdown", - "id": "4cc2a192", + "id": "828786a6", "metadata": {}, "source": [ "The smoothness of the KDE is dependent on how we choose the bandwidth." @@ -1382,7 +1382,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bf72d277", + "id": "a2f47588", "metadata": { "hide-output": false }, @@ -1398,7 +1398,7 @@ }, { "cell_type": "markdown", - "id": "46ca846d", + "id": "dddce5cd", "metadata": {}, "source": [ "When we use a larger bandwidth, the KDE is smoother.\n", @@ -1408,7 +1408,7 @@ }, { "cell_type": "markdown", - "id": "31b5d408", + "id": "ddce338e", "metadata": {}, "source": [ "#### Violin plots\n", @@ -1419,7 +1419,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dfa95d77", + "id": "9192c297", "metadata": { "hide-output": false }, @@ -1432,7 +1432,7 @@ }, { "cell_type": "markdown", - "id": "84ee7108", + "id": "628a1d67", "metadata": {}, "source": [ "Violin plots are particularly useful when we want to compare different distributions.\n", @@ -1443,7 +1443,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4a08c0b4", + "id": "c8cb33ed", "metadata": { "hide-output": false }, @@ -1458,7 +1458,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce2720a9", + "id": "474ae917", "metadata": { "hide-output": false }, @@ -1471,7 +1471,7 @@ }, { "cell_type": "markdown", - "id": "946bec28", + "id": "0370b543", "metadata": {}, "source": [ "### Connection to probability distributions\n", @@ -1492,7 +1492,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ef0723b", + "id": "fb446aa1", "metadata": { "hide-output": false }, @@ -1507,7 +1507,7 @@ { "cell_type": "code", "execution_count": null, - "id": "613f7283", + "id": "d264036b", "metadata": { "hide-output": false }, @@ -1522,7 +1522,7 @@ }, { "cell_type": "markdown", - "id": "1250ac5b", + "id": "d0a46734", "metadata": {}, "source": [ "The match between the histogram and the density is not very bad but also not very good.\n", @@ -1540,7 +1540,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ed4cc1e4", + "id": "c584c758", "metadata": { "hide-output": false }, @@ -1559,7 +1559,7 @@ }, { "cell_type": "markdown", - "id": "5ad9ae32", + "id": "4bf0b8ef", "metadata": {}, "source": [ "Note that if you keep increasing $ N $, which is the number of observations, the fit will get better and better.\n", @@ -1569,7 +1569,7 @@ } ], "metadata": { - "date": 1712122264.6787639, + "date": 1712983677.9439535, "filename": "prob_dist.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/pv.ipynb b/_notebooks/pv.ipynb index 736a86b0..cad3c324 100644 --- a/_notebooks/pv.ipynb +++ b/_notebooks/pv.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "95d98d0a", + "id": "5070f827", "metadata": {}, "source": [ "# Present Values" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "fba6bdc4", + "id": "645afb30", "metadata": {}, "source": [ "## Overview\n", @@ -49,7 +49,7 @@ }, { "cell_type": "markdown", - "id": "bb1c566f", + "id": "27274922", "metadata": {}, "source": [ "## Analysis\n", @@ -100,7 +100,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eb0fcf10", + "id": "2ecd3ded", "metadata": { "hide-output": false }, @@ -112,7 +112,7 @@ }, { "cell_type": "markdown", - "id": "0937772b", + "id": "dc690f9a", "metadata": {}, "source": [ "## Representing sequences as vectors\n", @@ -155,7 +155,7 @@ }, { "cell_type": "markdown", - "id": "f2642d54", + "id": "babbbe6e", "metadata": {}, "source": [ "## Exercise 10.1\n", @@ -219,7 +219,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0a59c3f7", + "id": "e026ef05", "metadata": { "hide-output": false }, @@ -241,7 +241,7 @@ }, { "cell_type": "markdown", - "id": "6e7aadfc", + "id": "06e014e0", "metadata": {}, "source": [ "Now let’s compute and plot the asset price.\n", @@ -252,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "96b490a2", + "id": "1f658b48", "metadata": { "hide-output": false }, @@ -264,7 +264,7 @@ }, { "cell_type": "markdown", - "id": "13d09411", + "id": "4f0f6eab", "metadata": {}, "source": [ "Let’s build the matrix $ A $" @@ -273,7 +273,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cbd7eac8", + "id": "5d7f1a05", "metadata": { "hide-output": false }, @@ -290,7 +290,7 @@ }, { "cell_type": "markdown", - "id": "d9b21635", + "id": "2f95e89d", "metadata": {}, "source": [ "Let’s inspect $ A $" @@ -299,7 +299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c21ee2f5", + "id": "c8f7c785", "metadata": { "hide-output": false }, @@ -310,7 +310,7 @@ }, { "cell_type": "markdown", - "id": "9ec3d8f0", + "id": "8d4de2ab", "metadata": {}, "source": [ "Now let’s solve for prices using [(10.5)](#equation-eq-apdb-sol)." @@ -319,7 +319,7 @@ { "cell_type": "code", "execution_count": null, - "id": "63e8cb06", + "id": "b48e4306", "metadata": { "hide-output": false }, @@ -337,7 +337,7 @@ }, { "cell_type": "markdown", - "id": "880d4a71", + "id": "e7fe39b3", "metadata": {}, "source": [ "Now let’s consider a cyclically growing dividend sequence:\n", @@ -350,7 +350,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e0d7c352", + "id": "abd5abbc", "metadata": { "hide-output": false }, @@ -372,7 +372,7 @@ }, { "cell_type": "markdown", - "id": "ed5ad79e", + "id": "4bd0b8e6", "metadata": {}, "source": [ "## Exercise 10.2\n", @@ -383,7 +383,7 @@ }, { "cell_type": "markdown", - "id": "a5989407", + "id": "ec7df836", "metadata": {}, "source": [ "## Solution to[ Exercise 10.2](https://intro.quantecon.org/#pv_ex_cyc)\n", @@ -394,7 +394,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9375999e", + "id": "c5ca0f7a", "metadata": { "hide-output": false }, @@ -422,7 +422,7 @@ }, { "cell_type": "markdown", - "id": "6a39a440", + "id": "6e925950", "metadata": {}, "source": [ "The weighted averaging associated with the present value calculation largely\n", @@ -431,7 +431,7 @@ }, { "cell_type": "markdown", - "id": "31821556", + "id": "94f05f1b", "metadata": {}, "source": [ "## Analytical expressions\n", @@ -456,7 +456,7 @@ }, { "cell_type": "markdown", - "id": "38b38f41", + "id": "dc967934", "metadata": {}, "source": [ "## Exercise 10.3\n", @@ -499,7 +499,7 @@ }, { "cell_type": "markdown", - "id": "d1bcd6b2", + "id": "1c220092", "metadata": {}, "source": [ "## More about bubbles\n", @@ -561,7 +561,7 @@ }, { "cell_type": "markdown", - "id": "a49e4972", + "id": "2d20daef", "metadata": {}, "source": [ "## Gross rate of return\n", @@ -584,7 +584,7 @@ }, { "cell_type": "markdown", - "id": "7fd4d263", + "id": "7d49b92b", "metadata": {}, "source": [ "## Exercises" @@ -592,7 +592,7 @@ }, { "cell_type": "markdown", - "id": "be71f293", + "id": "9eb8f3ec", "metadata": {}, "source": [ "## Exercise 10.4\n", @@ -608,7 +608,7 @@ }, { "cell_type": "markdown", - "id": "a47ecb18", + "id": "c94d173f", "metadata": {}, "source": [ "## Solution to[ Exercise 10.4](https://intro.quantecon.org/#pv_ex_a)\n", @@ -623,7 +623,7 @@ } ], "metadata": { - "date": 1712122264.7072258, + "date": 1712983677.969818, "filename": "pv.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/scalar_dynam.ipynb b/_notebooks/scalar_dynam.ipynb index 3a779299..a25b8a58 100644 --- a/_notebooks/scalar_dynam.ipynb +++ b/_notebooks/scalar_dynam.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "4e5cc26c", + "id": "9d945a76", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "c879f508", + "id": "b510dfb8", "metadata": {}, "source": [ "# Dynamics in One Dimension" @@ -19,7 +19,7 @@ }, { "cell_type": "markdown", - "id": "cbbaaa77", + "id": "403ec883", "metadata": {}, "source": [ "# Migrated lecture\n", @@ -29,7 +29,7 @@ }, { "cell_type": "markdown", - "id": "bfaa04f7", + "id": "94509b0c", "metadata": {}, "source": [ "## Overview\n", @@ -50,7 +50,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3b51cd74", + "id": "d9327e44", "metadata": { "hide-output": false }, @@ -63,7 +63,7 @@ }, { "cell_type": "markdown", - "id": "159f4121", + "id": "ea600ba3", "metadata": {}, "source": [ "## Some definitions\n", @@ -73,7 +73,7 @@ }, { "cell_type": "markdown", - "id": "7688bab0", + "id": "7187aa2d", "metadata": {}, "source": [ "### Composition of functions\n", @@ -116,7 +116,7 @@ }, { "cell_type": "markdown", - "id": "c0e52e57", + "id": "d3b97bb8", "metadata": {}, "source": [ "### Dynamic systems\n", @@ -139,7 +139,7 @@ }, { "cell_type": "markdown", - "id": "3395a510", + "id": "979ba38c", "metadata": {}, "source": [ "### Dynamic systems\n", @@ -189,7 +189,7 @@ }, { "cell_type": "markdown", - "id": "08197bed", + "id": "905ad0d8", "metadata": {}, "source": [ "### Example: A Linear Model\n", @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "48e133f9", + "id": "839deddd", "metadata": {}, "source": [ "### Example: A Nonlinear Model\n", @@ -273,7 +273,7 @@ }, { "cell_type": "markdown", - "id": "3cc31a3b", + "id": "7ce6dfd2", "metadata": {}, "source": [ "## Stability\n", @@ -284,7 +284,7 @@ }, { "cell_type": "markdown", - "id": "9c6de164", + "id": "87a6023c", "metadata": {}, "source": [ "### Steady states\n", @@ -307,7 +307,7 @@ }, { "cell_type": "markdown", - "id": "b8ed6c5f", + "id": "65d57b0e", "metadata": {}, "source": [ "### Global stability\n", @@ -331,7 +331,7 @@ }, { "cell_type": "markdown", - "id": "157f15c6", + "id": "62618ddb", "metadata": {}, "source": [ "### Local stability\n", @@ -352,7 +352,7 @@ }, { "cell_type": "markdown", - "id": "1bcdbd5c", + "id": "94d6dd53", "metadata": {}, "source": [ "## Graphical analysis\n", @@ -377,7 +377,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44f4c52c", + "id": "72c2132f", "metadata": { "hide-output": false }, @@ -469,7 +469,7 @@ }, { "cell_type": "markdown", - "id": "f588f54c", + "id": "02d9bb7f", "metadata": {}, "source": [ "Let’s create a 45 degree diagram for the Solow model with a fixed set of\n", @@ -479,7 +479,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1e9e067e", + "id": "d52d2b22", "metadata": { "hide-output": false }, @@ -490,7 +490,7 @@ }, { "cell_type": "markdown", - "id": "5e9dc68d", + "id": "f56c35a9", "metadata": {}, "source": [ "Here’s the update function corresponding to the model." @@ -499,7 +499,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6df3c702", + "id": "9055f7d9", "metadata": { "hide-output": false }, @@ -511,7 +511,7 @@ }, { "cell_type": "markdown", - "id": "69a4cd4b", + "id": "2b04878c", "metadata": {}, "source": [ "Here is the 45 degree plot." @@ -520,7 +520,7 @@ { "cell_type": "code", "execution_count": null, - "id": "10c82ee6", + "id": "ffa5f2ab", "metadata": { "hide-output": false }, @@ -533,7 +533,7 @@ }, { "cell_type": "markdown", - "id": "3e798c57", + "id": "44906ef4", "metadata": {}, "source": [ "The plot shows the function $ g $ and the 45 degree line.\n", @@ -566,7 +566,7 @@ }, { "cell_type": "markdown", - "id": "faf247da", + "id": "77fd8cad", "metadata": {}, "source": [ "### Trajectories\n", @@ -581,7 +581,7 @@ { "cell_type": "code", "execution_count": null, - "id": "753cfdc4", + "id": "e812f15e", "metadata": { "hide-output": false }, @@ -594,7 +594,7 @@ }, { "cell_type": "markdown", - "id": "507ad823", + "id": "6f84dea7", "metadata": {}, "source": [ "We can plot the time series of capital corresponding to the figure above as\n", @@ -604,7 +604,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a99e65c4", + "id": "20eaf716", "metadata": { "hide-output": false }, @@ -615,7 +615,7 @@ }, { "cell_type": "markdown", - "id": "4da6ab7d", + "id": "5df4f500", "metadata": {}, "source": [ "Here’s a somewhat longer view:" @@ -624,7 +624,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1e61549a", + "id": "5bb23440", "metadata": { "hide-output": false }, @@ -635,7 +635,7 @@ }, { "cell_type": "markdown", - "id": "8f05aae1", + "id": "c51cd8ed", "metadata": {}, "source": [ "When capital stock is higher than the unique positive steady state, we see that\n", @@ -645,7 +645,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40d5885a", + "id": "84dcb664", "metadata": { "hide-output": false }, @@ -658,7 +658,7 @@ }, { "cell_type": "markdown", - "id": "30642b45", + "id": "2bc585b1", "metadata": {}, "source": [ "Here is the time series:" @@ -667,7 +667,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72ffc65c", + "id": "f3310e95", "metadata": { "hide-output": false }, @@ -678,7 +678,7 @@ }, { "cell_type": "markdown", - "id": "257e1119", + "id": "4b657d0e", "metadata": {}, "source": [ "### Complex dynamics\n", @@ -698,7 +698,7 @@ { "cell_type": "code", "execution_count": null, - "id": "48aeeeb7", + "id": "78dd1d55", "metadata": { "hide-output": false }, @@ -713,7 +713,7 @@ }, { "cell_type": "markdown", - "id": "444f54fb", + "id": "16db4058", "metadata": {}, "source": [ "Now let’s look at a typical trajectory." @@ -722,7 +722,7 @@ { "cell_type": "code", "execution_count": null, - "id": "60d38cc9", + "id": "13b0dd6c", "metadata": { "hide-output": false }, @@ -733,7 +733,7 @@ }, { "cell_type": "markdown", - "id": "08b052ae", + "id": "a810eec0", "metadata": {}, "source": [ "Notice how irregular it is.\n", @@ -744,7 +744,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9d46c4af", + "id": "92d8406e", "metadata": { "hide-output": false }, @@ -755,7 +755,7 @@ }, { "cell_type": "markdown", - "id": "97ab37f6", + "id": "9b114f83", "metadata": {}, "source": [ "The irregularity is even clearer over a longer time horizon:" @@ -764,7 +764,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29e323ad", + "id": "899bd852", "metadata": { "hide-output": false }, @@ -775,7 +775,7 @@ }, { "cell_type": "markdown", - "id": "eb89bba5", + "id": "a4a3cc63", "metadata": {}, "source": [ "## Exercises" @@ -783,7 +783,7 @@ }, { "cell_type": "markdown", - "id": "c09b3e8c", + "id": "3c9a352b", "metadata": {}, "source": [ "## Exercise 22.1\n", @@ -807,7 +807,7 @@ }, { "cell_type": "markdown", - "id": "d356960f", + "id": "403128e2", "metadata": {}, "source": [ "## Solution to[ Exercise 22.1](https://intro.quantecon.org/#sd_ex1)\n", @@ -820,7 +820,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ebc975c8", + "id": "40add488", "metadata": { "hide-output": false }, @@ -833,7 +833,7 @@ }, { "cell_type": "markdown", - "id": "9cafcf94", + "id": "f348618d", "metadata": {}, "source": [ "Now let’s plot a trajectory:" @@ -842,7 +842,7 @@ { "cell_type": "code", "execution_count": null, - "id": "afec2de9", + "id": "f5687723", "metadata": { "hide-output": false }, @@ -854,7 +854,7 @@ }, { "cell_type": "markdown", - "id": "bd07ef1e", + "id": "52c99dea", "metadata": {}, "source": [ "Here is the corresponding time series, which converges towards the steady\n", @@ -864,7 +864,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2166537c", + "id": "d787e424", "metadata": { "hide-output": false }, @@ -875,7 +875,7 @@ }, { "cell_type": "markdown", - "id": "dcd69640", + "id": "37ebbe03", "metadata": {}, "source": [ "Now let’s try $ a=-0.5 $ and see what differences we observe.\n", @@ -886,7 +886,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d0b5134e", + "id": "1ed92fbc", "metadata": { "hide-output": false }, @@ -899,7 +899,7 @@ }, { "cell_type": "markdown", - "id": "906ee41b", + "id": "a74ce71a", "metadata": {}, "source": [ "Now let’s plot a trajectory:" @@ -908,7 +908,7 @@ { "cell_type": "code", "execution_count": null, - "id": "895b04e8", + "id": "bee3e20f", "metadata": { "hide-output": false }, @@ -920,7 +920,7 @@ }, { "cell_type": "markdown", - "id": "a2705acb", + "id": "0267673d", "metadata": {}, "source": [ "Here is the corresponding time series, which converges towards the steady\n", @@ -930,7 +930,7 @@ { "cell_type": "code", "execution_count": null, - "id": "06835637", + "id": "028f036c", "metadata": { "hide-output": false }, @@ -941,7 +941,7 @@ }, { "cell_type": "markdown", - "id": "18beeed6", + "id": "261167c1", "metadata": {}, "source": [ "Once again, we have convergence to the steady state but the nature of\n", @@ -955,7 +955,7 @@ } ], "metadata": { - "date": 1712122264.742485, + "date": 1712983678.0017552, "filename": "scalar_dynam.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/schelling.ipynb b/_notebooks/schelling.ipynb index d6210ce8..8ddae719 100644 --- a/_notebooks/schelling.ipynb +++ b/_notebooks/schelling.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "29028072", + "id": "613ad8bb", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "f2d74c2d", + "id": "3eb162c2", "metadata": {}, "source": [ "# Racial Segregation\n", @@ -22,7 +22,7 @@ }, { "cell_type": "markdown", - "id": "af0764ec", + "id": "ae00e6a4", "metadata": {}, "source": [ "# Migrated lecture\n", @@ -32,7 +32,7 @@ }, { "cell_type": "markdown", - "id": "93069b7b", + "id": "43ab5a78", "metadata": {}, "source": [ "## Outline\n", @@ -75,7 +75,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f859d4b2", + "id": "840270e1", "metadata": { "hide-output": false }, @@ -90,7 +90,7 @@ }, { "cell_type": "markdown", - "id": "cbc6859d", + "id": "a781826f", "metadata": {}, "source": [ "## The model\n", @@ -100,7 +100,7 @@ }, { "cell_type": "markdown", - "id": "1299615a", + "id": "fa47b2d8", "metadata": {}, "source": [ "### Set-Up\n", @@ -124,7 +124,7 @@ }, { "cell_type": "markdown", - "id": "f1a0c1f9", + "id": "b27695f9", "metadata": {}, "source": [ "### Preferences\n", @@ -148,7 +148,7 @@ }, { "cell_type": "markdown", - "id": "44056f48", + "id": "9b71f415", "metadata": {}, "source": [ "### Behavior\n", @@ -171,7 +171,7 @@ }, { "cell_type": "markdown", - "id": "e8145bd3", + "id": "3aa981f1", "metadata": {}, "source": [ "### (Jump Chain Algorithm)\n", @@ -189,7 +189,7 @@ }, { "cell_type": "markdown", - "id": "14c11a57", + "id": "067c01b0", "metadata": {}, "source": [ "## Results\n", @@ -203,7 +203,7 @@ }, { "cell_type": "markdown", - "id": "1f35f76d", + "id": "b3b0e144", "metadata": { "hide-output": false }, @@ -224,7 +224,7 @@ }, { "cell_type": "markdown", - "id": "f921977b", + "id": "c91b4621", "metadata": {}, "source": [ "Let’s build them." @@ -233,7 +233,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5264db6", + "id": "f54dfbf3", "metadata": { "hide-output": false }, @@ -290,7 +290,7 @@ }, { "cell_type": "markdown", - "id": "00557140", + "id": "f4c7ad7a", "metadata": {}, "source": [ "Here’s some code that takes a list of agents and produces a plot showing their\n", @@ -303,7 +303,7 @@ { "cell_type": "code", "execution_count": null, - "id": "87f89ac2", + "id": "3e732152", "metadata": { "hide-output": false }, @@ -335,7 +335,7 @@ }, { "cell_type": "markdown", - "id": "c2284e88", + "id": "b761a464", "metadata": {}, "source": [ "And here’s some pseudocode for the main loop, where we cycle through the\n", @@ -346,7 +346,7 @@ }, { "cell_type": "markdown", - "id": "efbbad35", + "id": "93817a44", "metadata": { "hide-output": false }, @@ -362,7 +362,7 @@ }, { "cell_type": "markdown", - "id": "ff997116", + "id": "95f9f44b", "metadata": {}, "source": [ "The real code is below" @@ -371,7 +371,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dae6e65a", + "id": "6c3eec52", "metadata": { "hide-output": false }, @@ -420,7 +420,7 @@ }, { "cell_type": "markdown", - "id": "8471f879", + "id": "ce6628b8", "metadata": {}, "source": [ "Let’s have a look at the results." @@ -429,7 +429,7 @@ { "cell_type": "code", "execution_count": null, - "id": "343465fe", + "id": "22a11bf0", "metadata": { "hide-output": false }, @@ -440,7 +440,7 @@ }, { "cell_type": "markdown", - "id": "f3e5d860", + "id": "dde71c59", "metadata": {}, "source": [ "As discussed above, agents are initially mixed randomly together.\n", @@ -460,7 +460,7 @@ }, { "cell_type": "markdown", - "id": "2385ac9e", + "id": "1c8896fe", "metadata": {}, "source": [ "## Exercises" @@ -468,7 +468,7 @@ }, { "cell_type": "markdown", - "id": "efb063c1", + "id": "e74423a3", "metadata": {}, "source": [ "## Exercise 20.1\n", @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "f8e650d8", + "id": "862499e6", "metadata": {}, "source": [ "## Solution to[ Exercise 20.1](https://intro.quantecon.org/#schelling_ex1)\n", @@ -512,7 +512,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c17eead", + "id": "265191d0", "metadata": { "hide-output": false }, @@ -621,7 +621,7 @@ }, { "cell_type": "markdown", - "id": "68a2e16b", + "id": "e8f90c8a", "metadata": {}, "source": [ "When we run this we again find that mixed neighborhoods break down and segregation emerges.\n", @@ -632,7 +632,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a98867a3", + "id": "11be4d2f", "metadata": { "hide-output": false }, @@ -643,7 +643,7 @@ } ], "metadata": { - "date": 1712122264.7634866, + "date": 1712983678.0197055, "filename": "schelling.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/short_path.ipynb b/_notebooks/short_path.ipynb index 04b0b246..4fe59a37 100644 --- a/_notebooks/short_path.ipynb +++ b/_notebooks/short_path.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "0aaf1203", + "id": "f7c8ab5f", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "fb309bd7", + "id": "7f5411d0", "metadata": {}, "source": [ "# Shortest Paths\n", @@ -22,7 +22,7 @@ }, { "cell_type": "markdown", - "id": "fd727183", + "id": "c63566a4", "metadata": {}, "source": [ "# Migrated lecture\n", @@ -32,7 +32,7 @@ }, { "cell_type": "markdown", - "id": "bbc2ebdd", + "id": "ec157de9", "metadata": {}, "source": [ "## Overview\n", @@ -62,7 +62,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6286eabe", + "id": "da9d6641", "metadata": { "hide-output": false }, @@ -73,7 +73,7 @@ }, { "cell_type": "markdown", - "id": "85eab720", + "id": "7411390c", "metadata": {}, "source": [ "## Outline of the problem\n", @@ -116,7 +116,7 @@ }, { "cell_type": "markdown", - "id": "2030ae00", + "id": "3fa3d268", "metadata": {}, "source": [ "## Finding least-cost paths\n", @@ -173,7 +173,7 @@ }, { "cell_type": "markdown", - "id": "c63abac2", + "id": "17ce1281", "metadata": {}, "source": [ "## Solving for minimum cost-to-go\n", @@ -184,7 +184,7 @@ }, { "cell_type": "markdown", - "id": "013d9765", + "id": "0f5d5dfd", "metadata": {}, "source": [ "### The algorithm\n", @@ -217,7 +217,7 @@ }, { "cell_type": "markdown", - "id": "4b369789", + "id": "4a801b71", "metadata": {}, "source": [ "### Implementation\n", @@ -253,7 +253,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8501b5b5", + "id": "5a656839", "metadata": { "hide-output": false }, @@ -272,7 +272,7 @@ }, { "cell_type": "markdown", - "id": "af4c544d", + "id": "a8dccf6e", "metadata": {}, "source": [ "Notice that the cost of staying still (on the principle diagonal) is set to\n", @@ -289,7 +289,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bb53af5d", + "id": "b64aa2a9", "metadata": { "hide-output": false }, @@ -322,7 +322,7 @@ }, { "cell_type": "markdown", - "id": "47c68d91", + "id": "ce855b82", "metadata": {}, "source": [ "This matches with the numbers we obtained by inspection above.\n", @@ -332,7 +332,7 @@ }, { "cell_type": "markdown", - "id": "4824aeb8", + "id": "ec40b32b", "metadata": {}, "source": [ "## Exercises" @@ -340,7 +340,7 @@ }, { "cell_type": "markdown", - "id": "618c3920", + "id": "11a14ff8", "metadata": {}, "source": [ "## Exercise 35.1\n", @@ -369,7 +369,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e7f27414", + "id": "79bd46ae", "metadata": { "hide-output": false }, @@ -480,7 +480,7 @@ }, { "cell_type": "markdown", - "id": "53837115", + "id": "668f6992", "metadata": {}, "source": [ "## Solution to[ Exercise 35.1](https://intro.quantecon.org/#short_path_ex1)\n", @@ -491,7 +491,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f7b45b63", + "id": "57220125", "metadata": { "hide-output": false }, @@ -522,7 +522,7 @@ }, { "cell_type": "markdown", - "id": "b3f77d13", + "id": "186cbd0c", "metadata": {}, "source": [ "In addition, let’s write\n", @@ -539,7 +539,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8515b602", + "id": "17ef37d1", "metadata": { "hide-output": false }, @@ -572,7 +572,7 @@ }, { "cell_type": "markdown", - "id": "083ba505", + "id": "08688af1", "metadata": {}, "source": [ "We used np.allclose() rather than testing exact equality because we are\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5f5ba4b2", + "id": "e8156ac8", "metadata": { "hide-output": false }, @@ -607,7 +607,7 @@ }, { "cell_type": "markdown", - "id": "a3d305c6", + "id": "3121df10", "metadata": {}, "source": [ "Okay, now we have the necessary functions, let’s call them to do the job we were assigned." @@ -616,7 +616,7 @@ { "cell_type": "code", "execution_count": null, - "id": "de45b603", + "id": "76974798", "metadata": { "hide-output": false }, @@ -629,7 +629,7 @@ }, { "cell_type": "markdown", - "id": "1bff823f", + "id": "219b62d0", "metadata": {}, "source": [ "The total cost of the path should agree with $ J[0] $ so let’s check this." @@ -638,7 +638,7 @@ { "cell_type": "code", "execution_count": null, - "id": "99532855", + "id": "b1b48112", "metadata": { "hide-output": false }, @@ -649,7 +649,7 @@ } ], "metadata": { - "date": 1712122264.7816417, + "date": 1712983678.036991, "filename": "short_path.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/simple_linear_regression.ipynb b/_notebooks/simple_linear_regression.ipynb index 2ade8c77..ac183c8e 100644 --- a/_notebooks/simple_linear_regression.ipynb +++ b/_notebooks/simple_linear_regression.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "bf5c3658", + "id": "27657f24", "metadata": {}, "source": [ "# Simple Linear Regression Model" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a3b6fc9c", + "id": "6b0732d8", "metadata": { "hide-output": false }, @@ -24,7 +24,7 @@ }, { "cell_type": "markdown", - "id": "bce32d32", + "id": "12ce05ca", "metadata": {}, "source": [ "The simple regression model estimates the relationship between two variables $ x_i $ and $ y_i $\n", @@ -57,7 +57,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6c4d4fb6", + "id": "311079cf", "metadata": { "hide-output": false }, @@ -72,7 +72,7 @@ }, { "cell_type": "markdown", - "id": "ae828a9c", + "id": "acc3cde7", "metadata": {}, "source": [ "We can use a scatter plot of the data to see the relationship between $ y_i $ (ice-cream sales in dollars (\\$’s)) and $ x_i $ (degrees Celsius)." @@ -81,7 +81,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b5285187", + "id": "625b1b6e", "metadata": { "hide-output": false }, @@ -98,7 +98,7 @@ }, { "cell_type": "markdown", - "id": "f6ea8a51", + "id": "b03e7df1", "metadata": {}, "source": [ "as you can see the data suggests that more ice-cream is typically sold on hotter days.\n", @@ -115,7 +115,7 @@ { "cell_type": "code", "execution_count": null, - "id": "015ef088", + "id": "d6e09204", "metadata": { "hide-output": false }, @@ -129,7 +129,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cd1b434a", + "id": "e5af3467", "metadata": { "hide-output": false }, @@ -143,7 +143,7 @@ }, { "cell_type": "markdown", - "id": "eeaff225", + "id": "bc61a16b", "metadata": {}, "source": [ "We can see that this model does a poor job of estimating the relationship.\n", @@ -154,7 +154,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dfa13add", + "id": "4f3c1440", "metadata": { "hide-output": false }, @@ -167,7 +167,7 @@ { "cell_type": "code", "execution_count": null, - "id": "324bb0b2", + "id": "0fcfadb8", "metadata": { "hide-output": false }, @@ -182,7 +182,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cdfdd79f", + "id": "cad1fe1f", "metadata": { "hide-output": false }, @@ -195,7 +195,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6376c21a", + "id": "1a98e2b0", "metadata": { "hide-output": false }, @@ -209,7 +209,7 @@ }, { "cell_type": "markdown", - "id": "b9c96f8c", + "id": "bd1ddc0e", "metadata": {}, "source": [ "However we need to think about formalizing this guessing process by thinking of this problem as an optimization problem.\n", @@ -227,7 +227,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f71ade2d", + "id": "5b631e7f", "metadata": { "hide-output": false }, @@ -239,7 +239,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b1008595", + "id": "cd6831fd", "metadata": { "hide-output": false }, @@ -251,7 +251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "77f6c16e", + "id": "ca2e14cc", "metadata": { "hide-output": false }, @@ -266,7 +266,7 @@ }, { "cell_type": "markdown", - "id": "0638289f", + "id": "8e5777aa", "metadata": {}, "source": [ "The Ordinary Least Squares (OLS) method chooses $ \\alpha $ and $ \\beta $ in such a way that **minimizes** the sum of the squared residuals (SSR).\n", @@ -286,7 +286,7 @@ }, { "cell_type": "markdown", - "id": "e497b9c3", + "id": "f2e66a7f", "metadata": {}, "source": [ "## How does error change with respect to $ \\alpha $ and $ \\beta $\n", @@ -299,7 +299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13b29ba2", + "id": "a5e26f01", "metadata": { "hide-output": false }, @@ -311,7 +311,7 @@ }, { "cell_type": "markdown", - "id": "c71a0222", + "id": "dd6d058c", "metadata": {}, "source": [ "We can then calculate the error for a range of $ \\beta $ values" @@ -320,7 +320,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7a26bf61", + "id": "e8e1d1c3", "metadata": { "hide-output": false }, @@ -333,7 +333,7 @@ }, { "cell_type": "markdown", - "id": "e7c88847", + "id": "6b230356", "metadata": {}, "source": [ "Plotting the error" @@ -342,7 +342,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4dde1d95", + "id": "f3b9aa52", "metadata": { "hide-output": false }, @@ -354,7 +354,7 @@ }, { "cell_type": "markdown", - "id": "f5ec3b48", + "id": "71c7941f", "metadata": {}, "source": [ "Now let us vary $ \\alpha $ (holding $ \\beta $ constant)" @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "62a33a6d", + "id": "e2bd7e7b", "metadata": { "hide-output": false }, @@ -376,7 +376,7 @@ }, { "cell_type": "markdown", - "id": "fc980dff", + "id": "7e6374c7", "metadata": {}, "source": [ "Plotting the error" @@ -385,7 +385,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1d30c44", + "id": "02ac2981", "metadata": { "hide-output": false }, @@ -397,7 +397,7 @@ }, { "cell_type": "markdown", - "id": "8ea243f5", + "id": "8d66b546", "metadata": {}, "source": [ "\n", @@ -406,7 +406,7 @@ }, { "cell_type": "markdown", - "id": "09bd8386", + "id": "c25528dc", "metadata": {}, "source": [ "## Calculating optimal values\n", @@ -515,7 +515,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11265b0e", + "id": "2eaf3a45", "metadata": { "hide-output": false }, @@ -530,7 +530,7 @@ }, { "cell_type": "markdown", - "id": "28937ac0", + "id": "31ba1b3a", "metadata": {}, "source": [ "Now computing across the 10 observations and then summing the numerator and denominator" @@ -539,7 +539,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1a3524e", + "id": "3224b50f", "metadata": { "hide-output": false }, @@ -554,7 +554,7 @@ }, { "cell_type": "markdown", - "id": "2def207b", + "id": "30a49bbb", "metadata": {}, "source": [ "Calculating $ \\alpha $" @@ -563,7 +563,7 @@ { "cell_type": "code", "execution_count": null, - "id": "598453dd", + "id": "1876b42c", "metadata": { "hide-output": false }, @@ -575,7 +575,7 @@ }, { "cell_type": "markdown", - "id": "de4c457e", + "id": "fcbd0334", "metadata": {}, "source": [ "Now we can plot the OLS solution" @@ -584,7 +584,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2922c0da", + "id": "2eebb2f7", "metadata": { "hide-output": false }, @@ -601,7 +601,7 @@ }, { "cell_type": "markdown", - "id": "e35c6f58", + "id": "84651cd7", "metadata": {}, "source": [ "## Exercise 42.1\n", @@ -620,7 +620,7 @@ }, { "cell_type": "markdown", - "id": "1efa58f6", + "id": "ec08770c", "metadata": {}, "source": [ "## Solution to[ Exercise 42.1](https://intro.quantecon.org/#slr-ex1)\n", @@ -635,7 +635,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20583e01", + "id": "867b2941", "metadata": { "hide-output": false }, @@ -648,7 +648,7 @@ { "cell_type": "code", "execution_count": null, - "id": "add14593", + "id": "64f894ff", "metadata": { "hide-output": false }, @@ -659,7 +659,7 @@ }, { "cell_type": "markdown", - "id": "c9444d94", + "id": "3d583754", "metadata": {}, "source": [ "You can see that the data downloaded from Our World in Data has provided a global set of countries with the GDP per capita and Life Expectancy Data.\n", @@ -674,7 +674,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2cf3f8ee", + "id": "6e178e7d", "metadata": { "hide-output": false }, @@ -687,7 +687,7 @@ }, { "cell_type": "markdown", - "id": "ce937d98", + "id": "13049017", "metadata": {}, "source": [ "Sometimes it can be useful to rename your columns to make it easier to work with in the DataFrame" @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "956fc08c", + "id": "c487628b", "metadata": { "hide-output": false }, @@ -708,7 +708,7 @@ }, { "cell_type": "markdown", - "id": "0bd58a53", + "id": "284b3682", "metadata": {}, "source": [ "We can see there are `NaN` values which represents missing data so let us go ahead and drop those" @@ -717,7 +717,7 @@ { "cell_type": "code", "execution_count": null, - "id": "432119d2", + "id": "8c9e4348", "metadata": { "hide-output": false }, @@ -729,7 +729,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7d61b816", + "id": "34d4234a", "metadata": { "hide-output": false }, @@ -740,7 +740,7 @@ }, { "cell_type": "markdown", - "id": "27b6c019", + "id": "fad46c5f", "metadata": {}, "source": [ "We have now dropped the number of rows in our DataFrame from 62156 to 12445 removing a lot of empty data relationships.\n", @@ -757,7 +757,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30ca9db0", + "id": "c68888c0", "metadata": { "hide-output": false }, @@ -769,7 +769,7 @@ }, { "cell_type": "markdown", - "id": "95797018", + "id": "30136d49", "metadata": {}, "source": [ "As you can see there are a lot of countries where data is not available for the Year 1543!\n", @@ -780,7 +780,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b49b0bd2", + "id": "1b7e2beb", "metadata": { "hide-output": false }, @@ -791,7 +791,7 @@ }, { "cell_type": "markdown", - "id": "fe901ee0", + "id": "f7f199ae", "metadata": {}, "source": [ "You can see that Great Britain (GBR) is the only one available\n", @@ -802,7 +802,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44ee76ec", + "id": "f31b185f", "metadata": { "hide-output": false }, @@ -813,7 +813,7 @@ }, { "cell_type": "markdown", - "id": "5139904f", + "id": "b9e223ec", "metadata": {}, "source": [ "In fact we can use pandas to quickly check how many countries are captured in each year" @@ -822,7 +822,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90fd5649", + "id": "ccc80e8f", "metadata": { "hide-output": false }, @@ -833,7 +833,7 @@ }, { "cell_type": "markdown", - "id": "d89ab85b", + "id": "cc9c0667", "metadata": {}, "source": [ "So it is clear that if you are doing cross-sectional comparisons then more recent data will include a wider set of countries\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bf0ab530", + "id": "df57335b", "metadata": { "hide-output": false }, @@ -856,7 +856,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22ace47c", + "id": "f51b4797", "metadata": { "hide-output": false }, @@ -867,7 +867,7 @@ }, { "cell_type": "markdown", - "id": "2405cfdd", + "id": "80c8b4db", "metadata": {}, "source": [ "This data shows a couple of interesting relationships.\n", @@ -884,7 +884,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4c0fea41", + "id": "de9069ef", "metadata": { "hide-output": false }, @@ -895,7 +895,7 @@ }, { "cell_type": "markdown", - "id": "0e9932ad", + "id": "127d1f61", "metadata": {}, "source": [ "As you can see from this transformation – a linear model fits the shape of the data more closely." @@ -904,7 +904,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7daf3f2b", + "id": "a9bc8932", "metadata": { "hide-output": false }, @@ -916,7 +916,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b24e9afc", + "id": "b59a0286", "metadata": { "hide-output": false }, @@ -927,7 +927,7 @@ }, { "cell_type": "markdown", - "id": "5b80951d", + "id": "066c3c74", "metadata": {}, "source": [ "**Q4:** Use [(42.1)](#equation-eq-optimal-alpha) and [(42.2)](#equation-eq-optimal-beta) to compute optimal values for $ \\alpha $ and $ \\beta $" @@ -936,7 +936,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e50c8421", + "id": "3c8bed26", "metadata": { "hide-output": false }, @@ -952,7 +952,7 @@ { "cell_type": "code", "execution_count": null, - "id": "489fa6a1", + "id": "140527c1", "metadata": { "hide-output": false }, @@ -964,7 +964,7 @@ { "cell_type": "code", "execution_count": null, - "id": "433e0f42", + "id": "ee88ed10", "metadata": { "hide-output": false }, @@ -980,7 +980,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15c6dc47", + "id": "6d581bc7", "metadata": { "hide-output": false }, @@ -992,7 +992,7 @@ }, { "cell_type": "markdown", - "id": "62c30221", + "id": "a29ad8c6", "metadata": {}, "source": [ "**Q5:** Plot the line of best fit found using OLS" @@ -1001,7 +1001,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e50cdb33", + "id": "e2b3c882", "metadata": { "hide-output": false }, @@ -1018,7 +1018,7 @@ }, { "cell_type": "markdown", - "id": "d788a748", + "id": "2e8aec71", "metadata": {}, "source": [ "## Exercise 42.2\n", @@ -1032,7 +1032,7 @@ } ], "metadata": { - "date": 1712122264.8224213, + "date": 1712983678.0713859, "filename": "simple_linear_regression.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/solow.ipynb b/_notebooks/solow.ipynb index 39748677..200ae718 100644 --- a/_notebooks/solow.ipynb +++ b/_notebooks/solow.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "7afd0714", + "id": "23ce9b31", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "616c8926", + "id": "ec55fd1c", "metadata": {}, "source": [ "# The Solow-Swan Growth Model\n", @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0d837bbc", + "id": "ef097886", "metadata": { "hide-output": false }, @@ -41,7 +41,7 @@ }, { "cell_type": "markdown", - "id": "f05479b6", + "id": "9af7cb1e", "metadata": {}, "source": [ "## The model\n", @@ -117,7 +117,7 @@ }, { "cell_type": "markdown", - "id": "c01913cf", + "id": "c2dc4dd7", "metadata": {}, "source": [ "## A graphical perspective\n", @@ -140,7 +140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aca26a65", + "id": "1216f92d", "metadata": { "hide-output": false }, @@ -153,7 +153,7 @@ }, { "cell_type": "markdown", - "id": "361e7488", + "id": "e20eb268", "metadata": {}, "source": [ "Now, we define the function $ g $." @@ -162,7 +162,7 @@ { "cell_type": "code", "execution_count": null, - "id": "62d188f5", + "id": "1d77ff56", "metadata": { "hide-output": false }, @@ -174,7 +174,7 @@ }, { "cell_type": "markdown", - "id": "485a35c9", + "id": "35fc7420", "metadata": {}, "source": [ "Let’s plot the 45 degree diagram of $ g $." @@ -183,7 +183,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df0982c2", + "id": "f49e138a", "metadata": { "hide-output": false }, @@ -232,7 +232,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2aa7b18d", + "id": "78a55ed5", "metadata": { "hide-output": false }, @@ -243,7 +243,7 @@ }, { "cell_type": "markdown", - "id": "8a6b821d", + "id": "e37595d6", "metadata": {}, "source": [ "Suppose, at some $ k_t $, the value $ g(k_t) $ lies strictly above the 45 degree line.\n", @@ -277,7 +277,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c7692ef3", + "id": "8e8fccc6", "metadata": { "hide-output": false }, @@ -289,7 +289,7 @@ }, { "cell_type": "markdown", - "id": "4068879a", + "id": "5906a2dd", "metadata": {}, "source": [ "From our graphical analysis, it appears that $ (k_t) $ converges to $ k^* $, regardless of initial capital\n", @@ -308,7 +308,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f3abc2b3", + "id": "b3ee99bc", "metadata": { "hide-output": false }, @@ -325,7 +325,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b0e03549", + "id": "e2c5dc47", "metadata": { "hide-output": false }, @@ -360,7 +360,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6966fd40", + "id": "3c111fc0", "metadata": { "hide-output": false }, @@ -371,7 +371,7 @@ }, { "cell_type": "markdown", - "id": "d3f9838e", + "id": "319bbe78", "metadata": {}, "source": [ "As expected, the time paths in the figure all converge to $ k^* $." @@ -379,7 +379,7 @@ }, { "cell_type": "markdown", - "id": "ee9af51b", + "id": "1bf16eb1", "metadata": {}, "source": [ "## Growth in continuous time\n", @@ -442,7 +442,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7504084d", + "id": "b381bd29", "metadata": { "hide-output": false }, @@ -453,7 +453,7 @@ }, { "cell_type": "markdown", - "id": "74cc0366", + "id": "3cebcf74", "metadata": {}, "source": [ "Next we define the function $ g $ for growth in continuous time" @@ -462,7 +462,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d8c4e72c", + "id": "c6171376", "metadata": { "hide-output": false }, @@ -475,7 +475,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2936a904", + "id": "df2924a0", "metadata": { "hide-output": false }, @@ -517,7 +517,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4adb2499", + "id": "cde7f35e", "metadata": { "hide-output": false }, @@ -529,7 +529,7 @@ }, { "cell_type": "markdown", - "id": "1963406b", + "id": "2809f905", "metadata": {}, "source": [ "This shows global stability heuristically for a fixed parameterization, but\n", @@ -591,7 +591,7 @@ }, { "cell_type": "markdown", - "id": "a151e038", + "id": "63b76bbe", "metadata": {}, "source": [ "## Exercises" @@ -599,7 +599,7 @@ }, { "cell_type": "markdown", - "id": "6af5c2c4", + "id": "7da9c8ed", "metadata": {}, "source": [ "## Exercise 21.1\n", @@ -615,7 +615,7 @@ }, { "cell_type": "markdown", - "id": "beabc853", + "id": "5a708fb2", "metadata": {}, "source": [ "## Solution to[ Exercise 21.1](https://intro.quantecon.org/#solow_ex1)\n", @@ -630,7 +630,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6c69e517", + "id": "861027b7", "metadata": { "hide-output": false }, @@ -644,7 +644,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2fb98a54", + "id": "57c3d7f1", "metadata": { "hide-output": false }, @@ -657,7 +657,7 @@ }, { "cell_type": "markdown", - "id": "c9319a54", + "id": "f5e8e203", "metadata": {}, "source": [ "Let’s find the value of $ s $ that maximizes $ c^* $ using [scipy.optimize.minimize_scalar](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize_scalar.html#scipy.optimize.minimize_scalar).\n", @@ -667,7 +667,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16cca4c3", + "id": "b21f6d29", "metadata": { "hide-output": false }, @@ -679,7 +679,7 @@ { "cell_type": "code", "execution_count": null, - "id": "79834eef", + "id": "d88f2e2d", "metadata": { "hide-output": false }, @@ -693,7 +693,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4842baa7", + "id": "621a2a04", "metadata": { "hide-output": false }, @@ -708,7 +708,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a8803e6d", + "id": "307e9198", "metadata": { "hide-output": false }, @@ -742,7 +742,7 @@ }, { "cell_type": "markdown", - "id": "8f05a904", + "id": "d3f96f4d", "metadata": {}, "source": [ "One can also try to solve this mathematically by differentiating $ c^*(s) $ and solve for $ \\frac{d}{ds}c^*(s)=0 $ using [sympy](https://www.sympy.org/en/index.html)." @@ -751,7 +751,7 @@ { "cell_type": "code", "execution_count": null, - "id": "13ed8a7d", + "id": "bef719ed", "metadata": { "hide-output": false }, @@ -763,7 +763,7 @@ { "cell_type": "code", "execution_count": null, - "id": "584ea76f", + "id": "2f11f2c3", "metadata": { "hide-output": false }, @@ -776,7 +776,7 @@ }, { "cell_type": "markdown", - "id": "6c98e567", + "id": "78f14fc6", "metadata": {}, "source": [ "Let’s differentiate $ c $ and solve using [sympy.solve](https://docs.sympy.org/latest/modules/solvers/solvers.html#sympy.solvers.solvers.solve)" @@ -785,7 +785,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53a974d4", + "id": "05046b24", "metadata": { "hide-output": false }, @@ -798,7 +798,7 @@ }, { "cell_type": "markdown", - "id": "5b99dbc0", + "id": "3839b268", "metadata": {}, "source": [ "Incidentally, the rate of savings which maximizes steady state level of per capita consumption is called the [Golden Rule savings rate](https://en.wikipedia.org/wiki/Golden_Rule_savings_rate)." @@ -806,7 +806,7 @@ }, { "cell_type": "markdown", - "id": "b700fd94", + "id": "b7c4d828", "metadata": {}, "source": [ "## Exercise 21.2\n", @@ -845,7 +845,7 @@ }, { "cell_type": "markdown", - "id": "779284e7", + "id": "6d7faf9e", "metadata": {}, "source": [ "## Solution to[ Exercise 21.2](https://intro.quantecon.org/#solow_ex2)\n", @@ -856,7 +856,7 @@ { "cell_type": "code", "execution_count": null, - "id": "334dd10f", + "id": "7569e609", "metadata": { "hide-output": false }, @@ -874,7 +874,7 @@ }, { "cell_type": "markdown", - "id": "00be6366", + "id": "9ced2605", "metadata": {}, "source": [ "Let’s define the function *k_next* to find the next value of $ k $" @@ -883,7 +883,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fe77962a", + "id": "b10e5947", "metadata": { "hide-output": false }, @@ -899,7 +899,7 @@ { "cell_type": "code", "execution_count": null, - "id": "933bbc35", + "id": "780c6279", "metadata": { "hide-output": false }, @@ -929,7 +929,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b1151d44", + "id": "04b7398d", "metadata": { "hide-output": false }, @@ -940,7 +940,7 @@ } ], "metadata": { - "date": 1712122264.8563306, + "date": 1712983678.0999646, "filename": "solow.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/status.ipynb b/_notebooks/status.ipynb index 88c13420..0464493e 100644 --- a/_notebooks/status.ipynb +++ b/_notebooks/status.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "9032e904", + "id": "40750c5c", "metadata": {}, "source": [ "# Execution Statistics\n", @@ -11,52 +11,52 @@ "\n", "[](https://intro.quantecon.org/ar1_processes.html)[](https://intro.quantecon.org/business_cycle.html)[](https://intro.quantecon.org/cagan_adaptive.html)[](https://intro.quantecon.org/cagan_ree.html)[](https://intro.quantecon.org/cobweb.html)[](https://intro.quantecon.org/commod_price.html)[](https://intro.quantecon.org/complex_and_trig.html)[](https://intro.quantecon.org/cons_smooth.html)[](https://intro.quantecon.org/eigen_I.html)[](https://intro.quantecon.org/eigen_II.html)[](https://intro.quantecon.org/equalizing_difference.html)[](https://intro.quantecon.org/geom_series.html)[](https://intro.quantecon.org/heavy_tails.html)[](https://intro.quantecon.org/inequality.html)[](https://intro.quantecon.org/inflation_history.html)[](https://intro.quantecon.org/input_output.html)[](https://intro.quantecon.org/intro.html)[](https://intro.quantecon.org/intro_supply_demand.html)[](https://intro.quantecon.org/laffer_adaptive.html)[](https://intro.quantecon.org/lake_model.html)[](https://intro.quantecon.org/linear_equations.html)[](https://intro.quantecon.org/lln_clt.html)[](https://intro.quantecon.org/long_run_growth.html)[](https://intro.quantecon.org/lp_intro.html)[](https://intro.quantecon.org/markov_chains_I.html)[](https://intro.quantecon.org/markov_chains_II.html)[](https://intro.quantecon.org/mle.html)[](https://intro.quantecon.org/money_inflation.html)[](https://intro.quantecon.org/money_inflation_nonlinear.html)[](https://intro.quantecon.org/monte_carlo.html)[](https://intro.quantecon.org/networks.html)[](https://intro.quantecon.org/olg.html)[](https://intro.quantecon.org/prob_dist.html)[](https://intro.quantecon.org/pv.html)[](https://intro.quantecon.org/scalar_dynam.html)[](https://intro.quantecon.org/schelling.html)[](https://intro.quantecon.org/short_path.html)[](https://intro.quantecon.org/simple_linear_regression.html)[](https://intro.quantecon.org/solow.html)[](https://intro.quantecon.org/.html)[](https://intro.quantecon.org/supply_demand_heterogeneity.html)[](https://intro.quantecon.org/supply_demand_multiple_goods.html)[](https://intro.quantecon.org/time_series_with_matrices.html)[](https://intro.quantecon.org/troubleshooting.html)[](https://intro.quantecon.org/unpleasant.html)[](https://intro.quantecon.org/zreferences.html)|Document|Modified|Method|Run Time (s)|Status|\n", "|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|\n", - "|ar1_processes|2024-04-03 04:28|cache|6.57|✅|\n", - "|business_cycle|2024-04-03 04:29|cache|14.11|✅|\n", - "|cagan_adaptive|2024-04-03 04:29|cache|2.65|✅|\n", - "|cagan_ree|2024-04-03 04:29|cache|3.39|✅|\n", - "|cobweb|2024-04-03 04:29|cache|2.64|✅|\n", - "|commod_price|2024-04-03 04:29|cache|20.55|✅|\n", - "|complex_and_trig|2024-04-03 04:29|cache|2.42|✅|\n", - "|cons_smooth|2024-04-03 04:29|cache|2.91|✅|\n", - "|eigen_I|2024-04-03 04:29|cache|4.74|✅|\n", - "|eigen_II|2024-04-03 04:29|cache|7.78|✅|\n", - "|equalizing_difference|2024-04-03 04:29|cache|2.28|✅|\n", - "|geom_series|2024-04-03 04:29|cache|2.85|✅|\n", - "|heavy_tails|2024-04-03 04:30|cache|16.19|✅|\n", - "|inequality|2024-04-03 04:30|cache|31.11|✅|\n", - "|inflation_history|2024-04-03 04:30|cache|9.87|✅|\n", - "|input_output|2024-04-03 04:31|cache|13.17|✅|\n", - "|intro|2024-04-03 04:31|cache|0.93|✅|\n", - "|intro_supply_demand|2024-04-03 04:31|cache|2.65|✅|\n", - "|laffer_adaptive|2024-04-03 04:31|cache|2.35|✅|\n", - "|lake_model|2024-04-03 04:31|cache|2.52|✅|\n", - "|linear_equations|2024-04-03 04:31|cache|2.14|✅|\n", - "|lln_clt|2024-04-03 04:33|cache|150.96|✅|\n", - "|long_run_growth|2024-04-03 04:34|cache|9.89|✅|\n", - "|lp_intro|2024-04-03 04:34|cache|7.0|✅|\n", - "|markov_chains_I|2024-04-03 04:34|cache|9.72|✅|\n", - "|markov_chains_II|2024-04-03 04:34|cache|6.66|✅|\n", - "|mle|2024-04-03 04:34|cache|7.77|✅|\n", - "|money_inflation|2024-04-03 04:34|cache|2.94|✅|\n", - "|money_inflation_nonlinear|2024-04-03 04:34|cache|2.13|✅|\n", - "|monte_carlo|2024-04-03 04:34|cache|16.07|✅|\n", - "|networks|2024-04-03 04:35|cache|8.85|✅|\n", - "|olg|2024-04-03 04:35|cache|2.69|✅|\n", - "|prob_dist|2024-04-03 04:35|cache|8.61|✅|\n", - "|pv|2024-04-03 04:35|cache|1.56|✅|\n", - "|scalar_dynam|2024-04-03 04:35|cache|2.99|✅|\n", - "|schelling|2024-04-03 04:35|cache|11.91|✅|\n", - "|short_path|2024-04-03 04:35|cache|0.93|✅|\n", - "|simple_linear_regression|2024-04-03 04:35|cache|4.78|✅|\n", - "|solow|2024-04-03 04:35|cache|3.85|✅|\n", - "|status|2024-04-03 04:35|cache|4.96|✅|\n", - "|supply_demand_heterogeneity|2024-04-03 04:35|cache|0.92|✅|\n", - "|supply_demand_multiple_goods|2024-04-03 04:35|cache|1.83|✅|\n", - "|time_series_with_matrices|2024-04-03 04:35|cache|2.77|✅|\n", - "|troubleshooting|2024-04-03 04:31|cache|0.93|✅|\n", - "|unpleasant|2024-04-03 04:35|cache|1.61|✅|\n", - "|zreferences|2024-04-03 04:31|cache|0.93|✅|\n", + "|ar1_processes|2024-04-12 00:25|cache|6.86|✅|\n", + "|business_cycle|2024-04-12 00:25|cache|14.51|✅|\n", + "|cagan_adaptive|2024-04-12 00:26|cache|2.69|✅|\n", + "|cagan_ree|2024-04-12 00:26|cache|3.75|✅|\n", + "|cobweb|2024-04-12 00:26|cache|3.09|✅|\n", + "|commod_price|2024-04-12 00:26|cache|20.51|✅|\n", + "|complex_and_trig|2024-04-12 00:26|cache|2.44|✅|\n", + "|cons_smooth|2024-04-12 00:26|cache|3.07|✅|\n", + "|eigen_I|2024-04-12 00:26|cache|4.87|✅|\n", + "|eigen_II|2024-04-12 00:26|cache|8.1|✅|\n", + "|equalizing_difference|2024-04-12 00:26|cache|2.26|✅|\n", + "|geom_series|2024-04-12 00:26|cache|2.93|✅|\n", + "|heavy_tails|2024-04-12 00:27|cache|16.18|✅|\n", + "|inequality|2024-04-12 00:27|cache|31.53|✅|\n", + "|inflation_history|2024-04-12 00:27|cache|9.15|✅|\n", + "|input_output|2024-04-12 00:28|cache|14.14|✅|\n", + "|intro|2024-04-12 00:28|cache|0.96|✅|\n", + "|intro_supply_demand|2024-04-12 00:28|cache|2.75|✅|\n", + "|laffer_adaptive|2024-04-12 00:28|cache|2.34|✅|\n", + "|lake_model|2024-04-12 00:28|cache|2.62|✅|\n", + "|linear_equations|2024-04-12 00:28|cache|2.0|✅|\n", + "|lln_clt|2024-04-12 00:30|cache|151.54|✅|\n", + "|long_run_growth|2024-04-12 00:30|cache|8.17|✅|\n", + "|lp_intro|2024-04-12 00:31|cache|6.85|✅|\n", + "|markov_chains_I|2024-04-12 00:31|cache|9.49|✅|\n", + "|markov_chains_II|2024-04-12 00:31|cache|6.6|✅|\n", + "|mle|2024-04-12 00:31|cache|6.93|✅|\n", + "|money_inflation|2024-04-12 00:31|cache|2.99|✅|\n", + "|money_inflation_nonlinear|2024-04-12 00:31|cache|2.27|✅|\n", + "|monte_carlo|2024-04-12 00:34|cache|192.43|✅|\n", + "|networks|2024-04-12 00:34|cache|9.2|✅|\n", + "|olg|2024-04-12 00:34|cache|2.52|✅|\n", + "|prob_dist|2024-04-12 00:35|cache|8.48|✅|\n", + "|pv|2024-04-12 00:35|cache|1.56|✅|\n", + "|scalar_dynam|2024-04-12 00:35|cache|2.92|✅|\n", + "|schelling|2024-04-12 00:35|cache|12.03|✅|\n", + "|short_path|2024-04-12 00:35|cache|1.06|✅|\n", + "|simple_linear_regression|2024-04-12 00:35|cache|4.22|✅|\n", + "|solow|2024-04-12 00:35|cache|3.92|✅|\n", + "|status|2024-04-12 00:35|cache|4.95|✅|\n", + "|supply_demand_heterogeneity|2024-04-12 00:35|cache|1.12|✅|\n", + "|supply_demand_multiple_goods|2024-04-12 00:35|cache|1.87|✅|\n", + "|time_series_with_matrices|2024-04-12 00:35|cache|2.57|✅|\n", + "|troubleshooting|2024-04-12 00:28|cache|0.96|✅|\n", + "|unpleasant|2024-04-12 00:35|cache|1.68|✅|\n", + "|zreferences|2024-04-12 00:28|cache|0.96|✅|\n", "\n", "\n", "These lectures are built on `linux` instances through `github actions`.\n", @@ -67,7 +67,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0999a027", + "id": "1ecd7e00", "metadata": { "hide-output": false }, @@ -78,7 +78,7 @@ }, { "cell_type": "markdown", - "id": "2ffe5ee2", + "id": "8b2004dd", "metadata": {}, "source": [ "and the following package versions" @@ -87,7 +87,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ac8dcea6", + "id": "090d2ab1", "metadata": { "hide-output": false }, @@ -98,7 +98,7 @@ } ], "metadata": { - "date": 1712122264.8806264, + "date": 1712983678.1205454, "filename": "status.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/supply_demand_heterogeneity.ipynb b/_notebooks/supply_demand_heterogeneity.ipynb index abe48854..648db4d1 100644 --- a/_notebooks/supply_demand_heterogeneity.ipynb +++ b/_notebooks/supply_demand_heterogeneity.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "a9197787", + "id": "38fed684", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "16a76f15", + "id": "a454db93", "metadata": {}, "source": [ "# Market Equilibrium with Heterogeneity" @@ -19,7 +19,7 @@ }, { "cell_type": "markdown", - "id": "5101fa3f", + "id": "6ba8c72b", "metadata": {}, "source": [ "## Overview\n", @@ -42,7 +42,7 @@ { "cell_type": "code", "execution_count": null, - "id": "08404893", + "id": "076c480a", "metadata": { "hide-output": false }, @@ -54,7 +54,7 @@ }, { "cell_type": "markdown", - "id": "ec2a7e91", + "id": "ed840508", "metadata": {}, "source": [ "## An simple example\n", @@ -105,7 +105,7 @@ }, { "cell_type": "markdown", - "id": "d41e9444", + "id": "5b508f99", "metadata": {}, "source": [ "## Exercise 41.1\n", @@ -131,7 +131,7 @@ }, { "cell_type": "markdown", - "id": "0c8f86c0", + "id": "b8504044", "metadata": {}, "source": [ "## Pure exchange economy\n", @@ -141,7 +141,7 @@ }, { "cell_type": "markdown", - "id": "0f68a6e3", + "id": "b7985a22", "metadata": {}, "source": [ "### Competitive equilibrium\n", @@ -173,7 +173,7 @@ }, { "cell_type": "markdown", - "id": "fae4d6cd", + "id": "f819ab33", "metadata": {}, "source": [ "### Designing some Python code\n", @@ -207,7 +207,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bf54826c", + "id": "c1bbfc58", "metadata": { "hide-output": false }, @@ -283,7 +283,7 @@ }, { "cell_type": "markdown", - "id": "42fded04", + "id": "fea83659", "metadata": {}, "source": [ "## Implementation\n", @@ -297,7 +297,7 @@ }, { "cell_type": "markdown", - "id": "cca0c17c", + "id": "db8db315", "metadata": {}, "source": [ "### Two-person economy without production\n", @@ -308,7 +308,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53d70909", + "id": "b12c96d9", "metadata": { "hide-output": false }, @@ -332,7 +332,7 @@ }, { "cell_type": "markdown", - "id": "8740b1d2", + "id": "8771b3b0", "metadata": {}, "source": [ "What happens if the first consumer likes the first good more and the second consumer likes the second good more?" @@ -341,7 +341,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ec9ea8e2", + "id": "eb2dea40", "metadata": { "hide-output": false }, @@ -358,7 +358,7 @@ }, { "cell_type": "markdown", - "id": "75a4eb51", + "id": "b3a82612", "metadata": {}, "source": [ "Let the first consumer be poorer." @@ -367,7 +367,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a65badfc", + "id": "f2a91777", "metadata": { "hide-output": false }, @@ -384,7 +384,7 @@ }, { "cell_type": "markdown", - "id": "ea1615e1", + "id": "4f42a963", "metadata": {}, "source": [ "Now let’s construct an autarky (i.e., no-trade) equilibrium." @@ -393,7 +393,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d174dbd6", + "id": "f80fac34", "metadata": { "hide-output": false }, @@ -413,7 +413,7 @@ }, { "cell_type": "markdown", - "id": "f22cee89", + "id": "afa6c1af", "metadata": {}, "source": [ "Now let’s redistribute endowments before trade." @@ -422,7 +422,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15ee2206", + "id": "c206faf0", "metadata": { "hide-output": false }, @@ -444,7 +444,7 @@ }, { "cell_type": "markdown", - "id": "fce8e9c4", + "id": "32cf436e", "metadata": {}, "source": [ "### A dynamic economy\n", @@ -455,7 +455,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fbb0f3bf", + "id": "70542e44", "metadata": { "hide-output": false }, @@ -479,7 +479,7 @@ }, { "cell_type": "markdown", - "id": "e55818b6", + "id": "1f242403", "metadata": {}, "source": [ "### Risk economy with arrow securities\n", @@ -490,7 +490,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c23f87a7", + "id": "26a5e6ca", "metadata": { "hide-output": false }, @@ -516,7 +516,7 @@ }, { "cell_type": "markdown", - "id": "bbfb49d9", + "id": "baabf5d5", "metadata": {}, "source": [ "## Deducing a representative consumer\n", @@ -599,7 +599,7 @@ } ], "metadata": { - "date": 1712122264.8971968, + "date": 1712983678.1358454, "filename": "supply_demand_heterogeneity.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/supply_demand_multiple_goods.ipynb b/_notebooks/supply_demand_multiple_goods.ipynb index 96915e08..cff08f4a 100644 --- a/_notebooks/supply_demand_multiple_goods.ipynb +++ b/_notebooks/supply_demand_multiple_goods.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "41874306", + "id": "9911b5b7", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "c745eb19", + "id": "e3d8a6c5", "metadata": {}, "source": [ "# Supply and Demand with Many Goods" @@ -19,7 +19,7 @@ }, { "cell_type": "markdown", - "id": "32cab300", + "id": "96b1dfd4", "metadata": {}, "source": [ "## Overview\n", @@ -68,7 +68,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c7162d24", + "id": "ae259bf7", "metadata": { "hide-output": false }, @@ -82,7 +82,7 @@ }, { "cell_type": "markdown", - "id": "73125e3b", + "id": "a287d21b", "metadata": {}, "source": [ "## Formulas from linear algebra\n", @@ -111,7 +111,7 @@ }, { "cell_type": "markdown", - "id": "a162f9f8", + "id": "0b5a41a9", "metadata": {}, "source": [ "## From utility function to demand curve\n", @@ -173,7 +173,7 @@ }, { "cell_type": "markdown", - "id": "67079c46", + "id": "6a577071", "metadata": {}, "source": [ "### Demand curve implied by constrained utility maximization\n", @@ -230,7 +230,7 @@ }, { "cell_type": "markdown", - "id": "03d572da", + "id": "03271dc7", "metadata": {}, "source": [ "## Endowment economy\n", @@ -260,7 +260,7 @@ }, { "cell_type": "markdown", - "id": "9f228f8a", + "id": "0e0a2d13", "metadata": {}, "source": [ "## Exercise 40.1\n", @@ -270,7 +270,7 @@ }, { "cell_type": "markdown", - "id": "f36dfbdc", + "id": "19635733", "metadata": {}, "source": [ "## Exercise 40.2\n", @@ -284,7 +284,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3cd9d7e9", + "id": "8d63c921", "metadata": { "hide-output": false }, @@ -338,7 +338,7 @@ }, { "cell_type": "markdown", - "id": "8bcf58ae", + "id": "4e1f0b5a", "metadata": {}, "source": [ "## Digression: Marshallian and Hicksian demand curves\n", @@ -382,7 +382,7 @@ }, { "cell_type": "markdown", - "id": "54ed4c10", + "id": "18828359", "metadata": {}, "source": [ "## Dynamics and risk as special cases\n", @@ -398,7 +398,7 @@ }, { "cell_type": "markdown", - "id": "c007470a", + "id": "a1e92922", "metadata": {}, "source": [ "### Dynamics\n", @@ -455,7 +455,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35d39493", + "id": "23c8911a", "metadata": { "hide-output": false }, @@ -479,7 +479,7 @@ }, { "cell_type": "markdown", - "id": "5b440007", + "id": "ef205f0b", "metadata": {}, "source": [ "### Risk and state-contingent claims\n", @@ -550,7 +550,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3a9f70b8", + "id": "804daa5a", "metadata": { "hide-output": false }, @@ -574,7 +574,7 @@ }, { "cell_type": "markdown", - "id": "a8d01808", + "id": "e0e3ec96", "metadata": {}, "source": [ "### Exercise 40.3\n", @@ -593,7 +593,7 @@ }, { "cell_type": "markdown", - "id": "8e174b34", + "id": "d0fa75b8", "metadata": {}, "source": [ "### Solution to[ Exercise 40.3](https://intro.quantecon.org/#sdm_ex3)\n", @@ -606,7 +606,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f1402ff", + "id": "b5f4666b", "metadata": { "hide-output": false }, @@ -622,7 +622,7 @@ }, { "cell_type": "markdown", - "id": "6ff69cda", + "id": "4c514403", "metadata": {}, "source": [ "If the consumer likes the first (or second) good more, then we can set a larger bliss value for good 1." @@ -631,7 +631,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f5bd4c2f", + "id": "3e2f3ae1", "metadata": { "hide-output": false }, @@ -646,7 +646,7 @@ }, { "cell_type": "markdown", - "id": "3e76488a", + "id": "99f74ecf", "metadata": {}, "source": [ "Increase the probability that state $ 1 $ occurs." @@ -655,7 +655,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5d281897", + "id": "1715069d", "metadata": { "hide-output": false }, @@ -679,7 +679,7 @@ }, { "cell_type": "markdown", - "id": "99725817", + "id": "08a061c3", "metadata": {}, "source": [ "## Economies with endogenous supplies of goods\n", @@ -689,7 +689,7 @@ }, { "cell_type": "markdown", - "id": "1e0712c7", + "id": "5df63144", "metadata": {}, "source": [ "### Supply curve of a competitive firm\n", @@ -741,7 +741,7 @@ }, { "cell_type": "markdown", - "id": "04689ca6", + "id": "1f78d4f3", "metadata": {}, "source": [ "### Competitive equilibrium\n", @@ -753,7 +753,7 @@ }, { "cell_type": "markdown", - "id": "e1c56204", + "id": "19802c13", "metadata": {}, "source": [ "#### $ \\mu=1 $ warmup\n", @@ -779,7 +779,7 @@ }, { "cell_type": "markdown", - "id": "130d2f74", + "id": "7b177be5", "metadata": {}, "source": [ "#### General $ \\mu\\neq 1 $ case\n", @@ -807,7 +807,7 @@ }, { "cell_type": "markdown", - "id": "e7266bb5", + "id": "365d1693", "metadata": {}, "source": [ "### Implementation\n", @@ -829,7 +829,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15a34827", + "id": "3c71fbb6", "metadata": { "hide-output": false }, @@ -900,7 +900,7 @@ }, { "cell_type": "markdown", - "id": "84dde31d", + "id": "dd476aa2", "metadata": {}, "source": [ "Then define a function that plots demand and supply curves and labels surpluses and equilibrium." @@ -909,7 +909,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a05bee5f", + "id": "049b034b", "metadata": { "hide-output": false }, @@ -962,7 +962,7 @@ }, { "cell_type": "markdown", - "id": "54f526a6", + "id": "1aa59944", "metadata": {}, "source": [ "#### Example: single agent with one good and production\n", @@ -980,7 +980,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1606c6cb", + "id": "70da1ec6", "metadata": { "hide-output": false }, @@ -1005,7 +1005,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0c0acaf3", + "id": "d0fe85f2", "metadata": { "hide-output": false }, @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "7edee8bd", + "id": "0db6b64d", "metadata": {}, "source": [ "Let’s give the consumer a lower welfare weight by raising $ \\mu $." @@ -1028,7 +1028,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6bb6accf", + "id": "c0020446", "metadata": { "hide-output": false }, @@ -1047,7 +1047,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c8b8be84", + "id": "2395a7ec", "metadata": { "hide-output": false }, @@ -1061,7 +1061,7 @@ }, { "cell_type": "markdown", - "id": "8b630e87", + "id": "3663fe6e", "metadata": {}, "source": [ "Now we change the bliss point so that the consumer derives more utility from consumption." @@ -1070,7 +1070,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f7c50226", + "id": "0cbca2a8", "metadata": { "hide-output": false }, @@ -1089,7 +1089,7 @@ }, { "cell_type": "markdown", - "id": "5c0255a9", + "id": "063ae845", "metadata": {}, "source": [ "This raises both the equilibrium price and quantity." @@ -1097,7 +1097,7 @@ }, { "cell_type": "markdown", - "id": "1ff09dc9", + "id": "a9577e2c", "metadata": {}, "source": [ "#### Example: single agent two-good economy with production\n", @@ -1109,7 +1109,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5b99391", + "id": "1a28bba4", "metadata": { "hide-output": false }, @@ -1136,7 +1136,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8edd4563", + "id": "b35c032b", "metadata": { "hide-output": false }, @@ -1153,7 +1153,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d617ee00", + "id": "c9efeb46", "metadata": { "hide-output": false }, @@ -1173,7 +1173,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bea7413c", + "id": "9289ec49", "metadata": { "hide-output": false }, @@ -1188,7 +1188,7 @@ }, { "cell_type": "markdown", - "id": "46a14728", + "id": "e036f06d", "metadata": {}, "source": [ "### Digression: a supplier who is a monopolist\n", @@ -1229,7 +1229,7 @@ }, { "cell_type": "markdown", - "id": "feab820b", + "id": "d386b34d", "metadata": {}, "source": [ "### Exercise 40.4\n", @@ -1239,7 +1239,7 @@ }, { "cell_type": "markdown", - "id": "8ea88343", + "id": "519d82ee", "metadata": {}, "source": [ "### A monopolist\n", @@ -1278,7 +1278,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5c13392c", + "id": "9d37134f", "metadata": { "hide-output": false }, @@ -1319,7 +1319,7 @@ }, { "cell_type": "markdown", - "id": "fcda08bd", + "id": "05669852", "metadata": {}, "source": [ "Define a function that plots the demand, marginal cost and marginal revenue curves with surpluses and equilibrium labelled." @@ -1328,7 +1328,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7bbd3f67", + "id": "c91dcf1e", "metadata": { "hide-output": false }, @@ -1391,7 +1391,7 @@ }, { "cell_type": "markdown", - "id": "b895502e", + "id": "a3512f72", "metadata": {}, "source": [ "#### A multiple good example\n", @@ -1402,7 +1402,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01128d43", + "id": "12491103", "metadata": { "hide-output": false }, @@ -1432,7 +1432,7 @@ }, { "cell_type": "markdown", - "id": "b0c6efaf", + "id": "bb6b9d78", "metadata": {}, "source": [ "#### A single-good example" @@ -1441,7 +1441,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14d8cb82", + "id": "7ac3ac4b", "metadata": { "hide-output": false }, @@ -1469,7 +1469,7 @@ }, { "cell_type": "markdown", - "id": "40850eb5", + "id": "62fa51fd", "metadata": {}, "source": [ "## Multi-good welfare maximization problem\n", @@ -1515,7 +1515,7 @@ } ], "metadata": { - "date": 1712122264.9449694, + "date": 1712983678.4341943, "filename": "supply_demand_multiple_goods.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/time_series_with_matrices.ipynb b/_notebooks/time_series_with_matrices.ipynb index 08ba7335..698dfc5b 100644 --- a/_notebooks/time_series_with_matrices.ipynb +++ b/_notebooks/time_series_with_matrices.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "04306de8", + "id": "0dece904", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "5f410446", + "id": "c8a5f6a6", "metadata": {}, "source": [ "# Univariate Time Series with Matrix Algebra" @@ -19,7 +19,7 @@ }, { "cell_type": "markdown", - "id": "a8f02c21", + "id": "cecbe0f3", "metadata": {}, "source": [ "## Overview\n", @@ -50,7 +50,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bbe22aa9", + "id": "574819b6", "metadata": { "hide-output": false }, @@ -65,7 +65,7 @@ }, { "cell_type": "markdown", - "id": "2917d4cc", + "id": "55369ab5", "metadata": {}, "source": [ "## Samuelson’s model\n", @@ -154,7 +154,7 @@ { "cell_type": "code", "execution_count": null, - "id": "366c0d1f", + "id": "c23cc305", "metadata": { "hide-output": false }, @@ -173,7 +173,7 @@ }, { "cell_type": "markdown", - "id": "1ab96f72", + "id": "af7e46b5", "metadata": {}, "source": [ "Now we construct $ A $ and $ b $." @@ -182,7 +182,7 @@ { "cell_type": "code", "execution_count": null, - "id": "33d5044c", + "id": "01feef01", "metadata": { "hide-output": false }, @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "f2d21d36", + "id": "0c8626d3", "metadata": {}, "source": [ "Let’s look at the matrix $ A $ and the vector $ b $ for our\n", @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9de20c2", + "id": "a1ff90f3", "metadata": { "hide-output": false }, @@ -226,7 +226,7 @@ }, { "cell_type": "markdown", - "id": "f163393b", + "id": "d950b259", "metadata": {}, "source": [ "Now let’s solve for the path of $ y $.\n", @@ -240,7 +240,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6744dde6", + "id": "94fba3f6", "metadata": { "hide-output": false }, @@ -253,7 +253,7 @@ }, { "cell_type": "markdown", - "id": "e2dfc7c0", + "id": "e4e75ceb", "metadata": {}, "source": [ "or we can use `np.linalg.solve`:" @@ -262,7 +262,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ec904151", + "id": "747a45d9", "metadata": { "hide-output": false }, @@ -273,7 +273,7 @@ }, { "cell_type": "markdown", - "id": "7d31bc83", + "id": "ab50af13", "metadata": {}, "source": [ "Here make sure the two methods give the same result, at least up to floating\n", @@ -283,7 +283,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c6c48840", + "id": "8de4f523", "metadata": { "hide-output": false }, @@ -294,7 +294,7 @@ }, { "cell_type": "markdown", - "id": "5a61d466", + "id": "41ad81d4", "metadata": {}, "source": [ ">**Note**\n", @@ -311,7 +311,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07ef2590", + "id": "dd030238", "metadata": { "hide-output": false }, @@ -326,7 +326,7 @@ }, { "cell_type": "markdown", - "id": "6a8a2446", + "id": "165beb0b", "metadata": {}, "source": [ "The **steady state** value $ y^* $ of $ y_t $ is obtained by setting $ y_t = y_{t-1} =\n", @@ -343,7 +343,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c76b436a", + "id": "715fa144", "metadata": { "hide-output": false }, @@ -361,7 +361,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7d3331a2", + "id": "18e78049", "metadata": { "hide-output": false }, @@ -373,7 +373,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7644f79e", + "id": "1ba5584f", "metadata": { "hide-output": false }, @@ -388,7 +388,7 @@ }, { "cell_type": "markdown", - "id": "5aa26aa6", + "id": "740fc0ed", "metadata": {}, "source": [ "## Adding a random term\n", @@ -444,7 +444,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53278e0d", + "id": "9f71710a", "metadata": { "hide-output": false }, @@ -456,7 +456,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47a842b9", + "id": "98d03dfa", "metadata": { "hide-output": false }, @@ -469,7 +469,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5662eda3", + "id": "8e81c624", "metadata": { "hide-output": false }, @@ -484,7 +484,7 @@ }, { "cell_type": "markdown", - "id": "54d16bcf", + "id": "c6869e01", "metadata": {}, "source": [ "The above time series looks a lot like (detrended) GDP series for a\n", @@ -496,7 +496,7 @@ { "cell_type": "code", "execution_count": null, - "id": "41a5607f", + "id": "9f78455c", "metadata": { "hide-output": false }, @@ -518,7 +518,7 @@ }, { "cell_type": "markdown", - "id": "0a86335e", + "id": "ee6151d1", "metadata": {}, "source": [ "Also consider the case when $ y_{0} $ and $ y_{-1} $ are at\n", @@ -528,7 +528,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cc92f03d", + "id": "ccc7c86f", "metadata": { "hide-output": false }, @@ -550,7 +550,7 @@ }, { "cell_type": "markdown", - "id": "8d1b88c0", + "id": "f5b47aad", "metadata": {}, "source": [ "## Computing population moments\n", @@ -596,7 +596,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff1ba0fd", + "id": "728c0c67", "metadata": { "hide-output": false }, @@ -663,7 +663,7 @@ }, { "cell_type": "markdown", - "id": "0a367d73", + "id": "37d48302", "metadata": {}, "source": [ "It is enlightening to study the $ \\mu_y, \\Sigma_y $’s implied by various parameter values.\n", @@ -676,7 +676,7 @@ { "cell_type": "code", "execution_count": null, - "id": "934897fc", + "id": "2bd24c4e", "metadata": { "hide-output": false }, @@ -699,7 +699,7 @@ }, { "cell_type": "markdown", - "id": "b008372b", + "id": "3e46dd71", "metadata": {}, "source": [ "Visually, notice how the variance across realizations of $ y_t $ decreases as $ t $ increases.\n", @@ -710,7 +710,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e9d8e73f", + "id": "f8de1eda", "metadata": { "hide-output": false }, @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "5c962b8f", + "id": "fd302724", "metadata": {}, "source": [ "Notice how the population variance increases and asymptotes\n", @@ -734,7 +734,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f0328630", + "id": "359e5421", "metadata": { "hide-output": false }, @@ -749,7 +749,7 @@ }, { "cell_type": "markdown", - "id": "bb0f57e4", + "id": "3f03586a", "metadata": {}, "source": [ "Notice that the covariance between $ y_t $ and $ y_{t-1} $ – the elements on the superdiagonal – are **not** identical.\n", @@ -766,7 +766,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5cf87ce8", + "id": "cd8c04ad", "metadata": { "hide-output": false }, @@ -778,7 +778,7 @@ }, { "cell_type": "markdown", - "id": "882d1e54", + "id": "e20d0f34", "metadata": {}, "source": [ "Please notice how the sub diagonal and super diagonal elements seem to have converged.\n", @@ -792,7 +792,7 @@ }, { "cell_type": "markdown", - "id": "157de6ad", + "id": "a78020cd", "metadata": {}, "source": [ "## Moving average representation\n", @@ -810,7 +810,7 @@ { "cell_type": "code", "execution_count": null, - "id": "482aa130", + "id": "fd64973c", "metadata": { "hide-output": false }, @@ -822,7 +822,7 @@ }, { "cell_type": "markdown", - "id": "0245eb09", + "id": "c09029e5", "metadata": {}, "source": [ "Evidently, $ A^{-1} $ is a lower triangular matrix.\n", @@ -833,7 +833,7 @@ { "cell_type": "code", "execution_count": null, - "id": "580fa6c6", + "id": "c5f9e6be", "metadata": { "hide-output": false }, @@ -845,7 +845,7 @@ }, { "cell_type": "markdown", - "id": "35d429c2", + "id": "90dc7363", "metadata": {}, "source": [ "Notice how every row ends with the previous row’s pre-diagonal entries.\n", @@ -872,7 +872,7 @@ }, { "cell_type": "markdown", - "id": "267f4e52", + "id": "222b67c1", "metadata": {}, "source": [ "## A forward looking model\n", @@ -935,7 +935,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0524e0af", + "id": "7333c519", "metadata": { "hide-output": false }, @@ -947,7 +947,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51868484", + "id": "58371098", "metadata": { "hide-output": false }, @@ -963,7 +963,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72d12e95", + "id": "d97feda1", "metadata": { "hide-output": false }, @@ -975,7 +975,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f20a2ae", + "id": "e305e078", "metadata": { "hide-output": false }, @@ -990,7 +990,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad25620a", + "id": "90b803a7", "metadata": { "hide-output": false }, @@ -1002,7 +1002,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b26cc7bd", + "id": "421a5c70", "metadata": { "hide-output": false }, @@ -1019,7 +1019,7 @@ }, { "cell_type": "markdown", - "id": "a625881b", + "id": "8cf63beb", "metadata": {}, "source": [ "Can you explain why the trend of the price is downward over time?\n", @@ -1031,7 +1031,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e0b46ac2", + "id": "cc191d8e", "metadata": { "hide-output": false }, @@ -1050,7 +1050,7 @@ } ], "metadata": { - "date": 1712122264.9799795, + "date": 1712983678.4666362, "filename": "time_series_with_matrices.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/troubleshooting.ipynb b/_notebooks/troubleshooting.ipynb index e2020dd2..59f7238b 100644 --- a/_notebooks/troubleshooting.ipynb +++ b/_notebooks/troubleshooting.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "70da64e1", + "id": "e0bce0a3", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "fbef0705", + "id": "d9be361c", "metadata": {}, "source": [ "# Troubleshooting\n", @@ -21,7 +21,7 @@ }, { "cell_type": "markdown", - "id": "0ccaf0ef", + "id": "decd5afb", "metadata": {}, "source": [ "## Fixing your local environment\n", @@ -63,7 +63,7 @@ }, { "cell_type": "markdown", - "id": "5ef5ec22", + "id": "986682f4", "metadata": {}, "source": [ "## Reporting an issue\n", @@ -80,7 +80,7 @@ } ], "metadata": { - "date": 1712122264.9864793, + "date": 1712983678.4727461, "filename": "troubleshooting.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/unpleasant.ipynb b/_notebooks/unpleasant.ipynb index 546a675d..703cc178 100644 --- a/_notebooks/unpleasant.ipynb +++ b/_notebooks/unpleasant.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "324a9645", + "id": "52d69426", "metadata": {}, "source": [ "# Unpleasant Monetarist Arithmetic" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "84a9d66e", + "id": "26b140f9", "metadata": {}, "source": [ "## Overview\n", @@ -46,7 +46,7 @@ }, { "cell_type": "markdown", - "id": "c54fae8e", + "id": "f26dd899", "metadata": {}, "source": [ "## Setup\n", @@ -86,7 +86,7 @@ }, { "cell_type": "markdown", - "id": "4bd8ee43", + "id": "0b6c8016", "metadata": {}, "source": [ "## Monetary-Fiscal Policy\n", @@ -110,7 +110,7 @@ }, { "cell_type": "markdown", - "id": "bcabb949", + "id": "6406f1b7", "metadata": {}, "source": [ "### Open market operations\n", @@ -137,7 +137,7 @@ }, { "cell_type": "markdown", - "id": "fd7394e8", + "id": "ae9ec534", "metadata": {}, "source": [ "## An open market operation at $ t=0 $\n", @@ -176,14 +176,19 @@ "$$\n", "\n", "We want to compute an equilibrium $ \\{p_t,m_t,b_t, R_t\\}_{t=0} $ sequence under this scheme for\n", - "running monetary-fiscal policy.\n", + "running monetary and fiscal policies.\n", "\n", - "**TOM: add definitions of monetary and fiscal policy and coordination here.**" + "Here, by **fiscal policy** we mean the collection of actions that determine a sequence of net-of-interest government deficits $ \\{g_t\\}_{t=0}^\\infty $ that must be financed by issuing to the public either money or interest bearing bonds.\n", + "\n", + "By **monetary policy** or **debt-management polcy**, we mean the collection of actions that determine how the government divides its portolio of debts to the public between interest-bearing parts (government bonds) and non-interest-bearing parts (money).\n", + "\n", + "By an **open market operation**, we mean a government monetary policy action in which the government\n", + "(or its delegate, say, a central bank) either buys government bonds from the public for newly issued money, or sells bonds to the public and withdraws the money it receives from public circulation." ] }, { "cell_type": "markdown", - "id": "5b53421e", + "id": "7b6e9f91", "metadata": {}, "source": [ "## Algorithm (basic idea)\n", @@ -229,7 +234,7 @@ }, { "cell_type": "markdown", - "id": "d5f713e4", + "id": "edba7ff5", "metadata": {}, "source": [ "## Before time $ T $\n", @@ -286,7 +291,7 @@ }, { "cell_type": "markdown", - "id": "01ca53ae", + "id": "3d9705af", "metadata": {}, "source": [ "## Algorithm (pseudo code)\n", @@ -344,7 +349,7 @@ }, { "cell_type": "markdown", - "id": "369f2773", + "id": "d8055ffa", "metadata": {}, "source": [ "## Example Calculations\n", @@ -373,7 +378,7 @@ { "cell_type": "code", "execution_count": null, - "id": "86997834", + "id": "9ad18db7", "metadata": { "hide-output": false }, @@ -386,7 +391,7 @@ }, { "cell_type": "markdown", - "id": "cc29d0aa", + "id": "9103719b", "metadata": {}, "source": [ "Now let’s dive in and implement our ‘‘pseudo code’’ in Python." @@ -395,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e6f12478", + "id": "07b81964", "metadata": { "hide-output": false }, @@ -421,7 +426,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c3929645", + "id": "309c02a4", "metadata": { "hide-output": false }, @@ -433,7 +438,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2305effc", + "id": "a52e9e09", "metadata": { "hide-output": false }, @@ -469,7 +474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d6ee9e1e", + "id": "5e0949ca", "metadata": { "hide-output": false }, @@ -491,7 +496,7 @@ }, { "cell_type": "markdown", - "id": "63db09bf", + "id": "0b27cb16", "metadata": {}, "source": [ "Let’s look at how price level $ p_0 $ in the stationary $ R_u $ equilibrium depends on the initial\n", @@ -507,7 +512,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17d0d6f2", + "id": "bc93fbb3", "metadata": { "hide-output": false }, @@ -519,7 +524,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9164eb9a", + "id": "0c7de008", "metadata": { "hide-output": false }, @@ -535,7 +540,7 @@ }, { "cell_type": "markdown", - "id": "bca8315b", + "id": "4f13b6aa", "metadata": {}, "source": [ "Now let’s write and implement code that let’s us experiment with the time $ 0 $ open market operation described earlier." @@ -544,7 +549,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8f382619", + "id": "c103c7de", "metadata": { "hide-output": false }, @@ -599,7 +604,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d242875e", + "id": "f7fde2c1", "metadata": { "hide-output": false }, @@ -633,7 +638,7 @@ { "cell_type": "code", "execution_count": null, - "id": "826d698f", + "id": "17331362", "metadata": { "hide-output": false }, @@ -644,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "91b8bf36", + "id": "1c477d37", "metadata": {}, "source": [ "Figure Fig. 27.1 summarizes outcomes of two experiments that convey messages of\n", @@ -657,7 +662,7 @@ } ], "metadata": { - "date": 1712122265.0111208, + "date": 1712983678.4980984, "filename": "unpleasant.md", "kernelspec": { "display_name": "Python", diff --git a/_notebooks/zreferences.ipynb b/_notebooks/zreferences.ipynb index aeb8ab02..8afe2cdf 100644 --- a/_notebooks/zreferences.ipynb +++ b/_notebooks/zreferences.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "67871e6b", + "id": "2c1ff831", "metadata": {}, "source": [ "\n", @@ -11,7 +11,7 @@ }, { "cell_type": "markdown", - "id": "11fda526", + "id": "bdbe269f", "metadata": {}, "source": [ "# References\n", @@ -199,7 +199,7 @@ } ], "metadata": { - "date": 1712122265.3553438, + "date": 1712983678.514569, "filename": "zreferences.md", "kernelspec": { "display_name": "Python", diff --git a/_pdf/quantecon-python-intro.pdf b/_pdf/quantecon-python-intro.pdf index 900c268f..e48f4b51 100644 Binary files a/_pdf/quantecon-python-intro.pdf and b/_pdf/quantecon-python-intro.pdf differ diff --git a/_sources/ar1_processes.ipynb b/_sources/ar1_processes.ipynb index 2724340c..7d98c91e 100644 --- a/_sources/ar1_processes.ipynb +++ b/_sources/ar1_processes.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "198509d2", + "id": "5a10596a", "metadata": {}, "source": [ "(ar1)=\n", @@ -48,7 +48,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4f3938de", + "id": "5a2bfb65", "metadata": {}, "outputs": [], "source": [ @@ -60,7 +60,7 @@ }, { "cell_type": "markdown", - "id": "2375476b", + "id": "5de107ed", "metadata": {}, "source": [ "## The AR(1) Model\n", @@ -164,7 +164,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15a2b73e", + "id": "dbc966ec", "metadata": {}, "outputs": [], "source": [ @@ -175,7 +175,7 @@ }, { "cell_type": "markdown", - "id": "cbc7b4e7", + "id": "58eb64d0", "metadata": {}, "source": [ "Here's the sequence of distributions:" @@ -184,7 +184,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8fa15a2e", + "id": "812f4b4f", "metadata": {}, "outputs": [], "source": [ @@ -209,7 +209,7 @@ }, { "cell_type": "markdown", - "id": "ad6d8edd", + "id": "b9eaf6ac", "metadata": {}, "source": [ "## Stationarity and Asymptotic Stability\n", @@ -222,7 +222,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5d6b018", + "id": "ded1f739", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "2bd432a2", + "id": "4bbd31b9", "metadata": {}, "source": [ "Moreover, the limit does not depend on the initial condition.\n", @@ -253,7 +253,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5fa0001", + "id": "ed3a862c", "metadata": {}, "outputs": [], "source": [ @@ -264,7 +264,7 @@ }, { "cell_type": "markdown", - "id": "54eaf0c0", + "id": "02836414", "metadata": {}, "source": [ "In fact it's easy to show that such convergence will occur, regardless of the initial condition, whenever $|a| < 1$.\n", @@ -300,7 +300,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b70b4dfc", + "id": "86903c76", "metadata": {}, "outputs": [], "source": [ @@ -318,7 +318,7 @@ }, { "cell_type": "markdown", - "id": "8594d30a", + "id": "e3ed80e2", "metadata": {}, "source": [ "As claimed, the sequence $\\{ \\psi_t \\}$ converges to $\\psi^*$.\n", @@ -440,7 +440,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c5e6360", + "id": "a253904b", "metadata": {}, "outputs": [], "source": [ @@ -481,7 +481,7 @@ }, { "cell_type": "markdown", - "id": "63beaf4a", + "id": "238000f2", "metadata": {}, "source": [ "```{solution-end}\n", @@ -544,7 +544,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c5d4450a", + "id": "08815e74", "metadata": {}, "outputs": [], "source": [ @@ -574,7 +574,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bc40ed3f", + "id": "9eea691a", "metadata": {}, "outputs": [], "source": [ @@ -593,7 +593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1317db04", + "id": "47b68180", "metadata": {}, "outputs": [], "source": [ @@ -607,7 +607,7 @@ }, { "cell_type": "markdown", - "id": "ed5ade95", + "id": "5342b353", "metadata": {}, "source": [ "We see that the kernel density estimator is effective when the underlying\n", @@ -669,7 +669,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7527c2f7", + "id": "7707c470", "metadata": {}, "outputs": [], "source": [ @@ -683,7 +683,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a2accfb1", + "id": "a933a05c", "metadata": {}, "outputs": [], "source": [ @@ -694,7 +694,7 @@ { "cell_type": "code", "execution_count": null, - "id": "61a65594", + "id": "b20d34b4", "metadata": {}, "outputs": [], "source": [ @@ -705,7 +705,7 @@ { "cell_type": "code", "execution_count": null, - "id": "445b3964", + "id": "387cb845", "metadata": {}, "outputs": [], "source": [ @@ -716,7 +716,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db4108b5", + "id": "15865b56", "metadata": {}, "outputs": [], "source": [ @@ -738,7 +738,7 @@ }, { "cell_type": "markdown", - "id": "33a61eaf", + "id": "21b16f29", "metadata": {}, "source": [ "The simulated distribution approximately coincides with the theoretical\n", diff --git a/_sources/business_cycle.ipynb b/_sources/business_cycle.ipynb index 6696271a..200b6a22 100644 --- a/_sources/business_cycle.ipynb +++ b/_sources/business_cycle.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "1da987c7", + "id": "56326824", "metadata": {}, "source": [ "# Business Cycles\n", @@ -23,7 +23,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f211a11a", + "id": "44878932", "metadata": { "tags": [ "hide-output" @@ -37,7 +37,7 @@ }, { "cell_type": "markdown", - "id": "4d23a868", + "id": "c230367a", "metadata": {}, "source": [ "We use the following imports" @@ -46,7 +46,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c489b2bd", + "id": "0b944371", "metadata": {}, "outputs": [], "source": [ @@ -59,7 +59,7 @@ }, { "cell_type": "markdown", - "id": "a7215516", + "id": "4a715a80", "metadata": {}, "source": [ "Here's some minor code to help with colors in our plots." @@ -68,7 +68,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7a7eb788", + "id": "6dc83183", "metadata": { "tags": [ "hide-input" @@ -84,7 +84,7 @@ }, { "cell_type": "markdown", - "id": "453dc8f7", + "id": "c4e4c176", "metadata": {}, "source": [ "## Data acquisition\n", @@ -100,7 +100,7 @@ { "cell_type": "code", "execution_count": null, - "id": "74888e5a", + "id": "8b662657", "metadata": {}, "outputs": [], "source": [ @@ -109,7 +109,7 @@ }, { "cell_type": "markdown", - "id": "347ccea6", + "id": "cac47d72", "metadata": {}, "source": [ "Now we use this series ID to obtain the data." @@ -118,7 +118,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7cbd4eea", + "id": "250a489b", "metadata": {}, "outputs": [], "source": [ @@ -130,7 +130,7 @@ }, { "cell_type": "markdown", - "id": "88a6cb0f", + "id": "22132049", "metadata": {}, "source": [ "We can look at the series' metadata to learn more about the series (click to expand)." @@ -139,7 +139,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bdb6ab79", + "id": "3228c8ae", "metadata": { "tags": [ "hide-output" @@ -152,7 +152,7 @@ }, { "cell_type": "markdown", - "id": "cf30d92a", + "id": "729dd498", "metadata": {}, "source": [ "(gdp_growth)=\n", @@ -166,7 +166,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8fc50d8", + "id": "54b323a5", "metadata": {}, "outputs": [], "source": [ @@ -180,7 +180,7 @@ }, { "cell_type": "markdown", - "id": "5878c868", + "id": "f9ac20fb", "metadata": {}, "source": [ "Here's a first look at the data" @@ -189,7 +189,7 @@ { "cell_type": "code", "execution_count": null, - "id": "459fe92e", + "id": "8aa11dfb", "metadata": {}, "outputs": [], "source": [ @@ -198,7 +198,7 @@ }, { "cell_type": "markdown", - "id": "7e6eefd9", + "id": "fc3fd8e7", "metadata": {}, "source": [ "We write a function to generate plots for individual countries taking into account the recessions." @@ -207,7 +207,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b736d950", + "id": "1dcd1e4c", "metadata": { "tags": [ "hide-input" @@ -288,7 +288,7 @@ }, { "cell_type": "markdown", - "id": "9a63aa65", + "id": "7ad7278f", "metadata": {}, "source": [ "Let's start with the United States." @@ -297,7 +297,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0884ccc2", + "id": "da44bc7e", "metadata": { "mystnb": { "figure": { @@ -320,7 +320,7 @@ }, { "cell_type": "markdown", - "id": "433bc12f", + "id": "54293e9a", "metadata": { "user_expressions": [] }, @@ -334,7 +334,7 @@ }, { "cell_type": "markdown", - "id": "14fc36f2", + "id": "7186c749", "metadata": {}, "source": [ "The United Kingdom (UK) has a similar pattern to the US, with a slow decline\n", @@ -346,7 +346,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f0ff9356", + "id": "76166168", "metadata": { "mystnb": { "figure": { @@ -368,7 +368,7 @@ }, { "cell_type": "markdown", - "id": "4492ff62", + "id": "42bea05a", "metadata": { "user_expressions": [] }, @@ -383,7 +383,7 @@ { "cell_type": "code", "execution_count": null, - "id": "739f3757", + "id": "a70a4c4d", "metadata": { "mystnb": { "figure": { @@ -405,7 +405,7 @@ }, { "cell_type": "markdown", - "id": "060e5d9f", + "id": "fa11b5be", "metadata": {}, "source": [ "Now let's study Greece." @@ -414,7 +414,7 @@ { "cell_type": "code", "execution_count": null, - "id": "583584fb", + "id": "f55a4cec", "metadata": { "mystnb": { "figure": { @@ -436,7 +436,7 @@ }, { "cell_type": "markdown", - "id": "169f253e", + "id": "7efd883b", "metadata": {}, "source": [ "Greece experienced a very large drop in GDP growth around 2010-2011, during the peak\n", @@ -448,7 +448,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b52878c1", + "id": "f3238581", "metadata": { "mystnb": { "figure": { @@ -470,7 +470,7 @@ }, { "cell_type": "markdown", - "id": "aaf4c2f4", + "id": "b743f7f2", "metadata": {}, "source": [ "Notice that Argentina has experienced far more volatile cycles than\n", @@ -490,7 +490,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6968522d", + "id": "a5796498", "metadata": { "tags": [ "hide-input" @@ -515,7 +515,7 @@ }, { "cell_type": "markdown", - "id": "766900ff", + "id": "0f9c2cc9", "metadata": {}, "source": [ "Let's plot the unemployment rate in the US from 1929 to 2022 with recessions\n", @@ -525,7 +525,7 @@ { "cell_type": "code", "execution_count": null, - "id": "776f89c1", + "id": "c6f920f4", "metadata": { "mystnb": { "figure": { @@ -583,7 +583,7 @@ }, { "cell_type": "markdown", - "id": "ff06b0c2", + "id": "ba8a9987", "metadata": {}, "source": [ "The plot shows that \n", @@ -616,7 +616,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ee9953c", + "id": "8892b3b0", "metadata": { "tags": [ "hide-input" @@ -698,7 +698,7 @@ }, { "cell_type": "markdown", - "id": "73f0b8d7", + "id": "b249162b", "metadata": {}, "source": [ "Here we compare the GDP growth rate of developed economies and developing economies." @@ -707,7 +707,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8526b24d", + "id": "13eaeadc", "metadata": { "tags": [ "hide-input" @@ -725,7 +725,7 @@ }, { "cell_type": "markdown", - "id": "0d876470", + "id": "393b4635", "metadata": {}, "source": [ "We use the United Kingdom, United States, Germany, and Japan as examples of developed economies." @@ -734,7 +734,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9fa4354a", + "id": "0cd547fb", "metadata": { "mystnb": { "figure": { @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "8091e644", + "id": "3ea31936", "metadata": {}, "source": [ "We choose Brazil, China, Argentina, and Mexico as representative developing economies." @@ -769,7 +769,7 @@ { "cell_type": "code", "execution_count": null, - "id": "38579508", + "id": "4af14b1d", "metadata": { "mystnb": { "figure": { @@ -794,7 +794,7 @@ }, { "cell_type": "markdown", - "id": "c3a1e6cc", + "id": "722a569b", "metadata": {}, "source": [ "The comparison of GDP growth rates above suggests that \n", @@ -816,7 +816,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d2021f18", + "id": "4cb8974e", "metadata": { "mystnb": { "figure": { @@ -847,7 +847,7 @@ }, { "cell_type": "markdown", - "id": "4f5c4df5", + "id": "3594c5fd", "metadata": {}, "source": [ "We see that France, with its strong labor unions, typically experiences\n", @@ -882,7 +882,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b37f67cd", + "id": "812790b5", "metadata": { "mystnb": { "figure": { @@ -949,7 +949,7 @@ }, { "cell_type": "markdown", - "id": "69105dc6", + "id": "40b81ec7", "metadata": {}, "source": [ "We see that \n", @@ -978,7 +978,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b20157c9", + "id": "4af5efff", "metadata": { "mystnb": { "figure": { @@ -1017,7 +1017,7 @@ }, { "cell_type": "markdown", - "id": "690d5674", + "id": "dd268a1b", "metadata": {}, "source": [ "We observe the delayed contraction in the plot across recessions.\n", @@ -1040,7 +1040,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4191bb15", + "id": "351a9573", "metadata": { "mystnb": { "figure": { @@ -1071,7 +1071,7 @@ }, { "cell_type": "markdown", - "id": "30bc9d94", + "id": "d5c89203", "metadata": {}, "source": [ "Note that the credit rises during economic expansions\n", diff --git a/_sources/cagan_adaptive.ipynb b/_sources/cagan_adaptive.ipynb index 84f4227b..c0d65596 100644 --- a/_sources/cagan_adaptive.ipynb +++ b/_sources/cagan_adaptive.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "723c85fb", + "id": "2f549128", "metadata": {}, "source": [ "# Monetarist Theory of Price Levels with Adaptive Expectations\n", @@ -283,7 +283,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9af91799", + "id": "18a04215", "metadata": {}, "outputs": [], "source": [ @@ -295,7 +295,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4a8d7c30", + "id": "dbef91c5", "metadata": {}, "outputs": [], "source": [ @@ -310,7 +310,7 @@ }, { "cell_type": "markdown", - "id": "dee5d1e7", + "id": "cef7381d", "metadata": { "user_expressions": [] }, @@ -321,7 +321,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3eb07a7b", + "id": "74f1c0fb", "metadata": {}, "outputs": [], "source": [ @@ -356,7 +356,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b3a4bfe3", + "id": "5d82d088", "metadata": {}, "outputs": [], "source": [ @@ -391,7 +391,7 @@ }, { "cell_type": "markdown", - "id": "bd2e0d92", + "id": "d21b2485", "metadata": { "user_expressions": [] }, @@ -420,7 +420,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5296683", + "id": "8705cbeb", "metadata": {}, "outputs": [], "source": [ @@ -429,7 +429,7 @@ }, { "cell_type": "markdown", - "id": "fafb10e6", + "id": "6152c3cb", "metadata": {}, "source": [ "## Experiments\n", @@ -460,7 +460,7 @@ { "cell_type": "code", "execution_count": null, - "id": "03dde3c8", + "id": "9f84bdfc", "metadata": {}, "outputs": [], "source": [ @@ -477,7 +477,7 @@ }, { "cell_type": "markdown", - "id": "1e7a45d2", + "id": "761ae3bc", "metadata": {}, "source": [ "We invite the reader to compare outcomes with those under rational expectations studied in {doc}`cagan_ree`.\n", @@ -499,7 +499,7 @@ { "cell_type": "code", "execution_count": null, - "id": "347d129d", + "id": "c360ddeb", "metadata": {}, "outputs": [], "source": [ diff --git a/_sources/cagan_ree.ipynb b/_sources/cagan_ree.ipynb index a03a2e84..fd759ee0 100644 --- a/_sources/cagan_ree.ipynb +++ b/_sources/cagan_ree.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "6468978c", + "id": "62f00f98", "metadata": {}, "source": [ "# A Monetarist Theory of Price Levels\n", @@ -230,7 +230,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8e394ca9", + "id": "c9b385ce", "metadata": {}, "outputs": [], "source": [ @@ -241,7 +241,7 @@ }, { "cell_type": "markdown", - "id": "abbcc9a3", + "id": "b216905f", "metadata": {}, "source": [ "First, we store parameters in a `namedtuple`:" @@ -250,7 +250,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e434ddd", + "id": "6e0cf163", "metadata": {}, "outputs": [], "source": [ @@ -271,7 +271,7 @@ }, { "cell_type": "markdown", - "id": "76596777", + "id": "2a670cb1", "metadata": {}, "source": [ "Now we can solve the model to compute $\\pi_t$, $m_t$ and $p_t$ for $t =1, \\ldots, T+1$ using the matrix equation above" @@ -280,7 +280,7 @@ { "cell_type": "code", "execution_count": null, - "id": "06e5369c", + "id": "64e7e726", "metadata": {}, "outputs": [], "source": [ @@ -308,7 +308,7 @@ }, { "cell_type": "markdown", - "id": "c0b2898f", + "id": "a9b0cdbd", "metadata": {}, "source": [ "### Some quantitative experiments\n", @@ -354,7 +354,7 @@ { "cell_type": "code", "execution_count": null, - "id": "939a6737", + "id": "fbaaafa8", "metadata": {}, "outputs": [], "source": [ @@ -373,7 +373,7 @@ }, { "cell_type": "markdown", - "id": "3070663f", + "id": "10efa886", "metadata": {}, "source": [ "Now we use the following function to plot the result" @@ -382,7 +382,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b24cd832", + "id": "f7ad4897", "metadata": {}, "outputs": [], "source": [ @@ -402,7 +402,7 @@ }, { "cell_type": "markdown", - "id": "7c227b4c", + "id": "8cc89194", "metadata": {}, "source": [ "The plot of the money growth rate $\\mu_t$ in the top level panel portrays\n", @@ -543,7 +543,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5213396", + "id": "976900cc", "metadata": {}, "outputs": [], "source": [ @@ -586,7 +586,7 @@ { "cell_type": "code", "execution_count": null, - "id": "272176c5", + "id": "eb61a912", "metadata": { "tags": [ "hide-input" @@ -632,7 +632,7 @@ }, { "cell_type": "markdown", - "id": "1938637c", + "id": "2a2fb72b", "metadata": {}, "source": [ "We invite you to compare these graphs with corresponding ones for the foreseen stabilization analyzed in experiment 1 above.\n", @@ -660,7 +660,7 @@ { "cell_type": "code", "execution_count": null, - "id": "09d607c3", + "id": "3a4c96db", "metadata": { "tags": [ "hide-input" @@ -690,7 +690,7 @@ }, { "cell_type": "markdown", - "id": "eaced635", + "id": "4e31cbec", "metadata": {}, "source": [ "It is instructive to compare the preceding graphs with graphs of log price levels and inflation rates for data from four big inflations described in\n", @@ -725,7 +725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1e5a0322", + "id": "1215e1ef", "metadata": {}, "outputs": [], "source": [ @@ -746,7 +746,7 @@ }, { "cell_type": "markdown", - "id": "c7f62192", + "id": "07702ac5", "metadata": {}, "source": [ "## Sequel\n", diff --git a/_sources/cobweb.ipynb b/_sources/cobweb.ipynb index 2b939d14..6c172843 100644 --- a/_sources/cobweb.ipynb +++ b/_sources/cobweb.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "8402c87b", + "id": "6728f902", "metadata": {}, "source": [ "(cobweb)=\n", @@ -53,7 +53,7 @@ }, { "cell_type": "markdown", - "id": "3531d83f", + "id": "a5e55908", "metadata": {}, "source": [ "We will use the following imports." @@ -62,7 +62,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dfdfd21c", + "id": "459f6ead", "metadata": {}, "outputs": [], "source": [ @@ -72,7 +72,7 @@ }, { "cell_type": "markdown", - "id": "b5bdd25e", + "id": "4eea2e16", "metadata": {}, "source": [ "## History\n", @@ -89,7 +89,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a3fb28ab", + "id": "7f41aa5c", "metadata": {}, "outputs": [], "source": [ @@ -108,7 +108,7 @@ }, { "cell_type": "markdown", - "id": "aedb4321", + "id": "0b85e4ed", "metadata": {}, "source": [ "## The model\n", @@ -143,7 +143,7 @@ { "cell_type": "code", "execution_count": null, - "id": "98f0d75a", + "id": "1aad67d7", "metadata": {}, "outputs": [], "source": [ @@ -169,7 +169,7 @@ }, { "cell_type": "markdown", - "id": "8a357c2e", + "id": "1162fac2", "metadata": {}, "source": [ "Now let's plot." @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2f38385d", + "id": "592dbe5f", "metadata": {}, "outputs": [], "source": [ @@ -197,7 +197,7 @@ }, { "cell_type": "markdown", - "id": "ff4222f2", + "id": "51dff8d2", "metadata": {}, "source": [ "Market equilibrium requires that supply equals demand, or\n", @@ -275,7 +275,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e288706f", + "id": "b725098a", "metadata": {}, "outputs": [], "source": [ @@ -291,7 +291,7 @@ }, { "cell_type": "markdown", - "id": "68abf625", + "id": "f5677c1f", "metadata": {}, "source": [ "Let's try to understand how prices will evolve using a 45 degree diagram, which is a tool for studying one-dimensional dynamics.\n", @@ -302,7 +302,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d23634ed", + "id": "7b4f6e48", "metadata": { "tags": [ "hide-input" @@ -382,7 +382,7 @@ }, { "cell_type": "markdown", - "id": "357923d6", + "id": "6426dbcb", "metadata": {}, "source": [ "Now we can set up a market and plot the 45 degree diagram." @@ -391,7 +391,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51645512", + "id": "512f2554", "metadata": {}, "outputs": [], "source": [ @@ -401,7 +401,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53a4414e", + "id": "e69da84a", "metadata": {}, "outputs": [], "source": [ @@ -410,7 +410,7 @@ }, { "cell_type": "markdown", - "id": "d3cb8826", + "id": "bb5e37ba", "metadata": {}, "source": [ "The plot shows the function $g$ defined in {eq}`def_g` and the $45$ degree line.\n", @@ -439,7 +439,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b3174917", + "id": "51186d23", "metadata": {}, "outputs": [], "source": [ @@ -473,7 +473,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fac4a212", + "id": "c12bc876", "metadata": {}, "outputs": [], "source": [ @@ -482,7 +482,7 @@ }, { "cell_type": "markdown", - "id": "aaf222fe", + "id": "867d7c4b", "metadata": {}, "source": [ "We see that a cycle has formed and the cycle is persistent.\n", @@ -497,7 +497,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3db6af56", + "id": "fa17fe79", "metadata": {}, "outputs": [], "source": [ @@ -506,7 +506,7 @@ }, { "cell_type": "markdown", - "id": "ee860838", + "id": "03ab68a7", "metadata": {}, "source": [ "## Adaptive expectations\n", @@ -554,7 +554,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a646f2c3", + "id": "a5e38420", "metadata": {}, "outputs": [], "source": [ @@ -568,7 +568,7 @@ }, { "cell_type": "markdown", - "id": "71b4286a", + "id": "0a53e15d", "metadata": {}, "source": [ "The function below plots price dynamics under adaptive expectations for different values of $\\alpha$." @@ -577,7 +577,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e4bd53d1", + "id": "a20e1ec6", "metadata": {}, "outputs": [], "source": [ @@ -600,7 +600,7 @@ }, { "cell_type": "markdown", - "id": "937f42a6", + "id": "2f3ed585", "metadata": {}, "source": [ "Let's call the function with prices starting at $p_0 = 5$.\n", @@ -611,7 +611,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f7e0970", + "id": "f724a266", "metadata": {}, "outputs": [], "source": [ @@ -620,7 +620,7 @@ }, { "cell_type": "markdown", - "id": "0a47b817", + "id": "348d9407", "metadata": {}, "source": [ "Note that if $\\alpha=1$, then adaptive expectations are just naive expectation.\n", @@ -653,7 +653,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1b4cd627", + "id": "b55efbd8", "metadata": {}, "outputs": [], "source": [ @@ -689,7 +689,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a8bce6f4", + "id": "b4b281da", "metadata": {}, "outputs": [], "source": [ @@ -699,7 +699,7 @@ }, { "cell_type": "markdown", - "id": "f7c3e9d3", + "id": "3c384e03", "metadata": {}, "source": [ "```{solution-end}\n", @@ -735,7 +735,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5629f535", + "id": "054224e7", "metadata": {}, "outputs": [], "source": [ @@ -750,7 +750,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5459abc", + "id": "e24eb1f2", "metadata": {}, "outputs": [], "source": [ @@ -782,7 +782,7 @@ { "cell_type": "code", "execution_count": null, - "id": "106c1a5f", + "id": "125123a6", "metadata": {}, "outputs": [], "source": [ @@ -796,7 +796,7 @@ }, { "cell_type": "markdown", - "id": "a924ae38", + "id": "9868e514", "metadata": {}, "source": [ "```{solution-end}\n", @@ -806,7 +806,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c5e72aff", + "id": "462cd0bf", "metadata": {}, "outputs": [], "source": [] diff --git a/_sources/commod_price.ipynb b/_sources/commod_price.ipynb index e319fdeb..f8d0cd7b 100644 --- a/_sources/commod_price.ipynb +++ b/_sources/commod_price.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "78863ec7", + "id": "31ac4da4", "metadata": {}, "source": [ "# Commodity Prices\n", @@ -34,7 +34,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0792a298", + "id": "39ad36c5", "metadata": { "tags": [ "hide-output" @@ -47,7 +47,7 @@ }, { "cell_type": "markdown", - "id": "27a5094f", + "id": "391c9693", "metadata": {}, "source": [ "We will use the following imports" @@ -56,7 +56,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bcfeb0d1", + "id": "789e264f", "metadata": {}, "outputs": [], "source": [ @@ -70,7 +70,7 @@ }, { "cell_type": "markdown", - "id": "334e3da9", + "id": "c959a794", "metadata": {}, "source": [ "## Data\n", @@ -81,7 +81,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c6cdebe6", + "id": "0bb2f1ae", "metadata": { "tags": [ "hide-input", @@ -96,7 +96,7 @@ { "cell_type": "code", "execution_count": null, - "id": "610298a1", + "id": "792167ea", "metadata": { "tags": [ "hide-input" @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "040f537c", + "id": "223130b9", "metadata": {}, "source": [ "The figure shows surprisingly large movements in the price of cotton.\n", @@ -395,7 +395,7 @@ { "cell_type": "code", "execution_count": null, - "id": "93e5fecd", + "id": "e7ec3506", "metadata": {}, "outputs": [], "source": [ @@ -450,7 +450,7 @@ }, { "cell_type": "markdown", - "id": "a04c36ff", + "id": "db24a738", "metadata": {}, "source": [ "The figure above shows the inverse demand curve $P$, which is also $p_0$, as\n", @@ -463,7 +463,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37032d7f", + "id": "4dc13386", "metadata": {}, "outputs": [], "source": [ diff --git a/_sources/complex_and_trig.ipynb b/_sources/complex_and_trig.ipynb index d1d18503..f9f1496a 100644 --- a/_sources/complex_and_trig.ipynb +++ b/_sources/complex_and_trig.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "242c74ef", + "id": "75d14d24", "metadata": {}, "source": [ "(complex_and_trig)=\n", @@ -99,7 +99,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29c7a360", + "id": "ef04c777", "metadata": {}, "outputs": [], "source": [ @@ -112,7 +112,7 @@ }, { "cell_type": "markdown", - "id": "f8f8302a", + "id": "2dab4983", "metadata": {}, "source": [ "### An Example\n", @@ -131,7 +131,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cfe04ac1", + "id": "8705dc1f", "metadata": {}, "outputs": [], "source": [ @@ -176,7 +176,7 @@ }, { "cell_type": "markdown", - "id": "3f379e6b", + "id": "311387a5", "metadata": {}, "source": [ "## De Moivre's Theorem\n", @@ -318,7 +318,7 @@ { "cell_type": "code", "execution_count": null, - "id": "840eb230", + "id": "0d83d6b5", "metadata": {}, "outputs": [], "source": [ @@ -347,7 +347,7 @@ }, { "cell_type": "markdown", - "id": "6c9df7e2", + "id": "ca6bfdab", "metadata": {}, "source": [ "Using the code above, we compute that\n", @@ -360,7 +360,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8a574d4c", + "id": "54f63eab", "metadata": {}, "outputs": [], "source": [ @@ -398,7 +398,7 @@ }, { "cell_type": "markdown", - "id": "7f1d1109", + "id": "6460919d", "metadata": {}, "source": [ "### Trigonometric Identities\n", @@ -457,7 +457,7 @@ { "cell_type": "code", "execution_count": null, - "id": "55132d32", + "id": "a7cfb2ba", "metadata": {}, "outputs": [], "source": [ @@ -473,7 +473,7 @@ }, { "cell_type": "markdown", - "id": "b98b1910", + "id": "c5220d2d", "metadata": {}, "source": [ "### Trigonometric Integrals\n", @@ -530,7 +530,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e366543", + "id": "0e681f6b", "metadata": {}, "outputs": [], "source": [ @@ -545,7 +545,7 @@ { "cell_type": "code", "execution_count": null, - "id": "09ff2d33", + "id": "c991e236", "metadata": {}, "outputs": [], "source": [ @@ -556,7 +556,7 @@ }, { "cell_type": "markdown", - "id": "394de4f4", + "id": "0cdefe3b", "metadata": {}, "source": [ "### Exercises\n", @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e38b7dd0", + "id": "8a091b8d", "metadata": {}, "outputs": [], "source": [ @@ -596,7 +596,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28ad778e", + "id": "0efa8811", "metadata": {}, "outputs": [], "source": [ @@ -609,7 +609,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51a4a736", + "id": "4b008045", "metadata": {}, "outputs": [], "source": [ @@ -621,7 +621,7 @@ }, { "cell_type": "markdown", - "id": "d8e129e6", + "id": "4734240f", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/cons_smooth.ipynb b/_sources/cons_smooth.ipynb index f4d0ffb7..e1cfeef4 100644 --- a/_sources/cons_smooth.ipynb +++ b/_sources/cons_smooth.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "d898dca5", + "id": "8dc3f6f3", "metadata": {}, "source": [ "# Consumption Smoothing\n", @@ -38,7 +38,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f317e09d", + "id": "af18db8a", "metadata": {}, "outputs": [], "source": [ @@ -49,7 +49,7 @@ }, { "cell_type": "markdown", - "id": "1bf172b6", + "id": "9e4c38ae", "metadata": {}, "source": [ "The model describes a consumer who lives from time $t=0, 1, \\ldots, T$, receives a stream $\\{y_t\\}_{t=0}^T$ of non-financial income and chooses a consumption stream $\\{c_t\\}_{t=0}^T$.\n", @@ -144,7 +144,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ab4e1a09", + "id": "f579a57e", "metadata": {}, "outputs": [], "source": [ @@ -160,7 +160,7 @@ }, { "cell_type": "markdown", - "id": "3f684f86", + "id": "50339da7", "metadata": {}, "source": [ "## Friedman-Hall consumption-smoothing model\n", @@ -280,7 +280,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3660f9ee", + "id": "04e7f0f5", "metadata": {}, "outputs": [], "source": [ @@ -307,7 +307,7 @@ }, { "cell_type": "markdown", - "id": "7d3858eb", + "id": "bd87c7f7", "metadata": {}, "source": [ "We use an example where the consumer inherits $a_0<0$.\n", @@ -322,7 +322,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fd872c18", + "id": "319a5982", "metadata": {}, "outputs": [], "source": [ @@ -341,7 +341,7 @@ }, { "cell_type": "markdown", - "id": "cfdd6aa0", + "id": "591dcae7", "metadata": {}, "source": [ "The graphs below show paths of non-financial income, consumption, and financial assets." @@ -350,7 +350,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0a4ceb7f", + "id": "53f67972", "metadata": {}, "outputs": [], "source": [ @@ -370,7 +370,7 @@ }, { "cell_type": "markdown", - "id": "0d375b0d", + "id": "3ac3c773", "metadata": {}, "source": [ "Note that $a_{T+1} = 0$, as anticipated.\n", @@ -381,7 +381,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c8aa4a23", + "id": "44cdb82c", "metadata": {}, "outputs": [], "source": [ @@ -396,7 +396,7 @@ }, { "cell_type": "markdown", - "id": "0f406b6c", + "id": "97867a61", "metadata": {}, "source": [ "### Experiments\n", @@ -411,7 +411,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6bd93fb7", + "id": "b14c4f98", "metadata": {}, "outputs": [], "source": [ @@ -440,7 +440,7 @@ }, { "cell_type": "markdown", - "id": "dc08ad80", + "id": "dba8dac8", "metadata": {}, "source": [ "In the experiments below, please study how consumption and financial asset sequences vary accross different sequences for non-financial income.\n", @@ -455,7 +455,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cb557c45", + "id": "7b4f9493", "metadata": {}, "outputs": [], "source": [ @@ -468,7 +468,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b35f747b", + "id": "28953e41", "metadata": {}, "outputs": [], "source": [ @@ -480,7 +480,7 @@ }, { "cell_type": "markdown", - "id": "cbbd1e4e", + "id": "bbda73a3", "metadata": {}, "source": [ "#### Experiment 2: permanent wage gain/loss\n", @@ -493,7 +493,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7430b1df", + "id": "8e41f8cf", "metadata": {}, "outputs": [], "source": [ @@ -507,7 +507,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dfd815e3", + "id": "ab843ce9", "metadata": {}, "outputs": [], "source": [ @@ -520,7 +520,7 @@ }, { "cell_type": "markdown", - "id": "9324896a", + "id": "c98a8593", "metadata": {}, "source": [ "#### Experiment 3: a late starter\n", @@ -531,7 +531,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2f5cc291", + "id": "f2ee42a3", "metadata": {}, "outputs": [], "source": [ @@ -544,7 +544,7 @@ }, { "cell_type": "markdown", - "id": "72590ae4", + "id": "1246722f", "metadata": {}, "source": [ "#### Experiment 4: geometric earner\n", @@ -557,7 +557,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f482574d", + "id": "822db8f1", "metadata": {}, "outputs": [], "source": [ @@ -576,7 +576,7 @@ }, { "cell_type": "markdown", - "id": "9e4887dc", + "id": "8beace69", "metadata": {}, "source": [ "Now we show the behavior when $\\lambda = 0.95$" @@ -585,7 +585,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b9e457ca", + "id": "7c0a6cce", "metadata": {}, "outputs": [], "source": [ @@ -600,7 +600,7 @@ }, { "cell_type": "markdown", - "id": "298f5d42", + "id": "2e3a3017", "metadata": {}, "source": [ "What happens when $\\lambda$ is negative" @@ -609,7 +609,7 @@ { "cell_type": "code", "execution_count": null, - "id": "037fabda", + "id": "3c2bb67d", "metadata": {}, "outputs": [], "source": [ @@ -624,7 +624,7 @@ }, { "cell_type": "markdown", - "id": "7fe43d34", + "id": "71a2543f", "metadata": {}, "source": [ "### Feasible consumption variations\n", @@ -700,7 +700,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0862d6da", + "id": "ffe6296d", "metadata": {}, "outputs": [], "source": [ @@ -721,7 +721,7 @@ }, { "cell_type": "markdown", - "id": "e32a5ea3", + "id": "602f4c2a", "metadata": {}, "source": [ "We visualize variations for $\\xi_1 \\in \\{.01, .05\\}$ and $\\phi \\in \\{.95, 1.02\\}$" @@ -730,7 +730,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4328a4ca", + "id": "44bf211c", "metadata": {}, "outputs": [], "source": [ @@ -769,7 +769,7 @@ }, { "cell_type": "markdown", - "id": "e61effc9", + "id": "5885d853", "metadata": {}, "source": [ "We can even use the Python `np.gradient` command to compute derivatives of welfare with respect to our two parameters. \n", @@ -782,7 +782,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5df7e3d", + "id": "fa9f06c1", "metadata": {}, "outputs": [], "source": [ @@ -804,7 +804,7 @@ }, { "cell_type": "markdown", - "id": "03db564c", + "id": "39b497cc", "metadata": {}, "source": [ "Then we can visualize the relationship between welfare and $\\xi_1$ and compute its derivatives" @@ -813,7 +813,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7685a4f7", + "id": "a427223b", "metadata": {}, "outputs": [], "source": [ @@ -834,7 +834,7 @@ }, { "cell_type": "markdown", - "id": "f423aaf6", + "id": "22064873", "metadata": {}, "source": [ "The same can be done on $\\phi$" @@ -843,7 +843,7 @@ { "cell_type": "code", "execution_count": null, - "id": "67c8bf4f", + "id": "3755d749", "metadata": {}, "outputs": [], "source": [ @@ -864,7 +864,7 @@ }, { "cell_type": "markdown", - "id": "85e6d2ee", + "id": "6da06618", "metadata": {}, "source": [ "## Wrapping up the consumption-smoothing model\n", diff --git a/_sources/eigen_I.ipynb b/_sources/eigen_I.ipynb index bffa3cdc..94339cab 100644 --- a/_sources/eigen_I.ipynb +++ b/_sources/eigen_I.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "d1944353", + "id": "ab638943", "metadata": { "user_expressions": [] }, @@ -36,7 +36,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bf6f3f72", + "id": "a6b34cfb", "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ }, { "cell_type": "markdown", - "id": "ccc8c79c", + "id": "b6f8e9b4", "metadata": {}, "source": [ "(matrices_as_transformation)=\n", @@ -129,7 +129,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a90f3397", + "id": "2eac8a8c", "metadata": {}, "outputs": [], "source": [ @@ -140,7 +140,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c13f9066", + "id": "38bf2e07", "metadata": {}, "outputs": [], "source": [ @@ -185,7 +185,7 @@ }, { "cell_type": "markdown", - "id": "b917d390", + "id": "0e47cbe4", "metadata": { "user_expressions": [] }, @@ -217,7 +217,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8a0892de", + "id": "fbe0cd3d", "metadata": { "tags": [ "hide-input" @@ -315,7 +315,7 @@ }, { "cell_type": "markdown", - "id": "0c78f73a", + "id": "55811ee5", "metadata": { "user_expressions": [] }, @@ -340,7 +340,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22b360c2", + "id": "3df34e55", "metadata": {}, "outputs": [], "source": [ @@ -352,7 +352,7 @@ }, { "cell_type": "markdown", - "id": "98fd527f", + "id": "c35767d6", "metadata": { "user_expressions": [] }, @@ -375,7 +375,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a290e827", + "id": "60dfe46c", "metadata": {}, "outputs": [], "source": [ @@ -387,7 +387,7 @@ }, { "cell_type": "markdown", - "id": "23c4d91a", + "id": "74cfc214", "metadata": { "user_expressions": [] }, @@ -410,7 +410,7 @@ { "cell_type": "code", "execution_count": null, - "id": "142840e8", + "id": "81c95aa5", "metadata": {}, "outputs": [], "source": [ @@ -422,7 +422,7 @@ }, { "cell_type": "markdown", - "id": "ff4eeee2", + "id": "bef5a0f9", "metadata": { "user_expressions": [] }, @@ -443,7 +443,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c6fa60ba", + "id": "5999ccf4", "metadata": {}, "outputs": [], "source": [ @@ -453,7 +453,7 @@ }, { "cell_type": "markdown", - "id": "8d78aea3", + "id": "88871d72", "metadata": { "user_expressions": [] }, @@ -604,7 +604,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a64f805e", + "id": "b24419fd", "metadata": { "tags": [ "hide-input" @@ -651,7 +651,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12a75a35", + "id": "fd515cea", "metadata": {}, "outputs": [], "source": [ @@ -663,7 +663,7 @@ }, { "cell_type": "markdown", - "id": "34f15903", + "id": "ca51f5ac", "metadata": { "user_expressions": [] }, @@ -674,7 +674,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90ab47eb", + "id": "c24b24a1", "metadata": {}, "outputs": [], "source": [ @@ -683,7 +683,7 @@ }, { "cell_type": "markdown", - "id": "de60a11d", + "id": "b57842bc", "metadata": { "user_expressions": [] }, @@ -694,7 +694,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cf597c05", + "id": "bb538c66", "metadata": {}, "outputs": [], "source": [ @@ -703,7 +703,7 @@ }, { "cell_type": "markdown", - "id": "9feafafb", + "id": "f0f22888", "metadata": { "user_expressions": [] }, @@ -733,7 +733,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2bb3ba27", + "id": "d4dacb5f", "metadata": {}, "outputs": [], "source": [ @@ -784,7 +784,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3511beb0", + "id": "bdda97ab", "metadata": {}, "outputs": [], "source": [ @@ -799,7 +799,7 @@ }, { "cell_type": "markdown", - "id": "8c5b70f9", + "id": "5fab2534", "metadata": { "user_expressions": [] }, @@ -812,7 +812,7 @@ { "cell_type": "code", "execution_count": null, - "id": "97fd4064", + "id": "8ebf4447", "metadata": {}, "outputs": [], "source": [ @@ -827,7 +827,7 @@ }, { "cell_type": "markdown", - "id": "0c5b94fc", + "id": "a092f777", "metadata": { "user_expressions": [] }, @@ -841,7 +841,7 @@ { "cell_type": "code", "execution_count": null, - "id": "71375ed7", + "id": "1acd72f4", "metadata": {}, "outputs": [], "source": [ @@ -856,7 +856,7 @@ }, { "cell_type": "markdown", - "id": "73ca0b4f", + "id": "2ef58de7", "metadata": { "user_expressions": [] }, @@ -903,7 +903,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72b114eb", + "id": "afcdd816", "metadata": { "tags": [ "output_scroll" @@ -959,7 +959,7 @@ }, { "cell_type": "markdown", - "id": "57eb1012", + "id": "76704270", "metadata": { "user_expressions": [] }, @@ -1017,7 +1017,7 @@ { "cell_type": "code", "execution_count": null, - "id": "be3c10af", + "id": "e205dff4", "metadata": {}, "outputs": [], "source": [ @@ -1034,7 +1034,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25c2dd99", + "id": "63f52cbe", "metadata": {}, "outputs": [], "source": [ @@ -1043,7 +1043,7 @@ }, { "cell_type": "markdown", - "id": "3f7f71d9", + "id": "bf68ccdd", "metadata": { "user_expressions": [] }, @@ -1133,7 +1133,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0507b54", + "id": "1ff49557", "metadata": {}, "outputs": [], "source": [ @@ -1148,7 +1148,7 @@ }, { "cell_type": "markdown", - "id": "b3b17244", + "id": "f36f5ad8", "metadata": {}, "source": [ "The spectral radius $r(A)$ obtained is less than 1.\n", @@ -1159,7 +1159,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2e8cdd10", + "id": "924b26ca", "metadata": {}, "outputs": [], "source": [ @@ -1170,7 +1170,7 @@ { "cell_type": "code", "execution_count": null, - "id": "717813d8", + "id": "8d4a7980", "metadata": {}, "outputs": [], "source": [ @@ -1180,7 +1180,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ab4232dd", + "id": "b10ac9e2", "metadata": {}, "outputs": [], "source": [ @@ -1193,7 +1193,7 @@ }, { "cell_type": "markdown", - "id": "d39de6cd", + "id": "487c09de", "metadata": {}, "source": [ "Let's check equality between the sum and the inverse methods." @@ -1202,7 +1202,7 @@ { "cell_type": "code", "execution_count": null, - "id": "120c8386", + "id": "e0370771", "metadata": {}, "outputs": [], "source": [ @@ -1211,7 +1211,7 @@ }, { "cell_type": "markdown", - "id": "9ee9583d", + "id": "6a5c0454", "metadata": {}, "source": [ "Although we truncate the infinite sum at $k = 50$, both methods give us the same\n", @@ -1250,7 +1250,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d508331c", + "id": "f0569095", "metadata": { "mystnb": { "figure": { @@ -1303,7 +1303,7 @@ }, { "cell_type": "markdown", - "id": "3faa11ed", + "id": "0c8bb249", "metadata": { "user_expressions": [] }, @@ -1314,7 +1314,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25bf700d", + "id": "bab53e40", "metadata": { "mystnb": { "figure": { @@ -1357,7 +1357,7 @@ }, { "cell_type": "markdown", - "id": "321acf95", + "id": "be80778f", "metadata": { "user_expressions": [] }, @@ -1384,7 +1384,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31845dd8", + "id": "bbd35f67", "metadata": {}, "outputs": [], "source": [ @@ -1404,7 +1404,7 @@ }, { "cell_type": "markdown", - "id": "05463529", + "id": "30c5da38", "metadata": { "user_expressions": [] }, @@ -1419,7 +1419,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0396476", + "id": "3c884091", "metadata": { "mystnb": { "figure": { @@ -1468,7 +1468,7 @@ }, { "cell_type": "markdown", - "id": "df621385", + "id": "8ac526d5", "metadata": { "user_expressions": [] }, @@ -1504,7 +1504,7 @@ { "cell_type": "code", "execution_count": null, - "id": "75a8e986", + "id": "f0517079", "metadata": { "mystnb": { "figure": { @@ -1578,7 +1578,7 @@ }, { "cell_type": "markdown", - "id": "77015a28", + "id": "bc4c925c", "metadata": { "user_expressions": [] }, @@ -1593,7 +1593,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d2a0ca41", + "id": "3d7c1b13", "metadata": { "mystnb": { "figure": { @@ -1662,7 +1662,7 @@ }, { "cell_type": "markdown", - "id": "57333f19", + "id": "524e04ee", "metadata": { "user_expressions": [] }, diff --git a/_sources/eigen_II.ipynb b/_sources/eigen_II.ipynb index f263ad6b..1cf8ae68 100644 --- a/_sources/eigen_II.ipynb +++ b/_sources/eigen_II.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "1d42d512", + "id": "b064c98d", "metadata": {}, "source": [ "# The Perron-Frobenius Theorem\n", @@ -16,7 +16,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e91d2c1c", + "id": "8d39d671", "metadata": { "tags": [ "hide-output" @@ -29,7 +29,7 @@ }, { "cell_type": "markdown", - "id": "73409337", + "id": "ec174b9d", "metadata": {}, "source": [ "In this lecture we will begin with the foundational concepts in spectral theory.\n", @@ -42,7 +42,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8f56bb0", + "id": "af378ca4", "metadata": {}, "outputs": [], "source": [ @@ -54,7 +54,7 @@ }, { "cell_type": "markdown", - "id": "5d6dfa2a", + "id": "9a779a6d", "metadata": {}, "source": [ "## Nonnegative matrices\n", @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bd1cf4dd", + "id": "855e3472", "metadata": {}, "outputs": [], "source": [ @@ -164,7 +164,7 @@ }, { "cell_type": "markdown", - "id": "95ae517d", + "id": "4cf76dbd", "metadata": {}, "source": [ "We can also use `scipy.linalg.eig` with argument `left=True` to find left eigenvectors directly" @@ -173,7 +173,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8049cbeb", + "id": "2e62bcbc", "metadata": {}, "outputs": [], "source": [ @@ -186,7 +186,7 @@ }, { "cell_type": "markdown", - "id": "d468f50f", + "id": "7d206901", "metadata": {}, "source": [ "The eigenvalues are the same while the eigenvectors themselves are different.\n", @@ -240,7 +240,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f6be9934", + "id": "15950f9a", "metadata": {}, "outputs": [], "source": [ @@ -251,7 +251,7 @@ }, { "cell_type": "markdown", - "id": "6a1f8315", + "id": "5877702e", "metadata": {}, "source": [ "We can compute the dominant eigenvalue and the corresponding eigenvector" @@ -260,7 +260,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7a592428", + "id": "e5566858", "metadata": {}, "outputs": [], "source": [ @@ -269,7 +269,7 @@ }, { "cell_type": "markdown", - "id": "c2d62500", + "id": "a87ba3a5", "metadata": {}, "source": [ "Now we can see the claims of the Perron-Frobenius Theorem holds for the irreducible matrix $A$:\n", @@ -335,7 +335,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aecc67f1", + "id": "d212644d", "metadata": {}, "outputs": [], "source": [ @@ -348,7 +348,7 @@ }, { "cell_type": "markdown", - "id": "ff11bddf", + "id": "dded4d05", "metadata": {}, "source": [ "We compute the dominant eigenvalue and the corresponding eigenvector" @@ -357,7 +357,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f291a8d7", + "id": "e258a0d4", "metadata": {}, "outputs": [], "source": [ @@ -366,7 +366,7 @@ }, { "cell_type": "markdown", - "id": "33e53de9", + "id": "5d948683", "metadata": {}, "source": [ "Now let's give some examples to see if the claims of the Perron-Frobenius Theorem hold for the primitive matrix $B$:\n", @@ -384,7 +384,7 @@ { "cell_type": "code", "execution_count": null, - "id": "437b8c77", + "id": "2ffcd0c8", "metadata": {}, "outputs": [], "source": [ @@ -454,7 +454,7 @@ }, { "cell_type": "markdown", - "id": "4cc785d4", + "id": "80ca0c83", "metadata": {}, "source": [ "The convergence is not observed in cases of non-primitive matrices.\n", @@ -465,7 +465,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cad66a0a", + "id": "901c4b53", "metadata": {}, "outputs": [], "source": [ @@ -484,7 +484,7 @@ }, { "cell_type": "markdown", - "id": "a89bd65d", + "id": "b44e451c", "metadata": {}, "source": [ "The result shows that the matrix is not primitive as it is not everywhere positive.\n", @@ -506,7 +506,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dd524ac4", + "id": "8687e965", "metadata": {}, "outputs": [], "source": [ @@ -520,7 +520,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b2b08d03", + "id": "2e59f8d4", "metadata": {}, "outputs": [], "source": [ @@ -532,7 +532,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c6e8cd02", + "id": "927a92fa", "metadata": {}, "outputs": [], "source": [ @@ -546,7 +546,7 @@ { "cell_type": "code", "execution_count": null, - "id": "85cef1fa", + "id": "84a9df9e", "metadata": {}, "outputs": [], "source": [ @@ -557,7 +557,7 @@ }, { "cell_type": "markdown", - "id": "02e40d3e", + "id": "610e1386", "metadata": {}, "source": [ "We can also verify other properties hinted by Perron-Frobenius in these stochastic matrices." @@ -565,7 +565,7 @@ }, { "cell_type": "markdown", - "id": "1c718fea", + "id": "a0509535", "metadata": {}, "source": [ "Another example is the relationship between convergence gap and convergence rate.\n", @@ -686,7 +686,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12550d24", + "id": "a1f6fd55", "metadata": {}, "outputs": [], "source": [ @@ -702,7 +702,7 @@ }, { "cell_type": "markdown", - "id": "7ee9edf9", + "id": "cf98f04e", "metadata": {}, "source": [ "Since we have $r(A) < 1$ we can thus find the solution using the Neumann Series Lemma." @@ -711,7 +711,7 @@ { "cell_type": "code", "execution_count": null, - "id": "093c3517", + "id": "cafd63c5", "metadata": {}, "outputs": [], "source": [ @@ -728,7 +728,7 @@ }, { "cell_type": "markdown", - "id": "94a7ae8c", + "id": "ab22885e", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/equalizing_difference.ipynb b/_sources/equalizing_difference.ipynb index 7947d850..e76afba3 100644 --- a/_sources/equalizing_difference.ipynb +++ b/_sources/equalizing_difference.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "945f4445", + "id": "d30fba45", "metadata": {}, "source": [ "# Equalizing Difference Model\n", @@ -45,7 +45,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0244a950", + "id": "414a58ba", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "4cfdd059", + "id": "461726c5", "metadata": {}, "source": [ "## The indifference condition\n", @@ -187,7 +187,7 @@ { "cell_type": "code", "execution_count": null, - "id": "594a631c", + "id": "a964bb17", "metadata": {}, "outputs": [], "source": [ @@ -216,7 +216,7 @@ }, { "cell_type": "markdown", - "id": "971e9e52", + "id": "955a7c0c", "metadata": {}, "source": [ "Using vectorization instead of loops,\n", @@ -230,7 +230,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e10e73dd", + "id": "9a59050e", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "99fbcb5a", + "id": "47cf86b9", "metadata": {}, "source": [ "Let's not charge for college and recompute $\\phi$.\n", @@ -253,7 +253,7 @@ { "cell_type": "code", "execution_count": null, - "id": "84cc2753", + "id": "a7658112", "metadata": {}, "outputs": [], "source": [ @@ -265,7 +265,7 @@ }, { "cell_type": "markdown", - "id": "60f34313", + "id": "208331bb", "metadata": {}, "source": [ "Let us construct some graphs that show us how the initial college-high-school wage ratio $\\phi$ would change if one of its determinants were to change. \n", @@ -276,7 +276,7 @@ { "cell_type": "code", "execution_count": null, - "id": "061e898f", + "id": "f8194eba", "metadata": {}, "outputs": [], "source": [ @@ -292,7 +292,7 @@ }, { "cell_type": "markdown", - "id": "78021e0f", + "id": "e58a56d9", "metadata": {}, "source": [ "Evidently, the initial wage ratio $\\phi$ must rise to compensate a prospective high school student for **waiting** to start receiving income -- remember that while she is earning nothing in years $t=0, 1, 2, 3$, the high school worker is earning a salary.\n", @@ -304,7 +304,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f12688e1", + "id": "911571bb", "metadata": {}, "outputs": [], "source": [ @@ -320,7 +320,7 @@ }, { "cell_type": "markdown", - "id": "84d6a974", + "id": "3a9b445b", "metadata": {}, "source": [ "Notice how the intitial wage gap falls when the rate of growth $\\gamma_c$ of college wages rises. \n", @@ -335,7 +335,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7cbabe60", + "id": "9f65421b", "metadata": {}, "outputs": [], "source": [ @@ -351,7 +351,7 @@ }, { "cell_type": "markdown", - "id": "e7753e71", + "id": "f32e4f44", "metadata": {}, "source": [ "## Entrepreneur-worker interpretation\n", @@ -384,7 +384,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b9588e7e", + "id": "e485d4c0", "metadata": {}, "outputs": [], "source": [ @@ -418,7 +418,7 @@ }, { "cell_type": "markdown", - "id": "2e05959f", + "id": "886ef341", "metadata": {}, "source": [ "If the probability that a new business succeeds is $0.2$, let's compute the initial wage premium for successful entrepreneurs." @@ -427,7 +427,7 @@ { "cell_type": "code", "execution_count": null, - "id": "46dac218", + "id": "8bc1ea3e", "metadata": {}, "outputs": [], "source": [ @@ -439,7 +439,7 @@ }, { "cell_type": "markdown", - "id": "56194b81", + "id": "8f5072e2", "metadata": {}, "source": [ "Now let's study how the initial wage premium for successful entrepreneurs depend on the success probability." @@ -448,7 +448,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25a2dcf7", + "id": "86299512", "metadata": {}, "outputs": [], "source": [ @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "f83bff74", + "id": "b7f07d6d", "metadata": {}, "source": [ "Does the graph make sense to you?\n", @@ -491,7 +491,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3897b865", + "id": "805b2530", "metadata": {}, "outputs": [], "source": [ @@ -501,7 +501,7 @@ }, { "cell_type": "markdown", - "id": "906b133a", + "id": "a19a9c60", "metadata": {}, "source": [ "Define function $A_h$" @@ -510,7 +510,7 @@ { "cell_type": "code", "execution_count": null, - "id": "70dbef73", + "id": "4ed081c7", "metadata": {}, "outputs": [], "source": [ @@ -520,7 +520,7 @@ }, { "cell_type": "markdown", - "id": "d8a542a5", + "id": "36d25087", "metadata": {}, "source": [ "Define function $A_c$" @@ -529,7 +529,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c81e484d", + "id": "73edc751", "metadata": {}, "outputs": [], "source": [ @@ -539,7 +539,7 @@ }, { "cell_type": "markdown", - "id": "398230f5", + "id": "cce9ba95", "metadata": {}, "source": [ "Now, define $\\phi$" @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3f976ea3", + "id": "3d12fb91", "metadata": {}, "outputs": [], "source": [ @@ -558,7 +558,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e12dc76e", + "id": "84cd4fe9", "metadata": {}, "outputs": [], "source": [ @@ -567,7 +567,7 @@ }, { "cell_type": "markdown", - "id": "5d30701e", + "id": "a0e4c778", "metadata": {}, "source": [ "We begin by setting default parameter values." @@ -576,7 +576,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0645f8bf", + "id": "fd0a2b56", "metadata": {}, "outputs": [], "source": [ @@ -589,7 +589,7 @@ }, { "cell_type": "markdown", - "id": "0ed83de5", + "id": "786a0627", "metadata": {}, "source": [ "Now let's compute $\\frac{\\partial \\phi}{\\partial D}$ and then evaluate it at the default values" @@ -598,7 +598,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72735392", + "id": "91bb2b38", "metadata": {}, "outputs": [], "source": [ @@ -609,7 +609,7 @@ { "cell_type": "code", "execution_count": null, - "id": "97d72df9", + "id": "e006f699", "metadata": {}, "outputs": [], "source": [ @@ -620,7 +620,7 @@ }, { "cell_type": "markdown", - "id": "c5c149b8", + "id": "fc883ef8", "metadata": {}, "source": [ "Thus, as with our earlier graph, we find that raising $R$ increases the initial college wage premium $\\phi$.\n", @@ -631,7 +631,7 @@ { "cell_type": "code", "execution_count": null, - "id": "403b6837", + "id": "a599efc8", "metadata": {}, "outputs": [], "source": [ @@ -642,7 +642,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b16d2074", + "id": "21f4d9af", "metadata": {}, "outputs": [], "source": [ @@ -653,7 +653,7 @@ }, { "cell_type": "markdown", - "id": "c384ce39", + "id": "8b972e1e", "metadata": {}, "source": [ "We find that raising $T$ decreases the initial college wage premium $\\phi$. \n", @@ -666,7 +666,7 @@ { "cell_type": "code", "execution_count": null, - "id": "24b71a40", + "id": "bd2201d9", "metadata": {}, "outputs": [], "source": [ @@ -677,7 +677,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b7e96bbd", + "id": "02e3c121", "metadata": {}, "outputs": [], "source": [ @@ -688,7 +688,7 @@ }, { "cell_type": "markdown", - "id": "151de4f9", + "id": "8f8dabc8", "metadata": {}, "source": [ "We find that raising $\\gamma_h$ increases the initial college wage premium $\\phi$, in line with our earlier graphical analysis.\n", @@ -699,7 +699,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f592c66", + "id": "e1ec31b2", "metadata": {}, "outputs": [], "source": [ @@ -710,7 +710,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b86603bf", + "id": "01752307", "metadata": {}, "outputs": [], "source": [ @@ -721,7 +721,7 @@ }, { "cell_type": "markdown", - "id": "699f17fd", + "id": "c471b9b7", "metadata": {}, "source": [ "We find that raising $\\gamma_c$ decreases the initial college wage premium $\\phi$, in line with our earlier graphical analysis.\n", @@ -732,7 +732,7 @@ { "cell_type": "code", "execution_count": null, - "id": "462e3bd9", + "id": "5e199565", "metadata": {}, "outputs": [], "source": [ @@ -743,7 +743,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1072d21d", + "id": "0db42316", "metadata": {}, "outputs": [], "source": [ @@ -754,7 +754,7 @@ }, { "cell_type": "markdown", - "id": "e1a42246", + "id": "a35ba440", "metadata": {}, "source": [ "We find that raising the gross interest rate $R$ increases the initial college wage premium $\\phi$, in line with our earlier graphical analysis." diff --git a/_sources/geom_series.ipynb b/_sources/geom_series.ipynb index 05f04c92..4860499d 100644 --- a/_sources/geom_series.ipynb +++ b/_sources/geom_series.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "8de82ccb", + "id": "ad101247", "metadata": {}, "source": [ "(geom_series)=\n", @@ -50,7 +50,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7a1c0b7e", + "id": "64ca62ea", "metadata": {}, "outputs": [], "source": [ @@ -65,7 +65,7 @@ }, { "cell_type": "markdown", - "id": "e825da75", + "id": "2dd86538", "metadata": {}, "source": [ "## Key formulas\n", @@ -665,7 +665,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e4be0de2", + "id": "d6995843", "metadata": {}, "outputs": [], "source": [ @@ -693,7 +693,7 @@ }, { "cell_type": "markdown", - "id": "cf00fd76", + "id": "1b19c504", "metadata": {}, "source": [ "Now that we have defined our functions, we can plot some outcomes.\n", @@ -704,7 +704,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d89b2adc", + "id": "0810ba06", "metadata": { "mystnb": { "figure": { @@ -742,7 +742,7 @@ }, { "cell_type": "markdown", - "id": "0c9ff3fa", + "id": "926f431c", "metadata": {}, "source": [ "Evidently our approximations perform well for small values of $T$.\n", @@ -756,7 +756,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ff1687c5", + "id": "27de334e", "metadata": { "mystnb": { "figure": { @@ -783,7 +783,7 @@ }, { "cell_type": "markdown", - "id": "e4d9b50f", + "id": "ca0b58cb", "metadata": {}, "source": [ "The graph above shows how as duration $T \\rightarrow +\\infty$,\n", @@ -797,7 +797,7 @@ { "cell_type": "code", "execution_count": null, - "id": "af4ede1a", + "id": "7b8d7497", "metadata": { "mystnb": { "figure": { @@ -827,7 +827,7 @@ }, { "cell_type": "markdown", - "id": "547e028f", + "id": "fc1e3f41", "metadata": {}, "source": [ "This graph gives a big hint for why the condition $r > g$ is\n", @@ -844,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ede4cc04", + "id": "1b2aff02", "metadata": { "mystnb": { "figure": { @@ -880,7 +880,7 @@ }, { "cell_type": "markdown", - "id": "1975b18e", + "id": "feed3816", "metadata": {}, "source": [ "We can use a little calculus to study how the present value $p_0$\n", @@ -900,7 +900,7 @@ { "cell_type": "code", "execution_count": null, - "id": "60be2cc7", + "id": "e5c08450", "metadata": {}, "outputs": [], "source": [ @@ -917,7 +917,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c7f906a4", + "id": "cda33aae", "metadata": {}, "outputs": [], "source": [ @@ -929,7 +929,7 @@ { "cell_type": "code", "execution_count": null, - "id": "057aac46", + "id": "fe90d40f", "metadata": {}, "outputs": [], "source": [ @@ -940,7 +940,7 @@ }, { "cell_type": "markdown", - "id": "0c73bb7a", + "id": "1a38a12a", "metadata": {}, "source": [ "We can see that for $\\frac{\\partial p_0}{\\partial r}<0$ as long as\n", @@ -960,7 +960,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9ac40a3c", + "id": "0e8bc861", "metadata": { "mystnb": { "figure": { @@ -998,7 +998,7 @@ }, { "cell_type": "markdown", - "id": "2c81d4d3", + "id": "bfdc709a", "metadata": {}, "source": [ "In this model, income grows over time, until it gradually converges to\n", @@ -1012,7 +1012,7 @@ { "cell_type": "code", "execution_count": null, - "id": "146c92b3", + "id": "7dc57a82", "metadata": { "mystnb": { "figure": { @@ -1038,7 +1038,7 @@ }, { "cell_type": "markdown", - "id": "45cfedcb", + "id": "3fbc2b13", "metadata": {}, "source": [ "Increasing the marginal propensity to consume $b$ increases the\n", @@ -1050,7 +1050,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8dd944bd", + "id": "19b5629d", "metadata": { "mystnb": { "figure": { @@ -1086,7 +1086,7 @@ }, { "cell_type": "markdown", - "id": "43f3084c", + "id": "7fb86e36", "metadata": {}, "source": [ "Notice here, whether government spending increases from 0.3 to 0.4 or\n", diff --git a/_sources/heavy_tails.ipynb b/_sources/heavy_tails.ipynb index aafdb002..deb50301 100644 --- a/_sources/heavy_tails.ipynb +++ b/_sources/heavy_tails.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "d8e560f2", + "id": "887437bd", "metadata": {}, "source": [ "(heavy_tail)=\n", @@ -14,7 +14,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44fec226", + "id": "e5ea3732", "metadata": { "tags": [ "hide-output" @@ -27,7 +27,7 @@ }, { "cell_type": "markdown", - "id": "41ec3453", + "id": "3eac7381", "metadata": {}, "source": [ "We use the following imports." @@ -36,7 +36,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9c562ab8", + "id": "e5c77904", "metadata": {}, "outputs": [], "source": [ @@ -54,7 +54,7 @@ }, { "cell_type": "markdown", - "id": "4ee4d365", + "id": "a9c3351c", "metadata": {}, "source": [ "## Overview\n", @@ -91,7 +91,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dbab917d", + "id": "f7a863c1", "metadata": {}, "outputs": [], "source": [ @@ -106,7 +106,7 @@ }, { "cell_type": "markdown", - "id": "4dade526", + "id": "ee71244e", "metadata": {}, "source": [ "Notice how \n", @@ -120,7 +120,7 @@ { "cell_type": "code", "execution_count": null, - "id": "165b1ae9", + "id": "1386656e", "metadata": {}, "outputs": [], "source": [ @@ -129,7 +129,7 @@ }, { "cell_type": "markdown", - "id": "484c4535", + "id": "19e11311", "metadata": {}, "source": [ "Here's another view of draws from the same distribution:" @@ -138,7 +138,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22045b14", + "id": "2432a550", "metadata": {}, "outputs": [], "source": [ @@ -155,7 +155,7 @@ }, { "cell_type": "markdown", - "id": "8edfdca6", + "id": "a721d2cb", "metadata": {}, "source": [ "We have plotted each individual draw $X_i$ against $i$.\n", @@ -218,7 +218,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c6d0e989", + "id": "42de9ef3", "metadata": {}, "outputs": [], "source": [ @@ -237,7 +237,7 @@ }, { "cell_type": "markdown", - "id": "c979a2fe", + "id": "a2a46e1e", "metadata": {}, "source": [ "This data looks different to the draws from the normal distribution we saw above.\n", @@ -250,7 +250,7 @@ { "cell_type": "code", "execution_count": null, - "id": "50d78d02", + "id": "d83194d4", "metadata": {}, "outputs": [], "source": [ @@ -269,7 +269,7 @@ }, { "cell_type": "markdown", - "id": "5c53abb6", + "id": "6f9a02f3", "metadata": {}, "source": [ "The histogram also looks different to the histogram of the normal\n", @@ -279,7 +279,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ba687d4c", + "id": "ea21d178", "metadata": {}, "outputs": [], "source": [ @@ -291,7 +291,7 @@ }, { "cell_type": "markdown", - "id": "0b3b2bfa", + "id": "aff88d7f", "metadata": {}, "source": [ "If we look at higher frequency returns data (e.g., tick-by-tick), we often see \n", @@ -369,7 +369,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17d37358", + "id": "d95c57da", "metadata": {}, "outputs": [], "source": [ @@ -403,7 +403,7 @@ }, { "cell_type": "markdown", - "id": "d2396bed", + "id": "d374f6e0", "metadata": {}, "source": [ "In the top subfigure, the standard deviation of the normal distribution is 2,\n", @@ -434,7 +434,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0123df90", + "id": "b9b7aa64", "metadata": {}, "outputs": [], "source": [ @@ -453,7 +453,7 @@ }, { "cell_type": "markdown", - "id": "ab994229", + "id": "fc924d2d", "metadata": {}, "source": [ "Another nonnegative distribution is the [Pareto distribution](https://en.wikipedia.org/wiki/Pareto_distribution). \n", @@ -495,7 +495,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f8dba228", + "id": "c95d2507", "metadata": {}, "outputs": [], "source": [ @@ -514,7 +514,7 @@ }, { "cell_type": "markdown", - "id": "f0a660b5", + "id": "6019820c", "metadata": {}, "source": [ "Notice how extreme outcomes are more common.\n", @@ -576,7 +576,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c08386bb", + "id": "13a4c64a", "metadata": {}, "outputs": [], "source": [ @@ -591,7 +591,7 @@ }, { "cell_type": "markdown", - "id": "de1f4175", + "id": "f5a7e9ee", "metadata": {}, "source": [ "Here's a log-log plot of the same functions, which makes visual comparison\n", @@ -601,7 +601,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3552ee2e", + "id": "05741263", "metadata": {}, "outputs": [], "source": [ @@ -615,7 +615,7 @@ }, { "cell_type": "markdown", - "id": "74873893", + "id": "a8a6935b", "metadata": {}, "source": [ "In the log-log plot, the Pareto CCDF is linear, while the exponential one is\n", @@ -641,7 +641,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5ca8587", + "id": "336a1a5c", "metadata": {}, "outputs": [], "source": [ @@ -681,7 +681,7 @@ }, { "cell_type": "markdown", - "id": "7860dce6", + "id": "fe34364d", "metadata": {}, "source": [ "As with the CCDF, the empirical CCDF from the Pareto distributions is \n", @@ -743,7 +743,7 @@ { "cell_type": "code", "execution_count": null, - "id": "519bd67d", + "id": "d31b2eff", "metadata": { "tags": [ "hide-input" @@ -811,7 +811,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4d41ae8d", + "id": "884408e4", "metadata": { "tags": [ "hide-input" @@ -842,7 +842,7 @@ }, { "cell_type": "markdown", - "id": "770f189e", + "id": "d6a37aff", "metadata": {}, "source": [ "### Firm size\n", @@ -853,7 +853,7 @@ { "cell_type": "code", "execution_count": null, - "id": "64e8d769", + "id": "367234f2", "metadata": { "tags": [ "hide-input" @@ -875,7 +875,7 @@ }, { "cell_type": "markdown", - "id": "47cb1bc6", + "id": "a29fd9e6", "metadata": {}, "source": [ "### City size\n", @@ -888,7 +888,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8516b979", + "id": "6bfeb817", "metadata": { "tags": [ "hide-input" @@ -910,7 +910,7 @@ }, { "cell_type": "markdown", - "id": "3108524d", + "id": "967d4757", "metadata": {}, "source": [ "### Wealth\n", @@ -923,7 +923,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40a0e18a", + "id": "a21f933b", "metadata": { "tags": [ "hide-input" @@ -958,7 +958,7 @@ }, { "cell_type": "markdown", - "id": "6f3455e7", + "id": "30a576a2", "metadata": {}, "source": [ "### GDP\n", @@ -971,7 +971,7 @@ { "cell_type": "code", "execution_count": null, - "id": "59a4284a", + "id": "d87fc621", "metadata": { "tags": [ "hide-input" @@ -995,7 +995,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1660413c", + "id": "00389630", "metadata": { "tags": [ "hide-input" @@ -1013,7 +1013,7 @@ }, { "cell_type": "markdown", - "id": "a2c4ec41", + "id": "daff5129", "metadata": {}, "source": [ "The plot is concave rather than linear, so the distribution has light tails.\n", @@ -1055,7 +1055,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b89247c3", + "id": "d72a653a", "metadata": {}, "outputs": [], "source": [ @@ -1085,7 +1085,7 @@ }, { "cell_type": "markdown", - "id": "f4613321", + "id": "941fa078", "metadata": {}, "source": [ "The sequence shows no sign of converging.\n", @@ -1294,7 +1294,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2138e88f", + "id": "35c354d4", "metadata": {}, "outputs": [], "source": [ @@ -1321,7 +1321,7 @@ }, { "cell_type": "markdown", - "id": "50c05979", + "id": "c0309bb3", "metadata": {}, "source": [ "```{solution-end}\n", @@ -1421,7 +1421,7 @@ { "cell_type": "code", "execution_count": null, - "id": "504e36bc", + "id": "d7a7541f", "metadata": {}, "outputs": [], "source": [ @@ -1444,7 +1444,7 @@ }, { "cell_type": "markdown", - "id": "3527ce6f", + "id": "a687d88f", "metadata": {}, "source": [ "Let's compute the lognormal parameters:" @@ -1453,7 +1453,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73372f55", + "id": "fc2d002c", "metadata": {}, "outputs": [], "source": [ @@ -1464,7 +1464,7 @@ }, { "cell_type": "markdown", - "id": "a2bb0e67", + "id": "d6c43881", "metadata": {}, "source": [ "Here's a function to compute a single estimate of tax revenue for a particular\n", @@ -1474,7 +1474,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e4967a19", + "id": "05e1838c", "metadata": {}, "outputs": [], "source": [ @@ -1491,7 +1491,7 @@ }, { "cell_type": "markdown", - "id": "24c7f6c8", + "id": "3b3fc017", "metadata": {}, "source": [ "Now let's generate the violin plot." @@ -1500,7 +1500,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b9cc08f5", + "id": "0966773d", "metadata": {}, "outputs": [], "source": [ @@ -1525,7 +1525,7 @@ }, { "cell_type": "markdown", - "id": "8a92b91d", + "id": "d3c57018", "metadata": {}, "source": [ "Finally, let's print the means and standard deviations." @@ -1534,7 +1534,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e31cd3c", + "id": "7f0fc71f", "metadata": {}, "outputs": [], "source": [ @@ -1544,7 +1544,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8697058a", + "id": "adfcaeba", "metadata": {}, "outputs": [], "source": [ @@ -1553,7 +1553,7 @@ }, { "cell_type": "markdown", - "id": "f71736f6", + "id": "cc8a6253", "metadata": {}, "source": [ "Looking at the output of the code, our main conclusion is that the Pareto\n", diff --git a/_sources/inequality.ipynb b/_sources/inequality.ipynb index 4d3ff962..70454cd2 100644 --- a/_sources/inequality.ipynb +++ b/_sources/inequality.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "0fbf8278", + "id": "8e987c85", "metadata": {}, "source": [ "# Income and Wealth Inequality\n", @@ -58,7 +58,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f3511619", + "id": "b1c90120", "metadata": { "tags": [ "hide-output" @@ -71,7 +71,7 @@ }, { "cell_type": "markdown", - "id": "d8141887", + "id": "6b55888d", "metadata": {}, "source": [ "We will also use the following imports." @@ -80,7 +80,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ddd55002", + "id": "c46cdd82", "metadata": {}, "outputs": [], "source": [ @@ -94,7 +94,7 @@ }, { "cell_type": "markdown", - "id": "93fdd7ae", + "id": "b998a246", "metadata": {}, "source": [ "## The Lorenz curve\n", @@ -159,7 +159,7 @@ { "cell_type": "code", "execution_count": null, - "id": "681f1046", + "id": "73dea597", "metadata": {}, "outputs": [], "source": [ @@ -211,7 +211,7 @@ }, { "cell_type": "markdown", - "id": "5d0ebe4b", + "id": "f0acba48", "metadata": {}, "source": [ "In the next figure, we generate $n=2000$ draws from a lognormal\n", @@ -229,7 +229,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c17e8a01", + "id": "75b9a717", "metadata": { "mystnb": { "figure": { @@ -261,7 +261,7 @@ }, { "cell_type": "markdown", - "id": "64b46224", + "id": "c0fb10af", "metadata": {}, "source": [ "### Lorenz curves for US data\n", @@ -276,7 +276,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ac36d602", + "id": "09830d11", "metadata": {}, "outputs": [], "source": [ @@ -288,7 +288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "318892cb", + "id": "fe6cdc80", "metadata": {}, "outputs": [], "source": [ @@ -297,7 +297,7 @@ }, { "cell_type": "markdown", - "id": "8956c01f", + "id": "6ead3e66", "metadata": {}, "source": [ "The next code block uses data stored in dataframe `df_income_wealth` to generate the Lorenz curves.\n", @@ -309,7 +309,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8a819bc8", + "id": "e0080be7", "metadata": { "tags": [ "hide-input" @@ -357,7 +357,7 @@ }, { "cell_type": "markdown", - "id": "0f3cd3e8", + "id": "fa791176", "metadata": {}, "source": [ "Now we plot Lorenz curves for net wealth, total income and labor income in the\n", @@ -371,7 +371,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d608b7b", + "id": "62e5ab49", "metadata": { "mystnb": { "figure": { @@ -398,7 +398,7 @@ }, { "cell_type": "markdown", - "id": "baf204e7", + "id": "9d3586e7", "metadata": {}, "source": [ "One key finding from this figure is that wealth inequality is more extreme than income inequality. \n", @@ -444,7 +444,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ea90696d", + "id": "0848282a", "metadata": { "mystnb": { "figure": { @@ -473,7 +473,7 @@ }, { "cell_type": "markdown", - "id": "253767ea", + "id": "a20dee31", "metadata": {}, "source": [ "In fact the Gini coefficient can also be expressed as\n", @@ -489,7 +489,7 @@ { "cell_type": "code", "execution_count": null, - "id": "71d5ad03", + "id": "b0f9465b", "metadata": { "mystnb": { "figure": { @@ -518,7 +518,7 @@ }, { "cell_type": "markdown", - "id": "4393509c", + "id": "c3ff5b4f", "metadata": {}, "source": [ "```{seealso}\n", @@ -535,7 +535,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bbb92077", + "id": "e5fa8e08", "metadata": {}, "outputs": [], "source": [ @@ -569,7 +569,7 @@ }, { "cell_type": "markdown", - "id": "a42a1640", + "id": "0d37ada1", "metadata": {}, "source": [ "Now we can compute the Gini coefficients for five different populations.\n", @@ -591,7 +591,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ad5154d", + "id": "9c1255cc", "metadata": {}, "outputs": [], "source": [ @@ -609,7 +609,7 @@ }, { "cell_type": "markdown", - "id": "ca7341b0", + "id": "a779e423", "metadata": {}, "source": [ "Let's build a function that returns a figure (so that we can use it later in the lecture)." @@ -618,7 +618,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35ca10c5", + "id": "fac0b5ce", "metadata": {}, "outputs": [], "source": [ @@ -634,7 +634,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72a70cf2", + "id": "d748e680", "metadata": { "mystnb": { "figure": { @@ -655,7 +655,7 @@ }, { "cell_type": "markdown", - "id": "58024ccc", + "id": "cdf8d2a9", "metadata": {}, "source": [ "The plots show that inequality rises with $\\sigma$, according to the Gini\n", @@ -673,7 +673,7 @@ { "cell_type": "code", "execution_count": null, - "id": "38b6f4c5", + "id": "b5f09f77", "metadata": {}, "outputs": [], "source": [ @@ -682,7 +682,7 @@ }, { "cell_type": "markdown", - "id": "88711fc0", + "id": "f3cb9210", "metadata": {}, "source": [ "We now know the series ID is `SI.POV.GINI`.\n", @@ -695,7 +695,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4c054b18", + "id": "48c9acad", "metadata": { "mystnb": { "figure": { @@ -723,7 +723,7 @@ }, { "cell_type": "markdown", - "id": "8ca2ec42", + "id": "d2beb2cb", "metadata": {}, "source": [ "We can see in {numref}`gini_histogram` that across 50 years of data and all countries the measure varies between 20 and 65.\n", @@ -734,7 +734,7 @@ { "cell_type": "code", "execution_count": null, - "id": "54622581", + "id": "4daef898", "metadata": {}, "outputs": [], "source": [ @@ -746,7 +746,7 @@ }, { "cell_type": "markdown", - "id": "c8533386", + "id": "b19bc6d0", "metadata": {}, "source": [ "(This package often returns data with year information contained in the columns. This is not always convenient for simple plotting with pandas so it can be useful to transpose the results before plotting.)" @@ -755,7 +755,7 @@ { "cell_type": "code", "execution_count": null, - "id": "05b19b7f", + "id": "261b3055", "metadata": {}, "outputs": [], "source": [ @@ -765,7 +765,7 @@ }, { "cell_type": "markdown", - "id": "4971b697", + "id": "b986e79d", "metadata": {}, "source": [ "Let us take a look at the data for the US." @@ -774,7 +774,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ca88568", + "id": "edd0061f", "metadata": { "mystnb": { "figure": { @@ -795,7 +795,7 @@ }, { "cell_type": "markdown", - "id": "326f3e6b", + "id": "ef2d0657", "metadata": {}, "source": [ "As can be seen in {numref}`gini_usa1`, the income Gini\n", @@ -815,7 +815,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6b1b31f0", + "id": "c5a9359f", "metadata": {}, "outputs": [], "source": [ @@ -824,7 +824,7 @@ }, { "cell_type": "markdown", - "id": "4cb73cdc", + "id": "98b4af55", "metadata": {}, "source": [ "**Note:** This code can be used to compute this information over the full dataset." @@ -833,7 +833,7 @@ { "cell_type": "code", "execution_count": null, - "id": "89a118e0", + "id": "6be051dd", "metadata": { "tags": [ "skip-execution", @@ -879,7 +879,7 @@ }, { "cell_type": "markdown", - "id": "3c195dab", + "id": "ee466da3", "metadata": {}, "source": [ "However, to speed up execution we will import a pre-computed dataset from the lecture repository.\n", @@ -890,7 +890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17a65e27", + "id": "e9572548", "metadata": {}, "outputs": [], "source": [ @@ -900,7 +900,7 @@ }, { "cell_type": "markdown", - "id": "2ca1d050", + "id": "c947c17a", "metadata": {}, "source": [ "Let's plot the Gini coefficients for net wealth." @@ -909,7 +909,7 @@ { "cell_type": "code", "execution_count": null, - "id": "149b89d9", + "id": "fdfb4be2", "metadata": { "mystnb": { "figure": { @@ -929,7 +929,7 @@ }, { "cell_type": "markdown", - "id": "12eb52cc", + "id": "b1d3558a", "metadata": {}, "source": [ "The time series for the wealth Gini exhibits a U-shape, falling until the early\n", @@ -955,7 +955,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bc2ab082", + "id": "76c4b2a0", "metadata": {}, "outputs": [], "source": [ @@ -965,7 +965,7 @@ }, { "cell_type": "markdown", - "id": "dffff6dc", + "id": "8d596a9c", "metadata": {}, "source": [ "There are 167 countries represented in this dataset. \n", @@ -976,7 +976,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e3222b0a", + "id": "72d4cbab", "metadata": { "mystnb": { "figure": { @@ -996,7 +996,7 @@ }, { "cell_type": "markdown", - "id": "c3849a80", + "id": "cee1c093", "metadata": {}, "source": [ "We see that Norway has a shorter time series.\n", @@ -1007,7 +1007,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5cf5eb0", + "id": "f4bf1015", "metadata": {}, "outputs": [], "source": [ @@ -1016,7 +1016,7 @@ }, { "cell_type": "markdown", - "id": "f4d46177", + "id": "a0ed7dcf", "metadata": {}, "source": [ "The data for Norway in this dataset goes back to 1979 but there are gaps in the time series and matplotlib is not showing those data points. \n", @@ -1027,7 +1027,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a613f07c", + "id": "2f571ff6", "metadata": { "mystnb": { "figure": { @@ -1048,7 +1048,7 @@ }, { "cell_type": "markdown", - "id": "73c6799c", + "id": "20975c04", "metadata": {}, "source": [ "From this plot we can observe that the US has a higher Gini coefficient (i.e.\n", @@ -1069,7 +1069,7 @@ { "cell_type": "code", "execution_count": null, - "id": "74108c3e", + "id": "bc356ff2", "metadata": {}, "outputs": [], "source": [ @@ -1082,7 +1082,7 @@ }, { "cell_type": "markdown", - "id": "3f510617", + "id": "7539d8de", "metadata": {}, "source": [ "We can rearrange the data so that we can plot GDP per capita and the Gini coefficient across years" @@ -1091,7 +1091,7 @@ { "cell_type": "code", "execution_count": null, - "id": "16174085", + "id": "e0e91ac1", "metadata": {}, "outputs": [], "source": [ @@ -1102,7 +1102,7 @@ }, { "cell_type": "markdown", - "id": "511900e6", + "id": "75ce8935", "metadata": {}, "source": [ "Now we can get the GDP per capita data into a shape that can be merged with `plot_data`" @@ -1111,7 +1111,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f4cccbf", + "id": "84eb7be3", "metadata": {}, "outputs": [], "source": [ @@ -1124,7 +1124,7 @@ }, { "cell_type": "markdown", - "id": "b945b4ff", + "id": "cd2dd6cc", "metadata": {}, "source": [ "Now we use Plotly to build a plot with GDP per capita on the y-axis and the Gini coefficient on the x-axis." @@ -1133,7 +1133,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14903a72", + "id": "cf79bdb6", "metadata": {}, "outputs": [], "source": [ @@ -1143,7 +1143,7 @@ }, { "cell_type": "markdown", - "id": "0c7de38f", + "id": "dc5dc2fa", "metadata": {}, "source": [ "The time series for all three countries start and stop in different years. We will add a year mask to the data to\n", @@ -1153,7 +1153,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ae797c3d", + "id": "d6a78e2e", "metadata": {}, "outputs": [], "source": [ @@ -1164,7 +1164,7 @@ }, { "cell_type": "markdown", - "id": "d0fd5670", + "id": "229f56d0", "metadata": {}, "source": [ "(fig:plotly-gini-gdppc-years)=" @@ -1173,7 +1173,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0248a7ea", + "id": "5e991965", "metadata": {}, "outputs": [], "source": [ @@ -1191,7 +1191,7 @@ }, { "cell_type": "markdown", - "id": "5f2c04a6", + "id": "cf0cbd9a", "metadata": {}, "source": [ "```{only} latex\n", @@ -1243,7 +1243,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7df5158d", + "id": "96ff4f2a", "metadata": { "tags": [ "hide-input" @@ -1293,7 +1293,7 @@ }, { "cell_type": "markdown", - "id": "24b4e594", + "id": "6a0ccb8f", "metadata": {}, "source": [ "Then let's plot the top shares." @@ -1302,7 +1302,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b985090d", + "id": "b10f5e86", "metadata": { "mystnb": { "figure": { @@ -1328,7 +1328,7 @@ }, { "cell_type": "markdown", - "id": "c4bdc028", + "id": "c00947fe", "metadata": {}, "source": [ "## Exercises\n", @@ -1363,7 +1363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fb48c503", + "id": "2faf7d7c", "metadata": {}, "outputs": [], "source": [ @@ -1378,7 +1378,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1da7a49", + "id": "24cfddcf", "metadata": {}, "outputs": [], "source": [ @@ -1404,7 +1404,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5408f096", + "id": "d137cbc1", "metadata": { "mystnb": { "figure": { @@ -1429,7 +1429,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1c3ad495", + "id": "5e58c700", "metadata": { "mystnb": { "figure": { @@ -1454,7 +1454,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f67d3507", + "id": "1109c492", "metadata": { "mystnb": { "figure": { @@ -1478,7 +1478,7 @@ }, { "cell_type": "markdown", - "id": "82a5197f", + "id": "43e1816b", "metadata": {}, "source": [ "```{solution-end}\n", @@ -1506,7 +1506,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c02a2642", + "id": "d8a1eb67", "metadata": {}, "outputs": [], "source": [ @@ -1518,7 +1518,7 @@ { "cell_type": "code", "execution_count": null, - "id": "57b42766", + "id": "c42d7100", "metadata": {}, "outputs": [], "source": [ @@ -1530,7 +1530,7 @@ { "cell_type": "code", "execution_count": null, - "id": "68c1d7eb", + "id": "43f2d320", "metadata": { "mystnb": { "figure": { @@ -1558,7 +1558,7 @@ }, { "cell_type": "markdown", - "id": "80ba5c30", + "id": "d300da38", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/inflation_history.ipynb b/_sources/inflation_history.ipynb index 27043cb4..17b12600 100644 --- a/_sources/inflation_history.ipynb +++ b/_sources/inflation_history.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "a3492ad9", + "id": "2941cd56", "metadata": {}, "source": [ "# Price Level Histories \n", @@ -17,7 +17,7 @@ { "cell_type": "code", "execution_count": null, - "id": "922a216c", + "id": "f995028b", "metadata": {}, "outputs": [], "source": [ @@ -26,7 +26,7 @@ }, { "cell_type": "markdown", - "id": "e57f871c", + "id": "9a426b95", "metadata": {}, "source": [ "We can then import the Python modules we will use." @@ -35,7 +35,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b778691e", + "id": "df5308c9", "metadata": {}, "outputs": [], "source": [ @@ -47,7 +47,7 @@ }, { "cell_type": "markdown", - "id": "f257f539", + "id": "63895dc2", "metadata": {}, "source": [ "The rate of growth of the price level is called **inflation** in the popular press and in discussions among central bankers and treasury officials.\n", @@ -89,7 +89,7 @@ { "cell_type": "code", "execution_count": null, - "id": "778ad2f3", + "id": "8a54332d", "metadata": {}, "outputs": [], "source": [ @@ -104,7 +104,7 @@ }, { "cell_type": "markdown", - "id": "200a520f", + "id": "e28b72d1", "metadata": {}, "source": [ "We first plot price levels over the period 1600-1914.\n", @@ -115,7 +115,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0e23b17", + "id": "d6308106", "metadata": { "mystnb": { "figure": { @@ -147,7 +147,7 @@ }, { "cell_type": "markdown", - "id": "b7cc7dca", + "id": "8b1205ae", "metadata": {}, "source": [ "We say \"most years\" because there were temporary lapses from the gold or silver standard.\n", @@ -200,7 +200,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e4744f2e", + "id": "5076e208", "metadata": { "mystnb": { "figure": { @@ -229,7 +229,7 @@ }, { "cell_type": "markdown", - "id": "b08f601d", + "id": "c6669118", "metadata": {}, "source": [ "{numref}`lrpl_lg` shows that paper-money-printing central banks didn't do as well as the gold and standard silver standard in anchoring price levels.\n", @@ -271,7 +271,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51c9d5fd", + "id": "acd2a066", "metadata": { "tags": [ "hide-input" @@ -337,7 +337,7 @@ }, { "cell_type": "markdown", - "id": "4520200a", + "id": "dd52de38", "metadata": {}, "source": [ "Now we write plotting functions `pe_plot` and `pr_plot` that will build figures that show the price level, exchange rates, \n", @@ -347,7 +347,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14ee7696", + "id": "d5a4b61a", "metadata": { "tags": [ "hide-input" @@ -419,7 +419,7 @@ }, { "cell_type": "markdown", - "id": "6c16d5a9", + "id": "02569c5f", "metadata": {}, "source": [ "We prepare the data for each country" @@ -428,7 +428,7 @@ { "cell_type": "code", "execution_count": null, - "id": "608e9416", + "id": "182dd6c0", "metadata": {}, "outputs": [], "source": [ @@ -469,7 +469,7 @@ }, { "cell_type": "markdown", - "id": "10770e30", + "id": "ca30fe7c", "metadata": {}, "source": [ "Now let's construct graphs for our four countries.\n", @@ -496,7 +496,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce5ed378", + "id": "37296804", "metadata": { "mystnb": { "figure": { @@ -523,7 +523,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ea14f78a", + "id": "540e7636", "metadata": { "mystnb": { "figure": { @@ -543,7 +543,7 @@ }, { "cell_type": "markdown", - "id": "440d3d81", + "id": "9a99c86b", "metadata": {}, "source": [ "Staring at {numref}`pi_xrate_austria` and {numref}`inflationrate_austria` conveys the following impressions to the authors of this lecture at QuantEcon.\n", @@ -564,7 +564,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad27bd89", + "id": "bc4399ef", "metadata": { "mystnb": { "figure": { @@ -592,7 +592,7 @@ { "cell_type": "code", "execution_count": null, - "id": "045c9bd4", + "id": "5b0112cd", "metadata": { "mystnb": { "figure": { @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "9ef3a892", + "id": "4187c777", "metadata": {}, "source": [ "### Poland\n", @@ -631,7 +631,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c537de67", + "id": "a32451a2", "metadata": { "mystnb": { "figure": { @@ -670,7 +670,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1b86c9e8", + "id": "192491b0", "metadata": {}, "outputs": [], "source": [ @@ -687,7 +687,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9c32830", + "id": "f1e7223b", "metadata": { "mystnb": { "figure": { @@ -707,7 +707,7 @@ }, { "cell_type": "markdown", - "id": "cdfd6413", + "id": "ae36e7a1", "metadata": {}, "source": [ "### Germany\n", @@ -721,7 +721,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cfadc194", + "id": "ee730183", "metadata": { "mystnb": { "figure": { @@ -749,7 +749,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a7aa56b8", + "id": "26f48d1a", "metadata": { "mystnb": { "figure": { @@ -783,7 +783,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7277e771", + "id": "f6875d8e", "metadata": { "mystnb": { "figure": { @@ -803,7 +803,7 @@ }, { "cell_type": "markdown", - "id": "609aec64", + "id": "d7cc6993", "metadata": {}, "source": [ "## Starting and stopping big inflations\n", diff --git a/_sources/input_output.ipynb b/_sources/input_output.ipynb index 3b4b8751..a929de4c 100644 --- a/_sources/input_output.ipynb +++ b/_sources/input_output.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "ff050765", + "id": "f3995571", "metadata": {}, "source": [ "# Input-Output Models\n", @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07a3fe59", + "id": "fd9acdb3", "metadata": { "tags": [ "hide-output" @@ -31,7 +31,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5d7b176", + "id": "42179c9d", "metadata": {}, "outputs": [], "source": [ @@ -51,7 +51,7 @@ }, { "cell_type": "markdown", - "id": "c179ce0c", + "id": "6a5d2edc", "metadata": {}, "source": [ "The following figure illustrates a network of linkages among 15 sectors\n", @@ -62,7 +62,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1bcd2fbd", + "id": "658764aa", "metadata": { "tags": [ "hide-cell" @@ -97,7 +97,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c02cd7a8", + "id": "23ef6449", "metadata": { "mystnb": { "figure": { @@ -132,7 +132,7 @@ }, { "cell_type": "markdown", - "id": "85a60f2a", + "id": "010dac01", "metadata": {}, "source": [ "|Label| Sector |Label| Sector |Label| Sector |\n", @@ -186,7 +186,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e1217993", + "id": "8125c3db", "metadata": { "tags": [ "hide-input" @@ -231,7 +231,7 @@ }, { "cell_type": "markdown", - "id": "74ea2853", + "id": "befab557", "metadata": {}, "source": [ "**Feasible allocations must satisfy**\n", @@ -250,7 +250,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31a92002", + "id": "364b6af3", "metadata": { "tags": [ "hide-input" @@ -289,7 +289,7 @@ }, { "cell_type": "markdown", - "id": "60d474d7", + "id": "6253e2c0", "metadata": { "user_expressions": [] }, @@ -348,7 +348,7 @@ { "cell_type": "code", "execution_count": null, - "id": "67611220", + "id": "5e338456", "metadata": {}, "outputs": [], "source": [ @@ -360,7 +360,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73a83ede", + "id": "e55ceef1", "metadata": {}, "outputs": [], "source": [ @@ -371,7 +371,7 @@ }, { "cell_type": "markdown", - "id": "55fdbbb2", + "id": "4273edbe", "metadata": {}, "source": [ "Let's check the **Hawkins-Simon conditions**" @@ -380,7 +380,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5f1164a7", + "id": "af05134b", "metadata": {}, "outputs": [], "source": [ @@ -389,7 +389,7 @@ }, { "cell_type": "markdown", - "id": "1090116d", + "id": "0ca7c325", "metadata": {}, "source": [ "Now, let's compute the **Leontief inverse** matrix" @@ -398,7 +398,7 @@ { "cell_type": "code", "execution_count": null, - "id": "341457ca", + "id": "d2939afe", "metadata": {}, "outputs": [], "source": [ @@ -409,7 +409,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0618a3ec", + "id": "88c0b69b", "metadata": {}, "outputs": [], "source": [ @@ -419,7 +419,7 @@ }, { "cell_type": "markdown", - "id": "9f289f87", + "id": "197c63de", "metadata": { "user_expressions": [] }, @@ -464,7 +464,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14fd2ef3", + "id": "b3485a7b", "metadata": {}, "outputs": [], "source": [ @@ -475,7 +475,7 @@ }, { "cell_type": "markdown", - "id": "c61c6caf", + "id": "3c54d0eb", "metadata": { "user_expressions": [] }, @@ -489,7 +489,7 @@ }, { "cell_type": "markdown", - "id": "9de9f8b0", + "id": "231dc403", "metadata": { "user_expressions": [] }, @@ -580,7 +580,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b9f81b0d", + "id": "ec4e7dda", "metadata": { "tags": [ "hide-input" @@ -618,7 +618,7 @@ }, { "cell_type": "markdown", - "id": "5cb9590e", + "id": "aceb77fe", "metadata": { "user_expressions": [] }, @@ -681,7 +681,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d5d99c5", + "id": "a927a148", "metadata": { "tags": [ "hide-input" @@ -697,7 +697,7 @@ }, { "cell_type": "markdown", - "id": "346ef22f", + "id": "dd6d1f95", "metadata": {}, "source": [ "A higher measure indicates higher importance as a supplier.\n", @@ -742,7 +742,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5571cca0", + "id": "66aeed79", "metadata": { "tags": [ "hide-input" @@ -762,7 +762,7 @@ }, { "cell_type": "markdown", - "id": "7873c061", + "id": "fc120dd9", "metadata": {}, "source": [ "We observe that manufacturing and agriculture are highest ranking sectors.\n", @@ -839,7 +839,7 @@ { "cell_type": "code", "execution_count": null, - "id": "704a41b4", + "id": "2aa5f262", "metadata": {}, "outputs": [], "source": [ @@ -851,7 +851,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5b69d70f", + "id": "0797ed55", "metadata": {}, "outputs": [], "source": [ @@ -863,7 +863,7 @@ { "cell_type": "code", "execution_count": null, - "id": "399c647f", + "id": "56e369b7", "metadata": {}, "outputs": [], "source": [ @@ -873,7 +873,7 @@ }, { "cell_type": "markdown", - "id": "dac755d3", + "id": "488a9d12", "metadata": { "user_expressions": [] }, diff --git a/_sources/intro.ipynb b/_sources/intro.ipynb index da900094..6663f671 100644 --- a/_sources/intro.ipynb +++ b/_sources/intro.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "41466174", + "id": "b9380d56", "metadata": {}, "source": [ "# A First Course in Quantitative Economics with Python\n", diff --git a/_sources/intro_supply_demand.ipynb b/_sources/intro_supply_demand.ipynb index bb8cbc36..22d9f6c5 100644 --- a/_sources/intro_supply_demand.ipynb +++ b/_sources/intro_supply_demand.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "b3f9f05e", + "id": "896dea53", "metadata": {}, "source": [ "# Introduction to Supply and Demand\n", @@ -52,7 +52,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cf4aec73", + "id": "c1fe6d9c", "metadata": {}, "outputs": [], "source": [ @@ -63,7 +63,7 @@ }, { "cell_type": "markdown", - "id": "9ad710b4", + "id": "57e73a43", "metadata": {}, "source": [ "## Consumer surplus\n", @@ -109,7 +109,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1f89d41f", + "id": "61f4d9f6", "metadata": { "mystnb": { "figure": { @@ -138,7 +138,7 @@ }, { "cell_type": "markdown", - "id": "ea5641ea", + "id": "ee4cac9b", "metadata": {}, "source": [ "The total consumer surplus in this market is \n", @@ -182,7 +182,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ab3b94a", + "id": "17122dc1", "metadata": { "mystnb": { "figure": { @@ -215,7 +215,7 @@ }, { "cell_type": "markdown", - "id": "eef636ac", + "id": "08128140", "metadata": {}, "source": [ "Reasoning by analogy with the discrete case, the area under the demand curve and above the price is called the **consumer surplus**, and is a measure of total gains from trade on the part of consumers.\n", @@ -226,7 +226,7 @@ { "cell_type": "code", "execution_count": null, - "id": "198087de", + "id": "56891406", "metadata": { "mystnb": { "figure": { @@ -260,7 +260,7 @@ }, { "cell_type": "markdown", - "id": "deca913c", + "id": "728e432e", "metadata": {}, "source": [ "The value $q^*$ is where the inverse demand curve meets price.\n", @@ -277,7 +277,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df702f5c", + "id": "54d42bfe", "metadata": { "mystnb": { "figure": { @@ -304,7 +304,7 @@ }, { "cell_type": "markdown", - "id": "e64a88a9", + "id": "c2790c16", "metadata": {}, "source": [ "Let $v_i$ be the price at which producer $i$ is willing to sell the good.\n", @@ -336,7 +336,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6215592c", + "id": "c437f727", "metadata": { "mystnb": { "figure": { @@ -375,7 +375,7 @@ }, { "cell_type": "markdown", - "id": "484e78c5", + "id": "0a418b84", "metadata": {}, "source": [ "(integration)=\n", @@ -397,7 +397,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8de12639", + "id": "4a20c568", "metadata": { "mystnb": { "figure": { @@ -426,7 +426,7 @@ }, { "cell_type": "markdown", - "id": "9fac4cf5", + "id": "d9357709", "metadata": {}, "source": [ "There are many rules for calculating integrals, with different rules applying to different choices of $f$.\n", @@ -483,7 +483,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4b5c46ec", + "id": "f838b7f5", "metadata": {}, "outputs": [], "source": [ @@ -496,7 +496,7 @@ }, { "cell_type": "markdown", - "id": "b6e162c3", + "id": "a42af058", "metadata": {}, "source": [ "The function below creates an instance of a Market namedtuple with default values." @@ -505,7 +505,7 @@ { "cell_type": "code", "execution_count": null, - "id": "50dc753d", + "id": "e366782f", "metadata": {}, "outputs": [], "source": [ @@ -515,7 +515,7 @@ }, { "cell_type": "markdown", - "id": "c1048b78", + "id": "a6c3164f", "metadata": {}, "source": [ "This `market` can then be used by our `inverse_demand` and `inverse_supply` functions." @@ -524,7 +524,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b2fd883b", + "id": "34f570fc", "metadata": {}, "outputs": [], "source": [ @@ -537,7 +537,7 @@ }, { "cell_type": "markdown", - "id": "11fe485a", + "id": "fe97845c", "metadata": {}, "source": [ "Here is a plot of these two functions using `market`." @@ -546,7 +546,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a452932f", + "id": "457797e2", "metadata": { "mystnb": { "figure": { @@ -578,7 +578,7 @@ }, { "cell_type": "markdown", - "id": "d71965e3", + "id": "d6589999", "metadata": {}, "source": [ "In the above graph, an **equilibrium** price-quantity pair occurs at the intersection of the supply and demand curves. \n", @@ -602,7 +602,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2034e2f6", + "id": "19b1029f", "metadata": { "mystnb": { "figure": { @@ -644,7 +644,7 @@ }, { "cell_type": "markdown", - "id": "e11e06dc", + "id": "f4e56a5b", "metadata": {}, "source": [ "Consumer surplus provides a measure of total consumer welfare at quantity $q$.\n", @@ -682,7 +682,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1a416fb", + "id": "2941c316", "metadata": { "mystnb": { "figure": { @@ -724,7 +724,7 @@ }, { "cell_type": "markdown", - "id": "8dabeb85", + "id": "d8c7b9b0", "metadata": {}, "source": [ "Producer surplus measures total producer welfare at quantity $q$ \n", @@ -769,7 +769,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3467e0a9", + "id": "a7fa672c", "metadata": {}, "outputs": [], "source": [ @@ -780,7 +780,7 @@ }, { "cell_type": "markdown", - "id": "dd1d7f1c", + "id": "41a37399", "metadata": {}, "source": [ "The next figure plots welfare as a function of $q$." @@ -789,7 +789,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5c01e49e", + "id": "71c2b52a", "metadata": { "mystnb": { "figure": { @@ -813,7 +813,7 @@ }, { "cell_type": "markdown", - "id": "d3245639", + "id": "ebdf71bb", "metadata": {}, "source": [ "Let's now give a social planner the task of maximizing social welfare.\n", @@ -917,7 +917,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3ae7c750", + "id": "36e955f2", "metadata": {}, "outputs": [], "source": [ @@ -930,7 +930,7 @@ }, { "cell_type": "markdown", - "id": "0877914d", + "id": "464361d1", "metadata": {}, "source": [ "Here is a plot of inverse supply and demand." @@ -939,7 +939,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7d84ce93", + "id": "25eb6083", "metadata": {}, "outputs": [], "source": [ @@ -963,7 +963,7 @@ }, { "cell_type": "markdown", - "id": "5b3cd375", + "id": "e11ae991", "metadata": {}, "source": [ "```{solution-end}\n", @@ -1025,7 +1025,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6d8e8f36", + "id": "b30d6034", "metadata": {}, "outputs": [], "source": [ @@ -1038,7 +1038,7 @@ }, { "cell_type": "markdown", - "id": "9c5fa655", + "id": "e079277c", "metadata": {}, "source": [ "The next figure plots welfare as a function of $q$." @@ -1047,7 +1047,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d9b4411e", + "id": "f9ef3bd8", "metadata": {}, "outputs": [], "source": [ @@ -1060,7 +1060,7 @@ }, { "cell_type": "markdown", - "id": "18c011e4", + "id": "ec5cae9e", "metadata": {}, "source": [ "```{solution-end}\n", @@ -1092,7 +1092,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42ee390e", + "id": "3b58b933", "metadata": {}, "outputs": [], "source": [ @@ -1108,7 +1108,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1a396810", + "id": "6f1e1d13", "metadata": {}, "outputs": [], "source": [ @@ -1118,7 +1118,7 @@ }, { "cell_type": "markdown", - "id": "969e03b3", + "id": "ea7bed3b", "metadata": {}, "source": [ "```{solution-end}\n", @@ -1163,7 +1163,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0a3168b6", + "id": "72dda9c9", "metadata": {}, "outputs": [], "source": [ @@ -1178,7 +1178,7 @@ }, { "cell_type": "markdown", - "id": "a9464a63", + "id": "df4ab403", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/laffer_adaptive.ipynb b/_sources/laffer_adaptive.ipynb index b6b53d1f..f3f89f0b 100644 --- a/_sources/laffer_adaptive.ipynb +++ b/_sources/laffer_adaptive.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "6a3c4ae4", + "id": "b7c32692", "metadata": {}, "source": [ "# Laffer Curves with Adaptive Expectations \n", @@ -163,7 +163,7 @@ { "cell_type": "code", "execution_count": null, - "id": "90062f98", + "id": "f6df7d9d", "metadata": {}, "outputs": [], "source": [ @@ -179,7 +179,7 @@ }, { "cell_type": "markdown", - "id": "6cdd62bd", + "id": "e154d6c3", "metadata": { "user_expressions": [] }, @@ -190,7 +190,7 @@ { "cell_type": "code", "execution_count": null, - "id": "595d3417", + "id": "8f795ea1", "metadata": {}, "outputs": [], "source": [ @@ -209,7 +209,7 @@ }, { "cell_type": "markdown", - "id": "079d5b21", + "id": "c073cb6a", "metadata": {}, "source": [ "Now we write code that computes steady-state $\\bar \\pi$s." @@ -218,7 +218,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f8923f4a", + "id": "56f75b9a", "metadata": {}, "outputs": [], "source": [ @@ -238,7 +238,7 @@ }, { "cell_type": "markdown", - "id": "e2ffdbca", + "id": "5632938d", "metadata": {}, "source": [ "We find two steady state $\\bar \\pi$ values\n", @@ -251,7 +251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "882566ad", + "id": "d6db1ee2", "metadata": { "mystnb": { "figure": { @@ -297,7 +297,7 @@ }, { "cell_type": "markdown", - "id": "d7d0a8c3", + "id": "9f3f54eb", "metadata": {}, "source": [ "## Associated Initial Price Levels\n", @@ -314,7 +314,7 @@ { "cell_type": "code", "execution_count": null, - "id": "796491b3", + "id": "1a4d6401", "metadata": {}, "outputs": [], "source": [ @@ -330,7 +330,7 @@ }, { "cell_type": "markdown", - "id": "5944ad47", + "id": "4bb74532", "metadata": {}, "source": [ "### Verification \n", @@ -343,7 +343,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5dc5bfb", + "id": "2fc5cb7c", "metadata": {}, "outputs": [], "source": [ @@ -381,7 +381,7 @@ }, { "cell_type": "markdown", - "id": "71d9eb06", + "id": "92fe128c", "metadata": {}, "source": [ "Compute limiting values starting from $p_{-1}$ associated with $\\pi_l$" @@ -390,7 +390,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fb4d69f3", + "id": "9d4f9b8e", "metadata": {}, "outputs": [], "source": [ @@ -408,7 +408,7 @@ }, { "cell_type": "markdown", - "id": "001daf43", + "id": "079dd4e7", "metadata": {}, "source": [ "Compute limiting values starting from $p_{-1}$ associated with $\\pi_u$" @@ -417,7 +417,7 @@ { "cell_type": "code", "execution_count": null, - "id": "65b7d993", + "id": "8532c41d", "metadata": {}, "outputs": [], "source": [ @@ -435,7 +435,7 @@ }, { "cell_type": "markdown", - "id": "be2ae3a5", + "id": "560fbe6a", "metadata": {}, "source": [ "## Slippery Side of Laffer Curve Dynamics\n", @@ -453,7 +453,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3bd80f2d", + "id": "aa01eb57", "metadata": { "tags": [ "hide-cell" @@ -496,7 +496,7 @@ }, { "cell_type": "markdown", - "id": "85503cbd", + "id": "362f4d56", "metadata": {}, "source": [ "Let's simulate the result generated by varying the initial $\\pi_{-1}$ and corresponding $p_{-1}$" @@ -505,7 +505,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ca7f38ed", + "id": "654dad83", "metadata": { "mystnb": { "figure": { diff --git a/_sources/lake_model.ipynb b/_sources/lake_model.ipynb index 4fd7dd74..6215e784 100644 --- a/_sources/lake_model.ipynb +++ b/_sources/lake_model.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "96aceabb", + "id": "a680ca48", "metadata": {}, "source": [ "# A Lake Model of Employment\n", @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "72357c6b", + "id": "dc6b7c7f", "metadata": {}, "outputs": [], "source": [ @@ -25,7 +25,7 @@ }, { "cell_type": "markdown", - "id": "27869c79", + "id": "92629f0c", "metadata": {}, "source": [ "## The Lake model\n", @@ -109,7 +109,7 @@ { "cell_type": "code", "execution_count": null, - "id": "741cd0d3", + "id": "5ba07352", "metadata": {}, "outputs": [], "source": [ @@ -173,7 +173,7 @@ { "cell_type": "code", "execution_count": null, - "id": "66a6451d", + "id": "3c6e0a77", "metadata": {}, "outputs": [], "source": [ @@ -208,7 +208,7 @@ }, { "cell_type": "markdown", - "id": "559da85c", + "id": "bb4bbbde", "metadata": {}, "source": [ "Not surprisingly, we observe that labor force $n_t$ increases at a constant rate.\n", @@ -318,7 +318,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4c2e489b", + "id": "3eb4c62d", "metadata": {}, "outputs": [], "source": [ @@ -397,7 +397,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fd4acd40", + "id": "c4610780", "metadata": {}, "outputs": [], "source": [ @@ -408,7 +408,7 @@ }, { "cell_type": "markdown", - "id": "4b363fa0", + "id": "aa8d7f48", "metadata": {}, "source": [ "Since $\\bar{x}$ is an eigenvector corresponding to the eigenvalue $r(A)$, all the vectors in the set\n", @@ -437,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1612bd8", + "id": "96426f77", "metadata": {}, "outputs": [], "source": [ @@ -447,7 +447,7 @@ }, { "cell_type": "markdown", - "id": "f7073575", + "id": "8c37604b", "metadata": {}, "source": [ "Thus, while the sequence of iterates still moves towards the dominant eigenvector $\\bar{x}$, in this case\n", @@ -514,7 +514,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e33f6414", + "id": "03d46bc6", "metadata": {}, "outputs": [], "source": [ @@ -554,7 +554,7 @@ }, { "cell_type": "markdown", - "id": "6f9f29f7", + "id": "8e8ca080", "metadata": {}, "source": [ "To provide more intuition for convergence, we further explain the convergence below without the Perron-Frobenius theorem.\n", @@ -620,7 +620,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b6c4c26", + "id": "57d7d3e3", "metadata": {}, "outputs": [], "source": [ @@ -641,7 +641,7 @@ }, { "cell_type": "markdown", - "id": "e04eee3b", + "id": "3d8c34a1", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/linear_equations.ipynb b/_sources/linear_equations.ipynb index bb29ce28..20cad9e3 100644 --- a/_sources/linear_equations.ipynb +++ b/_sources/linear_equations.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "a4681326", + "id": "ba360d92", "metadata": {}, "source": [ "# Linear Equations and Matrix Algebra\n", @@ -39,7 +39,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a602bad4", + "id": "3443f6a3", "metadata": {}, "outputs": [], "source": [ @@ -49,7 +49,7 @@ }, { "cell_type": "markdown", - "id": "68c01cf0", + "id": "7fa48dad", "metadata": {}, "source": [ "## A two good example\n", @@ -160,7 +160,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8a25c115", + "id": "cb66d499", "metadata": { "tags": [ "hide-input" @@ -190,7 +190,7 @@ }, { "cell_type": "markdown", - "id": "30539b31", + "id": "89bd405d", "metadata": {}, "source": [ "### Vector operations\n", @@ -259,7 +259,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5abd0bd", + "id": "9e4164f3", "metadata": { "tags": [ "hide-input" @@ -302,7 +302,7 @@ }, { "cell_type": "markdown", - "id": "92fbe864", + "id": "fcf4d26c", "metadata": {}, "source": [ "Scalar multiplication is an operation that multiplies a vector $x$ with a scalar elementwise.\n", @@ -345,7 +345,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c94308c7", + "id": "fb529806", "metadata": { "tags": [ "hide-input" @@ -385,7 +385,7 @@ }, { "cell_type": "markdown", - "id": "727acced", + "id": "f60ab0e4", "metadata": {}, "source": [ "In Python, a vector can be represented as a list or tuple, \n", @@ -401,7 +401,7 @@ { "cell_type": "code", "execution_count": null, - "id": "360b3490", + "id": "1876b39b", "metadata": {}, "outputs": [], "source": [ @@ -413,7 +413,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9334c9f0", + "id": "372a6f72", "metadata": {}, "outputs": [], "source": [ @@ -422,7 +422,7 @@ }, { "cell_type": "markdown", - "id": "bad0d612", + "id": "1fc7c85f", "metadata": {}, "source": [ "### Inner product and norm\n", @@ -465,7 +465,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5a1181a", + "id": "5f7dc25a", "metadata": {}, "outputs": [], "source": [ @@ -475,7 +475,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d4c65826", + "id": "bbb591ad", "metadata": {}, "outputs": [], "source": [ @@ -485,7 +485,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30ae68df", + "id": "8419b649", "metadata": {}, "outputs": [], "source": [ @@ -495,7 +495,7 @@ { "cell_type": "code", "execution_count": null, - "id": "85dc4358", + "id": "68567ddd", "metadata": {}, "outputs": [], "source": [ @@ -504,7 +504,7 @@ }, { "cell_type": "markdown", - "id": "2c74e759", + "id": "02410e9c", "metadata": {}, "source": [ "## Matrix operations\n", @@ -724,7 +724,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e754daf1", + "id": "59a6afd4", "metadata": {}, "outputs": [], "source": [ @@ -737,7 +737,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9debf097", + "id": "a0841611", "metadata": {}, "outputs": [], "source": [ @@ -749,7 +749,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a78afc67", + "id": "ad809726", "metadata": {}, "outputs": [], "source": [ @@ -758,7 +758,7 @@ }, { "cell_type": "markdown", - "id": "b9b22a67", + "id": "cae32b0e", "metadata": {}, "source": [ "The `shape` attribute is a tuple giving the number of rows and columns ---\n", @@ -776,7 +776,7 @@ { "cell_type": "code", "execution_count": null, - "id": "133a2aad", + "id": "1369ffca", "metadata": {}, "outputs": [], "source": [ @@ -788,7 +788,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8dc90d98", + "id": "c87ea6db", "metadata": {}, "outputs": [], "source": [ @@ -797,7 +797,7 @@ }, { "cell_type": "markdown", - "id": "7bcd3476", + "id": "2f520cc9", "metadata": {}, "source": [ "To multiply matrices we use the `@` symbol.\n", @@ -1034,7 +1034,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3910b61e", + "id": "9343afd2", "metadata": {}, "outputs": [], "source": [ @@ -1048,7 +1048,7 @@ }, { "cell_type": "markdown", - "id": "fa59c2a7", + "id": "8c647195", "metadata": { "tags": [] }, @@ -1192,7 +1192,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e798b586", + "id": "b19d03d9", "metadata": {}, "outputs": [], "source": [ @@ -1202,7 +1202,7 @@ }, { "cell_type": "markdown", - "id": "8c17b3e3", + "id": "51c7dab6", "metadata": {}, "source": [ "Now we change this to a NumPy array." @@ -1211,7 +1211,7 @@ { "cell_type": "code", "execution_count": null, - "id": "57f2eef0", + "id": "10471ed4", "metadata": {}, "outputs": [], "source": [ @@ -1221,7 +1221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40c3bb4a", + "id": "20afda0b", "metadata": {}, "outputs": [], "source": [ @@ -1233,7 +1233,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e8193d64", + "id": "6f007b1b", "metadata": {}, "outputs": [], "source": [ @@ -1244,7 +1244,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c591e666", + "id": "7ee1bd90", "metadata": {}, "outputs": [], "source": [ @@ -1257,7 +1257,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6f9d3c55", + "id": "f9d42909", "metadata": {}, "outputs": [], "source": [ @@ -1268,7 +1268,7 @@ { "cell_type": "code", "execution_count": null, - "id": "194ab181", + "id": "63f39c2a", "metadata": {}, "outputs": [], "source": [ @@ -1279,7 +1279,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b2080de7", + "id": "488a4119", "metadata": {}, "outputs": [], "source": [ @@ -1289,7 +1289,7 @@ }, { "cell_type": "markdown", - "id": "077d728c", + "id": "82fa2daf", "metadata": {}, "source": [ "Notice that we get the same solutions as the pencil and paper case.\n", @@ -1300,7 +1300,7 @@ { "cell_type": "code", "execution_count": null, - "id": "747d768a", + "id": "5dc1940b", "metadata": {}, "outputs": [], "source": [ @@ -1312,7 +1312,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6f244581", + "id": "7f5b195d", "metadata": {}, "outputs": [], "source": [ @@ -1322,7 +1322,7 @@ }, { "cell_type": "markdown", - "id": "15aa05d2", + "id": "e185cb54", "metadata": {}, "source": [ "Observe how we can solve for $x = A^{-1} y$ by either via `inv(A) @ y`, or using `solve(A, y)`.\n", @@ -1413,7 +1413,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0159141", + "id": "09cd1b99", "metadata": {}, "outputs": [], "source": [ @@ -1433,7 +1433,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c72b9516", + "id": "0e5d7626", "metadata": {}, "outputs": [], "source": [ @@ -1449,7 +1449,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7289f602", + "id": "f7a3c4ac", "metadata": {}, "outputs": [], "source": [ @@ -1461,7 +1461,7 @@ }, { "cell_type": "markdown", - "id": "bb77c042", + "id": "267521e8", "metadata": {}, "source": [ "The solution is given by:\n", @@ -1565,7 +1565,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0834c199", + "id": "ba1ab451", "metadata": {}, "outputs": [], "source": [ @@ -1576,7 +1576,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4cbef1d2", + "id": "386e8df4", "metadata": {}, "outputs": [], "source": [ @@ -1597,7 +1597,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fef25f77", + "id": "babdaed0", "metadata": {}, "outputs": [], "source": [ @@ -1608,7 +1608,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee296578", + "id": "4f47110c", "metadata": { "tags": [ "hide-input" @@ -1622,7 +1622,7 @@ }, { "cell_type": "markdown", - "id": "7f8635f9", + "id": "3665a42e", "metadata": {}, "source": [ "Here is a visualization of how the least squares method approximates the equation of a line connecting a set of points.\n", @@ -1633,7 +1633,7 @@ { "cell_type": "code", "execution_count": null, - "id": "64eb1f34", + "id": "56e1838b", "metadata": {}, "outputs": [], "source": [ @@ -1653,7 +1653,7 @@ }, { "cell_type": "markdown", - "id": "e4ea4a00", + "id": "f0a1b826", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/lln_clt.ipynb b/_sources/lln_clt.ipynb index 247f1a50..fd5040a7 100644 --- a/_sources/lln_clt.ipynb +++ b/_sources/lln_clt.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "acd0c61c", + "id": "8242949a", "metadata": {}, "source": [ "# LLN and CLT\n", @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4ba0c230", + "id": "2ae68ca7", "metadata": {}, "outputs": [], "source": [ @@ -41,7 +41,7 @@ }, { "cell_type": "markdown", - "id": "4f48ecc1", + "id": "23ccf722", "metadata": {}, "source": [ "(lln_mr)=\n", @@ -81,7 +81,7 @@ { "cell_type": "code", "execution_count": null, - "id": "999e5abf", + "id": "e988dd90", "metadata": {}, "outputs": [], "source": [ @@ -92,11 +92,13 @@ }, { "cell_type": "markdown", - "id": "32281f00", + "id": "57df4dc2", "metadata": {}, "source": [ "In this setting, the LLN tells us if we flip the coin many times, the fraction\n", - "of heads that we see will be close to the mean $p$.\n", + "of heads that we see will be close to the mean $p$. \n", + "\n", + "We use $n$ to represent the number of times the coin is flipped.\n", "\n", "Let's check this:" ] @@ -104,7 +106,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44b5e6f5", + "id": "21f384d9", "metadata": {}, "outputs": [], "source": [ @@ -115,7 +117,7 @@ }, { "cell_type": "markdown", - "id": "62fb132e", + "id": "6f6b2fbb", "metadata": {}, "source": [ "If we change $p$ the claim still holds:" @@ -124,7 +126,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aa83231d", + "id": "51045351", "metadata": {}, "outputs": [], "source": [ @@ -135,7 +137,7 @@ }, { "cell_type": "markdown", - "id": "615105c3", + "id": "48e0eb32", "metadata": {}, "source": [ "Let's connect this to the discussion above, where we said the sample average\n", @@ -281,7 +283,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4df7116b", + "id": "2abb4978", "metadata": {}, "outputs": [], "source": [ @@ -297,7 +299,7 @@ }, { "cell_type": "markdown", - "id": "ee9f7487", + "id": "ee06e9da", "metadata": {}, "source": [ "Now we write a function to generate $m$ sample means and histogram them." @@ -306,7 +308,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a32799c2", + "id": "e684d323", "metadata": {}, "outputs": [], "source": [ @@ -335,7 +337,7 @@ }, { "cell_type": "markdown", - "id": "69d33eca", + "id": "a631a503", "metadata": {}, "source": [ "Now we call the function." @@ -344,7 +346,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ffbbd72b", + "id": "46e5d8fb", "metadata": {}, "outputs": [], "source": [ @@ -356,7 +358,7 @@ }, { "cell_type": "markdown", - "id": "670d8bb9", + "id": "c3865ceb", "metadata": {}, "source": [ "We can see that the distribution of $\\bar X$ is clustered around $\\mathbb E X$\n", @@ -364,7 +366,7 @@ "\n", "Let's vary `n` to see how the distribution of the sample mean changes.\n", "\n", - "We will use a violin plot to show the different distributions.\n", + "We will use a [violin plot](https://intro.quantecon.org/prob_dist.html#violin-plots) to show the different distributions.\n", "\n", "Each distribution in the violin plot represents the distribution of $X_n$ for some $n$, calculated by simulation." ] @@ -372,7 +374,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42356c94", + "id": "93444f9a", "metadata": {}, "outputs": [], "source": [ @@ -406,7 +408,7 @@ }, { "cell_type": "markdown", - "id": "e19438d0", + "id": "dbf8372c", "metadata": {}, "source": [ "Let's try with a normal distribution." @@ -415,7 +417,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5831710", + "id": "e6bff5f8", "metadata": {}, "outputs": [], "source": [ @@ -424,7 +426,7 @@ }, { "cell_type": "markdown", - "id": "3a88bc4e", + "id": "9d8e8f11", "metadata": {}, "source": [ "As $n$ gets large, more probability mass clusters around the population mean $\\mu$.\n", @@ -435,7 +437,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dc3f43f7", + "id": "fa59a29e", "metadata": {}, "outputs": [], "source": [ @@ -444,7 +446,7 @@ }, { "cell_type": "markdown", - "id": "2c8625ed", + "id": "ed20bde0", "metadata": {}, "source": [ "We get a similar result." @@ -452,7 +454,7 @@ }, { "cell_type": "markdown", - "id": "aabc4211", + "id": "5e9a978f", "metadata": {}, "source": [ "## Breaking the LLN\n", @@ -475,12 +477,12 @@ "\n", "Hence the LLN does not hold.\n", "\n", - "The LLN fails to hold here because the assumption $\\mathbb E|X| = \\infty$ is violated by the Cauchy distribution." + "The LLN fails to hold here because the assumption $\\mathbb E|X| < \\infty$ is violated by the Cauchy distribution." ] }, { "cell_type": "markdown", - "id": "03392304", + "id": "f828e16e", "metadata": {}, "source": [ "### Failure of the IID condition\n", @@ -524,7 +526,7 @@ }, { "cell_type": "markdown", - "id": "409d40c7", + "id": "b879f094", "metadata": {}, "source": [ "## Central limit theorem\n", @@ -563,7 +565,7 @@ "\n", "The striking implication of the CLT is that for **any** distribution with\n", "finite [second moment](https://en.wikipedia.org/wiki/Moment_(mathematics)), the simple operation of adding independent\n", - "copies **always** leads to a Gaussian curve.\n", + "copies **always** leads to a Gaussian(Normal) curve.\n", "\n", "\n", "\n", @@ -590,7 +592,7 @@ { "cell_type": "code", "execution_count": null, - "id": "299d0b6d", + "id": "ee9808d2", "metadata": {}, "outputs": [], "source": [ @@ -625,7 +627,7 @@ }, { "cell_type": "markdown", - "id": "090ca89c", + "id": "28000c77", "metadata": {}, "source": [ "(Notice the absence of for loops --- every operation is vectorized, meaning that the major calculations are all shifted to fast C code.)\n", @@ -640,7 +642,7 @@ "```{exercise} \n", ":label: lln_ex1\n", "\n", - "Repeat the simulation [above1](sim_one) with the [Beta distribution](https://en.wikipedia.org/wiki/Beta_distribution).\n", + "Repeat the simulation [above](sim_one) with the [Beta distribution](https://en.wikipedia.org/wiki/Beta_distribution).\n", "\n", "You can choose any $\\alpha > 0$ and $\\beta > 0$.\n", "```\n", @@ -653,7 +655,7 @@ { "cell_type": "code", "execution_count": null, - "id": "201c85d8", + "id": "7b7e8a7d", "metadata": {}, "outputs": [], "source": [ @@ -686,7 +688,7 @@ }, { "cell_type": "markdown", - "id": "248515c4", + "id": "7204f724", "metadata": {}, "source": [ "```{solution-end}\n", @@ -817,7 +819,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8c3d11d9", + "id": "35bcf01a", "metadata": {}, "outputs": [], "source": [ @@ -852,7 +854,7 @@ }, { "cell_type": "markdown", - "id": "70c6c390", + "id": "b9f429fa", "metadata": {}, "source": [ "We see the convergence of $\\bar x$ around $\\mu$ even when the independence assumption is violated.\n", @@ -883,31 +885,31 @@ 39, 74, 78, - 85, - 89, - 93, - 97, - 238, - 247, - 251, - 273, - 277, - 282, - 293, - 320, - 324, + 87, + 91, + 95, + 99, + 240, + 249, + 253, + 275, + 279, + 284, + 295, + 322, 326, - 332, + 328, 334, - 338, - 362, - 403, - 464, - 492, - 515, - 541, - 667, - 695 + 336, + 340, + 364, + 405, + 466, + 494, + 517, + 543, + 669, + 697 ] }, "nbformat": 4, diff --git a/_sources/lln_clt.md b/_sources/lln_clt.md index eaa05701..7e7676ce 100644 --- a/_sources/lln_clt.md +++ b/_sources/lln_clt.md @@ -78,7 +78,9 @@ print(X) ``` In this setting, the LLN tells us if we flip the coin many times, the fraction -of heads that we see will be close to the mean $p$. +of heads that we see will be close to the mean $p$. + +We use $n$ to represent the number of times the coin is flipped. Let's check this: @@ -286,7 +288,7 @@ as expected. Let's vary `n` to see how the distribution of the sample mean changes. -We will use a violin plot to show the different distributions. +We will use a [violin plot](https://intro.quantecon.org/prob_dist.html#violin-plots) to show the different distributions. Each distribution in the violin plot represents the distribution of $X_n$ for some $n$, calculated by simulation. @@ -357,7 +359,7 @@ This means that the distribution of $\bar X_n$ does not eventually concentrate o Hence the LLN does not hold. -The LLN fails to hold here because the assumption $\mathbb E|X| = \infty$ is violated by the Cauchy distribution. +The LLN fails to hold here because the assumption $\mathbb E|X| < \infty$ is violated by the Cauchy distribution. +++ @@ -438,7 +440,7 @@ Here $\stackrel { d } {\to} N(0, \sigma^2)$ indicates [convergence in distributi The striking implication of the CLT is that for **any** distribution with finite [second moment](https://en.wikipedia.org/wiki/Moment_(mathematics)), the simple operation of adding independent -copies **always** leads to a Gaussian curve. +copies **always** leads to a Gaussian(Normal) curve. @@ -503,7 +505,7 @@ The fit to the normal density is already tight and can be further improved by in ```{exercise} :label: lln_ex1 -Repeat the simulation [above1](sim_one) with the [Beta distribution](https://en.wikipedia.org/wiki/Beta_distribution). +Repeat the simulation [above](sim_one) with the [Beta distribution](https://en.wikipedia.org/wiki/Beta_distribution). You can choose any $\alpha > 0$ and $\beta > 0$. ``` diff --git a/_sources/long_run_growth.ipynb b/_sources/long_run_growth.ipynb index a33d5c36..a02c55b9 100644 --- a/_sources/long_run_growth.ipynb +++ b/_sources/long_run_growth.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "15eb9af4", + "id": "ce648257", "metadata": {}, "source": [ "# Long-Run Growth\n", @@ -62,7 +62,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53969857", + "id": "dd8cb24a", "metadata": {}, "outputs": [], "source": [ @@ -75,7 +75,7 @@ }, { "cell_type": "markdown", - "id": "4c640039", + "id": "d7534498", "metadata": {}, "source": [ "## Setting up\n", @@ -95,7 +95,7 @@ { "cell_type": "code", "execution_count": null, - "id": "21bc53d8", + "id": "79825951", "metadata": {}, "outputs": [], "source": [ @@ -107,7 +107,7 @@ }, { "cell_type": "markdown", - "id": "41c82c2f", + "id": "5af50260", "metadata": {}, "source": [ "We can see that this dataset contains GDP per capita (`gdppc`) and population (pop) for many countries and years.\n", @@ -118,7 +118,7 @@ { "cell_type": "code", "execution_count": null, - "id": "20713c07", + "id": "18cae757", "metadata": {}, "outputs": [], "source": [ @@ -128,7 +128,7 @@ }, { "cell_type": "markdown", - "id": "a664583e", + "id": "a223d5e8", "metadata": {}, "source": [ "We can now explore some of the 169 countries that are available. \n", @@ -139,7 +139,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b32a1b36", + "id": "26f7263a", "metadata": {}, "outputs": [], "source": [ @@ -155,7 +155,7 @@ }, { "cell_type": "markdown", - "id": "0174e08a", + "id": "898b29f4", "metadata": {}, "source": [ "Let's now reshape the original data into some convenient variables to enable quicker access to countries' time series data.\n", @@ -166,7 +166,7 @@ { "cell_type": "code", "execution_count": null, - "id": "60477533", + "id": "25d985df", "metadata": {}, "outputs": [], "source": [ @@ -176,7 +176,7 @@ }, { "cell_type": "markdown", - "id": "c8f4b558", + "id": "c2f69ac3", "metadata": {}, "source": [ "Now we can focus on GDP per capita (`gdppc`) and generate a wide data format" @@ -185,7 +185,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d55322b0", + "id": "e7b4c00d", "metadata": {}, "outputs": [], "source": [ @@ -196,7 +196,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f829001c", + "id": "405ee495", "metadata": {}, "outputs": [], "source": [ @@ -205,7 +205,7 @@ }, { "cell_type": "markdown", - "id": "a7df27fc", + "id": "065e544e", "metadata": {}, "source": [ "We create a variable `color_mapping` to store a map between country codes and colors for consistency" @@ -214,7 +214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3f942ce3", + "id": "14675f9a", "metadata": { "tags": [ "hide-input" @@ -234,7 +234,7 @@ }, { "cell_type": "markdown", - "id": "0c4e5e58", + "id": "961d4fee", "metadata": {}, "source": [ "## GDP per capita\n", @@ -249,7 +249,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b81aa66e", + "id": "6a825cc7", "metadata": { "mystnb": { "figure": { @@ -273,7 +273,7 @@ }, { "cell_type": "markdown", - "id": "6286d937", + "id": "4b6537d9", "metadata": {}, "source": [ ":::{note}\n", @@ -288,7 +288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7aa43c35", + "id": "c3455b26", "metadata": { "mystnb": { "figure": { @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "7069f63c", + "id": "2b9299ae", "metadata": {}, "source": [ "### Comparing the US, UK, and China\n", @@ -329,7 +329,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2c922e91", + "id": "44bad050", "metadata": {}, "outputs": [], "source": [ @@ -374,7 +374,7 @@ }, { "cell_type": "markdown", - "id": "30ae44f3", + "id": "3fc0143e", "metadata": {}, "source": [ "As you can see from this chart, economic growth started in earnest in the 18th century and continued for the next two hundred years. \n", @@ -387,7 +387,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11ef324f", + "id": "e444f3c0", "metadata": { "mystnb": { "figure": { @@ -461,7 +461,7 @@ }, { "cell_type": "markdown", - "id": "f9532f46", + "id": "2edafe8c", "metadata": {}, "source": [ "The preceding graph of per capita GDP strikingly reveals how the spread of the Industrial Revolution has over time gradually lifted the living standards of substantial\n", @@ -489,7 +489,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eea86962", + "id": "be3b35ff", "metadata": { "mystnb": { "figure": { @@ -547,7 +547,7 @@ }, { "cell_type": "markdown", - "id": "73f58b6a", + "id": "b3a8982a", "metadata": {}, "source": [ "### Focusing on the US and UK\n", @@ -565,7 +565,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01afe3be", + "id": "f08cca2e", "metadata": { "mystnb": { "figure": { @@ -624,7 +624,7 @@ }, { "cell_type": "markdown", - "id": "ef6b2780", + "id": "3add06ec", "metadata": {}, "source": [ "## GDP growth\n", @@ -637,7 +637,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f10e202e", + "id": "fd017d5c", "metadata": {}, "outputs": [], "source": [ @@ -649,7 +649,7 @@ }, { "cell_type": "markdown", - "id": "fc4aaa75", + "id": "fb208c53", "metadata": {}, "source": [ "### Early industrialization (1820 to 1940)\n", @@ -666,7 +666,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a0fec897", + "id": "7569c5ed", "metadata": { "mystnb": { "figure": { @@ -688,7 +688,7 @@ }, { "cell_type": "markdown", - "id": "d2e767c6", + "id": "7fa0adf8", "metadata": {}, "source": [ "#### Constructing a plot similar to Tooze's\n", @@ -701,7 +701,7 @@ { "cell_type": "code", "execution_count": null, - "id": "baff8693", + "id": "20582e55", "metadata": {}, "outputs": [], "source": [ @@ -712,7 +712,7 @@ }, { "cell_type": "markdown", - "id": "dcb7469b", + "id": "f98e19bd", "metadata": {}, "source": [ "Now let's assemble our series and get ready to plot them." @@ -721,7 +721,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8410bede", + "id": "5ce3af4e", "metadata": {}, "outputs": [], "source": [ @@ -736,7 +736,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9bdd93a", + "id": "0c83af81", "metadata": {}, "outputs": [], "source": [ @@ -755,7 +755,7 @@ }, { "cell_type": "markdown", - "id": "9a604bfa", + "id": "626d18e0", "metadata": {}, "source": [ "At the start of this lecture, we noted how US GDP came from \"nowhere\" at the start of the 19th century to rival and then overtake the GDP of the British Empire\n", @@ -773,7 +773,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9b2e5583", + "id": "5f0d3283", "metadata": { "mystnb": { "figure": { @@ -795,7 +795,7 @@ }, { "cell_type": "markdown", - "id": "7c673f0c", + "id": "5d5c15e0", "metadata": {}, "source": [ "It is tempting to compare this graph with figure {numref}`gdp1` that showed the US overtaking the UK near the start of the \"American Century\", a version of the graph featured in chapter 1 of {cite}`Tooze_2014`.\n", @@ -810,7 +810,7 @@ { "cell_type": "code", "execution_count": null, - "id": "abeb97fd", + "id": "f0eed700", "metadata": {}, "outputs": [], "source": [ @@ -823,7 +823,7 @@ }, { "cell_type": "markdown", - "id": "bf93e8ea", + "id": "c589b0e5", "metadata": {}, "source": [ "We can save the raw data in a more convenient format to build a single table of regional GDP per capita" @@ -832,7 +832,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a26b0391", + "id": "5e1059bf", "metadata": {}, "outputs": [], "source": [ @@ -842,7 +842,7 @@ }, { "cell_type": "markdown", - "id": "d86e2f31", + "id": "d29ea43e", "metadata": {}, "source": [ "Let's interpolate based on time to fill in any gaps in the dataset for the purpose of plotting" @@ -851,7 +851,7 @@ { "cell_type": "code", "execution_count": null, - "id": "85f99925", + "id": "2da83864", "metadata": {}, "outputs": [], "source": [ @@ -860,7 +860,7 @@ }, { "cell_type": "markdown", - "id": "2a668090", + "id": "b1bdac3d", "metadata": {}, "source": [ "Looking more closely, let's compare the time series for `Western Offshoots` and `Sub-Saharan Africa` with a number of different regions around the world.\n", @@ -871,7 +871,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f8b7ee38", + "id": "652f4b67", "metadata": { "mystnb": { "figure": { diff --git a/_sources/lp_intro.ipynb b/_sources/lp_intro.ipynb index 547e54ff..88222573 100644 --- a/_sources/lp_intro.ipynb +++ b/_sources/lp_intro.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "f028a032", + "id": "45c226ad", "metadata": {}, "source": [ "(lp_intro)=\n", @@ -20,7 +20,7 @@ { "cell_type": "code", "execution_count": null, - "id": "02e492b1", + "id": "f1d863ab", "metadata": { "tags": [ "hide-output" @@ -33,7 +33,7 @@ }, { "cell_type": "markdown", - "id": "9f05ce17", + "id": "004e705d", "metadata": {}, "source": [ "## Overview\n", @@ -63,7 +63,7 @@ { "cell_type": "code", "execution_count": null, - "id": "117ae621", + "id": "2afe878b", "metadata": {}, "outputs": [], "source": [ @@ -77,7 +77,7 @@ }, { "cell_type": "markdown", - "id": "30548f0d", + "id": "d918cc66", "metadata": {}, "source": [ "Let's start with some examples of linear programming problem.\n", @@ -125,7 +125,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c64de3b8", + "id": "c0c2f39e", "metadata": { "tags": [ "hide-input" @@ -170,7 +170,7 @@ }, { "cell_type": "markdown", - "id": "a3c51100", + "id": "b4120e81", "metadata": {}, "source": [ "The blue region is the feasible set within which all constraints are satisfied.\n", @@ -197,7 +197,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dc3d3cc1", + "id": "406005c1", "metadata": {}, "outputs": [], "source": [ @@ -207,7 +207,7 @@ }, { "cell_type": "markdown", - "id": "7707f763", + "id": "753e454f", "metadata": {}, "source": [ "Let's us create two variables $x_1$ and $x_2$ such that they can only have nonnegative values." @@ -216,7 +216,7 @@ { "cell_type": "code", "execution_count": null, - "id": "41b71f67", + "id": "799aa501", "metadata": {}, "outputs": [], "source": [ @@ -227,7 +227,7 @@ }, { "cell_type": "markdown", - "id": "d24e74e8", + "id": "13cbc4ff", "metadata": {}, "source": [ "Add the constraints to the problem." @@ -236,7 +236,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e6340bdd", + "id": "fe85e868", "metadata": {}, "outputs": [], "source": [ @@ -249,7 +249,7 @@ }, { "cell_type": "markdown", - "id": "254856f4", + "id": "ce589082", "metadata": {}, "source": [ "Let's specify the objective function. We use `solver.Maximize` method in the case when we want to maximize the objective function and in the case of minimization we can use `solver.Minimize`." @@ -258,7 +258,7 @@ { "cell_type": "code", "execution_count": null, - "id": "53ae53e2", + "id": "059bc761", "metadata": {}, "outputs": [], "source": [ @@ -268,7 +268,7 @@ }, { "cell_type": "markdown", - "id": "d9c797f6", + "id": "6f418bbb", "metadata": {}, "source": [ "Once we solve the problem, we can check whether the solver was successful in solving the problem using it's status. If it's successful, then the status will be equal to `pywraplp.Solver.OPTIMAL`." @@ -277,7 +277,7 @@ { "cell_type": "code", "execution_count": null, - "id": "54b35d25", + "id": "427b9875", "metadata": {}, "outputs": [], "source": [ @@ -295,7 +295,7 @@ }, { "cell_type": "markdown", - "id": "95f32cdc", + "id": "1e9915f1", "metadata": {}, "source": [ "## Example 2: Investment Problem\n", @@ -390,7 +390,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e80598f4", + "id": "8b8bbb6b", "metadata": {}, "outputs": [], "source": [ @@ -400,7 +400,7 @@ }, { "cell_type": "markdown", - "id": "2ae3b8b8", + "id": "ef31d9a1", "metadata": {}, "source": [ "Let's us create five variables $x_1, x_2, x_3, x_4,$ and $x_5$ such that they can only have the values defined in the above constraints." @@ -409,7 +409,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0b69e424", + "id": "526ab72c", "metadata": {}, "outputs": [], "source": [ @@ -423,7 +423,7 @@ }, { "cell_type": "markdown", - "id": "f6dade86", + "id": "ec1997fb", "metadata": {}, "source": [ "Add the constraints to the problem." @@ -432,7 +432,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ee7e097", + "id": "f904fb94", "metadata": {}, "outputs": [], "source": [ @@ -448,7 +448,7 @@ }, { "cell_type": "markdown", - "id": "06296568", + "id": "33542df0", "metadata": {}, "source": [ "Let's specify the objective function." @@ -457,7 +457,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1f8162d1", + "id": "b3d9925e", "metadata": {}, "outputs": [], "source": [ @@ -467,7 +467,7 @@ }, { "cell_type": "markdown", - "id": "51ca61bf", + "id": "37b9c0fb", "metadata": {}, "source": [ "Let's solve the problem and check the status using `pywraplp.Solver.OPTIMAL`." @@ -476,7 +476,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c0de14e", + "id": "528b530e", "metadata": {}, "outputs": [], "source": [ @@ -497,7 +497,7 @@ }, { "cell_type": "markdown", - "id": "4e19d6c3", + "id": "2f014c89", "metadata": {}, "source": [ "OR-Tools tells us that the best investment strategy is:\n", @@ -626,7 +626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "619263dc", + "id": "3aea4c49", "metadata": {}, "outputs": [], "source": [ @@ -641,7 +641,7 @@ }, { "cell_type": "markdown", - "id": "6c6c7674", + "id": "cd424fa8", "metadata": {}, "source": [ "Once we solve the problem, we can check whether the solver was successful in solving the problem using the boolean attribute `success`. If it's successful, then the `success` attribute is set to `True`." @@ -650,7 +650,7 @@ { "cell_type": "code", "execution_count": null, - "id": "97c06504", + "id": "71de0c3c", "metadata": {}, "outputs": [], "source": [ @@ -668,7 +668,7 @@ }, { "cell_type": "markdown", - "id": "9387e9c1", + "id": "ac557188", "metadata": {}, "source": [ "The optimal plan tells the factory to produce $2.5$ units of Product 1 and $5$ units of Product 2; that generates a maximizing value of revenue of $27.5$.\n", @@ -730,7 +730,7 @@ { "cell_type": "code", "execution_count": null, - "id": "80f2a4d8", + "id": "f684d87b", "metadata": {}, "outputs": [], "source": [ @@ -756,7 +756,7 @@ }, { "cell_type": "markdown", - "id": "d3b226a9", + "id": "18c72ccc", "metadata": {}, "source": [ "Let's solve the problem and check the status using `success` attribute." @@ -765,7 +765,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15ea86f0", + "id": "16787975", "metadata": {}, "outputs": [], "source": [ @@ -788,7 +788,7 @@ }, { "cell_type": "markdown", - "id": "25e3bea7", + "id": "a9594b03", "metadata": {}, "source": [ "SciPy tells us that the best investment strategy is:\n", @@ -841,7 +841,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8ffdcdd3", + "id": "fb6ea357", "metadata": {}, "outputs": [], "source": [ @@ -856,7 +856,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8bf896a0", + "id": "8419d00f", "metadata": {}, "outputs": [], "source": [ @@ -873,7 +873,7 @@ { "cell_type": "code", "execution_count": null, - "id": "62d8fb05", + "id": "3439afd3", "metadata": {}, "outputs": [], "source": [ @@ -884,7 +884,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b67327bb", + "id": "d995812c", "metadata": {}, "outputs": [], "source": [ @@ -902,7 +902,7 @@ }, { "cell_type": "markdown", - "id": "1b9d3337", + "id": "21f25313", "metadata": {}, "source": [ "```{solution-end}\n", @@ -947,7 +947,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a999f2a6", + "id": "451e1645", "metadata": {}, "outputs": [], "source": [ @@ -957,7 +957,7 @@ }, { "cell_type": "markdown", - "id": "f8422d63", + "id": "c478e1ae", "metadata": {}, "source": [ "Let's us create two variables $x_1$ and $x_2$ such that they can only have nonnegative values." @@ -966,7 +966,7 @@ { "cell_type": "code", "execution_count": null, - "id": "75fe65c4", + "id": "a5e0eddf", "metadata": {}, "outputs": [], "source": [ @@ -978,7 +978,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2d943cff", + "id": "8bd686ca", "metadata": {}, "outputs": [], "source": [ @@ -992,7 +992,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7827c6f4", + "id": "ba518615", "metadata": {}, "outputs": [], "source": [ @@ -1003,7 +1003,7 @@ { "cell_type": "code", "execution_count": null, - "id": "95efd75e", + "id": "ec2c128a", "metadata": {}, "outputs": [], "source": [ @@ -1021,7 +1021,7 @@ }, { "cell_type": "markdown", - "id": "422f200a", + "id": "a830fb55", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/markov_chains_I.ipynb b/_sources/markov_chains_I.ipynb index 6db2294a..d6118966 100644 --- a/_sources/markov_chains_I.ipynb +++ b/_sources/markov_chains_I.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "935b28aa", + "id": "4308de47", "metadata": {}, "source": [ "# Markov Chains: Basic Concepts \n", @@ -17,7 +17,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8fa746e7", + "id": "4d183c50", "metadata": { "tags": [ "hide-output" @@ -30,7 +30,7 @@ }, { "cell_type": "markdown", - "id": "618cdbe8", + "id": "95ff2f3d", "metadata": {}, "source": [ "## Overview\n", @@ -63,7 +63,7 @@ { "cell_type": "code", "execution_count": null, - "id": "939a82c9", + "id": "99af9475", "metadata": {}, "outputs": [], "source": [ @@ -77,7 +77,7 @@ }, { "cell_type": "markdown", - "id": "6632287e", + "id": "c5905d39", "metadata": {}, "source": [ "## Definitions and examples\n", @@ -266,7 +266,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8d155bfd", + "id": "7f8eaaed", "metadata": {}, "outputs": [], "source": [ @@ -281,7 +281,7 @@ }, { "cell_type": "markdown", - "id": "7d9e2dc2", + "id": "2da6ab72", "metadata": {}, "source": [ "Here is a visualization, with darker colors indicating higher probability." @@ -290,7 +290,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0e2e42e8", + "id": "0236e454", "metadata": { "tags": [ "hide-input" @@ -328,7 +328,7 @@ }, { "cell_type": "markdown", - "id": "5fb81f8b", + "id": "fae88c9a", "metadata": {}, "source": [ "Looking at the data, we see that democracies tend to have longer-lasting growth\n", @@ -438,7 +438,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df863c4d", + "id": "e0628a9b", "metadata": {}, "outputs": [], "source": [ @@ -449,7 +449,7 @@ }, { "cell_type": "markdown", - "id": "3c209c4d", + "id": "197f477e", "metadata": {}, "source": [ "We'll write our code as a function that accepts the following three arguments\n", @@ -462,7 +462,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8197766e", + "id": "5c0641e0", "metadata": {}, "outputs": [], "source": [ @@ -491,7 +491,7 @@ }, { "cell_type": "markdown", - "id": "818bc484", + "id": "305f66de", "metadata": {}, "source": [ "Let's see how it works using the small matrix" @@ -500,7 +500,7 @@ { "cell_type": "code", "execution_count": null, - "id": "484bbd9e", + "id": "7f5494c3", "metadata": {}, "outputs": [], "source": [ @@ -510,7 +510,7 @@ }, { "cell_type": "markdown", - "id": "59f12648", + "id": "b85268cc", "metadata": {}, "source": [ "Here's a short time series." @@ -519,7 +519,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d7a286f", + "id": "43e81a78", "metadata": {}, "outputs": [], "source": [ @@ -528,7 +528,7 @@ }, { "cell_type": "markdown", - "id": "67e8e0f2", + "id": "5eeff188", "metadata": {}, "source": [ "It can be shown that for a long series drawn from `P`, the fraction of the\n", @@ -545,7 +545,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e1b27d85", + "id": "d27223b6", "metadata": {}, "outputs": [], "source": [ @@ -555,7 +555,7 @@ }, { "cell_type": "markdown", - "id": "cbf5fc9d", + "id": "5bbf5477", "metadata": {}, "source": [ "You can try changing the initial distribution to confirm that the output is\n", @@ -572,7 +572,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28042cf4", + "id": "166e699f", "metadata": {}, "outputs": [], "source": [ @@ -583,7 +583,7 @@ }, { "cell_type": "markdown", - "id": "458ec620", + "id": "f25886ed", "metadata": {}, "source": [ "The `simulate` routine is faster (because it is [JIT compiled](https://python-programming.quantecon.org/numba.html#numba-link))." @@ -592,7 +592,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25fee7cf", + "id": "4713e0da", "metadata": {}, "outputs": [], "source": [ @@ -602,7 +602,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f7a0d8fa", + "id": "84dd1283", "metadata": {}, "outputs": [], "source": [ @@ -611,7 +611,7 @@ }, { "cell_type": "markdown", - "id": "9394f0a3", + "id": "28737d1f", "metadata": {}, "source": [ "#### Adding state values and initial conditions\n", @@ -626,7 +626,7 @@ { "cell_type": "code", "execution_count": null, - "id": "204a8ce2", + "id": "a8540a07", "metadata": {}, "outputs": [], "source": [ @@ -637,7 +637,7 @@ { "cell_type": "code", "execution_count": null, - "id": "115b299d", + "id": "7ba9a6d2", "metadata": {}, "outputs": [], "source": [ @@ -647,7 +647,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6b266a9f", + "id": "c95f4513", "metadata": {}, "outputs": [], "source": [ @@ -656,7 +656,7 @@ }, { "cell_type": "markdown", - "id": "e8858d55", + "id": "8589d0a5", "metadata": {}, "source": [ "If we want to see indices rather than state values as outputs as we can use" @@ -665,7 +665,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bcda0c68", + "id": "099996d1", "metadata": {}, "outputs": [], "source": [ @@ -674,7 +674,7 @@ }, { "cell_type": "markdown", - "id": "ee2c549f", + "id": "abce25cd", "metadata": {}, "source": [ "(mc_md)=\n", @@ -848,7 +848,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e8e93bca", + "id": "cbc199bd", "metadata": {}, "outputs": [], "source": [ @@ -860,7 +860,7 @@ }, { "cell_type": "markdown", - "id": "5b78ba56", + "id": "6bd5a9ba", "metadata": {}, "source": [ "Notice that `ψ @ P` is the same as `ψ`.\n", @@ -937,7 +937,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47736989", + "id": "a7e30568", "metadata": {}, "outputs": [], "source": [ @@ -950,7 +950,7 @@ }, { "cell_type": "markdown", - "id": "e226cd12", + "id": "00042834", "metadata": {}, "source": [ "### Asymptotic stationarity\n", @@ -986,7 +986,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9e2502e0", + "id": "76240625", "metadata": {}, "outputs": [], "source": [ @@ -998,7 +998,7 @@ }, { "cell_type": "markdown", - "id": "eb3ef89a", + "id": "3a6a145a", "metadata": {}, "source": [ "Let's pick an initial distribution $\\psi_0$ and trace out the sequence of distributions $\\psi_0 P^t$ for $t = 0, 1, 2, \\ldots$\n", @@ -1009,7 +1009,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cb28829d", + "id": "2f5886fc", "metadata": {}, "outputs": [], "source": [ @@ -1025,7 +1025,7 @@ }, { "cell_type": "markdown", - "id": "37624fc8", + "id": "9f8094dc", "metadata": {}, "source": [ "Now we plot the sequence" @@ -1034,7 +1034,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e781da86", + "id": "fe891586", "metadata": {}, "outputs": [], "source": [ @@ -1062,7 +1062,7 @@ }, { "cell_type": "markdown", - "id": "97ec923a", + "id": "f71cee1b", "metadata": {}, "source": [ "Here\n", @@ -1085,7 +1085,7 @@ { "cell_type": "code", "execution_count": null, - "id": "175f051d", + "id": "af53d09c", "metadata": {}, "outputs": [], "source": [ @@ -1104,7 +1104,7 @@ }, { "cell_type": "markdown", - "id": "9311b4b8", + "id": "f7a6964a", "metadata": {}, "source": [ "We then write a function to plot the dynamics of $(\\psi_0 P^t)(i)$ as $t$ gets large, for each state $i$ with different initial distributions" @@ -1113,7 +1113,7 @@ { "cell_type": "code", "execution_count": null, - "id": "783b6cc1", + "id": "2780f2c1", "metadata": {}, "outputs": [], "source": [ @@ -1151,7 +1151,7 @@ }, { "cell_type": "markdown", - "id": "51b6041e", + "id": "a74e1abf", "metadata": {}, "source": [ "The following figure shows" @@ -1160,7 +1160,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1493629c", + "id": "9b0cd52a", "metadata": {}, "outputs": [], "source": [ @@ -1178,7 +1178,7 @@ }, { "cell_type": "markdown", - "id": "50768a2f", + "id": "83d10c6b", "metadata": {}, "source": [ "The convergence to $\\psi^*$ holds for different initial distributions.\n", @@ -1204,7 +1204,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c3b594f0", + "id": "6c8d684d", "metadata": {}, "outputs": [], "source": [ @@ -1219,7 +1219,7 @@ }, { "cell_type": "markdown", - "id": "912261aa", + "id": "334b5633", "metadata": {}, "source": [ "Indeed, this $P$ fails our asymptotic stationarity condition, since, as you can\n", @@ -1367,7 +1367,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1d8c6bb8", + "id": "250d5920", "metadata": {}, "outputs": [], "source": [ @@ -1380,7 +1380,7 @@ }, { "cell_type": "markdown", - "id": "9024c630", + "id": "a9e7f008", "metadata": {}, "source": [ "Note that rows of the transition matrix converge to the stationary distribution." @@ -1389,7 +1389,7 @@ { "cell_type": "code", "execution_count": null, - "id": "04c363be", + "id": "2ed49361", "metadata": {}, "outputs": [], "source": [ @@ -1400,7 +1400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "06127026", + "id": "6b82ee05", "metadata": {}, "outputs": [], "source": [ @@ -1411,7 +1411,7 @@ }, { "cell_type": "markdown", - "id": "6de9ce45", + "id": "861c0a48", "metadata": {}, "source": [ "Solution 3:\n", @@ -1422,7 +1422,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f450b09b", + "id": "df93850b", "metadata": {}, "outputs": [], "source": [ @@ -1433,7 +1433,7 @@ }, { "cell_type": "markdown", - "id": "36147f0a", + "id": "9afdd609", "metadata": {}, "source": [ "In fact, the rate of convergence is governed by {ref}`eigenvalues` {cite}`sargent2023economic`." @@ -1442,7 +1442,7 @@ { "cell_type": "code", "execution_count": null, - "id": "46ea45bd", + "id": "4024e7f9", "metadata": {}, "outputs": [], "source": [ @@ -1453,7 +1453,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5a0e582f", + "id": "8f95140f", "metadata": {}, "outputs": [], "source": [ @@ -1467,7 +1467,7 @@ }, { "cell_type": "markdown", - "id": "7164929a", + "id": "6b104c3f", "metadata": {}, "source": [ "More specifically, it is governed by the spectral gap, the difference between the largest and the second largest eigenvalue." @@ -1476,7 +1476,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29ddc93f", + "id": "9b2c5fd8", "metadata": {}, "outputs": [], "source": [ @@ -1488,7 +1488,7 @@ }, { "cell_type": "markdown", - "id": "d142d6fe", + "id": "0086cd88", "metadata": {}, "source": [ "We will come back to this when we discuss {ref}`spectral theory`.\n", @@ -1530,7 +1530,7 @@ { "cell_type": "code", "execution_count": null, - "id": "864730c9", + "id": "4a9203fb", "metadata": {}, "outputs": [], "source": [ @@ -1546,7 +1546,7 @@ }, { "cell_type": "markdown", - "id": "f58384ff", + "id": "fce65276", "metadata": {}, "source": [ "So it satisfies the requirement.\n", @@ -1559,7 +1559,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eee5082c", + "id": "6ef62fb3", "metadata": {}, "outputs": [], "source": [ @@ -1591,7 +1591,7 @@ }, { "cell_type": "markdown", - "id": "165a9dca", + "id": "ca9180f1", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/markov_chains_II.ipynb b/_sources/markov_chains_II.ipynb index 40c94497..fafddc97 100644 --- a/_sources/markov_chains_II.ipynb +++ b/_sources/markov_chains_II.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c8877eac", + "id": "3f2e1482", "metadata": {}, "source": [ "# Markov Chains: Irreducibility and Ergodicity\n", @@ -16,7 +16,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bcdbc6b6", + "id": "8a1aba17", "metadata": { "tags": [ "hide-output" @@ -29,7 +29,7 @@ }, { "cell_type": "markdown", - "id": "8f53863b", + "id": "59043cb2", "metadata": {}, "source": [ "## Overview\n", @@ -58,7 +58,7 @@ { "cell_type": "code", "execution_count": null, - "id": "78c7e686", + "id": "5b38550f", "metadata": {}, "outputs": [], "source": [ @@ -69,7 +69,7 @@ }, { "cell_type": "markdown", - "id": "693b6f14", + "id": "3fb19063", "metadata": {}, "source": [ "(mc_irreducible)=\n", @@ -127,7 +127,7 @@ { "cell_type": "code", "execution_count": null, - "id": "69eb3d41", + "id": "cb4bef9f", "metadata": {}, "outputs": [], "source": [ @@ -141,7 +141,7 @@ }, { "cell_type": "markdown", - "id": "99aebf7c", + "id": "999e4695", "metadata": {}, "source": [ "Here's a more pessimistic scenario in which poor people remain poor forever\n", @@ -160,7 +160,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1943036", + "id": "46c6b184", "metadata": {}, "outputs": [], "source": [ @@ -174,7 +174,7 @@ }, { "cell_type": "markdown", - "id": "2b790189", + "id": "cab2869c", "metadata": {}, "source": [ "It might be clear to you already that irreducibility is going to be important\n", @@ -296,7 +296,7 @@ { "cell_type": "code", "execution_count": null, - "id": "93992ca6", + "id": "5c89ada4", "metadata": {}, "outputs": [], "source": [ @@ -324,7 +324,7 @@ }, { "cell_type": "markdown", - "id": "b5d564aa", + "id": "ca98d0d0", "metadata": {}, "source": [ "You might like to try changing $x=1$ to either $x=0$ or $x=2$.\n", @@ -364,7 +364,7 @@ { "cell_type": "code", "execution_count": null, - "id": "82fdd7ef", + "id": "6b6d4a2e", "metadata": {}, "outputs": [], "source": [ @@ -396,7 +396,7 @@ }, { "cell_type": "markdown", - "id": "71ce9da3", + "id": "2f89636f", "metadata": {}, "source": [ "This example helps to emphasize that asymptotic stationarity is about the distribution, while ergodicity is about the sample path.\n", @@ -436,7 +436,7 @@ { "cell_type": "code", "execution_count": null, - "id": "927865b8", + "id": "507db987", "metadata": {}, "outputs": [], "source": [ @@ -470,7 +470,7 @@ }, { "cell_type": "markdown", - "id": "8a5d8948", + "id": "426de940", "metadata": {}, "source": [ "### Expectations of geometric sums\n", @@ -558,7 +558,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8cf36874", + "id": "5d5c3542", "metadata": {}, "outputs": [], "source": [ @@ -579,7 +579,7 @@ }, { "cell_type": "markdown", - "id": "7bf75a0a", + "id": "7b57737a", "metadata": {}, "source": [ "For this model, rows of $P^n$ converge to the stationary distribution as $n \\to\n", @@ -589,7 +589,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dbe755a8", + "id": "f168a25e", "metadata": {}, "outputs": [], "source": [ @@ -600,7 +600,7 @@ }, { "cell_type": "markdown", - "id": "1bf9f851", + "id": "a5903b7a", "metadata": {}, "source": [ "Part 2:" @@ -609,7 +609,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e7c87487", + "id": "a39c18b4", "metadata": {}, "outputs": [], "source": [ @@ -633,7 +633,7 @@ }, { "cell_type": "markdown", - "id": "383aff58", + "id": "1e570572", "metadata": {}, "source": [ "Note that the fraction of time spent at each state converges to the probability\n", @@ -696,7 +696,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b63b07aa", + "id": "d49684f5", "metadata": {}, "outputs": [], "source": [ @@ -731,7 +731,7 @@ }, { "cell_type": "markdown", - "id": "6c8671d0", + "id": "2e10b27f", "metadata": {}, "source": [ "```{solution-end}\n", @@ -761,7 +761,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3bb54d69", + "id": "9c322d7b", "metadata": {}, "outputs": [], "source": [ @@ -775,7 +775,7 @@ }, { "cell_type": "markdown", - "id": "841f5648", + "id": "24a20263", "metadata": {}, "source": [ "Let's try it." @@ -784,7 +784,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b0cf35a2", + "id": "7999123f", "metadata": {}, "outputs": [], "source": [ @@ -804,7 +804,7 @@ }, { "cell_type": "markdown", - "id": "d75c9504", + "id": "a8aca376", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/mle.ipynb b/_sources/mle.ipynb index 2602c0f3..61195522 100644 --- a/_sources/mle.ipynb +++ b/_sources/mle.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "81c11331", + "id": "22d57ca7", "metadata": {}, "source": [ "# Maximum Likelihood Estimation" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dc215198", + "id": "691801b6", "metadata": {}, "outputs": [], "source": [ @@ -25,7 +25,7 @@ }, { "cell_type": "markdown", - "id": "1f9e586a", + "id": "b50a0a1e", "metadata": {}, "source": [ "## Introduction\n", @@ -59,7 +59,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e3ff2d46", + "id": "64e41db9", "metadata": {}, "outputs": [], "source": [ @@ -72,7 +72,7 @@ }, { "cell_type": "markdown", - "id": "ea32f32a", + "id": "f89c96f8", "metadata": {}, "source": [ "For a population of size $N$, where individual $i$ has wealth $w_i$, total revenue raised by \n", @@ -97,7 +97,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2697af99", + "id": "623c0f46", "metadata": {}, "outputs": [], "source": [ @@ -106,7 +106,7 @@ }, { "cell_type": "markdown", - "id": "570c2e58", + "id": "752e9167", "metadata": {}, "source": [ "The data is derived from the\n", @@ -119,7 +119,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d993edac", + "id": "7f8aaf55", "metadata": { "tags": [ "hide-input" @@ -139,7 +139,7 @@ }, { "cell_type": "markdown", - "id": "11cd3c1b", + "id": "28c1e5b0", "metadata": {}, "source": [ "Let's histogram this sample." @@ -148,7 +148,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f3cbcd95", + "id": "de44dcf3", "metadata": {}, "outputs": [], "source": [ @@ -165,7 +165,7 @@ }, { "cell_type": "markdown", - "id": "f55fad7b", + "id": "2998b058", "metadata": {}, "source": [ "The histogram shows that many people have very low wealth and a few people have\n", @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d1db57ca", + "id": "22dfc744", "metadata": {}, "outputs": [], "source": [ @@ -187,7 +187,7 @@ }, { "cell_type": "markdown", - "id": "6041408c", + "id": "65cabbd1", "metadata": {}, "source": [ "How can we estimate total revenue from the full population using only the sample data?\n", @@ -233,7 +233,7 @@ { "cell_type": "code", "execution_count": null, - "id": "32a6d58d", + "id": "ee52a662", "metadata": {}, "outputs": [], "source": [ @@ -245,7 +245,7 @@ }, { "cell_type": "markdown", - "id": "8b0c360e", + "id": "97cf3516", "metadata": {}, "source": [ "Now our job is to obtain the maximum likelihood estimates of $\\mu$ and $\\sigma$, which\n", @@ -315,7 +315,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bf339ffa", + "id": "f6301409", "metadata": {}, "outputs": [], "source": [ @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "83360e9b", + "id": "3dd155c4", "metadata": {}, "outputs": [], "source": [ @@ -337,7 +337,7 @@ }, { "cell_type": "markdown", - "id": "29557ff6", + "id": "32a3d34d", "metadata": {}, "source": [ "Let's plot the log-normal pdf using the estimated parameters against our sample data." @@ -346,7 +346,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9d421d29", + "id": "2dc16910", "metadata": {}, "outputs": [], "source": [ @@ -364,7 +364,7 @@ }, { "cell_type": "markdown", - "id": "28e94993", + "id": "ee2bbca2", "metadata": {}, "source": [ "Our estimated lognormal distribution appears to be a reasonable fit for the overall data.\n", @@ -379,7 +379,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c9024be1", + "id": "4fe2b694", "metadata": {}, "outputs": [], "source": [ @@ -392,7 +392,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fbb8102a", + "id": "0de2a665", "metadata": {}, "outputs": [], "source": [ @@ -402,7 +402,7 @@ }, { "cell_type": "markdown", - "id": "69f9575a", + "id": "920c16c2", "metadata": {}, "source": [ "(Our unit was 100,000 dollars, so this means that actual revenue is 100,000\n", @@ -434,7 +434,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6004f426", + "id": "c6399ba8", "metadata": {}, "outputs": [], "source": [ @@ -445,7 +445,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28889152", + "id": "51decf22", "metadata": {}, "outputs": [], "source": [ @@ -456,7 +456,7 @@ }, { "cell_type": "markdown", - "id": "43dd335d", + "id": "cc7098b8", "metadata": {}, "source": [ "Now let's recompute total revenue." @@ -465,7 +465,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a88738b7", + "id": "5192dbee", "metadata": {}, "outputs": [], "source": [ @@ -476,7 +476,7 @@ }, { "cell_type": "markdown", - "id": "87d19561", + "id": "44b09b23", "metadata": {}, "source": [ "The number is very different!" @@ -485,7 +485,7 @@ { "cell_type": "code", "execution_count": null, - "id": "223bb5d6", + "id": "86e7553d", "metadata": {}, "outputs": [], "source": [ @@ -494,7 +494,7 @@ }, { "cell_type": "markdown", - "id": "474bb5ca", + "id": "ce572938", "metadata": {}, "source": [ "We see that choosing the right distribution is extremely important.\n", @@ -507,7 +507,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5c25d3a", + "id": "e4efb469", "metadata": {}, "outputs": [], "source": [ @@ -524,7 +524,7 @@ }, { "cell_type": "markdown", - "id": "85854f66", + "id": "94b87786", "metadata": {}, "source": [ "We observe that in this case the fit for the Pareto distribution is not very\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "859c6a68", + "id": "5e6cbbbd", "metadata": { "tags": [ "hide-input" @@ -565,7 +565,7 @@ }, { "cell_type": "markdown", - "id": "ce2dd671", + "id": "60a52b38", "metadata": {}, "source": [ "Let's plot this data." @@ -574,7 +574,7 @@ { "cell_type": "code", "execution_count": null, - "id": "76e80c67", + "id": "7e1e7eff", "metadata": {}, "outputs": [], "source": [ @@ -586,7 +586,7 @@ }, { "cell_type": "markdown", - "id": "72a1b9ab", + "id": "3dc2206d", "metadata": {}, "source": [ "Now let's try fitting some distributions to this data.\n", @@ -602,7 +602,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c233426", + "id": "6b2c3526", "metadata": {}, "outputs": [], "source": [ @@ -622,7 +622,7 @@ }, { "cell_type": "markdown", - "id": "740ff1c4", + "id": "08b35f71", "metadata": {}, "source": [ "While the lognormal distribution was a good fit for the entire dataset,\n", @@ -639,7 +639,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2493da86", + "id": "dcaf0793", "metadata": {}, "outputs": [], "source": [ @@ -658,7 +658,7 @@ }, { "cell_type": "markdown", - "id": "2a902f34", + "id": "0769e0b1", "metadata": {}, "source": [ "The Pareto distribution is a better fit for the right hand tail of our dataset.\n", @@ -705,7 +705,7 @@ { "cell_type": "code", "execution_count": null, - "id": "94ff025d", + "id": "39cac12a", "metadata": {}, "outputs": [], "source": [ @@ -716,7 +716,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fb9e4618", + "id": "e03c4e06", "metadata": {}, "outputs": [], "source": [ @@ -727,7 +727,7 @@ }, { "cell_type": "markdown", - "id": "e42d19be", + "id": "30a9ba4a", "metadata": {}, "source": [ "```{solution-end}\n", @@ -750,7 +750,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1274ea4e", + "id": "8bbc122c", "metadata": {}, "outputs": [], "source": [ @@ -766,7 +766,7 @@ }, { "cell_type": "markdown", - "id": "d089b99b", + "id": "63779080", "metadata": {}, "source": [ "Clearly, this distribution is not a good fit for our data.\n", diff --git a/_sources/money_inflation.ipynb b/_sources/money_inflation.ipynb index ae574a40..4649c1ea 100644 --- a/_sources/money_inflation.ipynb +++ b/_sources/money_inflation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "81e2dd79", + "id": "1feffc37", "metadata": {}, "source": [ "# Money Financed Government Deficits and Price Levels\n", @@ -257,7 +257,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e420535c", + "id": "9f33b4b2", "metadata": {}, "outputs": [], "source": [ @@ -270,7 +270,7 @@ }, { "cell_type": "markdown", - "id": "8fe5867f", + "id": "78461029", "metadata": {}, "source": [ "Let's set some parameter values and compute possible steady state rates of return on currency $\\bar R$, the seigniorage maximizing rate of return on currency, and an object that we'll discuss later, namely, an initial price level $p_0$ associated with the maximum steady state rate of return on currency.\n", @@ -281,7 +281,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cf396122", + "id": "4c58087d", "metadata": {}, "outputs": [], "source": [ @@ -302,7 +302,7 @@ }, { "cell_type": "markdown", - "id": "1cfe83a1", + "id": "988ce940", "metadata": {}, "source": [ "Now we compute the $\\bar R_{\\rm max}$ and corresponding revenue" @@ -311,7 +311,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a56790ae", + "id": "8da84040", "metadata": {}, "outputs": [], "source": [ @@ -333,7 +333,7 @@ }, { "cell_type": "markdown", - "id": "6eda2206", + "id": "98299f16", "metadata": {}, "source": [ "Now let's plot seigniorage as a function of alternative potential steady-state values of $R$.\n", @@ -348,7 +348,7 @@ { "cell_type": "code", "execution_count": null, - "id": "78a16b20", + "id": "0bc9a2a5", "metadata": { "mystnb": { "figure": { @@ -380,7 +380,7 @@ }, { "cell_type": "markdown", - "id": "bd723f7c", + "id": "11a80d4b", "metadata": {}, "source": [ "Let's print the two steady-state rates of return $\\bar R$ and the associated seigniorage revenues that the government collects.\n", @@ -393,7 +393,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2a175f26", + "id": "d8ae10ca", "metadata": {}, "outputs": [], "source": [ @@ -406,7 +406,7 @@ }, { "cell_type": "markdown", - "id": "b5ca5b6f", + "id": "b28732aa", "metadata": {}, "source": [ "Now let's compute the maximum steady state amount of seigniorage that could be gathered by printing money and the state state rate of return on money that attains it.\n", @@ -539,7 +539,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3161e4f6", + "id": "968b65bc", "metadata": {}, "outputs": [], "source": [ @@ -565,7 +565,7 @@ }, { "cell_type": "markdown", - "id": "1965d6e7", + "id": "c7a4d262", "metadata": {}, "source": [ "Let's write some code plot outcomes for several possible initial values $R_0$." @@ -574,7 +574,7 @@ { "cell_type": "code", "execution_count": null, - "id": "609a68f6", + "id": "65dbc811", "metadata": { "tags": [ "hide-cell" @@ -625,7 +625,7 @@ }, { "cell_type": "markdown", - "id": "91d4c6df", + "id": "1a7eac5b", "metadata": {}, "source": [ "Let's plot distinct outcomes associated with several $R_0 \\in [\\frac{\\gamma_2}{\\gamma_1}, R_u]$.\n", @@ -636,7 +636,7 @@ { "cell_type": "code", "execution_count": null, - "id": "efcb6a12", + "id": "22f83f8b", "metadata": { "mystnb": { "figure": { @@ -656,7 +656,7 @@ }, { "cell_type": "markdown", - "id": "65df482f", + "id": "9589df40", "metadata": {}, "source": [ "Notice how sequences that start from $R_0$ in the half-open interval $[R_l, R_u)$ converge to the steady state associated with to $ R_l$.\n", @@ -700,7 +700,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dca0bae9", + "id": "618609e3", "metadata": {}, "outputs": [], "source": [ @@ -712,7 +712,7 @@ }, { "cell_type": "markdown", - "id": "9c5329b8", + "id": "c199c58e", "metadata": {}, "source": [ "Define\n", @@ -725,7 +725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35ea5389", + "id": "d8a67159", "metadata": {}, "outputs": [], "source": [ @@ -735,7 +735,7 @@ }, { "cell_type": "markdown", - "id": "a04f7aa1", + "id": "b2f18d35", "metadata": {}, "source": [ "and write the system {eq}`eq:sytem101` as\n", @@ -786,7 +786,7 @@ { "cell_type": "code", "execution_count": null, - "id": "adb789cd", + "id": "085228b5", "metadata": {}, "outputs": [], "source": [ @@ -798,7 +798,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eb618de0", + "id": "9a3cbe69", "metadata": {}, "outputs": [], "source": [ @@ -811,7 +811,7 @@ }, { "cell_type": "markdown", - "id": "f23b3725", + "id": "cd6e831c", "metadata": {}, "source": [ "Partition $Q$ as\n", @@ -869,7 +869,7 @@ { "cell_type": "code", "execution_count": null, - "id": "33c40535", + "id": "2a8f49e7", "metadata": {}, "outputs": [], "source": [ @@ -884,7 +884,7 @@ }, { "cell_type": "markdown", - "id": "c9715c6e", + "id": "9d0923c4", "metadata": {}, "source": [ "For almost all initial vectors $y_0$, the gross rate of inflation $\\frac{p_{t+1}}{p_t}$ eventually converges to the larger eigenvalue ${R_l}^{-1}$.\n", @@ -1011,7 +1011,7 @@ { "cell_type": "code", "execution_count": null, - "id": "273646fe", + "id": "0277d09e", "metadata": {}, "outputs": [], "source": [ @@ -1022,7 +1022,7 @@ }, { "cell_type": "markdown", - "id": "fdf98b82", + "id": "e622cc17", "metadata": {}, "source": [ "It can be verified that this formula replicates itself over time in the sense that\n", @@ -1041,7 +1041,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6008c8fe", + "id": "ea35a87c", "metadata": { "tags": [ "hide-cell" @@ -1095,7 +1095,7 @@ { "cell_type": "code", "execution_count": null, - "id": "67a4c10b", + "id": "46ca1ce4", "metadata": { "mystnb": { "figure": { @@ -1114,7 +1114,7 @@ }, { "cell_type": "markdown", - "id": "e983a163", + "id": "72c8aa9b", "metadata": {}, "source": [ "Please notice that for $m_t$ and $p_t$, we have used log scales for the coordinate (i.e., vertical) axes. \n", diff --git a/_sources/money_inflation_nonlinear.ipynb b/_sources/money_inflation_nonlinear.ipynb index 05a57c69..1a5f3f71 100644 --- a/_sources/money_inflation_nonlinear.ipynb +++ b/_sources/money_inflation_nonlinear.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c7c1af21", + "id": "72d9f4bc", "metadata": {}, "source": [ "# Inflation Rate Laffer Curves \n", @@ -161,7 +161,7 @@ { "cell_type": "code", "execution_count": null, - "id": "da465f6e", + "id": "7572a43a", "metadata": {}, "outputs": [], "source": [ @@ -174,7 +174,7 @@ }, { "cell_type": "markdown", - "id": "888095f6", + "id": "5bd60286", "metadata": { "user_expressions": [] }, @@ -185,7 +185,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45faf302", + "id": "eeaed3f8", "metadata": {}, "outputs": [], "source": [ @@ -204,7 +204,7 @@ }, { "cell_type": "markdown", - "id": "4c3e3bad", + "id": "dd15903c", "metadata": { "user_expressions": [] }, @@ -215,7 +215,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42eab434", + "id": "251cdc2b", "metadata": {}, "outputs": [], "source": [ @@ -235,7 +235,7 @@ }, { "cell_type": "markdown", - "id": "5a10d7fd", + "id": "28902ef1", "metadata": {}, "source": [ "We find two steady state $\\bar \\pi$ values\n", @@ -248,7 +248,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8152789d", + "id": "67b9630c", "metadata": { "mystnb": { "figure": { @@ -294,7 +294,7 @@ }, { "cell_type": "markdown", - "id": "6584fb21", + "id": "24a6e03e", "metadata": {}, "source": [ "## Associated Initial Price Levels\n", @@ -305,7 +305,7 @@ { "cell_type": "code", "execution_count": null, - "id": "816a3df8", + "id": "b47dab46", "metadata": {}, "outputs": [], "source": [ @@ -331,7 +331,7 @@ }, { "cell_type": "markdown", - "id": "3a595583", + "id": "ccab8e8a", "metadata": {}, "source": [ "### Verification \n", @@ -345,7 +345,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8a29b103", + "id": "a7f18054", "metadata": {}, "outputs": [], "source": [ @@ -368,7 +368,7 @@ { "cell_type": "code", "execution_count": null, - "id": "482fa617", + "id": "db1813d0", "metadata": {}, "outputs": [], "source": [ @@ -389,7 +389,7 @@ }, { "cell_type": "markdown", - "id": "9e62898c", + "id": "ea82501d", "metadata": {}, "source": [ "## Slippery Side of Laffer Curve Dynamics\n", @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce592a4b", + "id": "c90aa126", "metadata": { "tags": [ "hide-cell" @@ -459,7 +459,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e9eb2dce", + "id": "9bd645dd", "metadata": { "mystnb": { "figure": { @@ -485,7 +485,7 @@ }, { "cell_type": "markdown", - "id": "6fcdc533", + "id": "f1cbc929", "metadata": {}, "source": [ "Staring at the paths of price levels in {numref}`p0_path_nonlin` reveals that almost all paths converge to the **higher** inflation tax rate displayed in the stationary state Laffer curve. displayed in figure {numref}`laffer_curve_nonlinear`. \n", diff --git a/_sources/monte_carlo.ipynb b/_sources/monte_carlo.ipynb index e8d15b9e..7fc18090 100644 --- a/_sources/monte_carlo.ipynb +++ b/_sources/monte_carlo.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "60463f5a", + "id": "7f0df51c", "metadata": {}, "source": [ "# Monte Carlo and Option Pricing\n", @@ -38,7 +38,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a84108b7", + "id": "cdaeb0b6", "metadata": {}, "outputs": [], "source": [ @@ -49,7 +49,7 @@ }, { "cell_type": "markdown", - "id": "6c18346c", + "id": "01c3bf46", "metadata": {}, "source": [ "## An introduction to Monte Carlo\n", @@ -87,7 +87,7 @@ "represented by a lognormal distribution with parameters $\\mu, \\sigma$ .\n", "\n", "* $S$ has the same distribution as $\\exp(\\mu + \\sigma Z)$ where $Z$ is standard normal.\n", - "* we write this statement as $S \\sim LN(\\mu, \\sigma)$.\n", + "* We write this statement as $S \\sim LN(\\mu, \\sigma)$.\n", "\n", "Any good reference on statistics (such as\n", "[Wikipedia](https://en.wikipedia.org/wiki/Log-normal_distribution)) will tell\n", @@ -138,12 +138,12 @@ "This is the Monte Carlo method, which runs as follows:\n", "\n", "1. Generate $n$ independent draws of $X_1$, $X_2$ and $X_3$ on a computer,\n", - "1. Use these draws to generate $n$ independent draws of $S$, and\n", - "1. Take the average value of these draws of $S$.\n", + "1. use these draws to generate $n$ independent draws of $S$, and\n", + "1. take the average value of these draws of $S$.\n", "\n", "This average will be close to the true mean when $n$ is large.\n", "\n", - "This is due to the law of large numbers, which we discussed in {doc}`another lecture `.\n", + "This is due to the law of large numbers, which we discussed in {doc}`lln_clt`.\n", "\n", "We use the following values for $p$ and each $\\mu_i$ and $\\sigma_i$." ] @@ -151,7 +151,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0055a245", + "id": "8c50fda0", "metadata": {}, "outputs": [], "source": [ @@ -163,7 +163,7 @@ }, { "cell_type": "markdown", - "id": "11959d08", + "id": "44de2d87", "metadata": {}, "source": [ "#### A routine using loops in python\n", @@ -180,7 +180,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d9f57f82", + "id": "fd8807d8", "metadata": {}, "outputs": [], "source": [ @@ -197,7 +197,7 @@ }, { "cell_type": "markdown", - "id": "8e9da3d8", + "id": "598cf111", "metadata": {}, "source": [ "We can also construct a function that contains these operations:" @@ -206,7 +206,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b57f6d32", + "id": "dbbe7bf9", "metadata": {}, "outputs": [], "source": [ @@ -222,7 +222,7 @@ }, { "cell_type": "markdown", - "id": "a6d13f0d", + "id": "c8e38d7a", "metadata": {}, "source": [ "Now let's call it." @@ -231,7 +231,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7fa60dd9", + "id": "8af9fe34", "metadata": {}, "outputs": [], "source": [ @@ -240,7 +240,7 @@ }, { "cell_type": "markdown", - "id": "798bacf1", + "id": "4176c839", "metadata": {}, "source": [ "### A vectorized routine\n", @@ -255,7 +255,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c9eeb2c", + "id": "8008a7fc", "metadata": {}, "outputs": [], "source": [ @@ -270,7 +270,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ebb512e2", + "id": "a84c7457", "metadata": {}, "outputs": [], "source": [ @@ -281,7 +281,7 @@ }, { "cell_type": "markdown", - "id": "2b123031", + "id": "0c9470b7", "metadata": {}, "source": [ "Notice that this routine is much faster.\n", @@ -292,7 +292,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cff5f310", + "id": "005c7753", "metadata": {}, "outputs": [], "source": [ @@ -303,10 +303,10 @@ }, { "cell_type": "markdown", - "id": "5381e4e7", + "id": "96828a65", "metadata": {}, "source": [ - "## Pricing a european call option under risk neutrality\n", + "## Pricing a European call option under risk neutrality\n", "\n", "Next we are going to price a European call option under risk neutrality.\n", "\n", @@ -314,7 +314,7 @@ "\n", "\n", "\n", - "### Risk-Neutral Pricing\n", + "### Risk-neutral pricing\n", "\n", "When we use risk-neutral pricing, we determine the price of a given asset\n", "according to its expected payoff:\n", @@ -451,7 +451,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1ad7b80a", + "id": "66b0302b", "metadata": {}, "outputs": [], "source": [ @@ -464,7 +464,7 @@ }, { "cell_type": "markdown", - "id": "c0c4620a", + "id": "11b070ca", "metadata": {}, "source": [ "We set the simulation size to" @@ -473,7 +473,7 @@ { "cell_type": "code", "execution_count": null, - "id": "108bef9c", + "id": "5b31f25f", "metadata": {}, "outputs": [], "source": [ @@ -482,7 +482,7 @@ }, { "cell_type": "markdown", - "id": "7613c381", + "id": "8edffc40", "metadata": {}, "source": [ "Here is our code" @@ -491,7 +491,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5291b7b", + "id": "6d6a522d", "metadata": {}, "outputs": [], "source": [ @@ -503,7 +503,7 @@ }, { "cell_type": "markdown", - "id": "9510ed18", + "id": "4051923c", "metadata": {}, "source": [ "## Pricing via a dynamic model\n", @@ -524,7 +524,7 @@ "\n", "where\n", "\n", - "* $S_0$ is normally distributed and\n", + "* $S_0$ is lognormally distributed and\n", "* $\\{ \\xi_t \\}$ is IID and standard normal.\n", "\n", "\n", @@ -586,23 +586,23 @@ { "cell_type": "code", "execution_count": null, - "id": "aa1ee4e1", + "id": "613536aa", "metadata": {}, "outputs": [], "source": [ - "μ = 0.0001\n", - "ρ = 0.1\n", - "ν = 0.001\n", - "S0 = 10\n", - "h0 = 0" + "default_μ = 0.0001\n", + "default_ρ = 0.1\n", + "default_ν = 0.001\n", + "default_S0 = 10\n", + "default_h0 = 0" ] }, { "cell_type": "markdown", - "id": "d2d5281c", + "id": "d96f0b39", "metadata": {}, "source": [ - "(Here `S0` is $S_0$ and `h0` is $h_0$.)\n", + "(Here `default_S0` is $S_0$ and `default_h0` is $h_0$.)\n", "\n", "For the option we use the following defaults." ] @@ -610,18 +610,18 @@ { "cell_type": "code", "execution_count": null, - "id": "7d03c5fc", + "id": "18ce462b", "metadata": {}, "outputs": [], "source": [ - "K = 100\n", - "n = 10\n", - "β = 0.95" + "default_K = 100\n", + "default_n = 10\n", + "default_β = 0.95" ] }, { "cell_type": "markdown", - "id": "497e86d8", + "id": "6ec7a602", "metadata": {}, "source": [ "### Visualizations\n", @@ -636,11 +636,11 @@ { "cell_type": "code", "execution_count": null, - "id": "b60410dd", + "id": "d410442d", "metadata": {}, "outputs": [], "source": [ - "def simulate_asset_price_path(μ=μ, S0=S0, h0=h0, n=n, ρ=ρ, ν=ν):\n", + "def simulate_asset_price_path(μ=default_μ, S0=default_S0, h0=default_h0, n=default_n, ρ=default_ρ, ν=default_ν):\n", " s = np.empty(n+1)\n", " s[0] = np.log(S0)\n", "\n", @@ -654,7 +654,7 @@ }, { "cell_type": "markdown", - "id": "4f6c1252", + "id": "e05c91ec", "metadata": {}, "source": [ "Here we plot the paths and the log of the paths." @@ -663,7 +663,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8236db9f", + "id": "41ca109b", "metadata": {}, "outputs": [], "source": [ @@ -683,7 +683,7 @@ }, { "cell_type": "markdown", - "id": "52a2a5ea", + "id": "67221f46", "metadata": {}, "source": [ "### Computing the price\n", @@ -709,18 +709,18 @@ { "cell_type": "code", "execution_count": null, - "id": "14db0bf7", + "id": "700a3d4c", "metadata": {}, "outputs": [], "source": [ - "def compute_call_price(β=β,\n", - " μ=μ,\n", - " S0=S0,\n", - " h0=h0,\n", - " K=K,\n", - " n=n,\n", - " ρ=ρ,\n", - " ν=ν,\n", + "def compute_call_price(β=default_β,\n", + " μ=default_μ,\n", + " S0=default_S0,\n", + " h0=default_h0,\n", + " K=default_K,\n", + " n=default_n,\n", + " ρ=default_ρ,\n", + " ν=default_ν,\n", " M=10_000):\n", " current_sum = 0.0\n", " # For each sample path\n", @@ -740,7 +740,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4dade5be", + "id": "a358b395", "metadata": {}, "outputs": [], "source": [ @@ -750,7 +750,7 @@ }, { "cell_type": "markdown", - "id": "8e3d086c", + "id": "917a7013", "metadata": {}, "source": [ "## Exercises\n", @@ -774,18 +774,18 @@ { "cell_type": "code", "execution_count": null, - "id": "acc0ef92", + "id": "ba382bce", "metadata": {}, "outputs": [], "source": [ - "def compute_call_price(β=β,\n", - " μ=μ,\n", - " S0=S0,\n", - " h0=h0,\n", - " K=K,\n", - " n=n,\n", - " ρ=ρ,\n", - " ν=ν,\n", + "def compute_call_price_vector(β=default_β,\n", + " μ=default_μ,\n", + " S0=default_S0,\n", + " h0=default_h0,\n", + " K=default_K,\n", + " n=default_n,\n", + " ρ=default_ρ,\n", + " ν=default_ν,\n", " M=10_000):\n", "\n", " s = np.full(M, np.log(S0))\n", @@ -802,17 +802,17 @@ { "cell_type": "code", "execution_count": null, - "id": "10617305", + "id": "9ff18a54", "metadata": {}, "outputs": [], "source": [ "%%time\n", - "compute_call_price()" + "compute_call_price_vector()" ] }, { "cell_type": "markdown", - "id": "427ea4f2", + "id": "98a65671", "metadata": {}, "source": [ "Notice that this version is faster than the one using a Python loop.\n", @@ -823,7 +823,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7141c111", + "id": "cb92cb95", "metadata": {}, "outputs": [], "source": [ @@ -833,7 +833,7 @@ }, { "cell_type": "markdown", - "id": "6bbd13ca", + "id": "0d80a3fe", "metadata": {}, "source": [ "```{solution-end}\n", @@ -859,37 +859,37 @@ { "cell_type": "code", "execution_count": null, - "id": "c01311c6", + "id": "afc178e5", "metadata": {}, "outputs": [], "source": [ - "μ = 0.0001\n", - "ρ = 0.1\n", - "ν = 0.001\n", - "S0 = 10\n", - "h0 = 0\n", - "K = 100\n", - "n = 10\n", - "β = 0.95\n", - "bp = 120" + "default_μ = 0.0001\n", + "default_ρ = 0.1\n", + "default_ν = 0.001\n", + "default_S0 = 10\n", + "default_h0 = 0\n", + "default_K = 100\n", + "default_n = 10\n", + "default_β = 0.95\n", + "default_bp = 120" ] }, { "cell_type": "code", "execution_count": null, - "id": "a5ce0874", + "id": "bae0ee91", "metadata": {}, "outputs": [], "source": [ - "def compute_call_price_with_barrier(β=β,\n", - " μ=μ,\n", - " S0=S0,\n", - " h0=h0,\n", - " K=K,\n", - " n=n,\n", - " ρ=ρ,\n", - " ν=ν,\n", - " bp=bp,\n", + "def compute_call_price_with_barrier(β=default_β,\n", + " μ=default_μ,\n", + " S0=default_S0,\n", + " h0=default_h0,\n", + " K=default_K,\n", + " n=default_n,\n", + " ρ=default_ρ,\n", + " ν=default_ν,\n", + " bp=default_bp,\n", " M=50_000):\n", " current_sum = 0.0\n", " # For each sample path\n", @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28d7aca9", + "id": "0b1cb37f", "metadata": {}, "outputs": [], "source": [ @@ -927,7 +927,7 @@ }, { "cell_type": "markdown", - "id": "ff5c4e69", + "id": "6024ad0e", "metadata": {}, "source": [ "Let's look at the vectorized version which is faster than using Python loops." @@ -936,19 +936,19 @@ { "cell_type": "code", "execution_count": null, - "id": "416356b9", + "id": "a6d9d288", "metadata": {}, "outputs": [], "source": [ - "def compute_call_price_with_barrier_vector(β=β,\n", - " μ=μ,\n", - " S0=S0,\n", - " h0=h0,\n", - " K=K,\n", - " n=n,\n", - " ρ=ρ,\n", - " ν=ν,\n", - " bp=bp,\n", + "def compute_call_price_with_barrier_vector(β=default_β,\n", + " μ=default_μ,\n", + " S0=default_S0,\n", + " h0=default_h0,\n", + " K=default_K,\n", + " n=default_n,\n", + " ρ=default_ρ,\n", + " ν=default_ν,\n", + " bp=default_bp,\n", " M=50_000):\n", " s = np.full(M, np.log(S0))\n", " h = np.full(M, h0)\n", @@ -969,7 +969,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f0cf8a2d", + "id": "237c0496", "metadata": {}, "outputs": [], "source": [ @@ -978,7 +978,7 @@ }, { "cell_type": "markdown", - "id": "e514953b", + "id": "6addd39a", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/monte_carlo.md b/_sources/monte_carlo.md index d4c00d8d..eecbd011 100644 --- a/_sources/monte_carlo.md +++ b/_sources/monte_carlo.md @@ -85,7 +85,7 @@ Suppose that, after analyzing the data, we guess that $S$ is well represented by a lognormal distribution with parameters $\mu, \sigma$ . * $S$ has the same distribution as $\exp(\mu + \sigma Z)$ where $Z$ is standard normal. -* we write this statement as $S \sim LN(\mu, \sigma)$. +* We write this statement as $S \sim LN(\mu, \sigma)$. Any good reference on statistics (such as [Wikipedia](https://en.wikipedia.org/wiki/Log-normal_distribution)) will tell @@ -136,12 +136,12 @@ But fortunately there's an easy way to do this, at least approximately. This is the Monte Carlo method, which runs as follows: 1. Generate $n$ independent draws of $X_1$, $X_2$ and $X_3$ on a computer, -1. Use these draws to generate $n$ independent draws of $S$, and -1. Take the average value of these draws of $S$. +1. use these draws to generate $n$ independent draws of $S$, and +1. take the average value of these draws of $S$. This average will be close to the true mean when $n$ is large. -This is due to the law of large numbers, which we discussed in {doc}`another lecture `. +This is due to the law of large numbers, which we discussed in {doc}`lln_clt`. We use the following values for $p$ and each $\mu_i$ and $\sigma_i$. @@ -238,7 +238,7 @@ compute_mean_vectorized(n=10_000_000) -## Pricing a european call option under risk neutrality +## Pricing a European call option under risk neutrality Next we are going to price a European call option under risk neutrality. @@ -246,7 +246,7 @@ Let's first discuss risk neutrality and then consider European options. -### Risk-Neutral Pricing +### Risk-neutral pricing When we use risk-neutral pricing, we determine the price of a given asset according to its expected payoff: @@ -426,7 +426,7 @@ $$ \ln \frac{S_{t+1}}{S_t} = \mu + \sigma \xi_{t+1} $$ where -* $S_0$ is normally distributed and +* $S_0$ is lognormally distributed and * $\{ \xi_t \}$ is IID and standard normal. @@ -485,23 +485,23 @@ Here $\{\eta_t\}$ is also IID and standard normal. For the dynamic model, we adopt the following parameter values. ```{code-cell} ipython3 -μ = 0.0001 -ρ = 0.1 -ν = 0.001 -S0 = 10 -h0 = 0 +default_μ = 0.0001 +default_ρ = 0.1 +default_ν = 0.001 +default_S0 = 10 +default_h0 = 0 ``` -(Here `S0` is $S_0$ and `h0` is $h_0$.) +(Here `default_S0` is $S_0$ and `default_h0` is $h_0$.) For the option we use the following defaults. ```{code-cell} ipython3 -K = 100 -n = 10 -β = 0.95 +default_K = 100 +default_n = 10 +default_β = 0.95 ``` @@ -515,7 +515,7 @@ $$ s_{t+1} = s_t + \mu + \exp(h_t) \xi_{t+1} $$ Here is a function to simulate a path using this equation: ```{code-cell} ipython3 -def simulate_asset_price_path(μ=μ, S0=S0, h0=h0, n=n, ρ=ρ, ν=ν): +def simulate_asset_price_path(μ=default_μ, S0=default_S0, h0=default_h0, n=default_n, ρ=default_ρ, ν=default_ν): s = np.empty(n+1) s[0] = np.log(S0) @@ -568,14 +568,14 @@ $$ Here's a version using Python loops. ```{code-cell} ipython3 -def compute_call_price(β=β, - μ=μ, - S0=S0, - h0=h0, - K=K, - n=n, - ρ=ρ, - ν=ν, +def compute_call_price(β=default_β, + μ=default_μ, + S0=default_S0, + h0=default_h0, + K=default_K, + n=default_n, + ρ=default_ρ, + ν=default_ν, M=10_000): current_sum = 0.0 # For each sample path @@ -617,14 +617,14 @@ Your task is to write a faster version of this code using NumPy. ``` ```{code-cell} ipython3 -def compute_call_price(β=β, - μ=μ, - S0=S0, - h0=h0, - K=K, - n=n, - ρ=ρ, - ν=ν, +def compute_call_price_vector(β=default_β, + μ=default_μ, + S0=default_S0, + h0=default_h0, + K=default_K, + n=default_n, + ρ=default_ρ, + ν=default_ν, M=10_000): s = np.full(M, np.log(S0)) @@ -640,7 +640,7 @@ def compute_call_price(β=β, ```{code-cell} ipython3 %%time -compute_call_price() +compute_call_price_vector() ``` @@ -676,27 +676,27 @@ Use the dynamics defined in {eq}`s_mc_dyms` to price the European call option. ``` ```{code-cell} ipython3 -μ = 0.0001 -ρ = 0.1 -ν = 0.001 -S0 = 10 -h0 = 0 -K = 100 -n = 10 -β = 0.95 -bp = 120 +default_μ = 0.0001 +default_ρ = 0.1 +default_ν = 0.001 +default_S0 = 10 +default_h0 = 0 +default_K = 100 +default_n = 10 +default_β = 0.95 +default_bp = 120 ``` ```{code-cell} ipython3 -def compute_call_price_with_barrier(β=β, - μ=μ, - S0=S0, - h0=h0, - K=K, - n=n, - ρ=ρ, - ν=ν, - bp=bp, +def compute_call_price_with_barrier(β=default_β, + μ=default_μ, + S0=default_S0, + h0=default_h0, + K=default_K, + n=default_n, + ρ=default_ρ, + ν=default_ν, + bp=default_bp, M=50_000): current_sum = 0.0 # For each sample path @@ -731,15 +731,15 @@ def compute_call_price_with_barrier(β=β, Let's look at the vectorized version which is faster than using Python loops. ```{code-cell} ipython3 -def compute_call_price_with_barrier_vector(β=β, - μ=μ, - S0=S0, - h0=h0, - K=K, - n=n, - ρ=ρ, - ν=ν, - bp=bp, +def compute_call_price_with_barrier_vector(β=default_β, + μ=default_μ, + S0=default_S0, + h0=default_h0, + K=default_K, + n=default_n, + ρ=default_ρ, + ν=default_ν, + bp=default_bp, M=50_000): s = np.full(M, np.log(S0)) h = np.full(M, h0) diff --git a/_sources/networks.ipynb b/_sources/networks.ipynb index 5fdc8b4e..f1914a49 100644 --- a/_sources/networks.ipynb +++ b/_sources/networks.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "9fedf79a", + "id": "1c9044fd", "metadata": {}, "source": [ "# Networks" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "59875246", + "id": "c45e5c89", "metadata": { "tags": [ "hide-output" @@ -24,7 +24,7 @@ }, { "cell_type": "markdown", - "id": "41cdbcf5", + "id": "69f7617a", "metadata": {}, "source": [ "## Outline\n", @@ -61,7 +61,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ef7b6b0", + "id": "d984beb8", "metadata": {}, "outputs": [], "source": [ @@ -80,7 +80,7 @@ }, { "cell_type": "markdown", - "id": "cd0a510f", + "id": "51198538", "metadata": {}, "source": [ "## Economic and financial networks\n", @@ -110,7 +110,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2d7050d7", + "id": "8f55ea20", "metadata": { "mystnb": { "figure": { @@ -176,7 +176,7 @@ }, { "cell_type": "markdown", - "id": "868264c8", + "id": "29eae45d", "metadata": {}, "source": [ "The circles in the figure are called **nodes** or **vertices** -- in this case they represent countries.\n", @@ -279,7 +279,7 @@ }, { "cell_type": "markdown", - "id": "2afc3312", + "id": "4cac8f30", "metadata": {}, "source": [ "We now construct a graph with the same nodes but different edges.\n", @@ -293,7 +293,7 @@ }, { "cell_type": "markdown", - "id": "90bacd99", + "id": "238a0017", "metadata": {}, "source": [ "For these graphs, the arrows (edges) can be thought of as representing\n", @@ -322,7 +322,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8e35f46e", + "id": "8e7e6c3c", "metadata": {}, "outputs": [], "source": [ @@ -331,7 +331,7 @@ }, { "cell_type": "markdown", - "id": "1411f88f", + "id": "e740f805", "metadata": {}, "source": [ "Next we populate it with nodes and edges.\n", @@ -343,7 +343,7 @@ { "cell_type": "code", "execution_count": null, - "id": "15a03a6d", + "id": "9a48a3d4", "metadata": {}, "outputs": [], "source": [ @@ -354,7 +354,7 @@ }, { "cell_type": "markdown", - "id": "a82f4fed", + "id": "13e9c550", "metadata": {}, "source": [ "Finally, we add the edges to our `DiGraph` object:" @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "07093ee7", + "id": "9ffb9c87", "metadata": {}, "outputs": [], "source": [ @@ -374,7 +374,7 @@ }, { "cell_type": "markdown", - "id": "aa22bbbf", + "id": "c6f6e814", "metadata": {}, "source": [ "Alternatively, we can use the method `add_edges_from`." @@ -383,7 +383,7 @@ { "cell_type": "code", "execution_count": null, - "id": "80e5999d", + "id": "1081d3da", "metadata": {}, "outputs": [], "source": [ @@ -392,7 +392,7 @@ }, { "cell_type": "markdown", - "id": "4061715e", + "id": "837714ec", "metadata": {}, "source": [ "Adding the edges automatically adds the nodes, so `G_p` is now a\n", @@ -404,7 +404,7 @@ { "cell_type": "code", "execution_count": null, - "id": "569d0c81", + "id": "e4f74101", "metadata": {}, "outputs": [], "source": [ @@ -417,7 +417,7 @@ }, { "cell_type": "markdown", - "id": "8cda3db5", + "id": "a770605c", "metadata": {}, "source": [ "The figure obtained above matches the original directed graph in {numref}`poverty_trap_2`.\n", @@ -432,7 +432,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d19b77ac", + "id": "fad71e32", "metadata": {}, "outputs": [], "source": [ @@ -441,7 +441,7 @@ }, { "cell_type": "markdown", - "id": "777a7de0", + "id": "80b8e2a0", "metadata": {}, "source": [ "(strongly_connected)=\n", @@ -477,7 +477,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5bd366f", + "id": "d57c9611", "metadata": {}, "outputs": [], "source": [ @@ -494,7 +494,7 @@ { "cell_type": "code", "execution_count": null, - "id": "518f67d5", + "id": "2253b62d", "metadata": {}, "outputs": [], "source": [ @@ -504,7 +504,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5c430647", + "id": "3680745f", "metadata": {}, "outputs": [], "source": [ @@ -521,7 +521,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1aa523ea", + "id": "57012e79", "metadata": {}, "outputs": [], "source": [ @@ -530,7 +530,7 @@ }, { "cell_type": "markdown", - "id": "a86ddab7", + "id": "188d9b3a", "metadata": {}, "source": [ "## Weighted graphs\n", @@ -548,7 +548,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a3b4503d", + "id": "fad598b0", "metadata": { "mystnb": { "figure": { @@ -618,7 +618,7 @@ }, { "cell_type": "markdown", - "id": "7bb48d50", + "id": "4ed5566b", "metadata": {}, "source": [ "The country codes are given in the following table\n", @@ -655,7 +655,7 @@ }, { "cell_type": "markdown", - "id": "92674e39", + "id": "9bac9924", "metadata": {}, "source": [ "### Definitions\n", @@ -725,7 +725,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c9d9fc2", + "id": "a8bb3f96", "metadata": {}, "outputs": [], "source": [ @@ -738,7 +738,7 @@ }, { "cell_type": "markdown", - "id": "807dcd2d", + "id": "64a90d9a", "metadata": {}, "source": [ "One of the key points to remember about adjacency matrices is that taking the\n", @@ -753,7 +753,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b9dbcced", + "id": "d962ebb8", "metadata": {}, "outputs": [], "source": [ @@ -782,7 +782,7 @@ }, { "cell_type": "markdown", - "id": "ee0bb267", + "id": "01af6be0", "metadata": {}, "source": [ "We see that bank 2 extends a loan of size 200 to bank 3.\n", @@ -821,7 +821,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1751ab99", + "id": "9ed9c731", "metadata": {}, "outputs": [], "source": [ @@ -849,7 +849,7 @@ }, { "cell_type": "markdown", - "id": "596e61fe", + "id": "97afbca3", "metadata": {}, "source": [ "In general, every nonnegative $n \\times n$ matrix $A = (a_{ij})$ can be\n", @@ -887,7 +887,7 @@ }, { "cell_type": "markdown", - "id": "c5c52356", + "id": "14679b57", "metadata": {}, "source": [ "The above result is obvious when $k=1$ and a proof of the general case can be\n", @@ -912,7 +912,7 @@ }, { "cell_type": "markdown", - "id": "753d7e64", + "id": "3f11ffa3", "metadata": {}, "source": [ "We illustrate the above theorem with a simple example.\n", @@ -928,7 +928,7 @@ }, { "cell_type": "markdown", - "id": "e6e843d3", + "id": "fe11e6e0", "metadata": {}, "source": [ "We first create the above network as a Networkx `DiGraph` object." @@ -937,7 +937,7 @@ { "cell_type": "code", "execution_count": null, - "id": "58e4ba73", + "id": "54a10ed9", "metadata": {}, "outputs": [], "source": [ @@ -950,7 +950,7 @@ }, { "cell_type": "markdown", - "id": "69d63a75", + "id": "3013bad8", "metadata": {}, "source": [ "Then we construct the associated adjacency matrix A." @@ -959,7 +959,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c5ec4e14", + "id": "79228124", "metadata": {}, "outputs": [], "source": [ @@ -971,7 +971,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0c21686a", + "id": "3677d4d6", "metadata": { "tags": [ "hide-input" @@ -990,7 +990,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29312884", + "id": "b2d6e5dd", "metadata": {}, "outputs": [], "source": [ @@ -1000,7 +1000,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9251e655", + "id": "a62c0bf5", "metadata": {}, "outputs": [], "source": [ @@ -1009,7 +1009,7 @@ }, { "cell_type": "markdown", - "id": "c303a3eb", + "id": "d909cc97", "metadata": {}, "source": [ "## Network centrality\n", @@ -1044,7 +1044,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51c7ba6b", + "id": "2c40f60e", "metadata": { "mystnb": { "figure": { @@ -1077,7 +1077,7 @@ }, { "cell_type": "markdown", - "id": "0cdc6dcd", + "id": "051dd35d", "metadata": {}, "source": [ "The following code displays the in-degree centrality of all nodes." @@ -1086,7 +1086,7 @@ { "cell_type": "code", "execution_count": null, - "id": "054c0639", + "id": "6cfec38b", "metadata": {}, "outputs": [], "source": [ @@ -1098,7 +1098,7 @@ }, { "cell_type": "markdown", - "id": "8316096e", + "id": "ae6c9b41", "metadata": {}, "source": [ "Consider the international credit network displayed in {numref}`financial_network`.\n", @@ -1109,7 +1109,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8e8a0a73", + "id": "2875c425", "metadata": {}, "outputs": [], "source": [ @@ -1120,7 +1120,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0166bfa5", + "id": "bcaed9de", "metadata": {}, "outputs": [], "source": [ @@ -1135,7 +1135,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f2779ef5", + "id": "6079c523", "metadata": {}, "outputs": [], "source": [ @@ -1155,7 +1155,7 @@ }, { "cell_type": "markdown", - "id": "862b2b6b", + "id": "ecd5dbd6", "metadata": {}, "source": [ "Unfortunately, while in-degree and out-degree centrality are simple to\n", @@ -1249,7 +1249,7 @@ { "cell_type": "code", "execution_count": null, - "id": "718b5517", + "id": "8b1bd38b", "metadata": {}, "outputs": [], "source": [ @@ -1268,7 +1268,7 @@ }, { "cell_type": "markdown", - "id": "ab8e8c54", + "id": "4275caff", "metadata": {}, "source": [ "Let's compute eigenvector centrality for the graph generated in {numref}`sample_gph_1`." @@ -1277,7 +1277,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d12b24e6", + "id": "9aa3662e", "metadata": {}, "outputs": [], "source": [ @@ -1287,7 +1287,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ffa6c2d6", + "id": "87687adf", "metadata": {}, "outputs": [], "source": [ @@ -1300,7 +1300,7 @@ }, { "cell_type": "markdown", - "id": "92bd2e3b", + "id": "b1c2c876", "metadata": {}, "source": [ "While nodes $2$ and $4$ had the highest in-degree centrality, we can see that nodes $1$ and $2$ have the\n", @@ -1312,7 +1312,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a259c3e5", + "id": "cf785d73", "metadata": {}, "outputs": [], "source": [ @@ -1322,7 +1322,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d638a9b4", + "id": "32e83d1e", "metadata": { "mystnb": { "figure": { @@ -1347,7 +1347,7 @@ }, { "cell_type": "markdown", - "id": "5db82543", + "id": "1d5f02a8", "metadata": {}, "source": [ "Countries that are rated highly according to this rank tend to be important\n", @@ -1467,7 +1467,7 @@ { "cell_type": "code", "execution_count": null, - "id": "64983a53", + "id": "172255de", "metadata": {}, "outputs": [], "source": [ @@ -1477,7 +1477,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8d5d6918", + "id": "d9a71aed", "metadata": { "mystnb": { "figure": { @@ -1502,7 +1502,7 @@ }, { "cell_type": "markdown", - "id": "3100611f", + "id": "055b4c68", "metadata": {}, "source": [ "Highly ranked countries are those that attract large inflows of credit, or\n", @@ -1604,7 +1604,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ea935024", + "id": "bfda1649", "metadata": {}, "outputs": [], "source": [ @@ -1631,7 +1631,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dde78c0b", + "id": "b4876c4a", "metadata": {}, "outputs": [], "source": [ @@ -1643,7 +1643,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5f72d5f6", + "id": "06653fc6", "metadata": {}, "outputs": [], "source": [ @@ -1656,7 +1656,7 @@ { "cell_type": "code", "execution_count": null, - "id": "38d91006", + "id": "1c9ccfd0", "metadata": {}, "outputs": [], "source": [ @@ -1669,7 +1669,7 @@ }, { "cell_type": "markdown", - "id": "d94a4b47", + "id": "31b11568", "metadata": {}, "source": [ "```{solution-end}\n", @@ -1704,7 +1704,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2da6bb85", + "id": "384b56d2", "metadata": {}, "outputs": [], "source": [ @@ -1723,7 +1723,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eea1d2d0", + "id": "05765f8d", "metadata": {}, "outputs": [], "source": [ @@ -1744,7 +1744,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e56c7fae", + "id": "6ed23933", "metadata": {}, "outputs": [], "source": [ @@ -1754,7 +1754,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fe489731", + "id": "8a857666", "metadata": {}, "outputs": [], "source": [ @@ -1763,7 +1763,7 @@ }, { "cell_type": "markdown", - "id": "09826791", + "id": "1da9ac2e", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/olg.ipynb b/_sources/olg.ipynb index e8110d0e..af69680e 100644 --- a/_sources/olg.ipynb +++ b/_sources/olg.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "47ba08ee", + "id": "f50c303a", "metadata": {}, "source": [ "# The Overlapping Generations Model\n", @@ -59,7 +59,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6a5de5e6", + "id": "f45d3b22", "metadata": {}, "outputs": [], "source": [ @@ -71,7 +71,7 @@ }, { "cell_type": "markdown", - "id": "2684c455", + "id": "928223c2", "metadata": {}, "source": [ "## Environment\n", @@ -298,7 +298,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fdfda5fc", + "id": "83d8e0c7", "metadata": {}, "outputs": [], "source": [ @@ -309,7 +309,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17cd6af7", + "id": "2dec66e0", "metadata": {}, "outputs": [], "source": [ @@ -320,7 +320,7 @@ }, { "cell_type": "markdown", - "id": "3adcdfdf", + "id": "c0f53db5", "metadata": {}, "source": [ "The next figure plots the supply of capital, as in [](saving_log_2_olg), as well as the demand for capital, as in [](aggregate_demand_capital_olg), as functions of the interest rate $R_{t+1}$.\n", @@ -331,7 +331,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12f34d4e", + "id": "2a6722e2", "metadata": {}, "outputs": [], "source": [ @@ -354,7 +354,7 @@ }, { "cell_type": "markdown", - "id": "fe9e8d0b", + "id": "bfe651a7", "metadata": {}, "source": [ "## Equilibrium\n", @@ -417,7 +417,7 @@ { "cell_type": "code", "execution_count": null, - "id": "98f3ef9a", + "id": "a62dce44", "metadata": {}, "outputs": [], "source": [ @@ -428,7 +428,7 @@ }, { "cell_type": "markdown", - "id": "70875636", + "id": "8f9a7aaa", "metadata": {}, "source": [ "In the case of log utility, since capital supply does not depend on the interest rate, the equilibrium quantity is fixed by supply.\n", @@ -446,7 +446,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2df94c31", + "id": "e2c19418", "metadata": {}, "outputs": [], "source": [ @@ -482,7 +482,7 @@ }, { "cell_type": "markdown", - "id": "aa40f474", + "id": "b14f5844", "metadata": {}, "source": [ "## Dynamics \n", @@ -519,7 +519,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e6f6e019", + "id": "4995c5f5", "metadata": {}, "outputs": [], "source": [ @@ -530,7 +530,7 @@ { "cell_type": "code", "execution_count": null, - "id": "321ace30", + "id": "4955c2e8", "metadata": {}, "outputs": [], "source": [ @@ -560,7 +560,7 @@ }, { "cell_type": "markdown", - "id": "89fe95fc", + "id": "006f1c08", "metadata": {}, "source": [ "### Steady state (log case)\n", @@ -595,7 +595,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9c94e11f", + "id": "54c362bc", "metadata": {}, "outputs": [], "source": [ @@ -605,7 +605,7 @@ }, { "cell_type": "markdown", - "id": "96077eb1", + "id": "94f41d00", "metadata": {}, "source": [ "### Time series\n", @@ -618,7 +618,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c59b6fe", + "id": "b8833544", "metadata": {}, "outputs": [], "source": [ @@ -640,7 +640,7 @@ }, { "cell_type": "markdown", - "id": "7d13dd18", + "id": "598a9f9e", "metadata": {}, "source": [ "If you experiment with different positive initial conditions, you will see that the series always converges to $k^*$." @@ -648,7 +648,7 @@ }, { "cell_type": "markdown", - "id": "2464f248", + "id": "ce2a381b", "metadata": {}, "source": [ "Below we also plot the gross interest rate over time." @@ -657,7 +657,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ed3d8e1", + "id": "8276b1b2", "metadata": {}, "outputs": [], "source": [ @@ -674,7 +674,7 @@ }, { "cell_type": "markdown", - "id": "f866e86e", + "id": "657ade08", "metadata": {}, "source": [ "The interest rate reflects the marginal product of capital, which is high when capital stock is low." @@ -682,7 +682,7 @@ }, { "cell_type": "markdown", - "id": "ece20dcd", + "id": "b2f41b4a", "metadata": {}, "source": [ "## CRRA preferences\n", @@ -704,7 +704,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c2bdd234", + "id": "a52e7050", "metadata": {}, "outputs": [], "source": [ @@ -722,7 +722,7 @@ }, { "cell_type": "markdown", - "id": "6c7117d2", + "id": "3cbfc960", "metadata": {}, "source": [ "Let's also redefine the capital demand function to work with this `namedtuple`." @@ -731,7 +731,7 @@ { "cell_type": "code", "execution_count": null, - "id": "047df72a", + "id": "ff9b6aaf", "metadata": {}, "outputs": [], "source": [ @@ -741,7 +741,7 @@ }, { "cell_type": "markdown", - "id": "03890a27", + "id": "768eb67e", "metadata": {}, "source": [ "### Supply\n", @@ -772,7 +772,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6279fbcc", + "id": "6c28bc23", "metadata": {}, "outputs": [], "source": [ @@ -784,7 +784,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b4aaa115", + "id": "46bb683a", "metadata": {}, "outputs": [], "source": [ @@ -807,7 +807,7 @@ }, { "cell_type": "markdown", - "id": "a9c9b3cd", + "id": "59ce05d2", "metadata": {}, "source": [ "### Equilibrium\n", @@ -842,7 +842,7 @@ }, { "cell_type": "markdown", - "id": "4239cecb", + "id": "a5955f96", "metadata": {}, "source": [ "## Exercises\n", @@ -890,7 +890,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9c11a0ab", + "id": "41c6e7af", "metadata": {}, "outputs": [], "source": [ @@ -905,7 +905,7 @@ }, { "cell_type": "markdown", - "id": "e2fc7f0f", + "id": "5698a2a3", "metadata": {}, "source": [ "Now let's define a function that finds the value of $k_{t+1}$." @@ -914,7 +914,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9b4b4a40", + "id": "8fa31673", "metadata": {}, "outputs": [], "source": [ @@ -924,7 +924,7 @@ }, { "cell_type": "markdown", - "id": "5a9ad58f", + "id": "9b6630b0", "metadata": {}, "source": [ "Finally, here is the 45 degree diagram." @@ -933,7 +933,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7cf8f780", + "id": "20188a09", "metadata": {}, "outputs": [], "source": [ @@ -962,7 +962,7 @@ }, { "cell_type": "markdown", - "id": "ae75249d", + "id": "b3adc3ac", "metadata": {}, "source": [ "```{solution-end}\n", @@ -1012,7 +1012,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3afa1234", + "id": "9257e43e", "metadata": {}, "outputs": [], "source": [ @@ -1027,7 +1027,7 @@ }, { "cell_type": "markdown", - "id": "554b0d55", + "id": "beedccd6", "metadata": {}, "source": [ "Let's apply Newton's method to find the root:" @@ -1036,7 +1036,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0714b5dc", + "id": "42193cba", "metadata": {}, "outputs": [], "source": [ @@ -1046,7 +1046,7 @@ }, { "cell_type": "markdown", - "id": "a503bf91", + "id": "d8d72bb5", "metadata": {}, "source": [ "```{solution-end}\n", @@ -1077,7 +1077,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1f28112d", + "id": "d9c5cab4", "metadata": {}, "outputs": [], "source": [ @@ -1088,7 +1088,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1b8f20c", + "id": "578cc912", "metadata": {}, "outputs": [], "source": [ @@ -1118,7 +1118,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e4eb3b63", + "id": "ab90f633", "metadata": {}, "outputs": [], "source": [ @@ -1127,7 +1127,7 @@ }, { "cell_type": "markdown", - "id": "86ffacc3", + "id": "9b5642a9", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/prob_dist.ipynb b/_sources/prob_dist.ipynb index 284ae6e9..a3054ce4 100644 --- a/_sources/prob_dist.ipynb +++ b/_sources/prob_dist.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c384224f", + "id": "e5600a65", "metadata": {}, "source": [ "# Distributions and Probabilities\n", @@ -18,7 +18,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c28279c3", + "id": "d9d20736", "metadata": { "tags": [ "hide-output" @@ -32,7 +32,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c2ca29b2", + "id": "6289d43e", "metadata": {}, "outputs": [], "source": [ @@ -46,7 +46,7 @@ }, { "cell_type": "markdown", - "id": "97912d4b", + "id": "11210eb0", "metadata": {}, "source": [ "## Common distributions\n", @@ -107,7 +107,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25d60c69", + "id": "91c3b736", "metadata": {}, "outputs": [], "source": [ @@ -117,7 +117,7 @@ }, { "cell_type": "markdown", - "id": "dcd73ec5", + "id": "a515ebb4", "metadata": {}, "source": [ "Here's the mean and variance:" @@ -126,7 +126,7 @@ { "cell_type": "code", "execution_count": null, - "id": "89fcbddd", + "id": "3a989319", "metadata": {}, "outputs": [], "source": [ @@ -135,7 +135,7 @@ }, { "cell_type": "markdown", - "id": "b36747be", + "id": "ce8cb8a2", "metadata": {}, "source": [ "The formula for the mean is $(n+1)/2$, and the formula for the variance is $(n^2 - 1)/12$.\n", @@ -147,7 +147,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4d1fd28b", + "id": "4773659d", "metadata": {}, "outputs": [], "source": [ @@ -157,7 +157,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aa0aafe1", + "id": "d5f8747c", "metadata": {}, "outputs": [], "source": [ @@ -166,7 +166,7 @@ }, { "cell_type": "markdown", - "id": "16d26418", + "id": "a52d9417", "metadata": {}, "source": [ "Here's a plot of the probability mass function:" @@ -175,7 +175,7 @@ { "cell_type": "code", "execution_count": null, - "id": "711c2a9c", + "id": "82295dc7", "metadata": {}, "outputs": [], "source": [ @@ -189,7 +189,7 @@ }, { "cell_type": "markdown", - "id": "1a30b12f", + "id": "2b813163", "metadata": {}, "source": [ "Here's a plot of the CDF:" @@ -198,7 +198,7 @@ { "cell_type": "code", "execution_count": null, - "id": "802b7971", + "id": "ccb66c4a", "metadata": {}, "outputs": [], "source": [ @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "fa34d0ea", + "id": "a0b1b596", "metadata": {}, "source": [ "The CDF jumps up by $p(x_i)$ at $x_i$.\n", @@ -248,7 +248,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a53a20bb", + "id": "390be75b", "metadata": {}, "outputs": [], "source": [ @@ -258,7 +258,7 @@ }, { "cell_type": "markdown", - "id": "9bffacb7", + "id": "980a0e89", "metadata": {}, "source": [ "Here's the mean and variance:" @@ -267,7 +267,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fbfa79f2", + "id": "4d684e4c", "metadata": {}, "outputs": [], "source": [ @@ -276,7 +276,7 @@ }, { "cell_type": "markdown", - "id": "81516d7b", + "id": "2f28abfd", "metadata": {}, "source": [ "The formula for the mean is $p$, and the formula for the variance is $p(1-p)$.\n", @@ -288,7 +288,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6fdcea75", + "id": "7e1db830", "metadata": {}, "outputs": [], "source": [ @@ -298,7 +298,7 @@ }, { "cell_type": "markdown", - "id": "fe23943e", + "id": "09059b80", "metadata": {}, "source": [ "#### Binomial distribution\n", @@ -321,7 +321,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df564559", + "id": "c56d14e1", "metadata": {}, "outputs": [], "source": [ @@ -333,7 +333,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e9f1cf5", + "id": "f1c6ad96", "metadata": {}, "outputs": [], "source": [ @@ -342,7 +342,7 @@ }, { "cell_type": "markdown", - "id": "27b11581", + "id": "fe4230f3", "metadata": {}, "source": [ "The formula for the mean is $n \\theta$ and the formula for the variance is $n \\theta (1-\\theta)$.\n", @@ -353,7 +353,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4dab127e", + "id": "e4b92df8", "metadata": {}, "outputs": [], "source": [ @@ -363,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cdd3fa5a", + "id": "3186fc47", "metadata": {}, "outputs": [], "source": [ @@ -377,7 +377,7 @@ }, { "cell_type": "markdown", - "id": "a4319e84", + "id": "f1a88f9f", "metadata": {}, "source": [ "Here's the CDF:" @@ -386,7 +386,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e83b10d8", + "id": "9ff0a403", "metadata": {}, "outputs": [], "source": [ @@ -400,7 +400,7 @@ }, { "cell_type": "markdown", - "id": "940872a4", + "id": "ea768b66", "metadata": {}, "source": [ "```{exercise}\n", @@ -419,7 +419,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c74ed5a6", + "id": "1931b515", "metadata": {}, "outputs": [], "source": [ @@ -434,7 +434,7 @@ }, { "cell_type": "markdown", - "id": "38ba7188", + "id": "c4a379e8", "metadata": {}, "source": [ "We can see that the output graph is the same as the one above.\n", @@ -458,7 +458,7 @@ { "cell_type": "code", "execution_count": null, - "id": "63da22e0", + "id": "906ef71a", "metadata": {}, "outputs": [], "source": [ @@ -469,7 +469,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ed411ef", + "id": "bb520254", "metadata": {}, "outputs": [], "source": [ @@ -478,7 +478,7 @@ }, { "cell_type": "markdown", - "id": "80375111", + "id": "ae77eacf", "metadata": {}, "source": [ "The the expectation of Poisson distribution is $\\lambda$ and the variance is also $\\lambda$.\n", @@ -489,7 +489,7 @@ { "cell_type": "code", "execution_count": null, - "id": "25071f54", + "id": "adcc9058", "metadata": {}, "outputs": [], "source": [ @@ -500,7 +500,7 @@ { "cell_type": "code", "execution_count": null, - "id": "32a0a6a5", + "id": "a7a71a4e", "metadata": {}, "outputs": [], "source": [ @@ -510,7 +510,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5c3cc7af", + "id": "e416701e", "metadata": {}, "outputs": [], "source": [ @@ -524,7 +524,7 @@ }, { "cell_type": "markdown", - "id": "bdec3d84", + "id": "63c8e88a", "metadata": {}, "source": [ "### Continuous distributions\n", @@ -577,7 +577,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad16f782", + "id": "0b407d1c", "metadata": {}, "outputs": [], "source": [ @@ -588,7 +588,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9930b9d9", + "id": "176b16bb", "metadata": {}, "outputs": [], "source": [ @@ -597,7 +597,7 @@ }, { "cell_type": "markdown", - "id": "b6269c64", + "id": "e296cc37", "metadata": {}, "source": [ "Here's a plot of the density --- the famous \"bell-shaped curve\":" @@ -606,7 +606,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f3b53575", + "id": "d801b92c", "metadata": {}, "outputs": [], "source": [ @@ -627,7 +627,7 @@ }, { "cell_type": "markdown", - "id": "41768fbb", + "id": "3d1bd39d", "metadata": {}, "source": [ "Here's a plot of the CDF:" @@ -636,7 +636,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d8880fff", + "id": "769c32ce", "metadata": {}, "outputs": [], "source": [ @@ -653,7 +653,7 @@ }, { "cell_type": "markdown", - "id": "dedbb34e", + "id": "710eadd5", "metadata": {}, "source": [ "#### Lognormal distribution\n", @@ -679,7 +679,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e23ad0f", + "id": "dc1818b1", "metadata": {}, "outputs": [], "source": [ @@ -690,7 +690,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a09d6258", + "id": "28271c60", "metadata": {}, "outputs": [], "source": [ @@ -700,7 +700,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e32d6a75", + "id": "2ef4adc5", "metadata": {}, "outputs": [], "source": [ @@ -722,7 +722,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e6e9a93b", + "id": "9ba3ecdc", "metadata": {}, "outputs": [], "source": [ @@ -741,7 +741,7 @@ }, { "cell_type": "markdown", - "id": "4c0fdfbb", + "id": "cef49d31", "metadata": {}, "source": [ "#### Exponential distribution\n", @@ -764,7 +764,7 @@ { "cell_type": "code", "execution_count": null, - "id": "214c541c", + "id": "fe7d018d", "metadata": {}, "outputs": [], "source": [ @@ -775,7 +775,7 @@ { "cell_type": "code", "execution_count": null, - "id": "96a3d6e6", + "id": "1e4bb5a2", "metadata": {}, "outputs": [], "source": [ @@ -785,7 +785,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3d31914e", + "id": "3896ad99", "metadata": {}, "outputs": [], "source": [ @@ -805,7 +805,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f62e76ec", + "id": "4ff3dfc8", "metadata": {}, "outputs": [], "source": [ @@ -822,7 +822,7 @@ }, { "cell_type": "markdown", - "id": "b3de2eea", + "id": "7bdfcbef", "metadata": {}, "source": [ "#### Beta distribution\n", @@ -850,7 +850,7 @@ { "cell_type": "code", "execution_count": null, - "id": "646a3cdd", + "id": "9f533db4", "metadata": {}, "outputs": [], "source": [ @@ -861,7 +861,7 @@ { "cell_type": "code", "execution_count": null, - "id": "83774047", + "id": "0d741664", "metadata": {}, "outputs": [], "source": [ @@ -871,7 +871,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b1947554", + "id": "9f13a348", "metadata": {}, "outputs": [], "source": [ @@ -892,7 +892,7 @@ { "cell_type": "code", "execution_count": null, - "id": "953a928a", + "id": "bf3369d4", "metadata": {}, "outputs": [], "source": [ @@ -909,7 +909,7 @@ }, { "cell_type": "markdown", - "id": "c3401c1b", + "id": "8534e765", "metadata": {}, "source": [ "#### Gamma distribution\n", @@ -936,7 +936,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ce1fde9a", + "id": "f01fc0c6", "metadata": {}, "outputs": [], "source": [ @@ -947,7 +947,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a792e058", + "id": "fbc30086", "metadata": {}, "outputs": [], "source": [ @@ -957,7 +957,7 @@ { "cell_type": "code", "execution_count": null, - "id": "996b1c15", + "id": "348afb6a", "metadata": {}, "outputs": [], "source": [ @@ -978,7 +978,7 @@ { "cell_type": "code", "execution_count": null, - "id": "52a03ac0", + "id": "8b2cbc5e", "metadata": {}, "outputs": [], "source": [ @@ -995,7 +995,7 @@ }, { "cell_type": "markdown", - "id": "68887fc6", + "id": "2c78f936", "metadata": {}, "source": [ "## Observed distributions\n", @@ -1009,7 +1009,7 @@ { "cell_type": "code", "execution_count": null, - "id": "92a6c83d", + "id": "75ce4b11", "metadata": {}, "outputs": [], "source": [ @@ -1030,7 +1030,7 @@ }, { "cell_type": "markdown", - "id": "f7743d4a", + "id": "1d3c43b5", "metadata": {}, "source": [ "In this situation, we might refer to the set of their incomes as the \"income distribution.\"\n", @@ -1066,7 +1066,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8eb7e217", + "id": "bb4b8a73", "metadata": {}, "outputs": [], "source": [ @@ -1076,7 +1076,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30fc30a5", + "id": "6b93ab73", "metadata": {}, "outputs": [], "source": [ @@ -1085,7 +1085,7 @@ }, { "cell_type": "markdown", - "id": "ca85ec84", + "id": "496cc86b", "metadata": {}, "source": [ "```{exercise}\n", @@ -1107,7 +1107,7 @@ }, { "cell_type": "markdown", - "id": "8dd0fa5b", + "id": "515c3ea5", "metadata": { "user_expressions": [] }, @@ -1117,7 +1117,7 @@ }, { "cell_type": "markdown", - "id": "367b427e", + "id": "2bd25b7a", "metadata": { "user_expressions": [] }, @@ -1128,7 +1128,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f3a71984", + "id": "9cc85414", "metadata": {}, "outputs": [], "source": [ @@ -1140,7 +1140,7 @@ }, { "cell_type": "markdown", - "id": "bd188c3f", + "id": "75898649", "metadata": { "user_expressions": [] }, @@ -1157,7 +1157,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8219bf83", + "id": "da95b6f7", "metadata": { "tags": [ "hide-output" @@ -1173,7 +1173,7 @@ }, { "cell_type": "markdown", - "id": "dc4342b7", + "id": "95b71f38", "metadata": { "user_expressions": [] }, @@ -1184,7 +1184,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7923ae04", + "id": "27ed70fd", "metadata": {}, "outputs": [], "source": [ @@ -1193,7 +1193,7 @@ }, { "cell_type": "markdown", - "id": "d04a9774", + "id": "d98cb47b", "metadata": { "user_expressions": [] }, @@ -1204,7 +1204,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1ca3881c", + "id": "e702ca82", "metadata": {}, "outputs": [], "source": [ @@ -1214,7 +1214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6066f54a", + "id": "39fda1ad", "metadata": {}, "outputs": [], "source": [ @@ -1225,7 +1225,7 @@ }, { "cell_type": "markdown", - "id": "d9329369", + "id": "260b3f1a", "metadata": { "user_expressions": [] }, @@ -1240,7 +1240,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35e8f8c2", + "id": "308e38a6", "metadata": {}, "outputs": [], "source": [ @@ -1251,7 +1251,7 @@ }, { "cell_type": "markdown", - "id": "c980c57d", + "id": "10732b4b", "metadata": {}, "source": [ "The smoothness of the KDE is dependent on how we choose the bandwidth." @@ -1260,7 +1260,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a692ea8a", + "id": "45cfe00a", "metadata": {}, "outputs": [], "source": [ @@ -1274,7 +1274,7 @@ }, { "cell_type": "markdown", - "id": "3d1df5fe", + "id": "36b2774d", "metadata": {}, "source": [ "When we use a larger bandwidth, the KDE is smoother.\n", @@ -1287,7 +1287,7 @@ }, { "cell_type": "markdown", - "id": "8bf4d8ce", + "id": "9a121770", "metadata": { "user_expressions": [] }, @@ -1298,7 +1298,7 @@ { "cell_type": "code", "execution_count": null, - "id": "acfd0497", + "id": "0523c0d0", "metadata": {}, "outputs": [], "source": [ @@ -1309,7 +1309,7 @@ }, { "cell_type": "markdown", - "id": "06b636fe", + "id": "471c9fc8", "metadata": { "user_expressions": [] }, @@ -1322,7 +1322,7 @@ { "cell_type": "code", "execution_count": null, - "id": "da9e2004", + "id": "15f5c09e", "metadata": { "tags": [ "hide-output" @@ -1339,7 +1339,7 @@ { "cell_type": "code", "execution_count": null, - "id": "79a7cf8e", + "id": "cd58bf98", "metadata": {}, "outputs": [], "source": [ @@ -1350,7 +1350,7 @@ }, { "cell_type": "markdown", - "id": "c08787ac", + "id": "550257db", "metadata": { "user_expressions": [] }, @@ -1360,7 +1360,7 @@ }, { "cell_type": "markdown", - "id": "909fdb8e", + "id": "9b2c184f", "metadata": { "user_expressions": [] }, @@ -1381,7 +1381,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6a87c8af", + "id": "b79fa3a1", "metadata": {}, "outputs": [], "source": [ @@ -1394,7 +1394,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22538bed", + "id": "d45f308c", "metadata": {}, "outputs": [], "source": [ @@ -1407,7 +1407,7 @@ }, { "cell_type": "markdown", - "id": "04cc01f0", + "id": "10e51fc0", "metadata": { "user_expressions": [] }, @@ -1419,7 +1419,7 @@ }, { "cell_type": "markdown", - "id": "5dd19feb", + "id": "152ed8c5", "metadata": { "user_expressions": [] }, @@ -1435,7 +1435,7 @@ { "cell_type": "code", "execution_count": null, - "id": "39b391bc", + "id": "5a5c22e3", "metadata": {}, "outputs": [], "source": [ @@ -1452,7 +1452,7 @@ }, { "cell_type": "markdown", - "id": "3d8f1859", + "id": "e07db8cc", "metadata": { "user_expressions": [] }, diff --git a/_sources/pv.ipynb b/_sources/pv.ipynb index 4687e0d6..ca1a4a7c 100644 --- a/_sources/pv.ipynb +++ b/_sources/pv.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "b2f9f520", + "id": "3c77e051", "metadata": {}, "source": [ "# Present Values\n", @@ -86,7 +86,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ea26c255", + "id": "2e7ce587", "metadata": {}, "outputs": [], "source": [ @@ -96,7 +96,7 @@ }, { "cell_type": "markdown", - "id": "1e8bf0a4", + "id": "26e7cd8a", "metadata": {}, "source": [ "## Representing sequences as vectors\n", @@ -135,7 +135,7 @@ }, { "cell_type": "markdown", - "id": "009a45c9", + "id": "bf217686", "metadata": {}, "source": [ "```{exercise-start} \n", @@ -201,7 +201,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b7c53ce1", + "id": "c0dbc3d6", "metadata": {}, "outputs": [], "source": [ @@ -221,7 +221,7 @@ }, { "cell_type": "markdown", - "id": "18474a50", + "id": "ed7a594e", "metadata": {}, "source": [ "Now let's compute and plot the asset price.\n", @@ -232,7 +232,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6313cb3d", + "id": "509186d7", "metadata": {}, "outputs": [], "source": [ @@ -242,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "18c1c551", + "id": "5426da0e", "metadata": {}, "source": [ "Let's build the matrix $A$" @@ -251,7 +251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0fef19ba", + "id": "074d6f89", "metadata": {}, "outputs": [], "source": [ @@ -266,7 +266,7 @@ }, { "cell_type": "markdown", - "id": "d7aec3b8", + "id": "cbcaa8c3", "metadata": {}, "source": [ "Let's inspect $A$" @@ -275,7 +275,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c3b287be", + "id": "e76c9f12", "metadata": {}, "outputs": [], "source": [ @@ -284,7 +284,7 @@ }, { "cell_type": "markdown", - "id": "9c344ff5", + "id": "fac2e0d7", "metadata": {}, "source": [ "Now let's solve for prices using {eq}`eq:apdb_sol`." @@ -293,7 +293,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8b9d888", + "id": "8822eb30", "metadata": {}, "outputs": [], "source": [ @@ -309,7 +309,7 @@ }, { "cell_type": "markdown", - "id": "108dc827", + "id": "85213cbe", "metadata": {}, "source": [ "Now let's consider a cyclically growing dividend sequence:\n", @@ -322,7 +322,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a078d892", + "id": "f91e984f", "metadata": {}, "outputs": [], "source": [ @@ -342,7 +342,7 @@ }, { "cell_type": "markdown", - "id": "195a3bd9", + "id": "8e54bdf4", "metadata": {}, "source": [ "```{exercise-start} \n", @@ -365,7 +365,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9b435fe1", + "id": "4af2efe0", "metadata": {}, "outputs": [], "source": [ @@ -391,7 +391,7 @@ }, { "cell_type": "markdown", - "id": "93d42fdf", + "id": "7a49884e", "metadata": {}, "source": [ "The weighted averaging associated with the present value calculation largely\n", @@ -466,7 +466,7 @@ }, { "cell_type": "markdown", - "id": "dbdaea0f", + "id": "bb44e0cc", "metadata": {}, "source": [ "## More about bubbles\n", @@ -485,7 +485,7 @@ }, { "cell_type": "markdown", - "id": "375c9bfb", + "id": "5316ca77", "metadata": {}, "source": [ "In this case system {eq}`eq:Euler1` of our $T+1$ asset pricing equations takes the\n", diff --git a/_sources/scalar_dynam.ipynb b/_sources/scalar_dynam.ipynb index 640bc5de..f0f395a4 100644 --- a/_sources/scalar_dynam.ipynb +++ b/_sources/scalar_dynam.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "98c82785", + "id": "4863e03f", "metadata": {}, "source": [ "```{raw} html\n", @@ -39,7 +39,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c655c3a5", + "id": "10d51844", "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ }, { "cell_type": "markdown", - "id": "2f152e10", + "id": "99ec1e7a", "metadata": {}, "source": [ "## Some definitions\n", @@ -324,7 +324,7 @@ { "cell_type": "code", "execution_count": null, - "id": "760b0f1b", + "id": "6503abb1", "metadata": { "tags": [ "hide-input", @@ -419,7 +419,7 @@ }, { "cell_type": "markdown", - "id": "38975748", + "id": "b512ead7", "metadata": {}, "source": [ "Let's create a 45 degree diagram for the Solow model with a fixed set of\n", @@ -429,7 +429,7 @@ { "cell_type": "code", "execution_count": null, - "id": "86691a37", + "id": "44fb5fbd", "metadata": {}, "outputs": [], "source": [ @@ -438,7 +438,7 @@ }, { "cell_type": "markdown", - "id": "8bab00f6", + "id": "4a2c2df5", "metadata": {}, "source": [ "Here's the update function corresponding to the model." @@ -447,7 +447,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eac68082", + "id": "216eb5e0", "metadata": {}, "outputs": [], "source": [ @@ -457,7 +457,7 @@ }, { "cell_type": "markdown", - "id": "55f07322", + "id": "3b676985", "metadata": {}, "source": [ "Here is the 45 degree plot." @@ -466,7 +466,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4c3cee90", + "id": "f0fd6304", "metadata": {}, "outputs": [], "source": [ @@ -477,7 +477,7 @@ }, { "cell_type": "markdown", - "id": "478c7112", + "id": "a76d292e", "metadata": {}, "source": [ "The plot shows the function $g$ and the 45 degree line.\n", @@ -517,7 +517,7 @@ { "cell_type": "code", "execution_count": null, - "id": "291a9a74", + "id": "4c01a0d7", "metadata": {}, "outputs": [], "source": [ @@ -528,7 +528,7 @@ }, { "cell_type": "markdown", - "id": "45981f1b", + "id": "9b4252a5", "metadata": {}, "source": [ "We can plot the time series of capital corresponding to the figure above as\n", @@ -538,7 +538,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d152112c", + "id": "fd57e26d", "metadata": {}, "outputs": [], "source": [ @@ -547,7 +547,7 @@ }, { "cell_type": "markdown", - "id": "2e220e0d", + "id": "62f72f7f", "metadata": {}, "source": [ "Here's a somewhat longer view:" @@ -556,7 +556,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a6517391", + "id": "7e494be0", "metadata": {}, "outputs": [], "source": [ @@ -565,7 +565,7 @@ }, { "cell_type": "markdown", - "id": "b28eed6f", + "id": "1fa5f8d9", "metadata": {}, "source": [ "When capital stock is higher than the unique positive steady state, we see that\n", @@ -575,7 +575,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eedd43c4", + "id": "400348e8", "metadata": {}, "outputs": [], "source": [ @@ -586,7 +586,7 @@ }, { "cell_type": "markdown", - "id": "9f29a42d", + "id": "a8d759e2", "metadata": {}, "source": [ "Here is the time series:" @@ -595,7 +595,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b50aa88d", + "id": "7f97d2e1", "metadata": {}, "outputs": [], "source": [ @@ -604,7 +604,7 @@ }, { "cell_type": "markdown", - "id": "eb4fbbbb", + "id": "d1b33714", "metadata": {}, "source": [ "### Complex dynamics\n", @@ -624,7 +624,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7a02c2f5", + "id": "db5c21c9", "metadata": {}, "outputs": [], "source": [ @@ -637,7 +637,7 @@ }, { "cell_type": "markdown", - "id": "82ff0b66", + "id": "4ca4d364", "metadata": {}, "source": [ "Now let's look at a typical trajectory." @@ -646,7 +646,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9d89edee", + "id": "67281620", "metadata": {}, "outputs": [], "source": [ @@ -655,7 +655,7 @@ }, { "cell_type": "markdown", - "id": "b7a21f86", + "id": "59112356", "metadata": {}, "source": [ "Notice how irregular it is.\n", @@ -666,7 +666,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d9040b4f", + "id": "529b02a4", "metadata": {}, "outputs": [], "source": [ @@ -675,7 +675,7 @@ }, { "cell_type": "markdown", - "id": "82ee6aaf", + "id": "9716e639", "metadata": {}, "source": [ "The irregularity is even clearer over a longer time horizon:" @@ -684,7 +684,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9ce6849", + "id": "19434b8b", "metadata": {}, "outputs": [], "source": [ @@ -693,7 +693,7 @@ }, { "cell_type": "markdown", - "id": "358ea1a4", + "id": "47afcd73", "metadata": {}, "source": [ "## Exercises\n", @@ -730,7 +730,7 @@ { "cell_type": "code", "execution_count": null, - "id": "912b053e", + "id": "95eeaf09", "metadata": {}, "outputs": [], "source": [ @@ -741,7 +741,7 @@ }, { "cell_type": "markdown", - "id": "971a06ea", + "id": "c80e49aa", "metadata": {}, "source": [ "Now let's plot a trajectory:" @@ -750,7 +750,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a39f7f99", + "id": "633144dc", "metadata": {}, "outputs": [], "source": [ @@ -760,7 +760,7 @@ }, { "cell_type": "markdown", - "id": "712b94d5", + "id": "ffbf47fa", "metadata": {}, "source": [ "Here is the corresponding time series, which converges towards the steady\n", @@ -770,7 +770,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6168fe00", + "id": "eb7bcc15", "metadata": {}, "outputs": [], "source": [ @@ -779,7 +779,7 @@ }, { "cell_type": "markdown", - "id": "a3a847a5", + "id": "6037920f", "metadata": {}, "source": [ "Now let's try $a=-0.5$ and see what differences we observe.\n", @@ -790,7 +790,7 @@ { "cell_type": "code", "execution_count": null, - "id": "436c58e0", + "id": "a2fd78f6", "metadata": {}, "outputs": [], "source": [ @@ -801,7 +801,7 @@ }, { "cell_type": "markdown", - "id": "80f6f2f2", + "id": "33102e34", "metadata": {}, "source": [ "Now let's plot a trajectory:" @@ -810,7 +810,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6db690e2", + "id": "ff3ce913", "metadata": {}, "outputs": [], "source": [ @@ -820,7 +820,7 @@ }, { "cell_type": "markdown", - "id": "8292f7a5", + "id": "95880b5b", "metadata": {}, "source": [ "Here is the corresponding time series, which converges towards the steady\n", @@ -830,7 +830,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ae9ef07b", + "id": "09df25bc", "metadata": {}, "outputs": [], "source": [ @@ -839,7 +839,7 @@ }, { "cell_type": "markdown", - "id": "abc69888", + "id": "f15002c2", "metadata": {}, "source": [ "Once again, we have convergence to the steady state but the nature of\n", diff --git a/_sources/schelling.ipynb b/_sources/schelling.ipynb index 84ad1fb6..4a6c2b7e 100644 --- a/_sources/schelling.ipynb +++ b/_sources/schelling.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "04d1d3b5", + "id": "82da565a", "metadata": {}, "source": [ "(schelling)=\n", @@ -69,7 +69,7 @@ { "cell_type": "code", "execution_count": null, - "id": "52c0ec20", + "id": "723419d6", "metadata": {}, "outputs": [], "source": [ @@ -82,7 +82,7 @@ }, { "cell_type": "markdown", - "id": "4f80a3e3", + "id": "fe9361bd", "metadata": {}, "source": [ "## The model\n", @@ -110,7 +110,7 @@ }, { "cell_type": "markdown", - "id": "b015412d", + "id": "74d2d352", "metadata": {}, "source": [ "### Preferences\n", @@ -133,7 +133,7 @@ }, { "cell_type": "markdown", - "id": "6151058c", + "id": "dc2190fe", "metadata": {}, "source": [ "### Behavior\n", @@ -169,7 +169,7 @@ }, { "cell_type": "markdown", - "id": "f01d9953", + "id": "9e75bf31", "metadata": {}, "source": [ "## Results\n", @@ -199,7 +199,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7318134c", + "id": "87a3cf09", "metadata": {}, "outputs": [], "source": [ @@ -254,7 +254,7 @@ }, { "cell_type": "markdown", - "id": "ab04b007", + "id": "0c7b16b5", "metadata": {}, "source": [ "Here's some code that takes a list of agents and produces a plot showing their\n", @@ -267,7 +267,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e3ae9bd5", + "id": "0b660b28", "metadata": {}, "outputs": [], "source": [ @@ -297,7 +297,7 @@ }, { "cell_type": "markdown", - "id": "7e60f0d3", + "id": "1fcec858", "metadata": {}, "source": [ "And here's some pseudocode for the main loop, where we cycle through the\n", @@ -319,7 +319,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0a7fd211", + "id": "bfdc7872", "metadata": {}, "outputs": [], "source": [ @@ -366,7 +366,7 @@ }, { "cell_type": "markdown", - "id": "566aaeeb", + "id": "fed88ae7", "metadata": {}, "source": [ "Let's have a look at the results." @@ -375,7 +375,7 @@ { "cell_type": "code", "execution_count": null, - "id": "acf13428", + "id": "1cd75352", "metadata": {}, "outputs": [], "source": [ @@ -384,7 +384,7 @@ }, { "cell_type": "markdown", - "id": "a54fa531", + "id": "00eb7386", "metadata": {}, "source": [ "As discussed above, agents are initially mixed randomly together.\n", @@ -444,7 +444,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37870c4a", + "id": "9c8fa002", "metadata": {}, "outputs": [], "source": [ @@ -551,7 +551,7 @@ }, { "cell_type": "markdown", - "id": "d7b5353a", + "id": "c8e5ba83", "metadata": {}, "source": [ "```{solution-end}\n", @@ -560,7 +560,7 @@ }, { "cell_type": "markdown", - "id": "fee50c91", + "id": "e705e2f0", "metadata": {}, "source": [ "When we run this we again find that mixed neighborhoods break down and segregation emerges.\n", @@ -571,7 +571,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5afd6147", + "id": "013a0ce0", "metadata": {}, "outputs": [], "source": [ @@ -581,7 +581,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dbc4c63e", + "id": "1afa324e", "metadata": {}, "outputs": [], "source": [] diff --git a/_sources/short_path.ipynb b/_sources/short_path.ipynb index e5e02e1a..25b71ccc 100644 --- a/_sources/short_path.ipynb +++ b/_sources/short_path.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "f64ced3a", + "id": "c04ae3a7", "metadata": {}, "source": [ "(short_path)=\n", @@ -50,7 +50,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7de83128", + "id": "bd12bc6a", "metadata": {}, "outputs": [], "source": [ @@ -59,7 +59,7 @@ }, { "cell_type": "markdown", - "id": "7d20f7cc", + "id": "4142b759", "metadata": {}, "source": [ "## Outline of the problem\n", @@ -213,7 +213,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f5e7f2c5", + "id": "90f079a2", "metadata": {}, "outputs": [], "source": [ @@ -230,7 +230,7 @@ }, { "cell_type": "markdown", - "id": "4cf2f524", + "id": "67a330ca", "metadata": {}, "source": [ "Notice that the cost of staying still (on the principle diagonal) is set to\n", @@ -246,7 +246,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fa85b84a", + "id": "8710d057", "metadata": {}, "outputs": [], "source": [ @@ -277,7 +277,7 @@ }, { "cell_type": "markdown", - "id": "5753448f", + "id": "b1f7be4d", "metadata": {}, "source": [ "This matches with the numbers we obtained by inspection above.\n", @@ -314,7 +314,7 @@ { "cell_type": "code", "execution_count": null, - "id": "357b5692", + "id": "25ec3745", "metadata": {}, "outputs": [], "source": [ @@ -423,7 +423,7 @@ }, { "cell_type": "markdown", - "id": "cf3de60d", + "id": "44dfe7c4", "metadata": {}, "source": [ "```{exercise-end}\n", @@ -439,7 +439,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d53d468e", + "id": "e7d199c4", "metadata": {}, "outputs": [], "source": [ @@ -468,7 +468,7 @@ }, { "cell_type": "markdown", - "id": "96fff9c2", + "id": "6a7aabad", "metadata": {}, "source": [ "In addition, let's write\n", @@ -484,7 +484,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1f7693b0", + "id": "afa8ef47", "metadata": {}, "outputs": [], "source": [ @@ -515,7 +515,7 @@ }, { "cell_type": "markdown", - "id": "475e5fbb", + "id": "dd49a112", "metadata": {}, "source": [ "We used np.allclose() rather than testing exact equality because we are\n", @@ -528,7 +528,7 @@ { "cell_type": "code", "execution_count": null, - "id": "eba0ba5f", + "id": "7bf968e1", "metadata": {}, "outputs": [], "source": [ @@ -548,7 +548,7 @@ }, { "cell_type": "markdown", - "id": "c1b0c9ae", + "id": "b801d4a2", "metadata": {}, "source": [ "Okay, now we have the necessary functions, let's call them to do the job we were assigned." @@ -557,7 +557,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d3d4b83a", + "id": "222c384a", "metadata": {}, "outputs": [], "source": [ @@ -568,7 +568,7 @@ }, { "cell_type": "markdown", - "id": "efbeec74", + "id": "36279e32", "metadata": {}, "source": [ "The total cost of the path should agree with $J[0]$ so let's check this." @@ -577,7 +577,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8c7fcc6e", + "id": "25854a41", "metadata": {}, "outputs": [], "source": [ @@ -586,7 +586,7 @@ }, { "cell_type": "markdown", - "id": "2edc1b84", + "id": "4e627d15", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/simple_linear_regression.ipynb b/_sources/simple_linear_regression.ipynb index 0dd9f462..9c52fefd 100644 --- a/_sources/simple_linear_regression.ipynb +++ b/_sources/simple_linear_regression.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "7946bc29", + "id": "e88f5a8a", "metadata": {}, "source": [ "# Simple Linear Regression Model" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "be15a669", + "id": "26441796", "metadata": {}, "outputs": [], "source": [ @@ -22,7 +22,7 @@ }, { "cell_type": "markdown", - "id": "bce4c5c5", + "id": "2e6bd615", "metadata": {}, "source": [ "The simple regression model estimates the relationship between two variables $x_i$ and $y_i$\n", @@ -56,7 +56,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7e04590f", + "id": "bb4cf314", "metadata": {}, "outputs": [], "source": [ @@ -69,7 +69,7 @@ }, { "cell_type": "markdown", - "id": "3bcc70cb", + "id": "efaa7369", "metadata": {}, "source": [ "We can use a scatter plot of the data to see the relationship between $y_i$ (ice-cream sales in dollars (\\$\\'s)) and $x_i$ (degrees Celsius)." @@ -78,7 +78,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d59d850b", + "id": "166ecf3e", "metadata": { "mystnb": { "figure": { @@ -100,7 +100,7 @@ }, { "cell_type": "markdown", - "id": "b387491f", + "id": "c23edbaf", "metadata": {}, "source": [ "as you can see the data suggests that more ice-cream is typically sold on hotter days. \n", @@ -117,7 +117,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17fb581f", + "id": "79d1b045", "metadata": {}, "outputs": [], "source": [ @@ -129,7 +129,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dfc47874", + "id": "95f9c1f3", "metadata": { "mystnb": { "figure": { @@ -148,7 +148,7 @@ }, { "cell_type": "markdown", - "id": "eea1ccf8", + "id": "939f3187", "metadata": {}, "source": [ "We can see that this model does a poor job of estimating the relationship.\n", @@ -159,7 +159,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8906e161", + "id": "8ba71f72", "metadata": {}, "outputs": [], "source": [ @@ -170,7 +170,7 @@ { "cell_type": "code", "execution_count": null, - "id": "66399005", + "id": "c03459d6", "metadata": { "mystnb": { "figure": { @@ -190,7 +190,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36967c18", + "id": "dd0cfb1e", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ee05947c", + "id": "4b35b9aa", "metadata": { "mystnb": { "figure": { @@ -220,7 +220,7 @@ }, { "cell_type": "markdown", - "id": "1f88955a", + "id": "c58aaff1", "metadata": {}, "source": [ "However we need to think about formalizing this guessing process by thinking of this problem as an optimization problem. \n", @@ -238,7 +238,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c9f5ada4", + "id": "4308683b", "metadata": {}, "outputs": [], "source": [ @@ -248,7 +248,7 @@ { "cell_type": "code", "execution_count": null, - "id": "11edd3de", + "id": "94a81f42", "metadata": {}, "outputs": [], "source": [ @@ -258,7 +258,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6868d026", + "id": "b3ddb50c", "metadata": { "mystnb": { "figure": { @@ -278,7 +278,7 @@ }, { "cell_type": "markdown", - "id": "f44001b9", + "id": "0f8f954e", "metadata": {}, "source": [ "The Ordinary Least Squares (OLS) method chooses $\\alpha$ and $\\beta$ in such a way that **minimizes** the sum of the squared residuals (SSR). \n", @@ -305,7 +305,7 @@ { "cell_type": "code", "execution_count": null, - "id": "610aaf0a", + "id": "ca6bfee4", "metadata": {}, "outputs": [], "source": [ @@ -315,7 +315,7 @@ }, { "cell_type": "markdown", - "id": "b8d5b299", + "id": "6dffacac", "metadata": {}, "source": [ "We can then calculate the error for a range of $\\beta$ values" @@ -324,7 +324,7 @@ { "cell_type": "code", "execution_count": null, - "id": "565e4ace", + "id": "89601aef", "metadata": {}, "outputs": [], "source": [ @@ -335,7 +335,7 @@ }, { "cell_type": "markdown", - "id": "f909ddba", + "id": "86052419", "metadata": {}, "source": [ "Plotting the error" @@ -344,7 +344,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5dce324d", + "id": "dacecbf2", "metadata": { "mystnb": { "figure": { @@ -361,7 +361,7 @@ }, { "cell_type": "markdown", - "id": "6627d4c9", + "id": "e0d5fb06", "metadata": {}, "source": [ "Now let us vary $\\alpha$ (holding $\\beta$ constant)" @@ -370,7 +370,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f48c5388", + "id": "faa4eb73", "metadata": {}, "outputs": [], "source": [ @@ -381,7 +381,7 @@ }, { "cell_type": "markdown", - "id": "9bb01acb", + "id": "c06dbd32", "metadata": {}, "source": [ "Plotting the error" @@ -390,7 +390,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1ff272b7", + "id": "ddbef48f", "metadata": { "mystnb": { "figure": { @@ -407,7 +407,7 @@ }, { "cell_type": "markdown", - "id": "3775d008", + "id": "407dca98", "metadata": {}, "source": [ "(slr:optimal-values)=\n", @@ -513,7 +513,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73d1e98d", + "id": "7eda75ad", "metadata": {}, "outputs": [], "source": [ @@ -526,7 +526,7 @@ }, { "cell_type": "markdown", - "id": "8764190e", + "id": "cfd07053", "metadata": {}, "source": [ "Now computing across the 10 observations and then summing the numerator and denominator" @@ -535,7 +535,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d72dc76f", + "id": "2bb54770", "metadata": {}, "outputs": [], "source": [ @@ -548,7 +548,7 @@ }, { "cell_type": "markdown", - "id": "466d0883", + "id": "4062bc92", "metadata": {}, "source": [ "Calculating $\\alpha$" @@ -557,7 +557,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9915190e", + "id": "bdfb2f22", "metadata": {}, "outputs": [], "source": [ @@ -567,7 +567,7 @@ }, { "cell_type": "markdown", - "id": "324b2724", + "id": "8ca3fee3", "metadata": {}, "source": [ "Now we can plot the OLS solution" @@ -576,7 +576,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2388223c", + "id": "6a3e50c8", "metadata": { "mystnb": { "figure": { @@ -598,7 +598,7 @@ }, { "cell_type": "markdown", - "id": "b9e73820", + "id": "a39ae84b", "metadata": {}, "source": [ ":::{exercise}\n", @@ -634,7 +634,7 @@ { "cell_type": "code", "execution_count": null, - "id": "792ea27c", + "id": "08c0f893", "metadata": {}, "outputs": [], "source": [ @@ -645,7 +645,7 @@ { "cell_type": "code", "execution_count": null, - "id": "26dbc282", + "id": "dbb33aba", "metadata": {}, "outputs": [], "source": [ @@ -654,7 +654,7 @@ }, { "cell_type": "markdown", - "id": "18548f6c", + "id": "9644f990", "metadata": {}, "source": [ "You can see that the data downloaded from Our World in Data has provided a global set of countries with the GDP per capita and Life Expectancy Data.\n", @@ -669,7 +669,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01e9090e", + "id": "d038a5a7", "metadata": {}, "outputs": [], "source": [ @@ -680,7 +680,7 @@ }, { "cell_type": "markdown", - "id": "c1bcdabe", + "id": "73ad9e67", "metadata": {}, "source": [ "Sometimes it can be useful to rename your columns to make it easier to work with in the DataFrame" @@ -689,7 +689,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9c20c689", + "id": "d1ff7946", "metadata": {}, "outputs": [], "source": [ @@ -699,7 +699,7 @@ }, { "cell_type": "markdown", - "id": "ec824801", + "id": "aba130b0", "metadata": {}, "source": [ "We can see there are `NaN` values which represents missing data so let us go ahead and drop those" @@ -708,7 +708,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4dbb624a", + "id": "6dbc5433", "metadata": {}, "outputs": [], "source": [ @@ -718,7 +718,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d1456869", + "id": "565caba1", "metadata": {}, "outputs": [], "source": [ @@ -727,7 +727,7 @@ }, { "cell_type": "markdown", - "id": "756817fb", + "id": "559fb847", "metadata": {}, "source": [ "We have now dropped the number of rows in our DataFrame from 62156 to 12445 removing a lot of empty data relationships.\n", @@ -744,7 +744,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3e107863", + "id": "9cb43d73", "metadata": {}, "outputs": [], "source": [ @@ -754,7 +754,7 @@ }, { "cell_type": "markdown", - "id": "b94d3e1b", + "id": "b079e547", "metadata": {}, "source": [ "As you can see there are a lot of countries where data is not available for the Year 1543!\n", @@ -765,7 +765,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e3d9c151", + "id": "cfe09ec0", "metadata": {}, "outputs": [], "source": [ @@ -774,7 +774,7 @@ }, { "cell_type": "markdown", - "id": "3e30e085", + "id": "92ce7c1c", "metadata": {}, "source": [ "You can see that Great Britain (GBR) is the only one available\n", @@ -785,7 +785,7 @@ { "cell_type": "code", "execution_count": null, - "id": "17eb5996", + "id": "c3c38cff", "metadata": {}, "outputs": [], "source": [ @@ -794,7 +794,7 @@ }, { "cell_type": "markdown", - "id": "2a9e2523", + "id": "7b5a06ee", "metadata": {}, "source": [ "In fact we can use pandas to quickly check how many countries are captured in each year" @@ -803,7 +803,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4770ced8", + "id": "c1d74aab", "metadata": {}, "outputs": [], "source": [ @@ -812,7 +812,7 @@ }, { "cell_type": "markdown", - "id": "7de43314", + "id": "682f30df", "metadata": {}, "source": [ "So it is clear that if you are doing cross-sectional comparisons then more recent data will include a wider set of countries\n", @@ -823,7 +823,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2da70c69", + "id": "3cb4ccef", "metadata": {}, "outputs": [], "source": [ @@ -833,7 +833,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3e4259fb", + "id": "2be260a8", "metadata": {}, "outputs": [], "source": [ @@ -842,7 +842,7 @@ }, { "cell_type": "markdown", - "id": "cd203e8e", + "id": "35c31699", "metadata": {}, "source": [ "This data shows a couple of interesting relationships.\n", @@ -858,7 +858,7 @@ { "cell_type": "code", "execution_count": null, - "id": "958b9a56", + "id": "ed929bd6", "metadata": {}, "outputs": [], "source": [ @@ -867,7 +867,7 @@ }, { "cell_type": "markdown", - "id": "ab8f6942", + "id": "0457ee52", "metadata": {}, "source": [ "As you can see from this transformation -- a linear model fits the shape of the data more closely." @@ -876,7 +876,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b049fdfc", + "id": "d72882d0", "metadata": {}, "outputs": [], "source": [ @@ -886,7 +886,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c9b717ea", + "id": "4da1df18", "metadata": {}, "outputs": [], "source": [ @@ -895,7 +895,7 @@ }, { "cell_type": "markdown", - "id": "b18964f6", + "id": "93b129e3", "metadata": {}, "source": [ "**Q4:** Use {eq}`eq:optimal-alpha` and {eq}`eq:optimal-beta` to compute optimal values for $\\alpha$ and $\\beta$" @@ -904,7 +904,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cf40cfd7", + "id": "316b1507", "metadata": {}, "outputs": [], "source": [ @@ -918,7 +918,7 @@ { "cell_type": "code", "execution_count": null, - "id": "02123323", + "id": "16a1b025", "metadata": {}, "outputs": [], "source": [ @@ -928,7 +928,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e7b79ab2", + "id": "18556059", "metadata": {}, "outputs": [], "source": [ @@ -942,7 +942,7 @@ { "cell_type": "code", "execution_count": null, - "id": "66b75276", + "id": "9e23924a", "metadata": {}, "outputs": [], "source": [ @@ -952,7 +952,7 @@ }, { "cell_type": "markdown", - "id": "119c1943", + "id": "40724aed", "metadata": {}, "source": [ "**Q5:** Plot the line of best fit found using OLS" @@ -961,7 +961,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4ead77ca", + "id": "19f93114", "metadata": {}, "outputs": [], "source": [ @@ -976,7 +976,7 @@ }, { "cell_type": "markdown", - "id": "18a592b6", + "id": "f5c8bba5", "metadata": {}, "source": [ ":::{solution-end}\n", diff --git a/_sources/solow.ipynb b/_sources/solow.ipynb index 82fd46fc..ac963c7e 100644 --- a/_sources/solow.ipynb +++ b/_sources/solow.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "cdb67126", + "id": "54931b06", "metadata": {}, "source": [ "(solow)=\n", @@ -22,7 +22,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e0331e41", + "id": "d3cda540", "metadata": {}, "outputs": [], "source": [ @@ -32,7 +32,7 @@ }, { "cell_type": "markdown", - "id": "dc506980", + "id": "0978fcd2", "metadata": {}, "source": [ "## The model\n", @@ -127,7 +127,7 @@ { "cell_type": "code", "execution_count": null, - "id": "05afd41c", + "id": "1c524dcc", "metadata": {}, "outputs": [], "source": [ @@ -138,7 +138,7 @@ }, { "cell_type": "markdown", - "id": "4eeeb404", + "id": "11a91c14", "metadata": {}, "source": [ "Now, we define the function $g$." @@ -147,7 +147,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f9b44ebb", + "id": "7abe30c1", "metadata": {}, "outputs": [], "source": [ @@ -157,7 +157,7 @@ }, { "cell_type": "markdown", - "id": "c8209b0d", + "id": "9d410644", "metadata": {}, "source": [ "Let's plot the 45 degree diagram of $g$." @@ -166,7 +166,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fdac4e21", + "id": "cbc1b0bd", "metadata": {}, "outputs": [], "source": [ @@ -213,7 +213,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37f74904", + "id": "00b7bdc1", "metadata": {}, "outputs": [], "source": [ @@ -222,7 +222,7 @@ }, { "cell_type": "markdown", - "id": "4836f1ff", + "id": "6fa31774", "metadata": {}, "source": [ "Suppose, at some $k_t$, the value $g(k_t)$ lies strictly above the 45 degree line.\n", @@ -254,7 +254,7 @@ { "cell_type": "code", "execution_count": null, - "id": "78a4c337", + "id": "b5c1aa3c", "metadata": {}, "outputs": [], "source": [ @@ -264,7 +264,7 @@ }, { "cell_type": "markdown", - "id": "af770176", + "id": "8ea51855", "metadata": {}, "source": [ "From our graphical analysis, it appears that $(k_t)$ converges to $k^*$, regardless of initial capital\n", @@ -284,7 +284,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4cab528c", + "id": "dd4a3ef3", "metadata": {}, "outputs": [], "source": [ @@ -299,7 +299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d43bff5b", + "id": "68cf0219", "metadata": {}, "outputs": [], "source": [ @@ -332,7 +332,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad047052", + "id": "513b013a", "metadata": {}, "outputs": [], "source": [ @@ -341,7 +341,7 @@ }, { "cell_type": "markdown", - "id": "a796e457", + "id": "e9d88d0e", "metadata": {}, "source": [ "As expected, the time paths in the figure all converge to $k^*$.\n", @@ -406,7 +406,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b0a81c39", + "id": "3bf3677f", "metadata": {}, "outputs": [], "source": [ @@ -415,7 +415,7 @@ }, { "cell_type": "markdown", - "id": "7d13a7c1", + "id": "23db6348", "metadata": {}, "source": [ "Next we define the function $g$ for growth in continuous time" @@ -424,7 +424,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5e2cd32", + "id": "ee2e6d0d", "metadata": {}, "outputs": [], "source": [ @@ -435,7 +435,7 @@ { "cell_type": "code", "execution_count": null, - "id": "27aa2ce0", + "id": "478cc29f", "metadata": {}, "outputs": [], "source": [ @@ -475,7 +475,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4ed3f472", + "id": "d2cf11e3", "metadata": {}, "outputs": [], "source": [ @@ -485,7 +485,7 @@ }, { "cell_type": "markdown", - "id": "22b2b889", + "id": "99127101", "metadata": {}, "source": [ "This shows global stability heuristically for a fixed parameterization, but\n", @@ -572,7 +572,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a6470821", + "id": "8c221bd9", "metadata": {}, "outputs": [], "source": [ @@ -584,7 +584,7 @@ { "cell_type": "code", "execution_count": null, - "id": "de38dc69", + "id": "36361df7", "metadata": {}, "outputs": [], "source": [ @@ -595,7 +595,7 @@ }, { "cell_type": "markdown", - "id": "e8df5f38", + "id": "88db9409", "metadata": {}, "source": [ "Let's find the value of $s$ that maximizes $c^*$ using [scipy.optimize.minimize_scalar](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize_scalar.html#scipy.optimize.minimize_scalar).\n", @@ -605,7 +605,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1e22f9fb", + "id": "10658590", "metadata": {}, "outputs": [], "source": [ @@ -615,7 +615,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28c95079", + "id": "62e651fc", "metadata": {}, "outputs": [], "source": [ @@ -627,7 +627,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ded64f57", + "id": "26cff9ec", "metadata": {}, "outputs": [], "source": [ @@ -640,7 +640,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a9d0ca96", + "id": "c83dc521", "metadata": {}, "outputs": [], "source": [ @@ -672,7 +672,7 @@ }, { "cell_type": "markdown", - "id": "5cd50072", + "id": "d2ebe272", "metadata": {}, "source": [ "One can also try to solve this mathematically by differentiating $c^*(s)$ and solve for $\\frac{d}{ds}c^*(s)=0$ using [sympy](https://www.sympy.org/en/index.html)." @@ -681,7 +681,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f26f15be", + "id": "d98d2d23", "metadata": {}, "outputs": [], "source": [ @@ -691,7 +691,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bab13ba8", + "id": "76a16bfd", "metadata": {}, "outputs": [], "source": [ @@ -702,7 +702,7 @@ }, { "cell_type": "markdown", - "id": "057a5355", + "id": "20112577", "metadata": {}, "source": [ "Let's differentiate $c$ and solve using [sympy.solve](https://docs.sympy.org/latest/modules/solvers/solvers.html#sympy.solvers.solvers.solve)" @@ -711,7 +711,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e3a32665", + "id": "aec0265f", "metadata": {}, "outputs": [], "source": [ @@ -722,7 +722,7 @@ }, { "cell_type": "markdown", - "id": "a739a3f9", + "id": "5a464e31", "metadata": {}, "source": [ "Incidentally, the rate of savings which maximizes steady state level of per capita consumption is called the [Golden Rule savings rate](https://en.wikipedia.org/wiki/Golden_Rule_savings_rate).\n", @@ -776,7 +776,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8677198a", + "id": "ce2a4503", "metadata": {}, "outputs": [], "source": [ @@ -792,7 +792,7 @@ }, { "cell_type": "markdown", - "id": "5b00c6c4", + "id": "4655981b", "metadata": {}, "source": [ "Let's define the function *k_next* to find the next value of $k$" @@ -801,7 +801,7 @@ { "cell_type": "code", "execution_count": null, - "id": "249b50f4", + "id": "6a9eac8f", "metadata": {}, "outputs": [], "source": [ @@ -815,7 +815,7 @@ { "cell_type": "code", "execution_count": null, - "id": "31256e91", + "id": "bb7a0336", "metadata": {}, "outputs": [], "source": [ @@ -843,7 +843,7 @@ { "cell_type": "code", "execution_count": null, - "id": "501122f5", + "id": "5e4c9594", "metadata": {}, "outputs": [], "source": [ @@ -852,7 +852,7 @@ }, { "cell_type": "markdown", - "id": "454a9dc5", + "id": "3bb2aec5", "metadata": {}, "source": [ "```{solution-end}\n", diff --git a/_sources/status.ipynb b/_sources/status.ipynb index db95b209..c79890b8 100644 --- a/_sources/status.ipynb +++ b/_sources/status.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "25cc9899", + "id": "996398dd", "metadata": {}, "source": [ "# Execution Statistics\n", @@ -22,7 +22,7 @@ { "cell_type": "code", "execution_count": null, - "id": "428ad444", + "id": "ae147206", "metadata": {}, "outputs": [], "source": [ @@ -31,7 +31,7 @@ }, { "cell_type": "markdown", - "id": "c5fb346f", + "id": "8574af47", "metadata": {}, "source": [ "and the following package versions" @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": null, - "id": "93cfb92e", + "id": "1f62683e", "metadata": { "tags": [ "hide-output" diff --git a/_sources/supply_demand_heterogeneity.ipynb b/_sources/supply_demand_heterogeneity.ipynb index 4350aeb9..52db0d86 100644 --- a/_sources/supply_demand_heterogeneity.ipynb +++ b/_sources/supply_demand_heterogeneity.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "70941872", + "id": "c22bc5ba", "metadata": {}, "source": [ "(supply_demand_heterogeneity)=\n", @@ -29,7 +29,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5316ef4b", + "id": "d3ac0445", "metadata": {}, "outputs": [], "source": [ @@ -39,7 +39,7 @@ }, { "cell_type": "markdown", - "id": "6ca48cee", + "id": "84bc6f90", "metadata": {}, "source": [ "## An simple example\n", @@ -175,7 +175,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ba41f2b7", + "id": "37689ce9", "metadata": {}, "outputs": [], "source": [ @@ -249,7 +249,7 @@ }, { "cell_type": "markdown", - "id": "3ec3588f", + "id": "d3d01d8f", "metadata": {}, "source": [ "## Implementation\n", @@ -268,7 +268,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dbedb0c6", + "id": "a085f4d1", "metadata": {}, "outputs": [], "source": [ @@ -290,7 +290,7 @@ }, { "cell_type": "markdown", - "id": "cd3bc3bb", + "id": "382afa6c", "metadata": {}, "source": [ "What happens if the first consumer likes the first good more and the second consumer likes the second good more?" @@ -299,7 +299,7 @@ { "cell_type": "code", "execution_count": null, - "id": "245ad95e", + "id": "85f1c99f", "metadata": {}, "outputs": [], "source": [ @@ -314,7 +314,7 @@ }, { "cell_type": "markdown", - "id": "4229bcef", + "id": "1d028c0b", "metadata": {}, "source": [ "Let the first consumer be poorer." @@ -323,7 +323,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0e920a66", + "id": "064f4c03", "metadata": {}, "outputs": [], "source": [ @@ -338,7 +338,7 @@ }, { "cell_type": "markdown", - "id": "70101c5e", + "id": "349442aa", "metadata": {}, "source": [ "Now let's construct an autarky (i.e., no-trade) equilibrium." @@ -347,7 +347,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c13d596a", + "id": "a0b2bf06", "metadata": {}, "outputs": [], "source": [ @@ -365,7 +365,7 @@ }, { "cell_type": "markdown", - "id": "2fd3c2b3", + "id": "9a1bb8e0", "metadata": {}, "source": [ "Now let's redistribute endowments before trade." @@ -374,7 +374,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a1b45b15", + "id": "08d494dc", "metadata": {}, "outputs": [], "source": [ @@ -394,7 +394,7 @@ }, { "cell_type": "markdown", - "id": "b88bacdf", + "id": "aa6115a2", "metadata": {}, "source": [ "### A dynamic economy\n", @@ -405,7 +405,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47fd21ac", + "id": "caf1a25d", "metadata": {}, "outputs": [], "source": [ @@ -427,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "64a11686", + "id": "0885acc3", "metadata": {}, "source": [ "### Risk economy with arrow securities\n", @@ -438,7 +438,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7c132d4d", + "id": "3f1328d5", "metadata": {}, "outputs": [], "source": [ @@ -462,7 +462,7 @@ }, { "cell_type": "markdown", - "id": "0e43dbee", + "id": "119e7bdc", "metadata": {}, "source": [ "## Deducing a representative consumer\n", diff --git a/_sources/supply_demand_multiple_goods.ipynb b/_sources/supply_demand_multiple_goods.ipynb index 7aed26c2..d5e41ff3 100644 --- a/_sources/supply_demand_multiple_goods.ipynb +++ b/_sources/supply_demand_multiple_goods.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "4925d416", + "id": "56594e98", "metadata": {}, "source": [ "(supply_demand_multiple_goods)=\n", @@ -53,7 +53,7 @@ { "cell_type": "code", "execution_count": null, - "id": "421abf8c", + "id": "e792e231", "metadata": {}, "outputs": [], "source": [ @@ -65,7 +65,7 @@ }, { "cell_type": "markdown", - "id": "c0b2e533", + "id": "02034b85", "metadata": {}, "source": [ "## Formulas from linear algebra\n", @@ -101,7 +101,7 @@ }, { "cell_type": "markdown", - "id": "7d80e401", + "id": "1515221f", "metadata": {}, "source": [ "We will analyze endogenous objects $c$ and $p$, where\n", @@ -112,7 +112,7 @@ }, { "cell_type": "markdown", - "id": "0556577f", + "id": "8c94e0dd", "metadata": {}, "source": [ "The matrix $\\Pi$ describes a consumer's willingness to substitute one good for every other good.\n", @@ -152,7 +152,7 @@ }, { "cell_type": "markdown", - "id": "e02d8a9f", + "id": "4d298037", "metadata": {}, "source": [ "### Demand curve implied by constrained utility maximization\n", @@ -245,7 +245,7 @@ { "cell_type": "code", "execution_count": null, - "id": "628c960c", + "id": "44083b52", "metadata": {}, "outputs": [], "source": [ @@ -297,7 +297,7 @@ }, { "cell_type": "markdown", - "id": "6a4479d6", + "id": "e0331c66", "metadata": {}, "source": [ "## Digression: Marshallian and Hicksian demand curves\n", @@ -336,7 +336,7 @@ }, { "cell_type": "markdown", - "id": "3c4d43d5", + "id": "c0a9e7f7", "metadata": {}, "source": [ "## Dynamics and risk as special cases\n", @@ -402,7 +402,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5a976997", + "id": "3c31e167", "metadata": {}, "outputs": [], "source": [ @@ -424,7 +424,7 @@ }, { "cell_type": "markdown", - "id": "c61b7a8f", + "id": "47118040", "metadata": {}, "source": [ "### Risk and state-contingent claims\n", @@ -466,7 +466,7 @@ }, { "cell_type": "markdown", - "id": "34e59b23", + "id": "82d94b8a", "metadata": {}, "source": [ "$$\n", @@ -496,7 +496,7 @@ }, { "cell_type": "markdown", - "id": "1185fc32", + "id": "4e9eb092", "metadata": {}, "source": [ "We use the tricks described above to interpret $c_1, c_2$ as \"Arrow securities\" that are state-contingent claims to consumption goods." @@ -504,7 +504,7 @@ }, { "cell_type": "markdown", - "id": "d9109a86", + "id": "1ed62d6b", "metadata": {}, "source": [ "Here is an instance of the risk economy:" @@ -513,7 +513,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0005119a", + "id": "58042877", "metadata": {}, "outputs": [], "source": [ @@ -535,7 +535,7 @@ }, { "cell_type": "markdown", - "id": "449ccc44", + "id": "f9595489", "metadata": {}, "source": [ "```{exercise}\n", @@ -556,7 +556,7 @@ }, { "cell_type": "markdown", - "id": "facd6359", + "id": "d2ea0c3f", "metadata": {}, "source": [ "```{solution-start} sdm_ex3\n", @@ -571,7 +571,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bdd1cc3a", + "id": "85c23c15", "metadata": {}, "outputs": [], "source": [ @@ -585,7 +585,7 @@ }, { "cell_type": "markdown", - "id": "6b118d65", + "id": "fcc44908", "metadata": {}, "source": [ "If the consumer likes the first (or second) good more, then we can set a larger bliss value for good 1." @@ -594,7 +594,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2e1822e2", + "id": "76fe2fd5", "metadata": {}, "outputs": [], "source": [ @@ -607,7 +607,7 @@ }, { "cell_type": "markdown", - "id": "8eed5fd3", + "id": "3234063c", "metadata": {}, "source": [ "Increase the probability that state $1$ occurs." @@ -616,7 +616,7 @@ { "cell_type": "code", "execution_count": null, - "id": "752400d5", + "id": "407e6192", "metadata": {}, "outputs": [], "source": [ @@ -638,7 +638,7 @@ }, { "cell_type": "markdown", - "id": "e094c7c2", + "id": "8a99c210", "metadata": {}, "source": [ "```{solution-end}\n", @@ -647,7 +647,7 @@ }, { "cell_type": "markdown", - "id": "309f87e9", + "id": "3de0329e", "metadata": {}, "source": [ "## Economies with endogenous supplies of goods\n", @@ -752,7 +752,7 @@ }, { "cell_type": "markdown", - "id": "82da25bc", + "id": "2da04c45", "metadata": {}, "source": [ "### Implementation\n", @@ -773,7 +773,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8c86352f", + "id": "92c0d27e", "metadata": {}, "outputs": [], "source": [ @@ -842,7 +842,7 @@ }, { "cell_type": "markdown", - "id": "d9d725fd", + "id": "30f3c31f", "metadata": {}, "source": [ "Then define a function that plots demand and supply curves and labels surpluses and equilibrium." @@ -851,7 +851,7 @@ { "cell_type": "code", "execution_count": null, - "id": "35c5912b", + "id": "eb743fa4", "metadata": { "tags": [ "hide-input" @@ -906,7 +906,7 @@ }, { "cell_type": "markdown", - "id": "9856d96a", + "id": "ef129723", "metadata": {}, "source": [ "#### Example: single agent with one good and production\n", @@ -927,7 +927,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f1e0c8b9", + "id": "e7a454d0", "metadata": {}, "outputs": [], "source": [ @@ -950,7 +950,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b9d28573", + "id": "b8b3ed38", "metadata": {}, "outputs": [], "source": [ @@ -962,7 +962,7 @@ }, { "cell_type": "markdown", - "id": "af67868b", + "id": "a3afca4e", "metadata": {}, "source": [ "Let's give the consumer a lower welfare weight by raising $\\mu$." @@ -971,7 +971,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f08da8b", + "id": "858734ac", "metadata": {}, "outputs": [], "source": [ @@ -988,7 +988,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6a8da6b5", + "id": "44f89dde", "metadata": {}, "outputs": [], "source": [ @@ -1000,7 +1000,7 @@ }, { "cell_type": "markdown", - "id": "8903dbd9", + "id": "7ce66c33", "metadata": {}, "source": [ "Now we change the bliss point so that the consumer derives more utility from consumption." @@ -1009,7 +1009,7 @@ { "cell_type": "code", "execution_count": null, - "id": "990a1e7a", + "id": "d00ce847", "metadata": {}, "outputs": [], "source": [ @@ -1026,7 +1026,7 @@ }, { "cell_type": "markdown", - "id": "e0a6e448", + "id": "5ee7ed53", "metadata": {}, "source": [ "This raises both the equilibrium price and quantity.\n", @@ -1042,7 +1042,7 @@ { "cell_type": "code", "execution_count": null, - "id": "04f6cfe1", + "id": "49f6b106", "metadata": {}, "outputs": [], "source": [ @@ -1067,7 +1067,7 @@ { "cell_type": "code", "execution_count": null, - "id": "476cc5b5", + "id": "0399766d", "metadata": {}, "outputs": [], "source": [ @@ -1082,7 +1082,7 @@ { "cell_type": "code", "execution_count": null, - "id": "469507fe", + "id": "c0f449eb", "metadata": {}, "outputs": [], "source": [ @@ -1100,7 +1100,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5c2d25c9", + "id": "24461808", "metadata": {}, "outputs": [], "source": [ @@ -1113,7 +1113,7 @@ }, { "cell_type": "markdown", - "id": "781f1def", + "id": "8d30d479", "metadata": {}, "source": [ "### Digression: a supplier who is a monopolist\n", @@ -1160,7 +1160,7 @@ }, { "cell_type": "markdown", - "id": "b41aa212", + "id": "ebd37987", "metadata": {}, "source": [ "### A monopolist\n", @@ -1198,7 +1198,7 @@ { "cell_type": "code", "execution_count": null, - "id": "275c35f9", + "id": "08a107fc", "metadata": {}, "outputs": [], "source": [ @@ -1237,7 +1237,7 @@ }, { "cell_type": "markdown", - "id": "e9fbb104", + "id": "7c54f4a2", "metadata": {}, "source": [ "Define a function that plots the demand, marginal cost and marginal revenue curves with surpluses and equilibrium labelled." @@ -1246,7 +1246,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e145af70", + "id": "33c7b886", "metadata": { "tags": [ "hide-input" @@ -1311,7 +1311,7 @@ }, { "cell_type": "markdown", - "id": "41f7077f", + "id": "549d3364", "metadata": {}, "source": [ "#### A multiple good example\n", @@ -1322,7 +1322,7 @@ { "cell_type": "code", "execution_count": null, - "id": "329f1556", + "id": "4be563a5", "metadata": {}, "outputs": [], "source": [ @@ -1350,7 +1350,7 @@ }, { "cell_type": "markdown", - "id": "47441298", + "id": "d137bd3d", "metadata": {}, "source": [ "#### A single-good example" @@ -1359,7 +1359,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9da0d8b7", + "id": "d0d218b0", "metadata": {}, "outputs": [], "source": [ @@ -1385,7 +1385,7 @@ }, { "cell_type": "markdown", - "id": "81a7d0b0", + "id": "71d360db", "metadata": {}, "source": [ "## Multi-good welfare maximization problem\n", diff --git a/_sources/time_series_with_matrices.ipynb b/_sources/time_series_with_matrices.ipynb index e80f7812..0bce1ae7 100644 --- a/_sources/time_series_with_matrices.ipynb +++ b/_sources/time_series_with_matrices.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "d89c0ee7", + "id": "dcaf792b", "metadata": {}, "source": [ "(time_series_with_matrices)=\n", @@ -44,7 +44,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4b7bb2e7", + "id": "e69c80a3", "metadata": {}, "outputs": [], "source": [ @@ -57,7 +57,7 @@ }, { "cell_type": "markdown", - "id": "1d002aa5", + "id": "de038bc6", "metadata": {}, "source": [ "## Samuelson's model\n", @@ -146,7 +146,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8ab47a8e", + "id": "53bbd2d3", "metadata": {}, "outputs": [], "source": [ @@ -163,7 +163,7 @@ }, { "cell_type": "markdown", - "id": "d50f1163", + "id": "a538f360", "metadata": {}, "source": [ "Now we construct $A$ and $b$." @@ -172,7 +172,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f49512c3", + "id": "67cf14ee", "metadata": {}, "outputs": [], "source": [ @@ -193,7 +193,7 @@ }, { "cell_type": "markdown", - "id": "a98c8bce", + "id": "1f8e4b1c", "metadata": {}, "source": [ "Let’s look at the matrix $A$ and the vector $b$ for our\n", @@ -203,7 +203,7 @@ { "cell_type": "code", "execution_count": null, - "id": "47e1810e", + "id": "03354824", "metadata": {}, "outputs": [], "source": [ @@ -212,7 +212,7 @@ }, { "cell_type": "markdown", - "id": "3a8d453f", + "id": "ec3c2225", "metadata": {}, "source": [ "Now let’s solve for the path of $y$.\n", @@ -226,7 +226,7 @@ { "cell_type": "code", "execution_count": null, - "id": "128becc0", + "id": "72b2fc21", "metadata": {}, "outputs": [], "source": [ @@ -237,7 +237,7 @@ }, { "cell_type": "markdown", - "id": "7869323d", + "id": "2b56cfb8", "metadata": {}, "source": [ "or we can use `np.linalg.solve`:" @@ -246,7 +246,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e16b8d0a", + "id": "7fc2869c", "metadata": {}, "outputs": [], "source": [ @@ -255,7 +255,7 @@ }, { "cell_type": "markdown", - "id": "1056cdb7", + "id": "c10f03fa", "metadata": {}, "source": [ "Here make sure the two methods give the same result, at least up to floating\n", @@ -265,7 +265,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9243ba32", + "id": "fe87cf39", "metadata": {}, "outputs": [], "source": [ @@ -274,7 +274,7 @@ }, { "cell_type": "markdown", - "id": "6a9f12fc", + "id": "98cb7d54", "metadata": {}, "source": [ "```{note}\n", @@ -291,7 +291,7 @@ { "cell_type": "code", "execution_count": null, - "id": "83a4ca09", + "id": "4c412466", "metadata": {}, "outputs": [], "source": [ @@ -304,7 +304,7 @@ }, { "cell_type": "markdown", - "id": "799e0c3d", + "id": "407d07fa", "metadata": {}, "source": [ "The **steady state** value $y^*$ of $y_t$ is obtained by setting $y_t = y_{t-1} =\n", @@ -321,7 +321,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2142468d", + "id": "aeac7a92", "metadata": {}, "outputs": [], "source": [ @@ -337,7 +337,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c9ebb27", + "id": "ba053783", "metadata": {}, "outputs": [], "source": [ @@ -347,7 +347,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aaee73d0", + "id": "1f2945d9", "metadata": {}, "outputs": [], "source": [ @@ -360,7 +360,7 @@ }, { "cell_type": "markdown", - "id": "609389f5", + "id": "2063f79a", "metadata": {}, "source": [ "## Adding a random term\n", @@ -412,7 +412,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12f0524b", + "id": "0303364d", "metadata": {}, "outputs": [], "source": [ @@ -422,7 +422,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bd08ec91", + "id": "51eb7f1a", "metadata": {}, "outputs": [], "source": [ @@ -433,7 +433,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bac1d1da", + "id": "0b0b24f1", "metadata": {}, "outputs": [], "source": [ @@ -446,7 +446,7 @@ }, { "cell_type": "markdown", - "id": "9a7dbefe", + "id": "1b57a080", "metadata": {}, "source": [ "The above time series looks a lot like (detrended) GDP series for a\n", @@ -458,7 +458,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7776375a", + "id": "e446cf18", "metadata": {}, "outputs": [], "source": [ @@ -478,7 +478,7 @@ }, { "cell_type": "markdown", - "id": "b8e92424", + "id": "75b8b5c4", "metadata": {}, "source": [ "Also consider the case when $y_{0}$ and $y_{-1}$ are at\n", @@ -488,7 +488,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0ef4422c", + "id": "f73fe5e3", "metadata": {}, "outputs": [], "source": [ @@ -508,7 +508,7 @@ }, { "cell_type": "markdown", - "id": "d904dadd", + "id": "21f95888", "metadata": {}, "source": [ "## Computing population moments\n", @@ -555,7 +555,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0553a763", + "id": "0875b28a", "metadata": {}, "outputs": [], "source": [ @@ -620,7 +620,7 @@ }, { "cell_type": "markdown", - "id": "edf13829", + "id": "6b072e19", "metadata": {}, "source": [ "It is enlightening to study the $\\mu_y, \\Sigma_y$'s implied by various parameter values.\n", @@ -633,7 +633,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a57a381a", + "id": "b950ea2c", "metadata": {}, "outputs": [], "source": [ @@ -654,7 +654,7 @@ }, { "cell_type": "markdown", - "id": "54e78be3", + "id": "b9812a1a", "metadata": {}, "source": [ "Visually, notice how the variance across realizations of $y_t$ decreases as $t$ increases.\n", @@ -665,7 +665,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7e0fd715", + "id": "919d3e04", "metadata": {}, "outputs": [], "source": [ @@ -676,7 +676,7 @@ }, { "cell_type": "markdown", - "id": "e04109ae", + "id": "ca2be2ec", "metadata": {}, "source": [ "Notice how the population variance increases and asymptotes" @@ -684,7 +684,7 @@ }, { "cell_type": "markdown", - "id": "fcf75597", + "id": "36f0e58c", "metadata": {}, "source": [ "Let's print out the covariance matrix $\\Sigma_y$ for a time series $y$" @@ -693,7 +693,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6533956e", + "id": "96624072", "metadata": {}, "outputs": [], "source": [ @@ -706,7 +706,7 @@ }, { "cell_type": "markdown", - "id": "7cb1fb9a", + "id": "0cb4a8d4", "metadata": {}, "source": [ "Notice that the covariance between $y_t$ and $y_{t-1}$ -- the elements on the superdiagonal -- are **not** identical.\n", @@ -723,7 +723,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c63d72b5", + "id": "210c737b", "metadata": {}, "outputs": [], "source": [ @@ -733,7 +733,7 @@ }, { "cell_type": "markdown", - "id": "4204b3e9", + "id": "79326ef2", "metadata": {}, "source": [ "Please notice how the sub diagonal and super diagonal elements seem to have converged.\n", @@ -747,7 +747,7 @@ }, { "cell_type": "markdown", - "id": "b0dd7e65", + "id": "69ae491c", "metadata": {}, "source": [ "## Moving average representation\n", @@ -764,7 +764,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e0b79d8", + "id": "db8de3c3", "metadata": {}, "outputs": [], "source": [ @@ -774,7 +774,7 @@ }, { "cell_type": "markdown", - "id": "a5ac719e", + "id": "bbd3b2b6", "metadata": {}, "source": [ "Evidently, $A^{-1}$ is a lower triangular matrix. \n", @@ -786,7 +786,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14bacc94", + "id": "5f034425", "metadata": {}, "outputs": [], "source": [ @@ -796,7 +796,7 @@ }, { "cell_type": "markdown", - "id": "4827f461", + "id": "16963bff", "metadata": {}, "source": [ "Notice how every row ends with the previous row's pre-diagonal entries.\n", @@ -885,7 +885,7 @@ { "cell_type": "code", "execution_count": null, - "id": "40dfe3ac", + "id": "43aef74a", "metadata": {}, "outputs": [], "source": [ @@ -895,7 +895,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d64900c3", + "id": "420e4ea9", "metadata": {}, "outputs": [], "source": [ @@ -909,7 +909,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ebd130fa", + "id": "5f1048fb", "metadata": {}, "outputs": [], "source": [ @@ -919,7 +919,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b574b935", + "id": "f0ac6221", "metadata": {}, "outputs": [], "source": [ @@ -932,7 +932,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ba8fb9fe", + "id": "fa65c563", "metadata": {}, "outputs": [], "source": [ @@ -942,7 +942,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8d60a100", + "id": "2259e09b", "metadata": {}, "outputs": [], "source": [ @@ -957,7 +957,7 @@ }, { "cell_type": "markdown", - "id": "6a7c129d", + "id": "3b611431", "metadata": {}, "source": [ "Can you explain why the trend of the price is downward over time?\n", @@ -969,7 +969,7 @@ { "cell_type": "code", "execution_count": null, - "id": "28863d08", + "id": "1905f88e", "metadata": {}, "outputs": [], "source": [ diff --git a/_sources/troubleshooting.ipynb b/_sources/troubleshooting.ipynb index 29878282..604864e1 100644 --- a/_sources/troubleshooting.ipynb +++ b/_sources/troubleshooting.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "da98c0d6", + "id": "fb5c3b25", "metadata": {}, "source": [ "(troubleshooting)=\n", diff --git a/_sources/unpleasant.ipynb b/_sources/unpleasant.ipynb index c47f8c2b..15f0083b 100644 --- a/_sources/unpleasant.ipynb +++ b/_sources/unpleasant.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "2cce033c", + "id": "0de5f900", "metadata": {}, "source": [ "# Unpleasant Monetarist Arithmetic \n", @@ -142,9 +142,14 @@ "$$ (eq:overlineg)\n", "\n", "We want to compute an equilibrium $\\{p_t,m_t,b_t, R_t\\}_{t=0}$ sequence under this scheme for\n", - "running monetary-fiscal policy.\n", + "running monetary and fiscal policies.\n", "\n", - "**TOM: add definitions of monetary and fiscal policy and coordination here.**\n", + "Here, by **fiscal policy** we mean the collection of actions that determine a sequence of net-of-interest government deficits $\\{g_t\\}_{t=0}^\\infty$ that must be financed by issuing to the public either money or interest bearing bonds.\n", + "\n", + "By **monetary policy** or **debt-management polcy**, we mean the collection of actions that determine how the government divides its portolio of debts to the public between interest-bearing parts (government bonds) and non-interest-bearing parts (money).\n", + "\n", + "By an **open market operation**, we mean a government monetary policy action in which the government\n", + "(or its delegate, say, a central bank) either buys government bonds from the public for newly issued money, or sells bonds to the public and withdraws the money it receives from public circulation. \n", "\n", "## Algorithm (basic idea)\n", "\n", @@ -314,7 +319,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d06e9aa4", + "id": "3b5ab84e", "metadata": {}, "outputs": [], "source": [ @@ -325,7 +330,7 @@ }, { "cell_type": "markdown", - "id": "8a787a6f", + "id": "94a9b4b0", "metadata": {}, "source": [ "Now let's dive in and implement our ''pseudo code'' in Python." @@ -334,7 +339,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4edb0a80", + "id": "b49da706", "metadata": {}, "outputs": [], "source": [ @@ -358,7 +363,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7b0ce3e7", + "id": "b8b24272", "metadata": {}, "outputs": [], "source": [ @@ -368,7 +373,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9608980a", + "id": "50fdd938", "metadata": {}, "outputs": [], "source": [ @@ -402,7 +407,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2ecc1236", + "id": "17c10f33", "metadata": {}, "outputs": [], "source": [ @@ -422,7 +427,7 @@ }, { "cell_type": "markdown", - "id": "5d48313a", + "id": "c0a191f2", "metadata": {}, "source": [ "Let's look at how price level $p_0$ in the stationary $R_u$ equilibrium depends on the initial\n", @@ -438,7 +443,7 @@ { "cell_type": "code", "execution_count": null, - "id": "864642a0", + "id": "79929de1", "metadata": {}, "outputs": [], "source": [ @@ -448,7 +453,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5be5469c", + "id": "30b61456", "metadata": {}, "outputs": [], "source": [ @@ -462,7 +467,7 @@ }, { "cell_type": "markdown", - "id": "e0985201", + "id": "23920447", "metadata": {}, "source": [ "Now let's write and implement code that let's us experiment with the time $0$ open market operation described earlier." @@ -471,7 +476,7 @@ { "cell_type": "code", "execution_count": null, - "id": "da2497ff", + "id": "3e43b6db", "metadata": {}, "outputs": [], "source": [ @@ -524,7 +529,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0259d1dc", + "id": "1207f6d8", "metadata": {}, "outputs": [], "source": [ @@ -556,7 +561,7 @@ { "cell_type": "code", "execution_count": null, - "id": "57a9979e", + "id": "5b8ff7f3", "metadata": { "mystnb": { "figure": { @@ -572,7 +577,7 @@ }, { "cell_type": "markdown", - "id": "cb04ecb9", + "id": "abca1a41", "metadata": {}, "source": [ "Figure {numref}`fig:unpl1` summarizes outcomes of two experiments that convey messages of \n", @@ -602,20 +607,20 @@ }, "source_map": [ 12, - 319, - 323, - 327, - 345, - 349, - 377, - 390, - 401, - 405, - 412, - 416, - 463, - 489, - 497 + 324, + 328, + 332, + 350, + 354, + 382, + 395, + 406, + 410, + 417, + 421, + 468, + 494, + 502 ] }, "nbformat": 4, diff --git a/_sources/unpleasant.md b/_sources/unpleasant.md index d78b48ff..3e57c1bf 100644 --- a/_sources/unpleasant.md +++ b/_sources/unpleasant.md @@ -148,9 +148,14 @@ $$ $$ (eq:overlineg) We want to compute an equilibrium $\{p_t,m_t,b_t, R_t\}_{t=0}$ sequence under this scheme for -running monetary-fiscal policy. +running monetary and fiscal policies. -**TOM: add definitions of monetary and fiscal policy and coordination here.** +Here, by **fiscal policy** we mean the collection of actions that determine a sequence of net-of-interest government deficits $\{g_t\}_{t=0}^\infty$ that must be financed by issuing to the public either money or interest bearing bonds. + +By **monetary policy** or **debt-management polcy**, we mean the collection of actions that determine how the government divides its portolio of debts to the public between interest-bearing parts (government bonds) and non-interest-bearing parts (money). + +By an **open market operation**, we mean a government monetary policy action in which the government +(or its delegate, say, a central bank) either buys government bonds from the public for newly issued money, or sells bonds to the public and withdraws the money it receives from public circulation. ## Algorithm (basic idea) diff --git a/_sources/zreferences.ipynb b/_sources/zreferences.ipynb index fdf4a32f..079a1652 100644 --- a/_sources/zreferences.ipynb +++ b/_sources/zreferences.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "c7f028b1", + "id": "bc60dba7", "metadata": {}, "source": [ "(references)=\n", diff --git a/ar1_processes.html b/ar1_processes.html index 713d9746..6c3ee2f8 100644 --- a/ar1_processes.html +++ b/ar1_processes.html @@ -692,9 +692,9 @@

30.5. Exercises
-_images/93c96f46b6ec9278b845d9c14d9fc48f880c803c94546e4a2c388b432f15fa01.png -_images/08a58eeb55480a32f702aefd8c9100411bed5003188bd1e4ae03d4636ef2137f.png -_images/d6671415d8eaa21456fa30383f741a2b4614241793b781e93026c2a9033ba566.png +_images/3d839e736b7224893f9ac42cd500b99bbfbae557026adab4435c2a4593b41cbd.png +_images/96091aca837e27b7047c63c0d4493d5c31fea9655e9a94fc00e01bf2da94faf8.png +_images/12cf5276eb1fe369efd53bf9d233587a9ea325cb7b51da94de7de784caf8aed4.png

We see that the kernel density estimator is effective when the underlying @@ -801,7 +801,7 @@

30.5. Exercises
-_images/a00a5bda5992334267ac477283bb35b9db38f96fb0ec2b51a5ceebee54c52600.png +_images/24c839c790c6591d72c0b829de99218a71719fcd4d01ff376719aab143c12643.png

The simulated distribution approximately coincides with the theoretical diff --git a/business_cycle.html b/business_cycle.html index 9759b6f1..26e7c587 100644 --- a/business_cycle.html +++ b/business_cycle.html @@ -272,7 +272,9 @@

3.1. Overview + +
Downloading wbgapi-1.0.12-py3-none-any.whl (36 kB)
 
Installing collected packages: wbgapi
@@ -303,7 +305,13 @@ 

3.1. Overview
Downloading pandas_datareader-0.10.0-py3-none-any.whl (109 kB)
 ?25l   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/109.5 kB ? eta -:--:--
-   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.5/109.5 kB 10.4 MB/s eta 0:00:00
+   ━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 30.7/109.5 kB 959.0 kB/s eta 0:00:01
+
+
+
   ━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━ 71.7/109.5 kB 1.1 MB/s eta 0:00:01
+
+
+
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.5/109.5 kB 1.1 MB/s eta 0:00:00
 ?25h
 
diff --git a/commod_price.html b/commod_price.html index 78636194..a09db455 100644 --- a/commod_price.html +++ b/commod_price.html @@ -270,13 +270,15 @@

25.1. Outline
Collecting yfinance
-  Downloading yfinance-0.2.37-py2.py3-none-any.whl.metadata (11 kB)
-Requirement already satisfied: pandas>=1.3.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (2.1.4)
-Requirement already satisfied: numpy>=1.16.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (1.26.4)
-Requirement already satisfied: requests>=2.31 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (2.31.0)
 
-
Collecting multitasking>=0.0.7 (from yfinance)
+
  Downloading yfinance-0.2.37-py2.py3-none-any.whl.metadata (11 kB)
+
+
+
Requirement already satisfied: pandas>=1.3.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (2.1.4)
+Requirement already satisfied: numpy>=1.16.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (1.26.4)
+Requirement already satisfied: requests>=2.31 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (2.31.0)
+Collecting multitasking>=0.0.7 (from yfinance)
   Downloading multitasking-0.0.11-py3-none-any.whl.metadata (5.5 kB)
 Requirement already satisfied: lxml>=4.9.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (4.9.3)
 Requirement already satisfied: appdirs>=1.4.4 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (1.4.4)
@@ -285,11 +287,10 @@ 

25.1. Outline
Collecting frozendict>=2.3.4 (from yfinance)
   Downloading frozendict-2.4.1.tar.gz (315 kB)
-?25l
+?25l     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/315.2 kB ? eta -:--:--
 
-

 done
-?25hCollecting peewee>=3.16.2 (from yfinance)
+
+
+
?25hCollecting peewee>=3.16.2 (from yfinance)
   Downloading peewee-3.17.1.tar.gz (3.0 MB)
 ?25l     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/3.0 MB ? eta -:--:--
 
-
+
Requirement already satisfied: six>=1.9 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from html5lib>=1.1->yfinance) (1.16.0)
 Requirement already satisfied: webencodings in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from html5lib>=1.1->yfinance) (0.5.1)
 
Requirement already satisfied: python-dateutil>=2.8.2 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from pandas>=1.3.0->yfinance) (2.8.2)
 Requirement already satisfied: tzdata>=2022.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from pandas>=1.3.0->yfinance) (2023.3)
 Requirement already satisfied: charset-normalizer<4,>=2 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests>=2.31->yfinance) (2.0.4)
-
-
-
Requirement already satisfied: idna<4,>=2.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests>=2.31->yfinance) (3.4)
+Requirement already satisfied: idna<4,>=2.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests>=2.31->yfinance) (3.4)
 Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests>=2.31->yfinance) (2.0.7)
 Requirement already satisfied: certifi>=2017.4.17 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests>=2.31->yfinance) (2024.2.2)
 Downloading yfinance-0.2.37-py2.py3-none-any.whl (72 kB)
 ?25l   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/73.0 kB ? eta -:--:--
-   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.0/73.0 kB 26.5 MB/s eta 0:00:00
-?25hDownloading html5lib-1.1-py2.py3-none-any.whl (112 kB)
-?25l   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/112.2 kB ? eta -:--:--
 
-

The figure above shows the inverse demand curve \(P\), which is also \(p_0\), as @@ -764,7 +773,7 @@

25.6. Code -_images/c46903780b3cd97238eab93960d02b1b24b871265b64e854e0e4946dfe11d058.png +_images/9fdb4c9a8a1d62f6f538e9d91b83dcadfab946695a3ec0cb5e0090b9f14f5ba8.png

diff --git a/eigen_I.html b/eigen_I.html index c4c5e915..3fc02fc2 100644 --- a/eigen_I.html +++ b/eigen_I.html @@ -1294,7 +1294,7 @@

15.8. Exercises

-_images/aadefc78024d299c03ddd051c519ebde8472a6225f44c8c08b43c49e75a9d617.png +_images/6294c83139a08690b025232fd9d0c486d741c88d6f0fba32313ff95f4806739e.png

Fig. 15.1 Power iteration#

@@ -1337,7 +1337,7 @@

15.8. Exercises
-_images/558ea33869a232c7653b977fa6f684167d9f235ba966ad72bfab1a5d407a340e.png +_images/6890861cf91198b7bd517cc653f857314dfa015b47ebb27736d0fe66a7782601.png

Fig. 15.2 Power iteration trajectory#

diff --git a/eigen_II.html b/eigen_II.html index 3916de57..4b27c49d 100644 --- a/eigen_II.html +++ b/eigen_II.html @@ -270,16 +270,18 @@

36. The Perron-Frobenius Theorem

-
Requirement already satisfied: idna<4,>=2.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests->quantecon) (3.4)
+
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests->quantecon) (2.0.4)
+Requirement already satisfied: idna<4,>=2.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests->quantecon) (3.4)
 Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests->quantecon) (2.0.7)
 Requirement already satisfied: certifi>=2017.4.17 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests->quantecon) (2024.2.2)
 Requirement already satisfied: mpmath>=0.19 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from sympy->quantecon) (1.3.0)
 Downloading quantecon-0.7.2-py3-none-any.whl (215 kB)
 ?25l   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/215.4 kB ? eta -:--:--
-   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 215.4/215.4 kB 13.4 MB/s eta 0:00:00
+
+
+
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 215.4/215.4 kB 9.1 MB/s eta 0:00:00
 ?25h
 
diff --git a/heavy_tails.html b/heavy_tails.html index a566d8b8..49510b89 100644 --- a/heavy_tails.html +++ b/heavy_tails.html @@ -284,15 +284,15 @@
Requirement already satisfied: pandas_datareader in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (0.10.0)
-
-
-
Requirement already satisfied: pandas>=1.3.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (2.1.4)
+Requirement already satisfied: pandas>=1.3.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (2.1.4)
 Requirement already satisfied: numpy>=1.16.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (1.26.4)
 Requirement already satisfied: requests>=2.31 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (2.31.0)
 Requirement already satisfied: multitasking>=0.0.7 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (0.0.11)
 Requirement already satisfied: lxml>=4.9.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (4.9.3)
 Requirement already satisfied: appdirs>=1.4.4 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (1.4.4)
-Requirement already satisfied: pytz>=2022.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from yfinance) (2023.3.post1)
+
+
+

Notice how

@@ -381,7 +381,7 @@

19.1.1. Introduction: light tails

We have plotted each individual draw \(X_i\) against \(i\).

diff --git a/inequality.html b/inequality.html index 51f91627..1b1a1446 100644 --- a/inequality.html +++ b/inequality.html @@ -304,9 +304,7 @@

5.1.2. Measurement
Requirement already satisfied: wbgapi in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (1.0.12)
 Requirement already satisfied: plotly in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (5.9.0)
 Requirement already satisfied: requests in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from wbgapi) (2.31.0)
-
- -
Requirement already satisfied: PyYAML in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from wbgapi) (6.0.1)
+Requirement already satisfied: PyYAML in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from wbgapi) (6.0.1)
 Requirement already satisfied: tabulate in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from wbgapi) (0.9.0)
 Requirement already satisfied: tenacity>=6.2.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from plotly) (8.2.2)
 Requirement already satisfied: charset-normalizer<4,>=2 in /usr/share/miniconda3/envs/quantecon/lib/python3.11/site-packages (from requests->wbgapi) (2.0.4)
@@ -459,7 +457,7 @@ 

5.2.2. Lorenz curves of simulated data
-_images/f2684e0373223b3837c3d3605d5a8fc8f9cf1bbc27e4cb1d5d894bc1bfa446bd.png +_images/cd1e915461e2da75af481219f24595ab83c3e1f9975b44afa9ad88036694f57d.png

Fig. 5.1 Lorenz curve of simulated data#

@@ -696,7 +694,7 @@

5.3.1. Definition
-_images/c21b3bc61831611fce4a51a5cdb3cccaf77c933985ee28b69ca0988d3728279a.png +_images/a525029539727cb1482ff64d454e1b879396928a3a3498099a800b84b69606d1.png

Fig. 5.3 Shaded Lorenz curve of simulated data#

@@ -731,7 +729,7 @@

5.3.1. Definition
-_images/859101bc8f28d2b47194badccd3d13d89da4865dcbcd6ca58b97b86f35e9dca0.png +_images/69c922aeea51af52c311d0b0e8bc00b92b40b08ac90b71b0c7d278a136fbdf58.png

Fig. 5.4 Lorenz curve and Gini coefficient#

@@ -831,7 +829,7 @@

5.3.2. Gini coefficient of simulated dat

-_images/f23eeb251fa18ea34878cf0f937c2da945c1bb778afa3c6edf62796a78e8b9b0.png +_images/e2b01ff8a337806724167d49ce6a618cd529a554e3222053948bc551e9f9f666.png

Fig. 5.5 Gini coefficients of simulated data#

@@ -1385,9 +1383,9 @@

5.3.6. Gini Coefficient and GDP per capi }); } -