(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 13839, 470]*) (*NotebookOutlinePosition[ 14914, 507]*) (* CellTagsIndexPosition[ 14870, 503]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{Cell[TextData["Choice"], "Title", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Hal Varian\nJanuary 1992"], "Subsubtitle", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["Slutsky equation"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "Let's check the Slutsky equation for the CES demand functions when ", Evaluatable->False, AspectRatioFixed->True], StyleBox["rho=-1", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold"], StyleBox[". First we'll calculate the CES demands, etc.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["u[x1_,x2_] := 1/x1 + 1/x2"], "Input", AspectRatioFixed->True], Cell[TextData["L= u[x1,x2] - lambda*(p1 x1 + p2 x2 - m)"], "Input", AspectRatioFixed->True], Cell[TextData[ "firstOrder=Evaluate[{D[L,x1]==0,D[L,x2]==0,D[L,lambda]==0}]"], "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["Alas, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Mathematica", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ " cannot solve this system directly. However, we can use the same trick \ that we used before. We define two auxiliary variables, ", Evaluatable->False, AspectRatioFixed->True], StyleBox["y1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["y2", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[", and then solve the entire system of equations.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "firstOrder=Union[firstOrder/.{x1^(-2)->y1^2,x2^(-2)->y2^2},\n\ {y1==1/x1,y2==1/x2}]\nsolution=Solve[firstOrder,{lambda,x1,x2,y1,y2}][[1]]\n\ x1[p1_,p2_,m_]:=Simplify[x1/.solution]\nx1[p1,p2,m]\nx2[p1_,p2_,m_] := \ Simplify[x2/.solution]\nx2[p1,p2,m]"], "Input", AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["Indirect utility and expenditure"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Here's the indirect utility function:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "v[p1_,p2_,m] := Simplify[u[x1,x2]/.solution]\nv[p1,p2,m]"], "Input", AspectRatioFixed->True], Cell[TextData[ "To solve for the expenditure function, solve for income as a function of \ utility:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "solution2=Solve[v[p1,p2,m]==u,m][[1]]\ne[p1_,p2_,m_] := m/.solution2\n\ e[p1,p2,m]"], "Input", AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Hicksian demands and Slutsky equation"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "The Hicksian demand function for good 1will be the derivative of this \ expenditure function with respect to p1. We'll evaluate it at \ u=v[p1,p2,m]:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["h[p1_,p2_,u_] := D[e[p1,p2,m],p1]"], "Input", AspectRatioFixed->True], Cell[TextData[ "slopeOfHicksianDemand=\n Simplify[D[h[p1,p2,u],p1]/.{u->v[p1,p2,m]}]"], "Input", AspectRatioFixed->True], Cell[TextData["We want to compare this to the Slutsky equation:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "slutskyTerm=Simplify[D[x1[p1,p2,m],p1] + \n \ D[x1[p1,p2,m],m]*x1[p1,p2,m]]"], "Input", AspectRatioFixed->True], Cell[TextData["Slutsky wins again..."], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Integrability"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Here we'll solve the integrability equations for the linear demand \ function:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["Linear demand"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["x[p_,m_] := a p + b m + c"], "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["Mathematica", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ " wants the integrability equation and the boundary condition in order to \ solve for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["mu", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[".", Evaluatable->False, AspectRatioFixed->True], StyleBox[" ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "solution=DSolve[{mu'[p]==a p + b mu[p] + c,mu[q]==m},\n \ mu[p],p][[1]]"], "Input", AspectRatioFixed->True], Cell[TextData[ "Here's the standard form for the money metric utility function"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["mm[p_,q_,m_] := mu[p]/.solution\nmm[p,q,m]"], "Input", AspectRatioFixed->True], Cell[TextData[ "Let's see if we can figure out what the indifference curves for this \ indirect utility function looks like. There are several ways to do this; one \ way is to solve for the Hicksian demands. We'll put the parameters into the \ utility function since we want to see how the indifference curve changes as \ these parameters change."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "h1[p_,q_,m_,a_,b_,c_] := \n Evaluate[x[p,income]/.{income->mm[p,q,m]}]\n\ h1[p,q,m,a,b,c]"], "Input", AspectRatioFixed->True], Cell[TextData[ "This is one Hicksian demand; the other one comes from the budget \ constraint:"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "h2[p_,q_,m_,a_,b_,c_] := Evaluate[(income - \n p \ x[p,income])/.{income->mm[p,q,m]}]\nh2[p,q,m,a,b,c]"], "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["Now we'll fix ", Evaluatable->False, AspectRatioFixed->True], StyleBox["q", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["m", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[", so that utility is held fixed, pick some values for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["(a,b,c)", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[" and then plot these functions as ", Evaluatable->False, AspectRatioFixed->True], StyleBox["p", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[" varies.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "hh1[p_] := Simplify[Evaluate[h1[p,1,10,-10,1,1]]]\nhh2[p_] := \ Simplify[Evaluate[h2[p,1,10,-10,1,1]]]"], "Input", AspectRatioFixed->True], Cell[TextData["Simplify[{hh1[p],hh2[p]}]"], "Input", AspectRatioFixed->True], Cell[TextData[ "ParametricPlot[{hh1[p],hh2[p]},{p,0,1.5},AxesOrigin->{0,0},\n \ PlotRange->{0,12},AspectRatio->1]"], "Input", AspectRatioFixed->True], Cell[TextData[ "Note that the indifference curve crosses the vertical axis. This makes no \ economic sense; it is a good warning to be careful in calculating welfare \ conclusions using this linear demand function."], "Text", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Log-Linear demand"], "Subsection", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Suppose that demand takes the form"], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["x[p_,m_] := p^a m^b E^c"], "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["We estimate the demand function and find that ", Evaluatable->False, AspectRatioFixed->True], StyleBox["a=-0.2, b=1.2, and c=0.0.", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[" Initially, the consumer faces prices ", Evaluatable->False, AspectRatioFixed->True], StyleBox["p=2", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[" and has income of 1. If the price rises to ", Evaluatable->False, AspectRatioFixed->True], StyleBox["p=3", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[ ", how much income would the consumer need to make her as well off as she \ was before the price increase?\n\nWe'll answer this question using \ integrability. Before the price change,", Evaluatable->False, AspectRatioFixed->True], StyleBox[" e[2,u]=1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[". We want to know what ", Evaluatable->False, AspectRatioFixed->True], StyleBox["e[3,u]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[ " equals. First we find a numerical solution to the integrability \ equation.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "a=-0.2\nb=1.2\nc=0.0\ndsolution=\n NDSolve[{e'[p]==(p^a)* (e[p]^b), \ e[2]==1},e,{p,1,4}]"], "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["We can plot the function e[p] that ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Mathematica", Evaluatable->False, AspectRatioFixed->True, FontWeight->"Bold", FontSlant->"Italic"], StyleBox[" found for us as follows. Note that ", Evaluatable->False, AspectRatioFixed->True], StyleBox["e[2]=1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[", as required by the boundary condition.", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["Plot[Evaluate[e[p]/.dsolution],{p,1,4}]"], "Input", AspectRatioFixed->True], Cell[TextData[{ StyleBox["To find the value of", Evaluatable->False, AspectRatioFixed->True], StyleBox[" e[3,u]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[", just substitute ", Evaluatable->False, AspectRatioFixed->True], StyleBox["3", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"], StyleBox[" into ", Evaluatable->False, AspectRatioFixed->True], StyleBox["e:", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier", FontWeight->"Bold"] }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["e[3]/.dsolution"], "Input", AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Solving for the direct utility function"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Given a normalized indirect utility function, we can find the direct utility \ function just by solving a minimization problem. Let's try the Cobb-Douglas \ case."], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "L = p1*p2 - lambda*(p1 x1 + p2 x2 - 1)\n\ solution=Solve[{D[L,p1]==0,D[L,p2]==0,D[L,lambda]==0},\n \ {p1,p2,lambda}][[1]]\nu[x1_,x2_] := p1*p2 /.solution\nu[x1,x2]"], "Input", AspectRatioFixed->True]}, Open]]}, Open]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 640}, {0, 460}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{520, 365}, WindowMargins->{{36, Automatic}, {Automatic, 16}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, Magnification->1.5, MacintoshSystemPageSetup->"\<\ AVU/IFiQKFD000000V8nh09RAj0000000OXQ<097PXP0AP1Y06`0I@1^0642HSkP 0V97`0000001nR4@0TN2R000000000000000009R?^0000000000000000000000 00000000000000000000000000000000\>" ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1731, 51, 81, 2, 70, "Title", Evaluatable->False], Cell[1815, 55, 105, 2, 70, "Subsubtitle", Evaluatable->False], Cell[CellGroupData[{ Cell[1943, 59, 93, 2, 70, "Section", Evaluatable->False], Cell[2039, 63, 424, 14, 70, "Text", Evaluatable->False], Cell[2466, 79, 78, 1, 70, "Input"], Cell[2547, 82, 93, 1, 70, "Input"], Cell[2643, 85, 113, 2, 70, "Input"], Cell[2759, 89, 885, 31, 70, "Text", Evaluatable->False], Cell[3647, 122, 303, 5, 70, "Input"], Cell[CellGroupData[{ Cell[3973, 129, 112, 2, 70, "Subsection", Evaluatable->False], Cell[4088, 133, 111, 2, 70, "Text", Evaluatable->False], Cell[4202, 137, 110, 2, 70, "Input"], Cell[4315, 141, 158, 4, 70, "Text", Evaluatable->False], Cell[4476, 147, 136, 3, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[4644, 152, 117, 2, 70, "Subsection", Evaluatable->False], Cell[4764, 156, 226, 5, 70, "Text", Evaluatable->False], Cell[4993, 163, 86, 1, 70, "Input"], Cell[5082, 166, 126, 3, 70, "Input"], Cell[5211, 171, 122, 2, 70, "Text", Evaluatable->False], Cell[5336, 175, 143, 3, 70, "Input"], Cell[5482, 180, 95, 2, 70, "Text", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[5618, 184, 90, 2, 70, "Section", Evaluatable->False], Cell[5711, 188, 153, 4, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[5887, 194, 93, 2, 70, "Subsection", Evaluatable->False], Cell[5983, 198, 78, 1, 70, "Input"], Cell[6064, 201, 644, 25, 70, "Text", Evaluatable->False], Cell[6711, 228, 133, 3, 70, "Input"], Cell[6847, 233, 137, 3, 70, "Text", Evaluatable->False], Cell[6987, 238, 95, 1, 70, "Input"], Cell[7085, 241, 407, 7, 70, "Text", Evaluatable->False], Cell[7495, 250, 148, 3, 70, "Input"], Cell[7646, 255, 153, 4, 70, "Text", Evaluatable->False], Cell[7802, 261, 180, 3, 70, "Input"], Cell[7985, 266, 1016, 38, 70, "Text", Evaluatable->False], Cell[9004, 306, 156, 3, 70, "Input"], Cell[9163, 311, 78, 1, 70, "Input"], Cell[9244, 314, 152, 3, 70, "Input"], Cell[9399, 319, 275, 5, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[9706, 326, 97, 2, 70, "Subsection", Evaluatable->False], Cell[9806, 330, 108, 2, 70, "Text", Evaluatable->False], Cell[9917, 334, 76, 1, 70, "Input"], Cell[9996, 337, 1545, 51, 70, "Text", Evaluatable->False], Cell[11544, 390, 144, 3, 70, "Input"], Cell[11691, 395, 643, 22, 70, "Text", Evaluatable->False], Cell[12337, 419, 92, 1, 70, "Input"], Cell[12432, 422, 689, 27, 70, "Text", Evaluatable->False], Cell[13124, 451, 68, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[13233, 454, 116, 2, 70, "Section", Evaluatable->False], Cell[13352, 458, 238, 5, 70, "Text", Evaluatable->False], Cell[13593, 465, 225, 4, 70, "Input"] }, Closed]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)