Tuesday, September 8, 2015

IRR using the Newton Raphson Method

Popular computer application such as MS Excel has made analytical solutions easier to obtain. In the past, solving a polynomial of higher degree than 3 was both time consuming and cumbersome. The easiness that MS Excel offers has, however, a drawback in terms of our understanding of methods and procedures. Take for example, the computation of an internal rate of return (IRR). Easy done with a financial calculator or with the Excel function =IRR(c0, c1, ..., cn, guess). The easiness is still involved for more complex problems such as obtaining an IRR from a combination of time-limited cash flows and a perpetuity. Using Goal seek does the work.
This semester I am again teaching Corporate Finance based on Principles of Corporate Finance by R.A. Brealey, S.C. Myers and F. Allen. In chapter 5 on pages 139-141 of the 10th Global edition, they are elaborating on why the IRR rule is unreliable for mutually exclusive projects. They present three projects (F, G and H) with F showing the highest IRR but the lowest NPV. In the building up of the argument, they report the IRR and the NPV for each project. Unfortunately, the majority of my students does not see how they got their IRR for the incremental cash flow between G and F. While the IRR for a perpetuity is easy to obtain, an IRR of a project with cash flows over a limited number of years followed by a perpetuity is not.
The cash flows for F are -$9,000 at t=0, $6,000 at t=1, $5,000 at t=2, $4,000 at t=3, and 0 afterwards. There is a unique IRR for F since there is no a shift in the sign of the cash flows. Using a financial calculator, the IRR is 33%. What about if we are left with no other alternatives than solving it by hand? How we go about obtaining the IRR? I will make the problem more complex by looking at the incremental cash flows on page 141 of the same book and edition. But before, let us get the IRR for G, which cash flow is a perpetuity.
The cash flows for G are -$9,000 at t=0 and $1,800 for ever. The IRR is the rate that makes NPV=0. Therefore, from 0=-$9,000+($1,800/IRR), we get IRR = $1,800/$9,000 = 0.2 or 20%.
Comparing F with G in terms of NPV, G is better than F. However, better than F if the discount rate is less than the rate at which F and G are equal. This is the IRR we need to know how to find. It is actually 15.6%. But how it was obtained? That is the question.
A financial calculator does not completely help in this case. Since you obviously will not be allowed to use Excel in an exam except a financial calculator, a better way to get it manually is to use the Newton Raphson Method, which solves equations of the form f(x)=0.
This is an iterative method to find a solution to an equation with a degree greater than 1.
The incremental cash flow (G-F) are 0 at t=0, -4200 at t=1, -3200 at t=2, -2200 at t=3, 1800 at t=4, and 1800 for ever.
The Newton Raphson method is given by x(n+1) = x(n) - (f(x)/f'(x)), where n=0,1,...,N, N is the number of iterations, f(x) is the equation that is set equal to 0, and f'(x) is the first derivative of f(x).
In our case,
f(x) = -4200(1+r)^(-1)+-3200(1+r)^(-2)+-2200(1+r)^(-3)+1800/r(1+r)^3
f'(x) = -4200(1+r)^(-2)+6400(1+r)^(-3)+6600(1+r)^(-4)-1800[((1+r)^3+3r(1+r)^2))/(r(1+r)^3)^2
where r = IRR and a simple expression for the term in bold is (-1800/r^2)((1+4r)/(1+r)^4).
Now let start by setting x0=10% and getting the sum of f(x0) and f'(x0), respectively.
Iteration 1
x0=0.1
sum of f(x0) = 5,407.964
sum of f'(x0) = -159,332
x1 = 0.1 - (5407.964/-159332) = 0.133941
error bound 1 (e1)= x1 - x0 = 0.133941 - 0.1 = 0.033941 which is greater than 0.000001 (the tolerance level)
Iteration 2
x1=0.133941
sum of f(x1) = 1515.4
sum of f'(x1) = -81549.9
x2 = 0.133941 - (1515.4/-81549.9) = 0.152525
e2 = 0.152525 - 0.133941 = 0.018583 which is greater than the tolerance level
Iteration 3
x2=0.152525
sum of f(x2) = 218.403
sum of f'(x2) = -59523.1
x3 = 0.156194
e3 = 0.00369 which is  greater than the tolerance level
Iteration 4
x3=0.156194
sum of f(x3) = 6.344567
sum of f'(x3) = -56107.2
x4 = 0.156307
e4 = 0.000113 which is greater than the tolerance level
Iteration 5
x4=0.156307
sum of f(x4) = 0.00573
sum of f'(x4) = -56005.9
x5 = 0.156307
e5 = 0.0000001 which is less than the tolerance level.
As we not getting further the procedure has converged to an IRR that is 15.631%.
I will not ask such a problem in an exam, but my students' self confidence is boosted by getting a sense of how their brains work through the mirror of the Newton Raphson iterative method.

Be blessed!

Sunday, April 26, 2015

Who did what?

The Democratic Republic of Congo (DRC) has experienced so far four different presidency regimes. The presidency of Joseph Kasavubu lasted 5 years and accumulated an average foreign aid of $100,560,000 per year. Data on external debt and interest payments are not available from the world bank database for the DRC from 1960 to 1965.
The presidency of Mobutu Sese Seko is the longest so far. It lasted 32 years. Started on Wednesday November 24, 1965 with a military coup, Mobutu's regime ended as it started on Saturday May 17, 1997. The external debt stayed at an average of $6,256,484,259.26 per year. Interest payments to foreign creditors were on average $224,076,451.61 per year. Foreign creditors showed also mercy. They forgave an average of $14,174,814.81 per year of the DRC's debt. The DRC received foreign aid averaging $224,076,451.61 per year. It is difficult to determine the share of foreign aid that was military aid, financial aid, and technical assistance aid. If we have to consider foreign aid as a financial inflow to the DRC, Mobutu has only paid $52,560,193.91 per year.
The presidency of Laurent Desire Kabila started on Saturday May 17, 1997 and ended abruptly on Wednesday January 17, 2001. The foreign debt portfolio was $12,468,428,600.00 on average per year during the LD Kabila's regime. However, since Mobutu left behind a debt averaging $6,256,484,259.26 per year, LD Kabila's contribution to the DRC's external debt is $6,211,944,340.74. For someone who stayed in power for less than 4 years, it is a huge burden he left behind him. It implies that the whole war against Mobutu costed billions of dollars to Congolese. From this perspective, LD Kabila bought his presidency not only with his own life, but also with billions of dollar. LD Kabila was a bad debtor. He only paid $2,199,000.00 in interests and principals. Debt forgiveness during his presidency was on average $11,650,000.00, whereas foreign aid was on average $109,267,500.00 per year.
The current president succeeded his farther. Joseph Kabange Kabila is by far the best president in terms of debt forgiveness, accumulated debt, foreign aid, and interest payments. The average foreign debt is $9,851,324,461.54 per year, but his own contribution to the debt burden is only $2,617,104,138.48 on average. He is the champion of foreign aids. It amounts to $1,870,415,384.62 on average per year. He is a good debtor. He pays on average $197,808,076.92 per year. Joseph Kabila is definitely the president that has brought the foreign debt down. Debt forgiveness is on average $1,286,101,538.46.
These figures show clearly that the worst performer of all the 3 presidents (Kasavubu, excluded) is LD Kabila whose actions impacted negatively on the country. People support or hate individuals instead of policies. A bad policy does not become a good policy simply because a president said so. LD Kabila played a zero-sum game, and lost. Loving your country does not mean ignoring bilateral and multilateral agreements. Loving your country does not mean not paying your debt.
Congolese do not look at facts. If they did they would have been able to support Joseph Kabila in a number of economic and financial issues.
These figures give a clear indication on why the international community has supported Joseph Kabila. Not only he pays his debt, but he also has contributed to the reduction of the country's debt burden. If you want be loved by the international community, you should first pay your debt, and second respect your words. LD Kabila did not. He was killed.

Saturday, April 25, 2015

Roads to failures

The Democratic Republic Congo (DRC) is a paradox of modern times. The country was expected to develop at a rate closer to that of Asian tigers. Many countries in the East Asia visited the DRC in the 1960s to take examples of its burgeoning agricultural economy. Many Africans came to Congo either to work or to study. It was a Country of the future. The war of 1960-1965 seems not to destroy the tools of production in many of the provinces of the Congo. Congolese who pursued their studies abroad returned home and they were the first generation of the Congolese elite.
When Mandela was arrested in 1962, he had faith that the DRC will become sooner than later a nation Africans will be proud of. He was obviously disappointed after his release from prison to learn that the DRC has became much poorer than South Africa. He could see by his own eyes that Congolese were many living in South Africa. The richest among them traveled there to cure themselves. Back home hospitals existed, but without skilled medical doctors, drugs, and medical tools, it was not thinkable to visit these houses of desolation.
The university of Kinshasa took its own road. Books were stolen. Resources were transferred from the public institution to private institutions. Students were intellectually and physically abused. Students were arrested for voicing their opinion about the founding president. PhD holders became full professors without showing any publication in peer-reviewed international journals. Those in power hated those exceptional professors preaching ethics, moral, and sciences of thoughts. It was not acceptable to teach students to think critically, to reinvent the Congo. and to transform the present in something brighter. They decided to make prominent professors ministers of toys and pleasures. The house of knowledge became the house of intellectual and physical prostitution.
When you examine the data from the 60s, you reach one conclusion. It was more difficult to get poorer than richer, but we did it all. We became poorer than ever in our history. We already were far behind other advanced nations technologically, but it seems not to bother any one. Since rich we were it was said, we will acquire everything we wanted elsewhere. Obviously, the poverty of mind was eating our brain. Music became an expression of what we want to become. Young Congolese with questionable morality started imposing their view on a generation of Congolese. Singers of questionable quality insulted Congolese from the country side. They presented Kinshasa as the place to be. The message was clear. Let us enjoy life. Only pleasure matters here in Kinshasa.
The government on its side was composed, decomposed, mystified, and nullified. The country adopted a new name without changing the president. With hindsight, Mobutu must have lost his mind. He did not hesitate to invade people's privacy. He was the owner of every thing. He stole foreigners' assets. People working for him developed policies to steal, to take control, and to be exempted from any future accountability. Data were not produced. State documents were intentionally destroyed. Statistics were the enemy to keep afar. Mobutu and his friends were fighting the state. Not longer enough, they decide to be the state themselves. Mobutu became godfather. Mobutu was not a mathematician, but he did invent one equality: "One Farther = One Chief = One Country".

Sunday, April 19, 2015

Estimating standard errors in Excel

I will estimate the following model
Y(t) = a + bX(t) + e(t)
Y(t) is the GDP per Capita growth in the Democratic Republic of Congo (DRC).
X(t) is the change in the price of copper.
t indexes years.
the sample period is from 1995 to 2013.
e(t) is an error term.
a and b are unknown coefficients.
The null hypothesis is that change in the price of copper is not significantly related to the DRC's growth, even though copper is an abundant resource in the DRC that for long has greatly contributed to the state budget.
Copper price returns (X) = [-24.62%, -0.79%, -31.95%, -5.03%, 14.23%, -13.89%, -1.20%, 13.18%, 47.67%, 24.97%, 60.28%, 5.73%, -2.31%, -30.06%, 38.06%, 15.84%, -10.32%, -8.25%]
ones = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]'
growth (Y) = [-7.41%, -8.00%, 0.00%, -8.70%, 24.12%, 0.00%, 35.67%, -16.25%, 11.12%, 10.01%, 9.10%, 12.26%, 10.92%, 3.39%, 6.45%, 3.08%, 11.44%, 7.80%]'
You can run a simple regression under Data, Data Analysis, and regression. What follows here is more a curiosity than a real challenge to estimate the unknown coefficients. However, you are losing nothing knowing what the program does by following its steps.
We know from the introductory course in statistics that the unknown coefficients are stack into a vector of coefficients, beta, which is here
beta = [a, b]'
beta = (X'X)^(-1)X'Y
X is a matrix including all the explanatory variables. Our explanatory variables are X(t) and ones with n by 2 dimension (nx2), which means that (X'X) gives a 2x2 matrix. In excel, select a 2 by 2 area and write in the first cell of the selected area the following
m1 = minverse(mmult(transpose(range of Xs),range of Xs)), and take ctrl+shift+enter
The dimension of X'Y is pxn nx1, giving px1, where p is the number of coefficients. Select two cells in a column, then write
m2 = mmult(transpose(range of Xs),range of Y), and take ctrl+shift+enter
The dimension of (X'X^(-1)X'Y is px1. Therefore select two cells in a column and write in the first cell of the selected area
m3 = mmult(transpose(m1,m2), and take ctrl+shift+enter
If you used the data above, a=0.052971 and b=0.105249.
It seems to exist a positive relationship between change in gdp and change in copper price. To make sure that such relationship is statistically significant we need to estimate the standard error of the estimates.
We first have to estimate the residual standard deviation. The dimension of the error is nx1, which suggests we have to select a range of the same dimension as our data. In the first cell of the select range write the following:
e = (range of y) - mmult(range of Xs,beta), and take ctrl+shift+enter
We also estimate the dependent variable residuals as y - average of y next to the column of e as
w = (range of y) - average(range of y), and take ctrl+shift+enter
We will compute both the sum of residual squares (ssr) and the total sum of squares (sst).
In a cell write to obtain
ssr = mmult(transpose(range of e),range of e)), and take ctrl+shift+enter => 0.24077
In another cell write to obtain
sst = mmult(transpose(range of w),range of w)), and take ctrl+shift+enter => 0.253078
We compute the residual variance as the ratio of ssr to n-p, where n is the number of observations.
In a cell write to obtain
n = count(range of ones) => 18
In another cell write to obtain
var = (ssr/(n-2))
In another cell write to obtain
sigma = var^0.5 = 0.122673
We compute the r-square as 1 minus the ratio of ssr to sst.
In a cell write to obtain
rsq = 1-(ssr/sst) = 0.048605
We compute the adjusted r-square as 1 - ((n-1)/(n-p))(1-rsq). In a cell write to obtain
arsq = 1 - ((n-1)/(n-2))*(1-rsq) = -0.01086
The standard error of a and b are sigma times their corresponding values in m1. The diagonal values in m1 are positive. use = to arrange the two values in a column. So, this is the diag vector. Select two cells in the column next to the estimated coefficients and write in the first cell of the selected range
s.e. = sqrt(mmult(range of diag), var), and take ctrl+shift+enter
The s.e. of a and b are 0.029514 and 0.116412, respectively. So, the t-stat for a and b are 1.8 and 0.9, respectively; far below 1.95.
We conclude that change in price of copper does not significantly impact the gdp growth of the DRC. We need may be to extend our model by including other variables and more data points. However, we have shown that we can estimate the unknown coefficients and their standard errors in MS Excel using the matrix language.




Saturday, April 18, 2015

A simple active portfolio

The Treynor and Black (1973) model offers a simple procedure to add a stock with a significant alpha to the passive market portfolio. The main ingredients of the model are the stock alpha (abnormal return), the stock beta, and the stock residual variance. Additional statistics are the market risk premium, and the market variance.
The case where there is only one stock, it is easy since it requires only few steps.
Suppose you have estimated a simple index model, where you regressed a stock excess return on a constant and the market excess return. Suppose both the constant and the beta are significant coefficients. Your alpha = 1.75%, beta = 1.75, residual standard deviation is 30%, the market standard deviation is 25%, the risk-free rate (rf) is 3%, and the market return (rm) is 14%.
The first step is to compute the ratio of alpha to the stock variance. This ratio is the base of the model, and it is referred to as the information variance ratio (IR).
IR = alpha/residual variance = 1.75%/30%^2  = 0.1944
The second step is to compute the ratio of the market risk premium (MRP) to the market variance, which is referred to as the market price of risk (MPR)
MRP = rm - rf = 14% - 3% = 11%
MPR = MRP/market variance = 11%/25%^2 = 1.76
The third step is to compute the ratio of IR to mpr (W0), which gives the risk-unadjusted investment proportion in the stock.
W0 = IR/MPR = 0.1944/1.76 = 0.11048
The fourth step is to adjust W0 for the beta risk. This is the case when beta is different from 1.
W1 = W0/(1+W0(1-beta)) = 0.11048/(1+0.11048(1-1.75)) = 0.12046.
W2 = 1 - W1 = 1 - 0.12046 = 0.87954
W1 is the investment proportion in the stock, whereas W2 is the investment proportion in the passive market portfolio.
The last step to obtain the performance of the active portfolio (AP) is simplified, where the optimal investment proportions do not appear.
AP = (SM^2 + alpha^2/residual variance)^0.5, where SM is the market Sharpe ratio
SM = 11%/25% = 0.44
AP = (0.44^2 + 1.75^2/30%^2)^0.5 = 0.44385
An improvement of 0.0583 over the passive market portfolio
***
The same steps apply when dealing with a number of stocks with significant alphas. Suppose the following:
alpha = [0.001, 0.0005, 0.021, 0.00135]', where alpha is a transposed row vector
sigma = [0.15, 0.08, 0.3, 0.18]', where sigma is a transposed row of standard deviations
ones = [1, 1, 1, 1]', where ones is a transposed row of ones
beta = [1.7, 1.1, 1.95,0.95]', where beta is a transposed row of betas
rho = [0.2, 0.35, 0.7, 0.8, -0.35]', where rho gives the correlation for r12, r13, r14, r23, and r34.
To obtain W1 for each of the stock, we use Excel. Let me give the formula in two parts. Start by making a 4 by 4 variance covariance matrix (VCM), and write in the cell the following
a = minverse(mmult(mmult(transpose(alpha),inverse(VCM)),ones), and take ctrl+shift+enter
a is a scalar. For b select 4 cells in a column and write in the first of the selected cells
b = mmult(inverse(VCM),alpha), and take ctrl+shift+enter
c = mmult(a,b), and take+shift+enter giving W*
bp = mmult(transpose(W*),beta), and take ctrl+shift+enter, where bp is the beta portfolio
ap = mmult(transpose(W*),alpha), and take ctrl+shift+enter, where ap is the alpha portfolio
vp = mmult(mmult(transpose(W*),VCM),W*), where vp is the portfolio variance
W0* = (ap/vp)/MPR = 0.2423
W1* = W0*/(1+W0*(1-bp)) = 0.2367
W2* = 1 - W1* = 0.7633
AP* = (SM^2 + ap^2/vp)^0.5 = 0.447903
An improvement of  0.0838 over the passive market portfolio
***





Thursday, April 16, 2015

Fear

Fear is a silent prayer. It sits deep inside. It guides thoughts. It is a power of some sort. I see it as a secret agent without announcing himself. An invisible agent, powerful, not refusing a pleasure to enter your dream.
Fear does not need an instructor. They say we are born with a fear to be abandoned and a fear to fall.
Fear shows the limit of life. A territory where life will be impossible to continue, not as I have it, but as I share it with others. Life does not exist in one individual, it only exists in us as a group of human beings.
 Don't be afraid, Jesus Christ said. Those are one of the words he pronounced not longer before himself needed to fight his own fear. Those are also one of the words for which we continue searching for the "true" meaning.
When does somebody tell you not to be afraid? When the hurdle is higher than normal. Does saying 'don't be afraid' make us not to be afraid? It is a spiritual communication. It is not the physical challenge we fear. We fear the idea of taking the challenge.
Ideas make us, make the world. Because ideas guide our future, controlling these ideas is the only policy of domination. Once all the channels are closed, we become prisoners. We are not free any longer to think by ourselves. It is as we cannot live without the freedom to use the alphabet in the way we want. It is as we cannot live without the freedom to use symbols and figures to express ourselves.
We don't fear to die. We want to walk to our death free. 

Monday, April 13, 2015

What about us?

The game of life you have both to play it and to watch it. If you only try either to play it or to watch it, you lose it. Of course, it is about being specialized to be able to play at least one game of interest. It is a fact of life that people are happier when they both play and watch. It is as to say you have to give and to receive. It is as to say you have to produce what is consumed, and to consume what is produced. Between playing and watching, giving and receiving, and producing and consuming, there should be a medium of exchange.
Countries differ in terms of the number of games, players, and spectators. More games is synonym of more production, consumption, and exchange opportunities. More players is synonym of more production tools. More spectators is synonym of more consumers.
We are survivors because we like to play games. We have invented many games since we are around. We made some games longer, other shorter.
At one point, we decided to invent a game where our meat is grilled. We could have continued eating raw meat. But grilling it made the game longer, more interesting, and eventually healthier. Surely, in the beginning someone did not want to grill his share of meat. It was for him time consuming.
However, such a game suggests that we invented a way to grill. It needed a new technology. It also needed calibration, a transformation process to make it not only better, but optimal.
I am sure not everyone did the right thing at the same time. Doubt is something that has saved human being from insanity. Without doubting, we would have killed ourselves because a god wanted so. But as we doubted, we saved ourselves from trouble.
May be only one person was convinced by the transformation process. The majority eat their raw meat, and went to hunt again. Some did not come back, attacked by a ferocious animal, or by another tribe nearby. The one who stayed behind grilling his meat waited them, they came back exhausted while he was contemplating the stars. They tried to explain, but they were too tired. They went to bed. Soon they forgot themselves in irrational dreams. Many days after, the stubborn but survivors realized that sitting around a fire was a more interesting game than hunting in the middle of night. The fire lured them. It was enjoyable to be around and to let something else take over. They could see each other in the eyes, make remarks. They played together. Soon it became a special moment to talk about something from the inside. They played more and more.
While sitting someone told someone else that it would be interesting to fool people living in the next village. They went there pretending something. They found them fighting each other. The game for them was interesting. But as they approached, the smell of a grilled meat reached them. They wanted to ask what it was. They told them that the grilled meat was a new game they have discovered. It is from an area where grilled meats drop from the sky. Those who heard asked more. They wanted to know the route there. They went, they never came back. Those behind laughed. They took their wives, they made their sons slaves, they were the masters.
All kind of stories could be told to an ignorant person who did not assist to the transformation process, who did not see that it was a raw meat, there was a fire, there was people around waiting, there was a moment where they all were puzzled by the transformation. They could have said to those absent that the grilled meat was the same meat but transformed. A simple industry with a simple technology separated people from the same environment.
In countries, where different games are organized to increase the chance for every one to play at least a game that can be watched by someone else, people tend to produce more independently of the political system ruling them. In countries where games are few, people produce less, poverty tends to be the share of those who watch, and wealth the share of those who play.
All societies are inherently unequal. Different beliefs lead to different choices.