# Looking for an optimal investment function from stock market model

Note: this question was written in plain text

From a stock market price prediction model, I am looking for an optimal investment function to check performance sustainability.

1. Background

1.1. Using Kalman filtering on a market state model, the model provides u_pred and uvar_pred each daytime t, where :

> u_pred(t) = [price_pred(t) -price_prev(t)] /price_prev(t),
> uvar_pred(t) = u_pred_error(t) variance, where :
> u_pred_error(t) = u_mes(t) -u_pred(t),
> u_mes(t) = [price_mes(t) -price_prev(t)] /price_prev(t),

> price_pred(t) = market price predicted by state model at t,
> price_mes(t) = market price measured (ie: real market price) at t,
> price_prev(t) = previous price measured at t, ie: price_prev(t) = price_mes(t-1),

1.2. From the previous notations, the daily yield obviously is u_mes(t), so that in summary, we know that the future yield u_predmes is deterministically defined as :
u_predmes(t) =u_pred(t) + z(t), where z(t) is a random, normally distributed function with 0-mean and variance = uvar_pred(t).

1.3. The model predictive performance is nonetheless very weak since the correlation coefficient between u_pred and u_mes variables lies in [0.10 ; 0.15] range. Which means that uvar_pred is one order of magnitude greater than variance(u_pred).

2. Objective

2.1. Now, knowing u_pred(t) and its variance uvar_pred(t), I am looking for alpha(t), an investment allocation function which maximizes the (what I abusively call) investment Sharpe, defined by:
Sharpe = mean[ alpha(t) * u_mes(t) ] / variance[ alpha(t) * u_mes(t) ]**0.5, where
variance[ alpha(t) * u_mes(t)] = mean[ (alpha(t) * u_mes(t))**2 ] -mean[ alpha(t) * u_mes(t) ]**2

2.2. alpha(t) obviously defines the investment sign (+: long, -: short) as well as quantity ; for instance, if alpha(t) is a constant equal to 1, this corresponds to a passive, long investment position in the stock market. Ideally, alpha(t) should only depend on u_pred(t) and uvar_pred(t) computed by the model.

3. Supposition and question

The optimized state model, obtained from the log-likelihood maximization, implies that :
mean [ log( uvar_pred(t) ) + u_pred(t)**2 /uvar_pred(t) ] is minimum.
So, an intuition consists in replacing alpha(t) with u_pred(t) /uvar_pred(t)**0.5 but I cannot demonstrate it is the optimal solution.
If a practical solution is feasible, I suspect a much more complex function that well-versed statisticians/quants could formalize.

Thank you for your help. Any additional information (research articles, etc.) welcome.
$$$$
`
• Hi, would you be able to set your equations in Latex Code for better readability? – Kermittfrog Jan 11 at 22:12
• If you wish to maximize your Sharpe ratio, then when $\vec{\mu}(t)$ is the expected returns of the assets, and $\Sigma(t)$ is the covariance of returns, you should allocate $c \left(\Sigma(t) + \vec{\mu}(t) \vec{\mu}^{\top}(t)\right)^{-1}\vec{\mu}(t)$ dollars to the assets. This is like Markowitz but takes into account the variation of returns over time. – steveo'america Jan 12 at 0:41
• Hi, thank you for the Markovitz solution which could solve my problem. For clarity, what do you mean with the c() in the allocation formula ? Thanks again. – Fiddod Jan 12 at 10:09
• the $c$ is a constant, which you adjust to reach a target level of risk. The parens go around the second moment matrix. This only reduces to Markowitz when there is no variability in $\vec{\mu}(t)$ over time. – steveo'america Jan 12 at 20:46