When calculating the DJIA, there are two components, one divided by the other. How is the divisor calculated? I'm asking for speciifcs, which are strangely elusive on Wikipedia or other sites. They say things like, "it is adjusted for stock splits or other structural changes" but do not elaborate. I'd like to know exactly how that number is generated.
Have you actually read the Wikipedia article?
To calculate the DJIA, the sum of the prices of all 30 stocks is divided by a divisor, the Dow Divisor. The divisor is adjusted in case of stock splits, spinoffs or similar structural changes, to ensure that such events do not in themselves alter the numerical value of the DJIA. Early on, the initial divisor was composed of the original number of component companies; which made the DJIA at first, a simple arithmetic average. The present divisor, after many adjustments, is less than one (meaning the index is larger than the sum of the prices of the components). That is:
DJIA = sum(p) / d
where p are the prices of the component stocks and d is the Dow Divisor.
Events such as stock splits or changes in the list of the companies composing the index alter the sum of the component prices. In these cases, in order to avoid discontinuity in the index, the Dow Divisor is updated so that the quotations right before and after the event coincide:
DJIA = sum(p_old) / d_old = sum(p_new) / d_new
The Dow Divisor was 0.14602128057775 on December 24, 2015. Presently, every $1 change in price in a particular stock within the average, equates to a 6.848 (or 1 ÷ 0.14602128057775) point movement.
Knowing the old prices, new prices (e.g. following a split), and old divisor, you can easily compute the new divisor...
Also, the detailed methodology is published by SP Indices (PDF).
For simplicity's sake, assume the DJIA is an index that contains 4 stocks, with a price of $100.00 each. One of the stocks splits 2:1, meaning the new price/share is $50.00. Plugging the numbers into the above equation, we can determine the new Dow Divisor:
400 / 4 = 350 / d => d = 3.5
The details of the DJIA methodology is outlined in the official methodology document on their website. In addition, you will need their index mathematics document, which gives the nitty-gritty details of any type of adjustments that must be made.
Between the two you should have the complete picture in as fine a detail as you want, including exactly what is done in response to various corporate actions like splits and structural changes.
Suppose you had an index of just two stocks: ABC and XYZ. ABC has a market capitalization of $100B spread out among 1B shares, while XYZ has a market capitalization of $40B spread among 100M shares. So you could add those together, and get a total of $140B. If that's too unwieldy a number, you could divide by a constant number, say 1B, and get 140. Then any time either of the market capitalizations increase by a dollar, you index will increase by one billionth of a dollar, regardless of which stock increased.
Other than the dividing by a billion part, this is a pretty simple system. But if you're Dow Jones, then you decide to, instead of adding the capitalizations together, add the stock prices together. Right now, ABC is at $100 a share ($100B/1B), while XYZ is at $400 a share ($40B/100M). So you just take the average of those, which is 250. This allows you to have a superficially simpler index, in that all you have to do is look at stock prices. Any time any stock price increases by a dollar, your index increases by half a point. Why half a point? Because you have two stocks. If you had 10 stocks, you would divide by 10.
Now, I said this is superficially simpler. That's because if one of the stocks goes up by a dollar, the index goes up half a point, regardless of which stock is went up. But if the capitalization on one company goes up by a dollar, the change in index depends on which stock went up. If ABC capitalization were to go up $100B, the index would go up 50. But if XYZ capitalization were to go up $100B, the index would go up 500.
A further issue is how to handle splits. Suppose XYZ decides that $400 is too high of a stock price, and they're going to do a 2:1 split to bring the price down to $200. So if you do an average of the stock prices, it will be 150. The index dropped 100 points, just because one of the companies decided to do a stock split. If you don't want your index dropping every time a stock splits, you need to do something about that. If you were smart, you'd realize this "look at stock price" thing, although initially simpler, is really not a good idea, and switch to market capitalization. If you were insistent on continuing your current index, you could adjust all the current stock prices and find their pre-split equivalents; since XYZ has a current split factor of 2, you could multiply their stock price by 2, add that to ABC, take the average, and then you would have the same index as before the split.
But if you're Dow Jones, you decide that you don't like either of those options. Instead of adjusting individual stocks, you'll adjust the index as a whole. The index went down by a factor of 0.6, so if instead of dividing by 2, you divide by 2*0.6=1.2, you'll get back to the previous value. This 1.2 is known as the Dow Divisor. It's calculated by taking the sum of the new prices, multiplying by the previous divisor, and then dividing the the sum of old prices. The sum of the new prices is $150, the previous divisor was 2, and the sum of the old prices was $250. So you have $150*2/250 = 1.2. Every time a stock splits, this Dow Divisor has to be recalculated.
Using this metehod means that the although the value of the index doesn't change at a stock split, its relationship to stock price does. Before the stock split, if XYZ were to double in value, the index would become (100+800)/2=450. If XYZ were to double in value after the stock split, the index would become (100+400)/1.2 = 416.67. Every time a stock splits, its effect on the DJIA decreases.
There are also adjustments to the DJIA whenever a company buys another one, but the details depend on whether both companies were originally in the DJIA, or just the buyer was, or just the bought company was, and it also depends on how the deal is structured. If a company in the DJIA splits into two companies, that can also require an adjustment.
The index divisor is a number arbitrarily chosen on day 1 and subsequently adjusted when necessary to make the index point continuous. Therefore it by nature is a recursively defined numerical series. To calculate the current divisor, you either need to calculate from previous value, or - if you don't know the previous value - from the previous value of previous value (recursive, right?). To calculate the current divisor from scratch, you will need to go all the way back to the day DJIA was introduced, when the initial divisor was chosen, instead of calculated, and apply all the historical adjustments up to date.
On the very first day of DJIA (May 26, 1896), the initial divisor was arbitrarily chosen to scale the calculated index value to a number that is easy to work with. Given DJIA is a price weighted index, and its day-1 point was 40.94 (calculated out of the average price of 11 stocks at that time), I don't know for sure but I guess the initial divisor was just 1 (otherwise you can just choose a nicer number to make the 0.94 disappear at least). Well that is just the starting point, you will need to figure out every event in history that impacts the divisor, and apply the methodology of that time to adjust the divisor.
This is why in all the systems I worked on (as a software developer in financial institutions), a reference divisor, usually T-1 divisor, always needs to be provided (by data vendors who track these numbers and changes). Then we apply the methodology others mentioned to calculate the T divisor intraday.