This is a short video to show how I solve for the optimal quantity to reach profit maximization by hand and using the Financial calculator.
This is a short video to show how I solve for the optimal quantity to reach profit maximization by hand and using the Financial calculator.
Usually people come across various forms of loans in their lifetime, which the mostly commonly seen in the USA are fixed rate loan for automobiles or houses. There is usually a fixed payment each period and by the end of the loan, all payments including interests and principals will be paid in full. However, how is the monthly payment calculated?
If you got a quote from the lender, the quickest way is to use some online calculators for mortgages and pretty much everything is a plug and play. In order to derive the equation on your own, there are also a few approaches. And here I am going to cover some of them. Using a financial calculator, using time value of money and the hard core way, derive the monthly payment using the definition of loan.
It is pretty easy to use the financial calculator to calculate the monthly payment. I uploaded a Youtube video.
You can also quickly check with the calculator in Google to confirm the calculation was right.
In finance, people like to evaluate the intrinsic value of an asset to be the net present value of all future cashflows. In a 30 year fix rate mortgage with equal monthly payment, we can assume that the monthly payment has the value pmt. And for the payment at period N, the net present value of pmt should be discounted using the internal rate of return which should be period interest rate, monthly interest rate.
NPV(pmt_12) = pmt / (1+r)^(12) where r = Annual Interest Rate / 12
In this case the net present value of all future cashflows will be sum of all monthly payments.
put the numbers into the equation, we got the right result.
LIFO(Last In First Out) is a commonly used inventory recognition method, mostly in the United States. It will assume that the latest inventory will be sold first from the accounting perspective, not necessarily physically. Since the inventory cost usually varies, in that case, even for the same physical goods and same resale, different ways of recognition the cost might lead to different financial performance on the paper. LIFO is said to have positive impact on the cashflow when inventory’s cost are uptrending because recognizing expensive cost will reduce profit, hence, less tax.
This article will focus on a terminology which is called LIFO reserve. It is defined to be the difference between inventory amount recognized under two different methods LIFO and FIFO. By having LIFO reserve, inventory value and COGS under one method can be converted to another easily.
Now let’s see how to adjust some of the numbers when compare a company reported under LIFO to the ones that aren’t.
The inventory amount under LIFO will need to add the LIFO reserve in order to reach the inventory amount under FIFO
COGS under LIFO should subtract the increase in LIFO reserve to reach COGS under FIFO
Now let’s explain why, we add a number to the end of each variable to represent the year, XXX_1 means year one, so on and so forth. Based on the definition:
LIFO_reserve_1 = inventory_FIFO_1 – inventory_LIFO_1 (Equation1)
LIFO_reserve_2 = inventory_FIFO_2 – inventory_LIFO_2 (Equation2)
inventory_FIFO_2 = inventory_FIFO_1 + Inventory Bought_FIFO – Inventory Sold_FIFO (Equation 3)
inventory_LIFO_2 = inventory_LIFO_1 + Inventory Bought_LIFO – Inventory Sold_LIFO (Equation 4)
Under different methods, inventory bought is the same because it is fixed money paid for new inventory. The wiggle room is that inventory sold can be adjusted depends on which inventory you assume to be sold.
By subtracting Equation 4 from Equation 3, we have
inventory_FIFO_2 – inventory_LIFO_2 = inventory_FIFO_1 -inventory_LIFO_1 – Inventory Sold_FIFO +Inventory Sold_LIFO
Inventory_Sold_LIFO – Inventory_Sold_FIFO = (inventory_FIFO_2 – inventory_LIFO_2) – (inventory_FIFO_1 – inventory_LIFO_1) = LIFO_reserve_2 – LIFO_reserve_1 = increment_LIFO_reserve
In one of the CFA Level1 practice problems, there is a problem which well explained how everything fits together.
The return on assets under LIFO for 2014 is 178/5570 = 3.2%.
Under FIFO, we need to adjust (increase) not only the net income due to the decreasing profit but also increase the asset by adding up the LIFO reserve. Both the numerator and denominator will increase by to different level.
Net_Income_FIFO = Net_Income_LIFO + LIFO_reserve_change adjusted by tax
Total_asset_FIFO = Total_asset_LIFO + LIFO_reserve_2014 adjusted by tax
Net_income_FIFO/Total_asset_FIFO = Net_income_LIFO + (867-547)*(1-t) / [Total_asset_LIFO + 867 * (1-t)] = (178 +(867-547)*(1-33.3%)) / (5570 +(867)*(1-33.3%)) = 6.4%.
The return on asset pretty much doubled under FIFO.
(867-547)*(1-33.3%)) / (867)*(1-33.3%)) = 36% which is pretty high. In that case, by analyzing the LIFO reserve, especially, the change percent in the lifo reserve and how much lifo reserve relative to total asset will give you a good picture of return on assets under different methods.
When reading about the financial statements for any given company, or any spreadsheet in general, a situation any person constantly run into is numbers are presented in a slightly inconsistent way regarding the signs (+/-). For example, if there is an expense line item, people might assume it is an expense (outflow of cash) and will present the way as is. Sometimes, people will actually consider expense is different from income and will present it in a different way from revenue by including the numbers in a brackets like (400). Things can get really complex because there are metrics derived from a series of basic metrics like net income (bottom line on statement of operations) which should be the ultimate result after adding/subtracting the relevant gains and losses. I always have a hard time by calculating the final results because the signs for each line always confuse me. In the end, I ended up playing with signs for each line with my fingers crossed, wishing that I will be “lucky” enough to make the math work.
Above is part of the cashflow statement from unaudited 10-Q for Arrow Electronics, Inc., a public listed company. They did a great job because the bottomline for the cash used for operations are a simple arithmetic sum of all the number, given you treat numbers in parenthesis as negative, hence to subtract.
However, I want to use this data as an example to see how my script will be able to “auto detect” that the numbers in parenthesis should actually be subtracted. The Python script will take a brute force approach to find the right signs for each line item in order to reach to the right “bottom line”. The idea is very simple, it will switch signs for each line (positive, negative or exclusion) until it finds all the right sign and approximate to the bottomline within certain error tolerance.
Now let’s take a quick look at the implementation.
First, we load all the data points into a data structure, since we are not sure about the signs for each line, or even should we include one line item or notat all, we will treat them all the same as positive numbers to get started. Benchmark variable is the final answer that we need to match. Base variable is 3 because for each number, it can either be treated as a positive number, a negative number or not included (for example, there could be an intermediate variable. Including the intermediate variable along with all the basic variables will lead to double count).
baseN is a utility function that I borrowed from Stackoverflow, it can convert from a integer into a string format representation of any base. For example, baseN(4, 3) will be 11. We will use this function to help us loop through all the possibilities.
Then the next step is to try out all the possible combinations. Frankly speaking, I should have done way more research than I did but the first thought that came to my mind is to loop through all the possible combinations and represent the each state as a number of base 3. For example, in total, we have 11 elements. Then we have a number of 11 digits which each digital can have three states (negative, not included, positive). It can be represented as (0, 1, 2) for each state. In that case.
00,000,000,000 represents a possibility where all numbers should be treated as negative and clearly the total sum will not add up to our benchmark. Then next,
00,000,000,001 represents a situation all numbers except “Other assets and liabilities” 123769 will be negative, and only 123769 will be excluded. And of course, it will not add up.
00,000,000,002 means treat the last number as positive leaving the rest as negative.
00,000,000,010 means treat the second to the last as excluded and the rest of negative.
So on and so forth, when the number keep increasing till 11,111,111,111, then we should have iterated through all the possible combinations, hence, np.power(3, 11) ~ 177K.
Weight is a variable that stores the sign for each variable. The code is pretty straightforward and I just want to clarify that the use of np.isclose is essential because all financial statements do some sort of rounding. It will be really hard to perfectly add up all the numbers and by tuning the error tolerance will be critical, something within 1% is probably a good rule of thumb.
In the end, the final outcome will look like this, as you can see, since I am comparing using the absolute value, the script gives me two answers where it successfully identified the lines items under “changes in assets and liabilities” should be treated as a opposite sign as the rest of the items.
There are several limitations to my implementation just out of the box. The first one will be the scalability. The complexity of this brute force approach will grow exponentially as the number of variables increases.
Here are some interesting ideas for further exploration.
EPS (earnings per share) is a very important ratio in income statement, it is calculated as earnings (net income) attributed to common shareholders divide by common shares outstanding. Actually, it is so important that it is required to include EPS on the face of the income statement.
As you can see, they not only show the EPS, there is also another line right below it which is the diluted EPS. The reason that diluted EPS need to be disclosed to the public is that there are different kinds of equity like preferred stock, convertible stock that has the potential of “diluting” the EPS. How big a difference is can be? Usually it is pretty small, like for Walmart, the earnings per share is only 0.01 but in some cases, the difference can be material enough that investor want to know the potential downside.
Say for example, convertible stock sometimes got paid dividend and can also be converted to certain amount of shares. If not convert, that is the simple calculation for EPS, however, the diluted EPS to evaluate if all the convertible stocks got redeemed into common stock, on one hand, the net income will increase because the earnings that used to go to dividend now can be retained, on the other hand, the number of outstanding common shares also increased due to the conversion. In this case, there is a scenario where the diluted EPS if converted can actually be higher than the basic EPS, if this happens, the diluted EPS sort of loses its meaning of providing a good projection of the potential downside. Both IFRS and GAAP require that this kind of EPS – Antidilutive Security be excluded from the diluted EPS calculation.
Now, let’s do some simple calculation and see under what situation Antidilutive security could exist.
Say a company’s net income is I, number of common shares outstanding is C and number of preferred stock is P. The term for preferred stock is that the annual dividend paid per share is D and it can also be converted to X amount of common stock if wanted.
Basic EPS = (I – P * D) / C
Diluted EPS = I / (C + P * X)
The constrain is that Basic EPS >= Diluted EPS
(I – P * D) / C >= I / (C + P * X)
After a bit transform, we got: X*I – D*C – P * X * D >= 0
I like to rearrange it into the following format:
D <= I / (P + C / X)
This is easy to interpret, P+C/X can be interpreted as if all shared got converted into preferred shares. If the dividend is smaller than if all converted to preferred stocks, then it is dilutive. If not, then it is anti-dilutive which should be excluded. So in this case you can see, if the dividend for the preferred stock is too high, or the conversion X is too small, it is highly likely that the constrain will not hold and it will be anti-dilutive. Also, if the number of preferred stock is substantial, this will also become anti-dilutive.
There is this fantastic TV show Shark Tank from ABC, where startups come to pitch their business to a group of seasoned businessmen/women. The “sharks” will decide if they should invest their own money in those startups, hence, their motivation is to seek for high return and the questions they asked are usually challenging. I have always been asking myself how can the sharks invest that much amount of money, usually hundreds of thousands of money for partial ownership – equity within just a few minutes, and one step further, how can they even tell how much a business worth in the first place? Sometimes, they call out the entrepreneurs “crazy” valuation and sometimes they take the offer the way it is, and sometimes even go beyond what was originally asked.
After watch it for a few seasons, you started to see patterns where they pretty much want to understand their income from revenue, margin (in order to calculate gross profit) and net earnings (take home). Relatively speaking, not that much questions about balance sheet or cashflow. Clearly, their valuation are based on those key financial metrics, but the question is how do they go from those metrics to how much a company worth? Thanks to some of the heated conversations every now and then, the sharks will make similar comments like “you are asking for a valuation X multiple of your earnings, you know that will never happen in Y industry, right?”.
Then you have been told the secret, the next question will be WHY a company’s worth is a multiple their earnings and why that ratio is different across industries?
To determine how much anything worth, there are usually several ways, what is the cost, what is the worth of similar product that have been sold recently, and if you ask someone in finance, they probably will threw you off by saying “the current worth of an asset is the sum of all its future cashflows discounted to today”.
Lots of buzz words, right, “cashflow”, “discount”, “asset”..etc. Do not worry, everything should be pretty straightforward after we go through a every day example.
First is to make sure that we are all on the same page that “one dollar tomorrow is not the same as one dollar today”. This is called the time value of money and can be explained using your interest paying saving account. Say you have a very good bank with an interest rate of 10%. There are lots of details go into how actual interest (yield) could different based on when interest are paid and how often are paid, let’s put it on the side and assume $10 is paid the end of the year if you put $100 at the beginning of the year. The you will have $110 at the beginning of next year and 10%*110 = $11 worth of interest will be paid end of the next year, interest will get higher and higher thanks to the interest built on top of earned interest, everyone favorite compounding. So your $100 dollar today look like “worth more” in the future.
Year 0: $100
Year 1: $110
Year 2: $121
Year N: $100*(1+10%)^N
However, in nature, they are same because you take no risk in this investment since it is the bank (I did not go through 2008 so bear with my naiveness here), you do not have to do any work other than providing capital, last, this kind of investment is open to pretty much everyone. Therefore, any reasonable investor shall “take this for granted” if they decide to park their money somewhere else.
If someone is going to ask you to invest or borrow your money, you should expect they pay you back higher than what they borrow you today, or vice versa, you should expect to lend out lower if they promise to pay you back a fixed amount in the future.
From another perspective, $100 next year will equal to $91 today, the same as $110 to $100 in the previous example; $100 two years will equal to $83 today, the same as $121 to $100. Now, we are ready to look at how a company will generate money for its investors.
A company will bear the goal of making profit, making profit to keep its day to day operations (if not, they will not live long), sometimes even to have some profit after paying for all kinds of expenses which is called the net income / earnings. Earnings sometime are reinvested back to the business to scale up its success and sometimes those extra money will be given back to its investors. Of course, depending on the stage of the company and its potential based on various reasons (industry, business model, environment, ..etc), investors will expect different use of those earnings, that is also why some companies pay dividend up to 10% and some tech companies pay literally no dividend. Let’s say the business that go to shark tank is already operating, has already attracted a fixed group of the customer with returning business, the revenue pay for everything with extra. If I am the owner of this business, we can start by assuming all earnings go to our pocket. Let’s even fixed everything else assuming that from now on, they company will make same amount of earnings ($100K) every year for the future. In that case, it is a pretty good way of collecting cash in the future. Using the idea we mentioned, let’s try to convert all those future annal net income to today’s worth. Shall we use the interest rate above? I will say yes for now, for in reality it is probably not this simple, the risk of running a small business is high, you probably will need to put into effort, so you probably should expect an return rate higher than bank interest.
Year1 -> today: $100K / (1+10%)
Year2 -> today: $100K / (1+10%)^2
Year3 -> today: $100K / (1+10%)^3
YearN -> today: $100K / (1+10%)^N
In order to give away this cashcow to you, the entrepreneur probably will trade you fairly at the price of receiving the same amount of the money in the future.
So sum will be a very simple geometric series where the sum can be represented in the following equation:
valuation = $100K/(1+10%) * (1-q^n) / (1-q) where q=1/1.1=1/(1+rate)
Now that we know the magical multiple is pretty much
valution/earning = (1+r)(1-1/(1+r)^n)/(1-1/(1+r))
I plot out a heatmap based on “multiple” using the number of years and IRR (internal rate of return). The interesting pattern is that as the rate increases, the multiple caps at certain value, the higher the rate, the sooner it flattens and the lower its cap is.
I also expanded the limits of each variable from 1 to 100 and here is the bird view.
As an investor, I might ask myself the question of how long this business might keep making money for me (dividend or capital gain due to reinvested earnings), what will be my required rate that I will expect taking the market interest rate and the premium that I want to add on top of that.
One can easily tell that the bank rate for investors is usually the big index funds and S&P 500 has already achieved an annual return of ~ 11%. If we double that benchmark to 22% as the required rate of return. Then we can see that by holding the company forever will earn no more than 7 times the original investment. Again, the power of compounding, $100 in 7 years will only worth $25, $5 in 15 years and roughly $1 in 23 years.
As you can see, if your business is attractive enough that your investor believe whatever you do will keep existing forever, also, if you can convince your investors that your business is less risky and at the same time, there is no good equivalent on the open market for investors (low interest), then you will position yourself to the top right of the chart. Of course, this article is based on a strong assumption that the earnings is fixed which it is never, it either can operate only for a few years (less than half of the small business survive the first 5 years), or the earnings could be volatile upwards and downwards for various reasons.
But in the end, hopefully this article is helpful to understand how a company worth from the most basic perspective and what are some of the factors investors and entrepreneurs need to pay attention to fairly evaluate and determine a company’s worth.
Part words from Shark Tank again “in sales, we trust”
Within Corporate Finance, there is a focus area where management optimize their cost structure. There are several key measurement to identify business risk under the name of leverage. They use the term elasticity of one percent change in one variable with regard to unit percentage change in another variable. The most commonly used degree of operating leverage and degree of financial leverage.
Attached is a screenshot of how I derived the equation based on the definition.
In the end, the term degree of total leverage is defined as %change in net income over %change in units sold. Once should reach to the conclusion easily that DTL = DOL * DFL
R_i = alpha_i + beta_i * R_m + e_i
where the R_m is the return of the market. You can simply get the monthly return for a given stock and the S&P 500 as the market. Run a linear regression and the slope will be your beta.
Based on this post from Quantitative Finance from Stackexchange, the Beta calculated was based on the monthly return for the past three years. Comparing with our calculation in Python, the number lines up pretty well.
Note: I was using the close price, when using the open price, it was pretty close too. However, the beta calculated using high and low is pretty different from Yahoo Finance.
This article is a visualization of a portfolio of two assets where we see how portfolio return and risk changes as the weight changes and the correlation between the two underlying assets changes.
This is a very typical risk return plot where the horizontal axis represent the risk – standard deviation of the portfolio where the vertical axis represent the expected return of the portfolio. All the data points are color coded by the correlation between the two assets (eg. purple +1, 100% positive correlated). It might not be that obvious, but I set the size of each data point to be the weight for asset 1 where the biggest represent all the capital is allocated to the asset one, and vice versa.
Here is a screenshot of the R code to generate the graph above.
The key takeaway is that given same expected return, you want to diversify your portfolio in a way where underlying assets are more negatively correlated to each other to reduce the risk. This might sounds magical but the math did serve the purpose of proof. However, it is easier to say than doing, if you have an asset that has a good return, but might correlate positively which you will like to replace, in real life, it will be hard to find some alternative with the same return because if a stock is negatively correlated to what you already have, it probably has a subpar return rate (hedging is another thing if that is what you want to achieve).
Just bought a microscope from Omax and this is a link to that model.
I do not have any professional biomedic education other than the one classes taken in high school and that was a moment where several students share a microscope so did not spend any quality time at all, I guess. Now I have my own 🙂
This model support a 1.3MP Digital camera and you only need to use a regular USB cable to connect it to your computer and you are good to go. Based on the description, the software functionality is highly limited on the MacOS platform but for a newbie like me, it is sufficient! The microscope does not come with any slide so I ordered some preprocessed slide from Amscope, now everything is ready, let’s show you a few photos that I have taken.
The first photo is a bee leg and second is actually a piece of napkin, the following are the pine leaf under different resolution.
Image recognition has already been very helpful in facial recognition, object detection and recognition in order to enable cool things like auto tagging, auto driving cars, .etc however, there is also applications at the macro and micro cell. Here is an interesting post from Google explaining how dermatologist use deep learning to detect skin cancer.