# Wolfram Language™

## Log Returns of Stock Prices

Stock prices modeled with geometric Brownian motion (in the classical BlackScholes model) are assumed to be normally distributed in their log returns. Here, this assumption is examined with the stock prices of five companies: Google, Microsoft, Facebook, Apple, and Intel.

Retrieve the stock prices in 2015 with FinancialData.

In:= ```symbols = {"GOOGL", "MSFT", "FB", "AAPL", "INTC"}; prices = Table[ FinancialData[stock, {{2015, 1, 1}, {2015, 12, 31}}], {stock, symbols}];```

Compute the log returns.

In:= `logreturn = Minus[Differences[Log[prices[[All, All, 2]]], {0, 1}]];`

Filter the log returns with an ARCHProcess of order 1.

In:= ```fdata = Table[ {\[Kappa]1, \[Alpha]1} = {\[Kappa], \[Alpha]} /. FindProcessParameters[lr, ARCHProcess[\[Kappa], {\[Alpha]}]]; MovingMap[Last[#]/Sqrt[\[Kappa]1 + \[Alpha]1 First[#]^2] &, lr, 2] , {lr, logreturn}]; fdata = Transpose[fdata];```

Compare the filtered data from each stock to the normal distribution with QuantilePlot. For all five companies, the tails deviate from normal.

show complete Wolfram Language input
In:= ```MapThread[ QuantilePlot[#1, PlotLabel -> #2, PlotTheme -> "Detailed"] &, {Transpose[fdata], symbols}]```
Out= Perform a multivariate normality test with BaringhausHenzeTest (BHEP). The normality assumption is clearly rejected.

In:= `htd = BaringhausHenzeTest[fdata, "HypothesisTestData"];`
In:= `htd["TestDataTable"]`
Out= In:= `htd["ShortTestConclusion"]`
Out= Fit the filtered data with MultinormalDistribution and MultivariateTDistribution.

In:= ```multiN = EstimatedDistribution[fdata, MultinormalDistribution[Array[x, 5], Array[s, {5, 5}]]]```
Out= In:= ```multiT = EstimatedDistribution[fdata, MultivariateTDistribution[Array[x, 5], Array[s, {5, 5}], nu]]```
Out= Compute the AIC for the two distributions. The model of MultivariateTDistribution has a smaller value.

In:= `aic[k_, dist_, data_] := 2 k - 2 LogLikelihood[dist, data]`
In:= `aic[5 + 15, multiN, fdata]`
Out= In:= `aic[5 + 15 + 1, multiT, fdata]`
Out= 