How do I statistically differentiate a series of prices from a series of returns?
How do I statistically differentiate a series of prices from a series of returns?
Loading saved threads...
SRKX · External communityPost link
External question — Quantitative Finance Stack Exchange
Author: SRKX
Original post: https://quant.stackexchange.com/questions/3666
License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I developed an optimization algorithm that uses returns (among other parameters) as input and basically output an allocation.
As I'm pretty happy with the results, I am in the process of putting the algorithm in production. As a matter of fact, I have to embed some checks into the algorithm to make sure that the input was right and that the output makes sense. For example, I check that the allocation sums to 1, I check that the time series provided are all of the same length and so on...
I would like to add another test which allows me to display a warning if the input time series appear to be prices instead of returns (and people
will
do this mistake one day I'm sure). So, I would like to setup a statistical test on my set of points $x=x_1, ... , x_n$ to determine whether they are likely to be prices.
Formally the statistical test if a function defined as follows:
$$A(x) \rightarrow \{0,1\}$$
Ideally we would like to find a test that is sufficient and necessary for a time series to be returns (as compared to prices, not to "a random time series").
There are three types of interesting statistical tests:
Type I (necessary and sufficient)
$$A(x)=1 \iff x ~ \text{are returns}$$
Type II (sufficient)
$$A(x)=1 \Longrightarrow x ~ \text{are returns}$$
Type III (necessary)
$$A(x) \neq 1 \Longrightarrow x ~ \text{are prices}$$
The following test is a dummy one:
$$A_{\text{dummy}}(x)=\frac{1}{n} \sum_{i=1}^n x_i > 1$$
This is not good because a Forex time series are prices of a currency expressed in the base currency of the portfolio, and such a series would produce a result of 1.
I came up with a Type II test:
$$A_\text{Type II}(x) = \exists i ~ x_i<0$$
Note that I assume that the input could be
either prices or returns
.
A series of prices with non-negative returns would fool this test so it is not necessary.
I believe it is impossible to come up with a Type I test, which implies that I can't come up with a Type III test either (otherwise I could construct a Type I test easily).
I would be looking for extra Type II tests to improve the probability of wrong input detection.
Have you ever had to do such test? What method would you recommend?
Quote
Report
Akavall · External communityPost link
External answer — Quantitative Finance Stack Exchange
Author: Akavall
Original post: https://quant.stackexchange.com/a/3668
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I think that can never be 100% sure, and the most you could do is raise a warning, and your approach makes perfect sense to me.
I want to point out one thing though. While prices cannot be negative, they are sometimes recorded with a negative sign, where negative sign conveys some other information. For example in CRSP:
Price
Usually, the CRSP price is the closing price, the price of the last reported trade on any given day. However, if no trade is recorded
on a given trading day, the reported price will be the negative of the
average of the bid and asked prices for that day. The price reported
in CRSP monthly files is the price of the last trading day of the
month.
link
Quote
Report
Marc Shivers · External communityPost link
External answer — Quantitative Finance Stack Exchange
Author: Marc Shivers
Original post: https://quant.stackexchange.com/a/3676
License: CC BY-SA 3.0 — https://creativecommons.org/licenses/by-sa/3.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
You could test for whether the input series is I(0) vs the alternative of I(1). Specifically, regress the input series on its own lag, and test whether the coefficient on the lag is significantly different from zero. Price series should have a coefficient close to 1, while return series should have a coefficient close to 0.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Quantitative Finance Stack Exchange Author: Akavall Source score (net votes, not local likes): 3 Original post: https://quant.stackexchange.com/a/3668 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I think that can never be 100% sure, and the most you could do is raise a warning, and your approach makes perfect sense to me. I want to point out one thing though. While prices cannot be negative, they are sometimes recorded with a negative sign, where negative sign conveys some other information. For example in CRSP: Price Usually, the CRSP price is the closing price, the price of the last reported trade on any given day. However, if no trade is recorded on a given trading day, the reported price will be the negative of the average of the bid and asked prices for that day. The price reported in CRSP monthly files is the price of the last trading day of the month. link
Checking account access…