rollapply Questions

4

Solved

Imagine that I have a list of numbers (i.e. numbers column in data.table/data.frame). 1 5 5 10 11 12 for each number in a list a want to count how many unique numbers are there which are lower t...
Castroprauxel asked 14/2, 2020 at 14:27

2

My imported data contains 7 variables: Y and X1, X2, X3, X4, X5, X6. I tried applying the rollapply function in zoo in order to run a rolling regression within an in-sample with a window of 262 obs...
Lauralauraceous asked 18/4, 2014 at 21:49

3

Solved

I have a data frame similar to the following with a total of 500 columns: Probes <- data.frame(Days=seq(0.01, 4.91, 0.01), B1=5:495,B2=-100:390, B3=10:500,B4=-200:290) I would like to calcul...
Rust asked 19/11, 2015 at 20:20

3

Solved

This is what my data frame looks like: library(data.table) df <- fread(' Name EventType Date SalesAmount RunningTotal Runningtotal(prior365Days) John Email 1/1/2014 0 0 0 John Sale 2/1/2014...
Harri asked 2/6, 2015 at 15:17

2

I want to estimate rolling value-at-risk for a dataset of about 22.5 million observations, thus I want to use sparklyr for fast computation. Here is what I did (using a sample database): library(P...
Ziwot asked 3/9, 2017 at 14:10

1

Solved

The problem is similar to How do I do a conditional sum which only looks between certain date criteria but slightly different and the answer from that does not fit into current problem. The main di...
Osteitis asked 7/6, 2017 at 7:20

2

Solved

I am trying to calculate a rolling mean of value grouped by multiple dimensions in R. Something I would do in SQL in the following way: AVG(value) OVER (PARTITION BY dim1, dim2 ORDER BY date R...
Leuctra asked 3/4, 2014 at 18:16

4

Solved

I am trying to compute a rolling covariance between a set of data (each column of my x variable) and one other (y variable) in R. I thought I could use one of the apply functions, but can not find ...
Poundfoolish asked 28/7, 2016 at 19:21

2

I just want to take difference between rows in a data.table such that dif[n] = value[n] - value[n-1]. I currently try to achive that using zoo::rollapplyr: library(data.table) dt <- fread(text ...
Influential asked 10/5, 2016 at 14:21

1

Solved

I want to calculate the rolling mean for all variables in column "sp". This is a sample of my data: the_date sp wins 01-06--2012 1 305 02-06--2012 1 276 03-06--2012 1 184 04-06--2012 1 248 05-06--...
Fernanda asked 18/11, 2015 at 0:34

2

Solved

I am trying to calculate some statistics for a moving window and am using rollapply in the zoo package. My question is how do I get rollapply to apply that function to the previous n observations i...
Trifocal asked 26/8, 2015 at 18:56

4

Solved

I have a matrix in which each row is a sample from a distribution. I want to do a rolling comparison of the distributions using ks.test and save the test statistic in each case. The simplest way to...
Guv asked 24/4, 2015 at 15:32

2

Solved

I need to perform rolling VaR estimation of daily stock returns. At first I did the following: library(PerformanceAnalytics) data(edhec) sample<-edhec[,1:5] var605<-rollapply(as.zoo(sample),...
Hardy asked 28/8, 2014 at 10:57

1

Solved

I need to run rolling window function on a xts data which contains about 7,000 rows and 11,000 columns. I did the following: require(PerformanceAnalytics) ssd60<-rollapply(wddxts,width=60,FUN=f...
Casserole asked 24/8, 2014 at 10:20

2

Solved

I need to calculate rolling VaR of stock returns. From this post: Using rollapply function for VaR calculation using R , I understand that columns having complete missing cases will give error. But...
Hectograph asked 3/8, 2014 at 22:18

1

Solved

I did the following for calculating Value at Risk (VaR) over 20 period rolling window: require(PerformanceAnalytics); require(zoo) data(edhec) class(edhec) # [1] "xts" "zoo" class(edhec$CTAGlobal)...
Wolffish asked 30/7, 2014 at 19:45

2

Bellow is a stock daily returns matrix example (ret_matriz) IBOV PETR4 VALE5 ITUB4 BBDC4 PETR3 [1,] -0.040630825 -0.027795652 -0.052643733 -0.053488685 -0.048455772 -0.061668282 [2,] -0.03046348...
Mollymollycoddle asked 5/6, 2014 at 17:3
1

© 2022 - 2024 — McMap. All rights reserved.