#!/bin/sh # # A license is hereby granted to reproduce this software source code # and to create executable versions from this source code for # personal, non-commercial use. The copyright notice included with # the software must be maintained in all copies produced. # # THIS PROGRAM IS PROVIDED "AS IS". THE AUTHOR PROVIDES NO WARRANTIES # WHATSOEVER, EXPRESSED OR IMPLIED, INCLUDING WARRANTIES OF # MERCHANTABILITY, TITLE, OR FITNESS FOR ANY PARTICULAR PURPOSE. THE # AUTHOR DOES NOT WARRANT THAT USE OF THIS PROGRAM DOES NOT INFRINGE # THE INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY IN ANY COUNTRY. # # So there. # # Copyright (c) 1994-2005, John Conover, All Rights Reserved. # # Find the distribution and cummulative distribution of the marginal # increments of the fractional Brownian equivalent of the DJIA time # series, djia1900-2004. # # Using the tsmath program, take the log of the time series of the # DJIA to produce the fractional Brownian equivalent of the DJIA time # series; use the tslsq program to LSQ the linear trend; use the # tsderivative program to get the marginal increments. In pseudo code: # # count the number of marginal increments # # strip off the last two digits of each marginal increment to make # 4 digit precision "buckets" from the 6 digit values # # sort the 4 digit precision numbers, and count how many there are # of each number using the tscount program # # divide each value in the time series by the count of the number # of marginal increments using the tsmath program, (i.e., the # cumulative must equal unity) # # integrate, using the tsintegrate program, to get the cumulative # distribution # # Note that as an algorithmic artifact, there are two zeros in the # distribution and its cumulative; those positive, but less than # 0.0001, and those negative, but more than -0.0001, or +0.0000 and # -0.0000. # # John Conover, john@email.johncon.com # COUNT=`tsmath -l djia1900-2004 | tslsq -o | tsderivative | sed 's/[0-9][0-9]$//' | wc -l` tsmath -l djia1900-2004 | tslsq -o | tsderivative | sed 's/[0-9][0-9]$//' | sort -n | tscount -r | tsmath -t -d "${COUNT}" | tsintegrate -t > djia1900-2004.cumulative.distribution tsmath -l djia1900-2004 | tslsq -o | tsderivative | sed 's/[0-9][0-9]$//' | sort -n | tscount -r | tsmath -t -d "${COUNT}" > djia1900-2004.distribution