Displaying 20 results from an estimated 12000 matches similar to: "Rolling regressions with sample extended one period at a time"
2010 Jan 17
1
Confusion in 'quantile' and getting rolling estimation of sample quantiles
Guys:
1).When I using the 'quantile' function, I get really confused. Here is what
I met:
> x<-zoo(rnorm(500,0,1))
> quantile(x,0.8)
400
1.060258
> c=rnorm(500,0,1)
> quantile(c,0.8)
80%
0.9986075
why do the results display different? Is that because of the different type
of the class?
2).And I want to use the 'rollapply' function to compute a
2012 May 25
1
Rolling Sample VAR
hi guys,
I am using trivariate VAR model to get 10 step ahead orthogonalized impulse
response functions. I want to use rolling sample analysis on the
coefficients of the irf but I have no idea how to do that. I looked through
the forums but I can't seem to find any solutions.
Any suggestions would be helpful.
B
--
View this message in context:
2009 Jul 07
1
Error in Rolling window of function - rollapply
Dear Colleagues,
I have faced with the problem that function rollaply with rolling window for
calculation of volatility doesn't give the all results of calculations.
I have run the rolling window for calculation in Excel and obtained that the
number of outputs for Excel is 36 and for R is 18. The total number of
observations is 37. In the attachment you can find pdf of the Excel and
Excel
2011 Mar 04
2
apply.rolling() to a multi column timeSeries
Hello there,
I am trying to compute the 3 months return momentum with the timeSeries x.ts,
which is just a subset of simple returns from a much bigger series,
> class(x.ts)
[1] "timeSeries"
attr(,"package")
[1] "timeSeries"
> dim(x.ts)
[1] 20 3
> x.ts[1:8,]
GMT
MS.US AAPL.US CA.FP
1996-01-31 0.15159065 -0.133391894
2010 May 06
1
question about rolling regressions
Hi All,
I am using R 2.11.0 on a Ubuntu machine. I have a time series data set and
want to run rolling regressions with it. Any suggestions would be useful.
Here are the details:
(1) I convert relevant variables into time series objects and compute first
differences:
vad <- ts(data$ALLGVA/data$GDPDEF, start=1948, frequency=1)
emp <- ts(data$ALLEMP, start=1948, frequency=1)
vad.dif1 <-
2009 Nov 27
2
How to compute Rolling analysis of Standard Deviation using ZOO package?
Hello:
I want to get a rolling estimation of the stdev of my data.
Searching the document, I found the function "rollapply" in the zoo package.
For example, my series is "c", and i want get a period of 10 days,
so i write the command below:
roll.sd = rollapply( c, 10, sd, na.pad = TRUE, align = 'right' )
but there is an error in it ,and the computing cannot be
2008 Feb 13
4
rolling sum (like in Rmetrics package)
Hello, I'm new to R and would like to know how to create a vector of "rolling
sums". (I have seen the Rmetrics package and the rollMean function and I
would like to do the same thing except Sum instead of Mean.) I imagine
someone has done this, I just can't find it anywhere.
Example:
x <- somevector #where x is 'n' entries long
#what I would like to do is:
x1
2010 Aug 18
2
Rolling window linear regression
Hi
Does there exists an efficient way of performing linear regression on rolling windows in R.
The exact problem is:
We have a dataset of length l. The window size is w.
Now, I perform linear regression on window i to (i+w) . Using this model can I perform linear regression over window (i+1) to (i+w+1).
Thanks
Sid
Sent on my BlackBerry? from Vodafone
2017 Aug 10
2
Zoo rolling window with increasing window size
Hi again,
I am wondering there is any function for 'zoo' time series, where I
can apply a user defined function rolling window basis, wherein window
size is ever increasing i.e. not fixed. For example, let say I have
below user defined function and a zoo time series :
> library(zoo)
> UDF = function(x) sum(x)
> TS = zoo(rnorm(10), seq(as.Date('2017-01-01'),
2007 Nov 30
1
Rolling Correlations
Hi R,
I want to do some rolling correlations. But before, I searched for
"?rollingCorrelation" and tried the example in it. But I was not
successful. What could be the problem? Here is the code I tried:
> library(zoo)
> library(PerformanceAnalytics)
> rollingCorrelation(manager.ts@Data[,1],edhec.ts@Data,n=12)
Error in inherits(object, "zoo") : object
2017 Aug 10
3
Zoo rolling window with increasing window size
Hi Joshua, thanks for your prompt reply. However as I said, sum()
function I used here just for demonstrating the problem, I have other
custom function to implement, not necessarily sum()
I am looking for a generic solution for above problem.
Any better idea? Thanks,
On Fri, Aug 11, 2017 at 12:04 AM, Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
> Use a `width` of integer index
2011 Oct 03
2
rolling regression
Dear all,
I have spent the last few days on a seemingly simple and previously documented rolling regression.
I have a 60 year data set organized in a ts matrix.
The matrix has 5 columns; cash_ret, epy1, ism1, spread1, unemp1
I have been able to come up with the following based on previous help threads. It seems to work fine.
The trouble is I get regression coefficients but need the immediate
2017 Aug 10
0
Zoo rolling window with increasing window size
Use a `width` of integer index locations. And you likely want =
"right" (or rollapplyr(), as I used).
R> set.seed(21)
R> x <- rnorm(10)
R> rs <- rollapplyr(x, seq_along(x), sum)
R> cs <- cumsum(x)
R> identical(rs, cs)
[1] TRUE
On Thu, Aug 10, 2017 at 1:28 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:
> Hi again,
>
> I am
2008 Jul 29
1
rolling regression between adjacent columns
Hi everyone,
I am trying to apply linear regression to adjacent columns in a matrix (i.e.
col1~col2; col3~col4; etc.). The columns in my matrix come with identifiers
at the top of each column, but when I try to use these identifiers to
reference the columns in the regression function using rollapply(), the
columns are not recognised and the regression breaks down. Is there a more
robust way to
2011 Oct 10
1
how to calculate the statistics of a yearly window with a rolling step as 1 day?
Hope someone can help me here.
I have a daily time series, say
2003-02-01 2003-02-03 2003-02-07 2003-02-09 2003-02-14 .......... 2004-02-01
2004-02-04
0.4914798 -1.1857653 -1.6982844 -0.3559572 -0.2333087 ...........
0.44553 -0.45222
I need to calculate the statistics for the overlapping rolling yearly window
with rolling step as 1 day
so for each of the intervals: (2003-02-01 ~
2017 Aug 10
0
Zoo rolling window with increasing window size
Replace "sum" with your custom function's name. I don't see any
reason why that wouldn't work, and the problem with my solution is not
clear in your response.
r <- rollapplyr(x, seq_along(x), yourCustomFunctionGoesHere)
On Thu, Aug 10, 2017 at 1:39 PM, Christofer Bogaso
<bogaso.christofer at gmail.com> wrote:
> Hi Joshua, thanks for your prompt reply. However
2010 Apr 16
2
efficient rolling rank
Could someone give me an idea on how to do rolling ranking, i.e. rank in the
moving window of last 100 numbers in a long vector? I tried naive solution
like
roll.rank<-function(v, len){
r<-numeric(length(v)-len+1)
for(i in len:length(v))
r[i-len+1]<-rank(v[(i-len+1):i])[len]
r
}
However, it turns out pretty slow even on my rather able Linux box. For
2010 Jan 13
1
Rollapply
Hi
I would like to understand how to extend the function (FUN) I am using in
rollapply below.
######################################
With the following simplified data, test1 yields parameters for a rolling
regression
data = data.frame(Xvar=c(70.67,70.54,69.87,69.51,70.69,72.66,72.65,73.36),
Yvar =c(78.01,77.07,77.35,76.72,77.49,78.70,77.78,79.58))
data.z = zoo(d)
test1 =
2008 Aug 02
1
problem with nested loop for regression
Hi everyone,
I'm experiencing difficulty getting the results I want when I use a nested
for loop. I have a data set to which I perform some calculations, and then
try to apply a regression over a rolling window. The code runs, but the
regression results I am getting (intercept and slope) are simply the same,
repeated again and again in the results matrix. The regression does not seem
to be
2010 Oct 28
4
Returning highs and lows in R
I'm having trouble returning a rolling n period highest value for a data
set. For each day I want to calculate the highest value over the last 3
days. I am using the following packages: zoo, xts, quantmod and TTR.
Thanks, Jason
GLD.Close
2010-10-01 128.91
2010-10-04 128.46
2010-10-05 130.99
2010-10-06 131.81
2010-10-07 130.37
2010-10-08 131.66
2010-10-11