Tuesday, September 24, 2024

Predicting Berkshire Hathaway stock price from current "Price/Book" Ratio

On the one hand, if the stock market is "Efficient", then one should not be able to predict how much the stock will go up or down from its current price based on information other than the stock price. The Efficient Market Hypothesis (EMH) teaches us that all the information about a company is available and priced into its current stock price. If we could predict from other information that the stock would rise, then that would cause the current price of the stock to rise in anticipation of this.

On the other hand, if we find we can predict outsize or undersize growth in stock price based on non-price information, then the EMH is by no means completely true, and we may be able to increase our earnings by trading shares, or options on those shares, rather than just buying them and holding them.

Here, we consider Berkshire Hathaway stock. We will work with the "B" shares for convenience. In particular, we will look at the "Price/Book" ratio of the stock to see if there is information in this metric that can help us make outsize returns from trading BRK.B stock, or options on this stock.
In this figure, we show the stock price and the book value of a BRK.B share over the last 5 years. The blue line shows the stock price in dollars over those 5 years, it has risen from about $200/share to about $450/share during that time. The green line shows the "Book value per share" for the company. The Book value of a company is an estimate of the value of the company calculated in a very highly specified way. For this green line, the amount of Book value associated with each BRK.B share is calculated and shown. The Book value is calculated 4 times a year and reported by the company, we see the Book value rising and falling ever 3 months in the figure. Finally, the red line is "Price/Book", the ratio of the stock price to the stock's book value. Note the Price/Book has values shown on the right-hand y-axis, ranging from 1.0 to about 1.7 over these 5 years.

We hypothesize that Book/Share is a reasonable measure of the true, or intrinsic value of a share of stock. Then when the P/B is high, the price of a share is high, for example at P/B=1.6, someone buying a share of BRK.B is paying a 60% premium over its Book value to buy that share. On the other hand, when the P/B=1.2, someone buying the share at that point is paying only a 20% premium above book to buy a share.

Looking at the time-variation of P/B, we see it varying in a possibly random way between about 1.0 and 1.7. If this is true, we would expect the stock to be a better buy when P/B is lower, and $1 of Book value is selling at a low premium, then when P/B is higher. Perhaps we will make more money if we buy the stock when P/B is lower than when it is higher?
In this figure, we show how much money you would expect to make over a two-year holding period when you buy a share of BRK.B at a particular P/B ratio. The x-axis shows the P/B ratio at which the BRK.B share is purchased. The blue line shows the ratio of the stock price 2 years after the share is purchased to the stock price when the share was purchased. So for example, from this chart we look at 1.2 on the x-axis, representing times when we could purchase a share at a price = 1.2*Book/Share. Looking at the curve, we see it's y-axis value at P/B = 1.2 is price=1.5. Here, price represents c_stock/o_stock, the ratio of the c_stock, the stock price at "close," 2 years after purchase, to o_stock, the stock price at open, when we bought the share. That this ratio is 1.5 on this plot means that averaged over many time-periods where the stock could have been bought at P/B = 1.2, the average stock price the stock could be sold at after 2 years is 1.5*o_stock, a 50% gain in two years of holding the stock.

Looking over the whole range of P/B plotted, we see that the expected earnings from holding a share for 2 years varies tremendously depending on the P/B of the stock when it is purchased. For P/B ~= 1.1, we expect a 70% return on our investment in 2 years, or at least that has been our return for such purchases averaged over the last 5 years of stock prices. At the other end of the plot, of P/B = 1.6 we would, on average, have made only about 15% profit in 2 years.

By the way, looking at the label on the title of the plot, it is BRK-B_STOCK_ddays_504. "ddays_504" means we do the average return calculation assuming the stock is held for 504 trading days. There are about 252 trading days per year that the stock market is open, so "ddays_504" is what we do to find the two year return of the stock.
In this figure, we look at how much money you would expect to make over only a one-year holding period.  The curve is very similarly shaped to the two-year curve previously shown.  Indeed, it looks like the 1-year curve is just 20% lower than the 2-year curve.  That is, the 2-year curve went from 70% return down to 20% return as P/B went from 1.1 up to 1.6, while the 1-year curve goes from 50% return to about 0% return over that same P/B.  One might even hypothesize that after 1 year of growth, the stock "forgets" what P/B you originally purchased it at, and just earns you, on average, another 20% for the next year that you hold it.
We now look at the returns after just 6 months. We still see a higher return when buying at low P/B, but the return at P/B=1.1 is 25% over 6 months vs 50% over 1 year. But we now see an interesting phenomenon when buying at higher P/B.  At P/B ~= 1.3, the average return on holding the shares for 6 months is negative!  One would expect to lose 5% of value on these investments, or at least on average that is what has happened during the last 5 years.  This suggests that it is possible to have the stock on sale for such a high price, that not too long after buying the stock at this price the stock price is actually lower.
Going down to only a 3-month holding period of the purchased stock, we see the predictive value on return of the various P/B stock prices we might buy at is becoming degraded, noisier in some sense.  We still see evidence of a better return for P/B < 1.3.  But above 1.3 we sort of see a mish-mosh of returns ranging from a gain of 5% to a loss of 2.5%.
Finally, we complete the picture showing the investment returns over 21 trading days, about 1 month of holding time for the purchased shares.  For the truly inexpensive purchase prices P/B <= 1.2, we see a pretty strong prediction of 8% returns on average, and 8% in 1 month is pretty spectacular.  But for P/B > 1.2 or so, we see a mish-mosh of 1 month returns ranging from +4% down to -2%.

CONCLUSION

In summary, we see strong evidence that the price at which we buy stock provides quite a lot of information about how well this investment will perform over the next 6 months to 1 year. For time-scales shorter than 6 months, the results are not as clear, although for very low P/B ratios (very cheap stock prices) we still predict outperformance.

Wednesday, April 01, 2020

March 2020: California Corona/COVID Cases doubled every 3.6 days without a break.

This post is written April 1 2020 but it is most decidedly and unfortunately NOT a joke.  I feature the data prominently because in an exponentially growing pandemic, these numbers will be difficult to interpret without being able to note "Oh yeah, that was like 4 days ago" or whatever.  

From the data on https://en.wikipedia.org/wiki/2020_coronavirus_pandemic_in_California I tabulated cumulative cases and cumulative deaths from the cited article.  I calculated daily new cases and deaths by taking differences.  Plotted it all on logarithmic axes. 

image.png
By counting dots  on cumulative cases, determined it is taking 12 days to rise tenfold.  That is 21% rise per day.  That is doubling time of 3.6 days.  Counted over two decades of rise a.k.a. 6.6 doubling times.  

Here is same plot, with a straight line (on semilog plot) of the 12 day doubling time superimposed on each line.  
image.png

All four lines seem essentially consistent with a slightly noisy exponential.  

What does it mean?  California locked down in mid-March, the statewide stay-at-home order was 3/18/2020.  I plotted this data to look for what effect this might have had on the data.  Using my old eyes, I see nothing.  

What does this portend?  If this trend continues another week (through April 6), California will have nearly 27,000 cases and have accumulated nearly 5,000 deaths.  If it continues throughout April, at the end of April nearly 7% of Californians will have been infected and more than 1% of Californians will have died from Corona.  


Friday, September 02, 2016

How To Get a Working Browser after a Windows Vista Restore (or Reinstall)

I have an old Dell PC running Windows Vista Home Premium.  It had a number of "broken" things in its system, it couldn't see Windows Update anymore and I couldn't install Microsoft Security Essentials on it.  I decided to do a clean reinstall, or system reset on it.  This can be done without requiring any external back-up or restore or install media, it can be done entirely from the machine.  

This post does not tell you how to do the clean reinstall.  You can find that elsewhere.  

What this post tells you is how to finish the clean reinstall so that you have a working browser on the machine!  When I did the reinstall, Vista came up with Internet Explorer 7 installed.  IE 7 COULD NOT see Microsoft pages associated with updating IE 7!  It could not see google pages associated with downloading the Chrome browser!   

So how do you get Internet Explorer 9, the highest version that supports Windows Vista, on to a machine without a working browser?  

To do what I am describing will require you to have:
  1. The Vista machine with Vista clean installed (also known as "Reset") on it.  Find instructions on the web to get this done.  You should be able to do it completely from the Vista machine, no additional install media should be required.  
  2. Another working Windows machine connected to the Internet through a working Web Browser. 
  3. A flash drive ( or any portable USB connected drive) with at least 64 MB free space on it. 
FIRST: Let Windows Update install all the Vista updates it knows about. 

The first thing I did was let Windows Update update everything that it knew about.  This was over 100 updates when I did this in August 2016.  It took about 8 hours on my old slow Vista machine.  It required about 3 manual restarts, so check the machine once in a while while it is updating as it will hang until you approve the restarts.  I am not absolutely sure this is required before taking the next steps but it is what I did that worked so you decide whether you want to experiment or not.  

SECOND: Learn how many bits, what architecture and what Operating System your machine is.

The first thing to do is determine three things about your machine.  These three facts will be needed in choosing install packages.  These three things are:
  1. Is your machine 32-bit or 64-bit?
  2. Is your machine architecture x86 or x64?
  3. What exactly is your operating system?  Mine is Vista Home Premium.  
You can determine these by
  1. Pressing the windows button at lower left end of your screen
  2. typing "msinfo" and hitting return.  This will pop open a window.
  3. Clicking on "System Summary" in that window.  
  4. Your operating system is listed at the top under "OS Name."
  5. Your architecture is listed further down under "System Type."
  6. If your architecture is "x64" then you have a 64-bit machine.  If your architecture is "x86" then you have a 32-bit machine.
  7. Keep these three facts handy, write them on a piece of paper which you can refer to as you do the rest of this.  
THIRD: Get a Google Chrome version 49 installer from your other machine.

To get a working browser on your Vista machine, you will download an installer for Chrome version 49 onto a flash drive connected to another PC with a working browser and internet connection.  I took my copy from http://www.slimjet.com/chrome/google-chrome-old-version.php.  You may find a copy elsewhere on the web, but I am told that some copies are infected with viruses.  I have had no problems with the copy I took, so you decide.  

From that page, right click on the version 49 download link for your machine and save it to your flash drive.  

Then attach your flash drive to your Vista machine and double click the installer on your flash drive.  Choose to install it to someplace on your C: drive on your vista machine.  You can then run Chrome browser by double-clicking on the Chrome app you installed.  You can put a shortcut to that on your desktop.  

FOURTH: Manually Install Vista Service Pack 1

You can find the installer for Windows Vista Service Pack 1 here: https://www.microsoft.com/en-us/download/details.aspx?id=30.  It takes an hour or two to install.  

FIFTH: Manually Install 3 Other Required Updates.  

This page: https://support.microsoft.com/en-us/kb/2399238 tells us that there are three other updates that need to be installed manually before IE 9.  They are:
  1. Vista Service Pack 2
  2. the Windows Graphics, Imaging, and XPS Library (KB971512)
  3. Platform update supplement for Windows Vista and Windows Server 2008 (KB2117917)
They need to be installed in that order.  The page referenced has links to follow for the installers for each of these updates.  Service Pack 2 will take 1 to 2 hours to install, the others are faster than that.  

FIFTH: Install Internet Explorer 9

Windows Internet Explorer 9 installer for Vista is here: https://www.microsoft.com/en-us/download/internet-explorer-9-details.aspx  

If you have installed all the updates above, you should find that this install will work.  

CONCLUSION

Microsoft stopped supporting Windows Vista in early 2016.  The instructions above worked on my Dell laptop in August of 2016.  Without official support, the information above took me many hours to sort out.  There is no guarantee that these instructions will continue to work as without support who knows what entropy will do to the web pages I used to get this done.  Good luck! 

Friday, October 23, 2015

Why Innovative Energy is a Bad Investment, or Why the Government Should Fund It, and Other Brilliant Observations About Energy

Bill Gates has said  a bunch of brilliant thing about innovations in Energy which have been reported in a article in The Atlantic.  I'll give you a summary which is much shorter than that article.

For energy, the incentive to invent is bad.  Patents give you a 20 year exclusive on your invention, and trade secrets don't really do much better than that.  But in energy, innovations are adopted over many decades.  In digital electronics, things are adopted almost instantly.  So while innovations in digital electronics are developed by the marketplace and paid for by patents, innovations in energy will be in the public domain before they have been broadly adopted!

A very high carbon tax could force energy to change faster than it is used to.  But perhaps better to just pay for the necessary innovations publicly, since they will wind up in the public domain benefiting society as a whole by the time they are broadly deployed.

But won't the government screw it up?  What Gates says is brilliant and insightful: “Yes, the government will be somewhat inept, but the private sector is in general inept. How many companies do venture capitalists invest in that go poorly? By far most of them.”

Responding to the concern that American politicians can't even agree on whether climate change is real, Gates said: “If you’re not bringing math skills to the problem, then representative democracy is a problem.”

“... the climate problem has to be solved in the rich countries. China and the U.S. and Europe have to solve CO2 emissions, and when they do, hopefully they’ll make it cheap enough for everyone else. But the big numbers are all in the developed economies, where China’s defined into that term.”

“When I first got into this I thought, How well does the Department of Energy spend its R&D budget? And I was worried: Gosh, if I’m going to be saying it should double its budget, if it turns out it’s not very well spent, how am I going to feel about that? But as I’ve really dug into it, the DARPA money is very well spent, and the basic-science money is very well spent. The government has these “Centers of Excellence.” They should have twice as many of those things, and those things should get about four times as much money as they do.”

There's plenty of good stuff in the article that I didn't include here.

Friday, July 10, 2015

Using the Audio Jack for power and digital interface to smartphones!

If you have seen credit car readers on smartphones, you will see they are a small block that plugs into the smartphone's audio jack, what you might think of as its headphone jack.

This is a remarkably clever solution to the problem: how do I build an add-on for both iPhone and Android without paying licensing fees to either?

Project HiJack at University of Michigan gets the credit for figuring this stuff out.

  • For power, your app can play a tone out the speaker jack on, say, the left speaker channel.  That tone can be rectified in your external device to provide up to about 7.4 mW.
  • If you need to, you can send data to your external device from your sensor.  You essentially generate an audio tone in software as you might generate a radio frequency in hardware on a radio communicator.  The data modulates the audio tone.  You build a demodulator on your external device and you are set.  
  • You can get data from your external device.  You generate an audio tone on your external device and play it into the microphone lead of the audio jack.  The app on the smartphone can record that audio, represent it in software as an array of numbers (voltage values from an analog-to-digital converter (ADC)).  The data you are sending can modulate the audio tone, which modulation can be detected mathematically by processing the recorded ADC values from receiving the audio.  
This stuff is cool!

Monday, February 09, 2015

Gasoline Engines: a simple mostly linear model

If you have ever googled, the efficiency of a gasoline engine, you have likely found something like this:

While this is very much a standard diagram to see, by the end of this post I am going to replace it with a different figure that has the same information on it, just rearranged.  The beauty of the replacement figure is that it will show that at any given engine speed, the engine output power increases linearly with the amount of gasoline flowing in to the engine.  It will show that this is true except at very high flow rates of gasoline into the engine, where the power output of the engine is seen to "saturate," the engine becomes less efficient at converting gasoline to output energy when the gasoline is flowing in to the engine very fast.  

The above diagram is called a BSFC map, a Brake Specific Fuel Consumption map.  This is created by measuring the engine output with a brake dynamometer.  A brake dynamometer effectively puts a friction brake on the output shaft of the engine, or rather to something connected to the output shaft of the engine.  The friction brake can be applied to slow the engine output down.  The dynamometer is instrumented so that it can measure the braking effort currently applied to the output shaft of the engine.  That braking effort is measured in units of torque, which in the metric system has units of Newton-meters.  

If the dynamometer measures the engine output shaft rotation speed at the same time as it measures the braking torque on the output shaft, we can easily calculate the power that the engine is dumping into heating up the brake.  Torque times rotation speed gives power.  To get power in the standard metric system unit of Watts, the engine speed needs to be expressed as an angular velocity in radians per second. To do this, the RPM measurement is divided by 60, to convert it to rotations per second, then multiplied by 2π to convert it into radians per second. 

The way you use a dynamometer to get the figure above is you set the engine accelerator to a fixed setting.  Then you adjust the braking force over a range of values.  At each braking force, you measure 1) the braking torque, 2) the engine rpm, and 3) the fuel consumption, typically in grams per second.  At each x,y point you have measured, you know how many Watts (W) are being produced in rotational motion of the engine shaft because at that point you can multiply the torque by the angular velocity corresponding to that point.  Since you have also measured the gasoline consumption in grams per second (g/s), with a little straightforward math you can calculate the number of grams of gasoline that would be required to produce a kWh of rotational output energy.  kWh is "kilowatt-hour," it is the amount of energy that a 1000 W power source produces in 1 hour.  1 kWh = 3,600,000 J.  

The contour lines on the BSFC map are lines of constant energy efficiency.  At any point on, for example, the 280 g/kWh contour, the engine produces 1 kWh of output energy for every 280 g of gasoline that it consumes.  One can see from the chart that the engine is most efficient at an engine speed of about 2700 rpm and an output torque of 95 Nm.  At this efficient point, by using the math above we calculate the engine is putting out about 26.9 kW.

One last little bit of mathematical conversion.  A gram of gasoline can be burned, and when it is burned it releases a certain amount of heat energy.  The amount of energy released is slightly variable because the mixture of hydrocarbons in gasoline is slightly variable depending on how it is formulated at the refinery.  The US EPA has settled on 33.7 kWh as a standard estimate of the energy content of one U.S. gallon of gasoline.  This translates to about 12.2 Wh/g energy content of gasoline.  So the contours of gasoline usage in units of "g/kWh" can actually be simplified to a pure energetic efficiency.

280 g of gasoline release 3.425 kWh of heat energy when burned.  but near the most efficient point of the engine shown in the BSFC fuel map above, we find we are able to get 1 kWh of rotational energy out of this engine for each 280 g of gasoline burned in the engine.  This means that the energy conversion efficiency of this engine operating on that 280 g/kWh contour is 1/3.425 = 29%.  That is to say that when this engine is operating at any point along the 280 g/kWh contour, is converting 29% of the thermal energy of the gasoline it is burning into rotational energy at the output shaft of the engine.

Finally, we combine all that we have said above and reformulate the BSFC fuel map into the following:


Here, the different colored dots come from digitizing points on the BSFC map above, and converting them so each one shows its output power, the rotational power of the output shaft of the engine, vs its input power, the heat energy of the gasoline flowing in to the engine to produce that output power.  We group data points by RPM.  At each RPM value, we find the best fit straight line through the points at that RPM.  What we find is generally: 1) at lower RPM, we convert gasoline heat energy into rotational energy more efficiently.  2) To get higher total output power, we need to go to higher RPM, but this costs us a little bit in efficiency.  3) at the high power end of each RPM value, there is some "saturation" visible: the output power falls below the best fit line.  The engine is a little less efficient when a lot of gasoline is flowing in to it then when less gasoline is flowing in to it.

We can rearrange the data in the Power out vs Power in plot by creating a y-axis showing values of Power_out / Power_in = Efficiency.  Here is that plot:
Plotting efficiency on the y-axis, we see that at each RPM, the efficiency of the engine rises as we drive it harder, as we pour more gasoline into it.  The efficiency drops to zero when we apply only enough gasoline to keep the engine idling: to keep the engine turning but with no extra energy available to be delivered through the engine's output shaft.

Note that each output line has an x-intercept, a value of gasoline flow into the engine which can keep the engine turning at this RPM value, but which produces no additional power at the output of the engine.  This is the fuel flow into the engine that is required to keep the idling engine turning at the specified RPM.  One could explore the points along the x-axis by putting the car in neutral gear, and revving the engine with the gas pedal.  If while doing this, you were able to measure the gasoline consumed at each RPM value, you would expect to measure directly the x-intercept values shown in this figure.

Here are plotted the x-intercept values, vs RPM.  Essentially this is a plot of the fuel flow rate required to keep the engine idling at a particular RPM value.



Saturday, January 10, 2015

Gasoline Usage at Idle with and without Air Conditioner Running

I logged gasoline usage with my car running at idle.  I varied the RPM to see how that affected it.  I turned the air conditioner on and off to see how that affected it.

The car is my 2005 Mercedes CLK320A.  This has a 3.2L V6 gasoline engine.  It is supposed to use "premium" fuel (91 Octane in the US), but I have been unable to determine any performance difference using what is sold as "regular" fuel (87 Octane in the US) in San Diego, where I live.  So I run it using regular fuel, and the results here are with regular fuel.

My set-up for testing this stuff is described in this post.

For the test, I used a warmed-up engine.  I ran the engine in my driveway and applied the accelerator pedal to achieve different RPM levels.  The RPM levels and fuel usage rates shown are those logged by the setup described in the other post throug the car's OBD2 connector.

For "air conditioner off" condition, everything in the car is turned off including the climate control.  The car does have running lights that stay on in the daytime, these were on.  No attempt was made to determine the state of the alternator, whether it was charging the battery or not during this test.

For "air conditioner on" condition, the climate control in the car cabin was turned on.  The thermostatic control was set to 60° F in order to keep the air conditioner on constantly.  The fan blowing air in the cabin was set to its highest setting.

Results


Results are shown above.  Minimum mean square error line fit to the data are shown.  At lower RPM, results are pretty nice and linear.  

Idle Fuel Usage with Air Conditioner turned off

Without applying the accelerator, this engine idles at about 600 RPM.  The fuel usage at idle is about 0.25 gallons per hour, with the air conditioner turned off.  The idle fuel usage rises to about 1.0 gallons per hour at 2500 RPM.  The fitted line, with air conditioner turned off, nearly passes through 0 fuel usage at 0 RPM.  Thus for all intents and purposes, the idle fuel usage is:

(1 Gallon per Hour) * ( Engine RPM / 2500 )

What is the meaning of 0.25 gallons per hour of idling loss?  This is a car which gets about 22 miles per gallon averaged over my driving.  So an hour of idling uses the same amount of gasoline as driving about 5.5 miles.  At $4/gallon (as I write this prices in San Diego are as low as $2.40/gallon), idling costs $1/hour or 1.6 cents per minute.  My conclusion is that in regular use where idling more than a few minutes would be very unusual, idling is a very inexpensive process and not worth great efforts to avoid.  

Fuel Usage by Air Conditioner

The caption of the figure shows the linear fit equations for the fuel usage with air conditioner off and on.  The difference between these two linear fits is 0.16 gallons per hour.  This suggests that when the air conditioner is running, no matter what the RPM of the engine is, it is demanding fuel at a rate of 1 gallon every 6 hours.  

If the car gets 22 mpg with the air conditioner off, adding fuel flow of one additional gallon every 6 hours would correspond to moving the car at about 4 miles per hour.  Now this is with the air conditioner running constantly (it was set to 60° F for this test).  Since it cycles off and on in actual use, actual usage with air conditioner on will be less than this.  

At $4/gallon, air conditioner on constantly costs about 67 cents/hour.  Since in actual use air conditioner cycles on and off, a better rule of thumb might be 25 cents/hour.