algorithm - Rule extraction of financial time series in R -


i struggle rule extraction algorithm using r. generally, had financial time series, splited different segments according trend , duration. result got data frame similar below:

 > head(df)   segment   trend  duration description   1       1       c         s         c_s  2       2      vp         l        vp_l   3       3      vn         s        vn_s  4       4       n         s         n_s   5       5       p         m         p_m   6       6      vp         m        vp_m   

where vn,n,c,p,vp (very negative, negative, constant, positive, positive) describe trend occured during selected segment, s,m,l (short, medium, long) describe duration of each segment , last column combination of previous. want obtain rules, lhs contains historic information segments , rhs future segment. example 1 rule this:

 id   rule                                  support confidence   r5   seg(t-2): vp_b & seg(t-1): n_s             10      71.4%         => seg(t): p_m 

i want emphasize segments used create rule should sequential. ideas proposed algorithm or r package appreciated. in advance!

this uses arules package:

lines <- "segment   trend  duration description   1       1       c         s         c_s  2       2      vp         l        vp_l   3       3      vn         s        vn_s  4       4       n         s         n_s   5       5       p         m         p_m   6       6      vp         m        vp_m"   library(arules) library(zoo)  z <- read.zoo(text = lines, header = true, fun = identity) lags <- as.data.frame(lag(z$description, 0:-2))  <- apriori(lags) inspect(a) 

see vignette("arules") more information.

another thing try is:

library(rpart) rpart(lag0 ~., lags) 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -