search for: polyfit2

Displaying 1 result from an estimated 1 matches for "polyfit2".

Did you mean: polyfit
2012 Jan 24
1
problems with rollapply {zoo}
..._t <- seq(1-nrow(alpha),0) # Just to check the code for the regression, apply the regression to the whole series (unless the series is realy short or has a strong slow pattern the regression result is not useful except to show that the code works) polyfit <- lm(Close ~ poly(rel_t,4),alpha) polyfit2 <- lm(Close ~ rel_t + I(rel_t^2) + I(rel_t^3) + I(rel_t^4), data=alpha) # This is the objective, where all the magic happens rollRegFun <- function(d,i) { # set up the relative time variable, so that the current record has rt = 0 d$rt <- seq(1-nrow(d),0) # apply the regression to fi...