Please Note: Blog posts are not selected, edited or screened by Seeking Alpha editors.

|Includes: SPDR S&P 500 Trust ETF (SPY)

Another point I normally point out is the concept of a "trading day."

To show the importance of the human factor, we plot the daily log-returns for the S&P500, again using the R-Language, per day-of-week. The code below is straightforward, but the plots show that the skewness of the returns changes with the day of the week. This is not an expected result, considering that the overall returns are somewhat normally distributed with small skewness.

This goes to amplify the point that, even though when you look at the market as a whole you are confronted with the fact that it is pretty much behaving like a log-normal stochastic process, if you start digging deeper, you will find that the spinners of the roulette wheel are not all equal!

That is, there is structure in the market that can be exploited. This is the essence of quantitative methods that the technical and quant traders use.

To replicate the example, create an R-File and put this function in it:

[code language="R"]
evaluateSymbolPerDayOfWeek<- function(symbol)
{
nPoints <- nrow(symbol)
dates<-as.Date(rownames(symbol))[1:nPoints,drop=FALSE]
log.Return<- as.numeric(log(symbol[[1]][1:(nPoints-1),1]/
symbol[2:nPoints,1]))
log.Return.Days = dates[1:(nPoints-1)];

# plot log return histogram
increment<- 0.001

plottedWeekdays=c("Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday");

hist(log.Return, breaks=seq(from=(min(log.Return)-increment), to=(max(log.Return)+increment),
by=increment),
main=c("Daily Log Return Histogram since ",
toString(dates[nPoints]), "with Skewness",
toString(skewness(log.Return))))
for (i in 1:5)
{
plottedReturns = log.Return[weekdays(log.Return.Days) == plottedWeekdays[i]]
hist(plottedReturns, breaks=seq(from=(min(log.Return)-increment), to=(max(log.Return)+increment),
by=increment),
main=c(plottedWeekdays[i],
" log returns with Skewness",
toString(skewness(plottedReturns))))
}
return;
}

[/code]

You will need to source your file to be able to run the function.

Once you have sourced your file and it is available to the R-language, then you can will need to run the following script. Note that to run the script you will need to have made the requested libraries available in R. See the R-Language help to do that, or use R-Studio.

The script below simply loads the libraries, then downloads the historic quotes for the symbol SPY. Then it calls the above function which computes the daily log returns, their skewness and plot them to show you how "normal" the log return series is.

[code language="R"]

library(quantmod);
library(tseries);
library(zoo);
library(PerformanceAnalytics);
library(caTools);
ticker &lt;- &quot;SPY&quot;

####GET ADJUSTED CLOSE AND ORDER CORRECTLY
symbol&lt;-as.data.frame(symbol)[NROW(symbol):1,,drop=FALSE]
symbol&lt;-na.locf(symbol, na.rm=FALSE)

evaluateSymbolPerDayOfWeek(symbol)

[/code]

The plots for the overall week, and the individual days are as follows. It is clear that Tuesdays are generally better trading days than Wednesdays for the S&P500.

Try it with other symbols and check!

Now, for SPY, if you are to calculate the average log daily returns for each day of the week (that is assuming you bought at close of the previous business day and sold at the close of that day), using the R-Language "mean" function, you will find

 Day Average Day-to-Day Log Return Number of Data Points Cumulative one-Day Return Monday 0.04382% 968 52.83% Tuesday 0.07113% 1053 111.49% Wednesday 0.02877% 1056 35.50% Thursday 0.00465% 1036 4.93% Friday 0.01499% 1029 16.68% Overall 0.03266% 5142 436.26% Adjusted Close for SPY (start, end) 30.09 161.36

I think you would agree that the day-of-week discrepancy cannot be explained away by statistics, given the number of data points involved over the 20-year study.

Disclosure: I have no positions in any stocks mentioned, and no plans to initiate any positions within the next 72 hours.