R for using Ornstein-Uhlenbeck to estimate time for medium reversal

I am looking for an example r code to use Ornstein-Uhlenbeck to estimate the time for average reversal when considering co-integrated securities

+5
source share
3 answers

Link: Package 'ouch (link)

Title: Ornstein-Uhlenbeck Models for Phylogenetic Comparative Hypotheses

prev_sprd <- c(sprd[2:length(sprd)], 0)
d_sprd <- sprd - prev_sprd
prev_sprd_mean <- prev_sprd - mean(prev_sprd)
sprd.zoo <- merge(d_sprd, prev_sprd_mean)
sprd_t <- as.data.frame(sprd.zoo)

with interception:

result <- lm(d_sprd ~ prev_sprd_mean, data = sprd_t)
half_life <- -log(2)/coef(result)[2]
half_life

or if there is no interception:

result = lm(d_sprd ~ prev_sprd_mean + 0,  data = sprd_t)   
half_life1 = -log(2)/coef(result)[1]
half_life1

also try:

Statistical Methods for Financial Engineering, B. Remillard

On Modeling and Evaluation of the Ornstein-Uhlenbeck Inverse Transformation Process in Average Circulation

Why is it important?

3 4 , , , , , , -

+4

CRAN , Ornstein-Uhlenbeck. rseek, , , .

+2
+2

All Articles