# Labor/Leisure Decisions

The set of exercises considers models that extend the textbook model by
introducing the option of selecting the amount of time the consumer works,
thereby affecting income. The consumer is assumed to have money 
income, M, from nonlabor sources (M>=0) and a given number of hours, T,
per time period. These hours can be used in leisure (denoted as z) or 
labor (T - z). 

The first exercise below considers the Cobb-Douglas utility function. The 
second section treats the CES utility function. The third section uses the
hybrid function that appeared in the preceding exercise set. It shows that
a changed wage rate, w, can affect both the amount of leisure and the 
composition of the consumption bundle of other goods.

## The Cobb-Douglas Case

The consumer has an amount of time, T, to allocate between leisure, z, 
and labor (quantity of labor supplied = T - z). The consumer's money 
income is M + w*(T-z), where M is nonwage income and w is the wage rate.
The income is spent on purchasing good x, so px*x equals money income. 

kill(all)$ ratprint:false$ fpprintprec:5$
px*x  = M + w*(T - z); solnx1: solve(%,x)[1];

The consumer's utility level is determined by the quantities of x and z.
The function u is a Cobb-Douglas utility function with the single parameter
a, which determines the relative weight attached to good x and good z
(leisuure).

Define usub by substituting the expression for x that is derived above
into u. Take the derivative of usub with respect to the single variable that
the consumer can control, z. 

Define the first-order condition for this consumer and attach the name
foc1 to the expression  that results.  Solve foc1 for z.

/*Input. Execute (ctrl-enter) for results */
u : x^a*z^(1-a); usub: subst(solnx1,u);
diff(usub,z);  
foc1: solve(%,z);

Discussion
The first term can be phrased as z = (1-a)*(T + M/w), where (1-a)
is the share of "full" income -- time plus the time equivalent of M --
that the consumer allocates to leisure. It applies as long as z <= T.
The second term applies if z = T, in which case the consumer does not
work, so that x = M/px. 

To determine how the variables and parameters affect
v, use the command diff(foc1[1 ])$. (Use the $ sign to avoid large
amount of output. Then use ratsimp(%); to generate an easily-read
expression. (You can embed the diff(...) command within the 
ratsimp(...) or radcan(...) command.

/*Input. Execute (ctrl-enter) for results */
diff(foc1[1])$ /*radcan gives the same expression*/ ratsimp(%);

Denote the partial derivatives like this: the partial derivative of z with respect to 
T is z_T, so that the first term is z_T*del(T). 

Confirm that the signs are as follows: z_T > 0, z_M > 0, z_w < 0 (a higher wage 
results in less leisure, more labor), and z_a < 0. Explain why 
each of  these (except, perhaps for z_w, accords with theoretical expectations.

Discussion
Actually z_w < 0 is rather easily interpreted: The substitution effect dominates the
income effect. This is not surprising when one realizes that the price elasticity of
demand and the income elasticity of demand equal 1. Given that M is just part of 
"full" income, the effect of a one percent change in w is an income change of less 
than 1 percent and, therefore, an income effect of less than one percent. 

We should set del(a) = 0 if this applies to a single consumer. A change in a in effect
creates a new consumer. A consumer with a higher a value prefers more of good x, 
other things equal, and therefore prefers less z.

## A CES Utility Function

Replace u with v1 = (x^-a + x^-a)^(-1/a), the CES function. Now a = 1/(1-s), where s is 
the elasticity of substitution. 

Substitute the expression v1: (x^-a + z^-a)^(-1/a); for the Cobb-Douglas utility
function. Create an expression named v1sub by substituting solnx1 into 
expression v1. Then take the derivative of v1sub with respect ot z and 
solve the result for z. Optional: Apply radcan (not ratsimp) to the result.

/*Input. Execute (ctrl-enter) for results */
kill(all)$ fpprintprec:5$ ratprint:false$
px*x  = M + w*(T - z); solnx1: solve(%,x)[1];
v1: (x^-a + z^-a)^(-1/a);  v1sub: subst(solnx1,v1);
solve(diff(v1sub,z), z); foc2: radcan(%);

Confirm that the term foc2[1] yields z = (w/px)*(z - T) - M/px which, being 
negative, has no economic interpretation. The second term contains z on both sides 
of the expression and cannot be solved analytically.  

Approximate roots of this expression using find_root.  Substitute M=25,T=100, and
px=1 into foc2[2]. Create f(z,w,a) = the right-hand side of the resulting 
expression less z. 

/*Input. Execute (ctrl-enter) for results */
subst([M=40,T=100,px=1],foc2[2]);
f(z,w,a):= ''(rhs(%)-z);
/*
As always, the transpose(matrix(...)) is not
required, but is used to produce output that is
easier to read
*/
transpose(matrix([f(z,1,-0.5),f(z,1,9.0),
              f(z,1.5,-0.5),f(z,1.5,9.0)]));

Create four values of z, using the pairs of w values and of a values.
To do this use expressions like this: find_root(f(z,1,-0.5),z,1,139);.
Start the range with a small positive value, like 1. Use the 
results above to determine the upper limit. The value 139 used
here is one less than the 140 that would cause either of the first
two results above to be undefined.

/*Input. Execute (ctrl-enter) for results */
z10List: [find_root(f(z,1,-0.5),z,1,139),
find_root(f(z,1, 9.0),z,1,139)];
z15List: [find_root(f(z,1.5,-0.5),z,1,189/1.5),
find_root(f(z,1.5, 9.0),z,1,189/1.5)];

/*Input. Execute (ctrl-enter) for results */
subst([T=100,M=40,px=1],rhs(solnx1))$
fxw(z,w):=''(%);

/*Input. Execute (ctrl-enter) for results */
x10List: fxw(z10List,1.0);
x15List: fxw(z15List,1.5);

/*Input. Execute (ctrl-enter) for results */
fmrs(x,z,a):=''(diff(v1,x)/diff(v1,z));
matrix(
["a=-0.5 :",
   fmrs(z10List[1],x10List[1],-0.5),
   fmrs(z15List[1],x15List[1],-0.5)],
["a= 9.0 :",
   fmrs(z10List[2],x10List[2],9),
   fmrs(z15List[2],x15List[2],9)])$
addrow(matrix(["","w=1.0","w=1.5"]),%);

Check: Is mrs = px/w? Yes.

Optional.  Recast v1 as V1(x,z,a) and use the resulting functional
expression to visually represent two CES functions, one with 
a = 9 (s = 1/10) and the other with a = 0.5 (s = 2.0), and a Cobb
Douglas function with a = 0.5.

Begin by determining the utility level for each of the utility
level that results when x=z=10. Assign names to these values
and use the names in the graph.

/*Input. Execute (ctrl-enter) for results */
V1(x,z,a):=''(v1);
V11: V1(10.0,10,9);
V12: V1(10.0,10,-.5);
CD1: 10^.5*10^.5;

In wxdraw2d, use the implicit option three times. In each implicit
expression set the pertinent functional expression equal to the 
value generated above. Confirm that the curvature of the Cobb-
Douglas indifference curve is intermediate between those for the two 
CES functions.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(xlabel="x",ylabel="z",line_width=2,
key = "s=0.1",implicit(V1(x,z,9)-V11,x,1,20,z,1,20),
color=black, key="s=2",
implicit(V1(x,z,-0.5)-V12,x,1,20,z,1,20),
color=gray,key="s=1,Cobb Douglas",
implicit(x^0.5*z^0.5 - CD1, x,1,20,z,1,20)
)$

## Three Goods

Adding a third good to the utility function can show how the consumption pattern
of goods other than leisure is affected by the wage rate. The function to be used
is the extension of the CES function that appears in the preceding exercise set.
Analysis of the effect of a wage change must be conducted using numerical 
analysis, so  we use numerical analysis from the beginning. The effect of w is 
being considered, so we set px = py =1.

To enter the utility function and the budget function use these commands:
U: (x^0.8 + z^0.8)^(1/0.8)*(y^-4.0 + z^-4.0)^(-1/4.0); and
B: 40+w*(100-z)-(x + y);. 

/*Input. Execute (ctrl-enter) for results */
kill(all)$ ratprint:false$ fpprintprec:5$
U: (x^0.8 + z^0.8)^(1/0.8)*(y^-4.0 + z^-4.0)^(-1/4.0);
B: 40+w*(100-z)-(x + y);

We will use mnewton below. This iterative search progam works best if reasonal
guesses are provided intially.  For this purpose, we will draw a graph to 
represents U and B. Before proceeding, we should determine a value of U that
is roughly the value that will be determined numerically. Use solve(subst(w=1,B),z);
to confirm that z = 140 - (x + y). Use that relationship to select a set of x, y, and z
values that are consistent with B and insert these values into U; assign the name 
U0 to the resulting value.

/*Input. Execute (ctrl-enter) for results */
solve(subst(w=1,B),z);
/*
Use whatever values you like, but stay away from
very small values for x, y, or z.
*/
U0: subst([x=30,y=30,z=50.0],U);

Use wxdraw3d (or draw3d if you prefer an image that you can enlarge and rotate)
to examine B and U. Use the implicit option twice. The first tme, it is applied to 
U - U0. The second implicit function is B, evaluated at w = 1.

The graph will show that the budget line intersects the 3-D indifference 
map. This mean, of course, the the selected values of x, y, and z are not
optimal, and that a higher value of U is possible.

/*Input. Execute (ctrl-enter) for results */
wxdraw3d(view=[70,30],dimensions=[480,480],
xtics=60,ytics=60,ztics=60,xlabel="x",ylabel="y",
implicit(U-U0,x,1,100,y,1,100,z,1,100), color=green,
implicit(subst(w=1,B),x,0,140,y,0,140,z,0,140),
dimensions=[640,640]  )$

Create a list of three first-order condtions. The first is dU/dz / dU/dx = w,
the second is that dU/dz / dU/dz = w, and the third is B. Assign a name 
to this list.

/*Input. Execute (ctrl-enter) for results */
foc3: [diff(U,z)/diff(U,x)-w, diff(U,z)/diff(U,y)=w, B]$
/*
Note the slightly different ways that the first two 
conditions are expressed.
*/
transpose(matrix(foc3));

Load mnewton and apply mnewton to the list of first-order condtions, given
that w = 1. Assign the name xyz10 (for x, y, z w = 1.0) to the resulting list
of values.

/*Input. Execute (ctrl-enter) for results */
load(mnewton)$ foc310:subst(w=1.0,foc3)$
mnewton(foc310,[x,y,z],[40,40,40]);
xyz10: %[1];

Substitute xyz10 into the list of first-order conditions to confirm that these
conditions are satisfied. Also, substitute the values into U to determine the
maximum attainable utility level given w = 1.0.

/*Input. Execute (ctrl-enter) for results */
subst(xyz10,[foc310, U]);

Now let w = 1.5, find the resulting list of x, y, and z values and assign
that list the name xyz15. Discuss the relatively large increase in x.

/*Input. Execute (ctrl-enter) for results */
foc315: subst(w=1.5,foc3)$
xyz15: mnewton(foc315,[x,y,z],[40,40,40])[1];

Confirm that the first-order conditions are satisfied, and determine how
much the higher wage rate affects this measure of utiliy.

/*Input. Execute (ctrl-enter) for results */
subst(xyz15,[foc315,U]);