# how to estimate a variable's upper limit with 95% confidence level?

Suppose I have a variable, $S(t)$, for stock price. So always have $S(t) > 0$.

$S(t)$ is a random variable, with some volatility $\sigma$ and trend.

Now the requirement is to estimate $\hat S(t+1)$ with at 95% confidence level, or: estimate $\hat S(t+1)$ based on $S(0)$, $S(1)$, ..., $S(t)$, so that 95% of the time $S(t+1) < \hat S(t+1)$.

If it's not for the 95% confidence level, it's easy, I could just use regression to genereate a formula something like $$S(t+1) = a_0 + a_1 S(t) + a_2 S(t-1) ... + a_m S(t-m+1)$$ .

But such estimation is only predicting the "trend", not considering the volatility and 95% confidence level.

If it's not for the trend, it's also easy, I could just get the 95% percentile value from history S:

$\hat S(t+1) = 95 %$ percentile value of $S(t), S(t-1), ... S(t-m)$

, maybe could choose $m = 36%$, using 3 years' data.

But such prediction would not cater the trend -- if there is a trend in the market that the Stock price rises, the estimation will always be lower than the future realized.

How could I have a $\hat S(t+1)$ that could cater both "trend" and "95% confidence level"?

Please notice here we didn't assume any parametric model about Stock price's distribution.

-

## 1 Answer

The standard Kalman filter can be used for this. It makes some assumptions about Gaussianity of observations and updates, but it easily gives you a prediction for the next step expressed as a mean and variance. If you want to go beyond Gaussianity, there are some extensions ("unscented" Kalman filter etc) which you could go into.

EDIT: actually, not sure if it's easy to incorporate the "trend" aspect here. The basic application of Kalman filter would not do this, you simply specify the update matrix in advance. However, it might well be possible to use the framework with an unknown trend as one element in the update matrix, and fit that.

-

thanks, after reading the wiki page i guess it works! – athos Feb 26 at 1:53
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 14, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9286618828773499, "perplexity_flag": "middle"}