load(draw)$ 
set_draw_defaults(draw_realpart=false)$
kill(all)$ fpprintprec:5$ ratprint:false$

# Time

This chapter considers two aspects of time. The first involves the analysis
of decisions whose effects have implications over time for costs or revenues.
The second involves processes that play out over time, in a dynamic fashion.

## Introduction

## Intertemporal Decisions

## Investment

This section applies the reasoning that Section 2 develops to investment.

### Discrete Income Flow

The illustration below represents a one-time investment of $100 that
yields six payments of $25, at the end of years 1, 2, 3, 4, 5, and 6.
The net present value of that investment is stated in the first command.
The second command solves for npv = 0 (that is, for the present value
of the payments to equal $100). The result is a 6th-degree polynomial
expression in terms of r, which is graphed. The graph suggests that 
for r < 0.25 or so, npv > 0. The last command uses find_root( ) to
determine that the critical r value is r = 0.26.

npv:-100+sum(25/(1+r/2)^t,t,1,6); 
solve(npv,r);
wxdraw2d(xaxis = true, xlabel = "r", ylabel = "$",
key = "npv", explicit(npv, r, 0, 1))$
find_root(npv, r, 0, 1);

For larger numbers of periods, the logic is unaffected, though 
the polynomial would be too large to write on the screen. Consider
t = 120 below. (The period here is months, so the annual rate r 
is replaced by the monthly rate r/12.)

npv: -10000 + sum(200/(1+r/12)^t, t, 1,120)$
wxdraw2d(xaxis = true, xlabel = "r", ylabel = "$",
key = "npv", explicit(npv, r, 0, 1))$
find_root(npv, r, 0, 1);

The receipts need not be constant. Here are six quarterly
receipts.

flowlist: [40, 25, 10, 10, 40, 25]$
npv: sum(flowlist[t]/(1+r/4)^t, t, 1, 6) - 100;
wxdraw2d(xaxis = true, xlabel = "r", ylabel = "$",
key = "npv", explicit(npv, r, 0, 1))$
find_root(npv, r, 0,1);

### Continuous Income Flows}

The following example treats a continuous flow of income, one
that follows one path for the first five periods and another
thereafter.

The investment yields npv > 0 for r < 4.51% per period.

assume(r > 0)$   stream: if t < 5 then 10*exp(0.1*t) 
  else 10*exp(0.1*5 - 0.05*(t-5))$
npv : -200 +  integrate(10*exp(0.1*t - r*t),t,0,3)+
integrate(10*exp(0.1*5 -0.05*(t-5) - r*t),t,3,inf);
find_root(npv, r, 0, 1);

The stream is graphed below (left panel) and its npv as a function
of r appears in the right panel.

streamgraph: gr2d(xlabel="Time",ylabel="$ per year",
yrange = [0, 20], key="Receipts, $",explicit(stream, t, 0, 50) )$
npvgraph: gr2d( ylabel="npv ($)",xlabel="r",
 xrange=[0,0.05],xaxis = true,explicit(npv,r,0.01,0.05))$
wxdraw(streamgraph,npvgraph,columns=2, 
 dimensions=[640,360])$

### Risky Investment

Receipts arrive in the future, so the actual values are subject to risk.
This section considers two situations. In the first, the investment must 
be made today, and the riskiness must be integrated into the analysis.
In the second case, the investment can be made either today or in the 
next period (or later). These two situations have different implications
regarding the appropriate criterion for evaluating an investment.

Expected Net Present Value

This example differs from the earlier, simpler one in two respects. First, costs
are incurred for a finite number of periods, after which revenues begin to flow. 
Second, one of two revenue streams will occur, with a probability attached to each. 

The first fact implies that we must compute the present value of the costs. It also
implies that the revenue stream must be discounted twice: first, to the beginning
of the first period in which they are earned (which coincides with the end of the 
last period that costs are incurred), and then to the present.

Note that the pvsuccess expression is rearranged slightly from 
that in the text. The presentation here emphasizes the two-step
process that the comment documents. Also, note a small change
in the Enpv expression. Finally, subst( ) is used; this usage is logically
the same as the command in the text.

probsuccess: 0.25$
/*Discount costs to the present */
pvcost : 100 + (50/r)*(1 - 1/(1+r)^5)$ 

/*Use the formula to discount revenues to the beginning
 of period 6 (end of period 5) and then apply 1/(1+r)^5
 to discount that value to the present */
pvsuccess :  (150*(1 - 1/(1+r)^40)/r)*(1/(1+r)^5)$

/*Calculate npv if success occurs */
npvsuccess : pvsuccess - pvcost$

/*Apply the relevant probabilities. */
Enpv : npvsuccess*probsuccess +(0 - pvcost)*(1-probsuccess)$

/*Determine the critical value of r */
r0: find_root(Enpv, r, 0.001, 1)$

/* Compute a set of values when r = r0 */
subst(r=r0,[pvcost, pvsuccess, npvsuccess, Enpv])$
numbers0 : cons(r0, %)$

/* Compute a set of values when r = 0.15 */
subst(r=.15,[pvcost, pvsuccess, npvsuccess, Enpv])$
numbers15 : cons(0.15, %)$

/* Compute a set of values when r = 0.05 */  
numbers05: subst(r=.05,[pvcost, pvsuccess, npvsuccess, Enpv])$
numbers05:cons(.05,numbers05)$

/*Create a list of names */
names : ["r", "pvcost", "pvsuccess", "npvsuccess","Enpv"]$

/* Create a table */
matrix(names, numbers05, numbers0, numbers15);

Timing of an Investment

In the preceding example, a firm must decide now whether to make an investment.
When investments are of that sort, then undertaking an investment if and only
if the expected present value is positive will, on average, add to the firm's 
value.

Often, however, a firm can postpone making the investment decision, perhaps 
waiting for more information. When waiting is an option, routinely using the
rule sketched in the previous paragraph does not, on average, increase the 
firm's value.

A relatively simple model provides insights into the implications 
being able to opt to invest later for the net present value (NPV) rule. In 
particular, it shows that this approach tends to result in too much investment 
at the present time and not enough waiting and investing later. In this model
a firm can either invest an amount C now or wait until the next period to decide 
whether to invest. The realized return from the investment a random variable V. 

The first expression the first term below, (1 - Vo), is the probability that 
a Vo specific value will result in the investment being made now. 
Vo is the value of the option to make this investment; we wish to determine 
its value. The expected return, if the investment is made now, is the
average of the values between Vo and 1, inclusive, which is (Vo+1)/2, so
the net return in (Vo+1)/2 - C. 

Vo is the probability that a given value V = Vo will cause the 
investment to be postponed. Because this process can be extended 
indefinitely, its expected value is the same in each period, so 
the expected return in period 2 is EVo*Vo, and this value must
be discounted for one period.

expr:EVo=(1-Vo)*((1+Vo)/2-C)+Vo*(EVo/(1+r));

Solve the expression above for EVo and differentiate the solution with 
respect to Vo, the optimal value of which we seek. Setting the derivative 
equal to zero and solving for Vo yields two expressions. The second of the two 
implies that Vo > 1 and can be ignored.

solnEVo: ratsimp(solve(expr, EVo));
diffEVo: ratsimp(diff(rhs(solnEVo[1]),Vo));
solndiff: solve(diffEVo, Vo);

Next define Vo as a function of C and r and plot that function.
Rather than a 3-dimensional graph, we use a set of 2-dimension
representations. The first graph allows very large r values (up
to 200% per period); the second graph constraints r to values
up to 10% per period.

Both graphs show that even if C = 0, Vo > 0, even for very large
r values. In general Vo > C, often much larger, at least for interest
rates in the range that one typically observes. Thus, the expected
NPV rule, which dictates investing whenever V > C, would dictate 
investing even when doing so would result in negative exprected 
net present value.

/*Define an expression for Vo as a function of C and r */
Vo(C, r):=''(rhs(solndiff[1]));   
/*Specify a (very large) maximum interest rate (200% here) */
rmax: 2.0$
/*Create a scenario for in which 0 <= r <= rmax */
rlarge : gr2d(yrange=[0,1],xlabel="r",ylabel="Vo", 
 grid=true,line_width=2, 
 key="C = 0",explicit(Vo(0,r),r,0, rmax), color=red,
 key="C = 0.2",explicit(Vo(0.2,r),r,0,rmax),color=black,
 key="C = 0.4",explicit(Vo(0.4,r),r,0,rmax) )$

/* Create a scenario in which 0 <= r <= rmax/20 */
rsmall:gr2d(xlabel="r",ylabel="Vo",grid=true,key=
"C = 0",explicit(Vo(0,r),r,0,rmax/20),line_width=2,
 key="C = 0.2",explicit(Vo(0.2,r),r,0,rmax/20),color=
 gray,key = "C = 0.4", explicit(Vo(.4,r),r,0,rmax/20))$

/* Draw the graphs */
wxdraw(rlarge,rsmall,dimensions=[480,540])$

TeX:
\section{Investments in Human Capital}
The preceding section discusses criteria that firms or government agencies
might use to evaluate investments in physical capital. This section applies
similar reasoning to investments in one's own productivity. Gary Becker,
the Nobel laureate who developed the reasoning on which the section is 
based, labeled this sort of investment \emph{Human Capital}.
\index{human capital}
\index{investment!human capital}

\subsection{Continuous Income Flow}

We illustrate the human capital model by specifying a functional relationship
that approximates age-earnings profiles. One's earning at any time depends
on the maximum earnings ($ymax$), one's initial earnings ($ymax - a$, one's
age ($18 + t$ in the specification below, on the assumption that one begins
to earn at age 18, when $t = 0$), and the rate at which earnings converge
to $ymax$, which $g$ determines. 
\index{human capital!continuous income flow}

y(ymax, a, g, t) := ymax - a*exp(-g*t)$

TeX:
We assume that two options are available to our 18-year-old.
The first option is to enter the workforce without investing in 
human capital with maximum earning of $ymax = 80$, $a = 30$ (initial
earning of $ymax - a = 50$),  and $g = 0.10$. 

The second option is to leads to a higher maximum earning, $ymax = 100$, 
but with a lower initial earning reflected in $a = 70$ ($ymax - a = 30$. The 

an age-earning profile 
that starts lower, with $ymax - a = 30$,
and which requires an explicit outlay, the present value of which
is $150$ (any number could be substituted). The second option
has two advantages: it yields a maximum income of $ymax = 100$,
and it converges to that higher value relatively rapidly, with $g = 0.15$.

wxdraw2d(user_preamble="set key bottom right",
 yrange=[0,110], xlabel="year",ylabel="$ per year",
 line_type=solid,line_width=2, 
 key="Less Human Capital",
 explicit(y(80,40,0.1,t),t,0,45),
 color=black,key="More Human Capital",
 explicit(y(100,70,0.15,t),t,0,45),
 line_width=1, color=blue,
 key = "ymax=80",explicit(80,t,0,45),
 color=black,key="ymax=100",explicit(100,t,0,45) )$

Integrating the difference between the two expressions that are graphed
above, with discounting at the unknown rate r returns the expression npvdiff.

The find_root( ) command shows that the critical value of r is r = 8.44%,
approximately. If r < 8.44%, then the "More Human Capital" option yields more
wealth.

ratprint:false$  assume(r>0)$
npvdiff: integrate(y(100,70,0.15,t)/exp(r*t) - 
  y(80,40,0.1,t)/exp(r*t), t, 0, 45) - 150;
r_critical: find_root(npvdiff, r, .001, 1);

Without discounting (r = 0), the "High Human Capital" option yields a much larger value.

[totalMHC: float(integrate(y(100,70,0.15,t),t,0,45)),
totalLHC: float(integrate(y(80,40,0.1,t), t, 0, 45)),
totalMHC - totalLHC - 150];

### Discrete Income Flow

By applying the function above to a list of years, we can examine the investment
decision when payments are discrete rather than continuous.

/* Assume that the worker is 20 years old when deciding and will work 
 unit age = 65 */
tlist:makelist(i-1,i,1,46)$ 

/*Create a list of 26 income differences, undiscounted */ 
ydifflist: y(100,70,0.15,tlist) - y(80, 40,0.10,tlist)$

/* Discount the v(%i79) b_per_year(T, K, r) := (K*exp(r*T)/(K + exp(r*T) - 1))/T$ 
diff_b_per_year : diff(b_per_year(T, 1000, 0.20), T)$
solve(%, T);   Tmsy : round(find_root(%[1], T, 10, 100))$
transpose(matrix(["Max. sustainable yield period =",
"Total biomass as period's end =",
"PV with maximum sustainable yield =",
"PV with optimal rotation ="],[Tmsy,b(Tmsy,1000,0.20),
 float(PV(Tmsy,  1,  0.05)),float(PV(Topt,  1,  0.05))],
 ["years","units","dollars","dollars"]  ));
(%o81) [T=(5*%e^(T/5)+4995)/999]
(%o83) matrix(["Max. sustainable yield period =",45,"years"],["Total biomass as period's end =",890.24,"units"],["PV with maximum sustainable yield =",104.89,"dollars"],["PV with optimal rotation =",117.7,"dollars"])alues in ydifflist */
discountlist: ydifflist/(1+r_critical)^tlist$

wxdraw2d(user_preamble="set key bottom",xaxis=true,
 xlabel="Years: Age = Years + 18",ylabel="$ per year",
 axis_top=false,key="undiscounted differences", 
 points(ydifflist),point_type =2, color=red,
 key="discounted differences",points(discountlist))$

The next cell shows the undiscounted and discounted differences, with the
critical discount rate used above used to compute discounted values. The
discounted diffference is $153.0631, approximately the  $150 initial investment.

sum(ydifflist[i],i,1,46);
sum(discountlist[i],i,1,46);

The sum( ) command can be used in place of the integrate( ) command. The [i] 
subscript is used to define the range over which summation is to occur.

discounteddifferences: (y(100,70,0.15,tlist) - 
  y(80, 40,0.10,tlist))/(1+r)^tlist;   
find_root(
  sum(discounteddifferences[i],i,1,46)-150,r,0.001,1);