Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Monday, May 30, 2022

My current projects

 


I'm still working my way through a list of improvements to my time series programs and databases.  They always take longer than I thought they would.  Programming, especially in Visual Basic, is time-consuming, because one almost always makes errors in coding, from simple typos to errors in the logic, but VBA's clumsy way of interrogating values during execution makes tracking down coding errors tedious.   

I'm also resurrecting my APL  programs, but since they work off my Excel spreadsheets, reading from and writing to spreadsheets, they need the VBA programs to work.

My current project is to create a composite monthly series which gives a reasonable estimate of GDP for the USA, and to extend this series back to WW1.  Ultimately, I might write a paper on this for publication.  In the meantime, I'm busy creating a continuous series for the volume of US retail sales from several disparate series going back to 1919.  I'll show y'all the results when I'm done.


Saturday, May 14, 2022

Russia business confidence, and other things

 I've been off-line, more or less, due to medical issues, plus I also wanted to work on my Visual Basic programs, adjusting my seasonal adjustment programs to handle time series which go negative.  The latter took a lot of work, because the assumption that time series were positive (e.g, the PMI, or industrial production, say) was embedded in all sorts of small but crucial software segments.  Also, Visual Basic makes the strange assumption that zero ('0')is the same thing as 'empty', which it most emphatically isn't.  It took me hours to discover this!

Why did I want to be able to seasonally and extreme adjust time series which go negative?  Because I wanted (specifically) to analyse the Russian business confidence data, partly as part of my attempt to estimate the Russian PMI prior to 2011 (my data stop there) and partly because it will be interesting to see just how deep business confidence falls in Russia as the war progresses and sanctions bite, and (generally) because one does from time to time need to seasonally and extreme adjust time series which go negative. 

The chart below shows the original (unadjusted) data for business confidence plus my calculation of the seasonally and extreme adjusted data.  Note the very strong seasonal cycle, with business confidence plunging in winter and recovering in summer (why?  I know Russian winters are bad, but ....)  Also, business confidence has been more or less negative for the last decade-plus.  Which is consistent with the sharp decline in US$ GDP since 2013, after the annexation of Crimea. (GDP chart second below; note optimistic forecast for 2022 GDP!) 



Source: Trading Economics
If the 2011-2013 growth rate had continued, Russia's GDP would now be *double* what it is now.  Does Putin understand that in the long run, power comes from economic not military might?  That his yearning for great power status would come from sustained economic growth?  But that would imply the end of the kleptocracy, and we can't have that, can we?

How does business confidence compare with the PMI for Russia?  I show that in the chart  below.  I expect both the PMI and business confidence to fall sharply over the next 6 to 12 months.  How much of this is due to oil?  The oil price fell sharply during the GFC (2009), but recovered almost to previous highs  between 2010 and 2015, so the plunge in GDP and business confidence/PMI was due to the relatively mild sanctions imposed after the Crimean annexation, not oil.  The new sanctions are strong and will cut deep into Russia's exports.  In real (volume) terms, Russian GDP fell 10% in 2009.  I expect the downturn this time to be worse, and the recovery more sluggish.    

I'll keep you posted.



Thursday, April 30, 2020

Expanding my graph program

My graph program is good for quickly drawing up to four series on a single chart, with automatic scaling. I can also use functions in the arguments.  So I don't need to create the series before charting it, like one has to in Excel.  I can just type in 'YOY USIP', for example, and it does the calc for me.   But I wanted the ability to draw several charts on one page, either with the same time scale or different ones—for example, a chart at the top showing a long-term relationship with shorter periods below.  It will allow up to six charts, with different configurations.  Writing the codes was fairly difficult!  It still needs some tweaking but as you can see, works quite well.  I'll improve it incrementally as I go on.  The Elon Musk method.


Friday, August 23, 2019

The S&P500 since 1871

I've been working on long times series history for the USA.  We have several key series back to the first world war, and some even  further back.  But first, I had to rewrite some of my own programs, which took a while.  My programs are mostly written in APL with some VBA, and read and write to Excel files.  However, Excel doesn't handle dates before 1900.  So I had to do some coding in APL to allow for this.  Anyway, one of the first of my long term series is the S&P500, which I have got a monthly average for back to 1871.  And here's its chart (as usual, click to enlarge).  By the way, the software which produces this is written in APL.



Note that because this is plotted on a log scale, the same percentage move takes up the same space on the chart.  So even though in the Great Depression, the market only fell 17 or 18 points, it was by far the largest percentage fall.  Also, see how from 1871 to the early 1940s, the trend growth rate of the market (which would be a straight line because it's a log scale) was appreciably lower than the trend growth rate since then.  Notice also how the 1987 crash, which seemed so huge at the time is just a blip on this chart.

Fascinating.