Questions tagged [xts]

xts is an R package that contains an eXtensible Time Series class and methods. xts extends and behaves like zoo.

xts is an package for analysis. It provides uniform handling of R's different time-based data classes by extending the package.

Repositories

Vignettes

Other resources

Related tags

1987 questions
1
vote
1 answer

Rolling regression return multiple objects

I am trying to build a rolling regression function based on the example here, but in addition to returning the predicted values, I would like to return the some rolling model diagnostics (i.e. coefficients, t-values, and mabye R^2). I would like…
MikeTP
  • 7,716
  • 16
  • 44
  • 57
1
vote
1 answer

Back testing Trading / Error in hasTsp(x) : invalid time series parameters specified in R

I applied a different data set to Joshua Ulrich's answer at previous question (Automatic vlookup and multiply coefficients with R) and it gives an error I haven't been able to solve. New dataset:Brazil's Bovespa…
Pedro9
  • 186
  • 1
  • 11
1
vote
1 answer

smart way to find the number of rows between two 1s

I have an xts object which consists of just 1s and 0s, but mainly zeros, and I was wondering if there was a smart/efficient method of working out the number of rows (not days) between two 1s and example of part of what the object looks like... …
h.l.m
  • 13,015
  • 22
  • 82
  • 169
1
vote
2 answers

Dates in R differ between Windows and Linux

I have a data frame in R names as data. data <- as.xts(read.zoo("data1.csv",sep=",",tz="" ,header=T)) data index in the format 2004-01-04 09:44:00 IST I applied the operation to change the index to Dates index(data) <- as.Date(index(data)) Output…
user1177819
  • 103
  • 1
  • 3
  • 7
1
vote
1 answer

split xts object by time of day, regardless of date

Possible Duplicate: XTS apply function to time of day subset? I'm interested in this kind of pattern: does something interesting happen each day between 09:45 and 09:55 [regardless if it's this day or the other]. I'm using xts, but I can't find a…
zuuz
  • 859
  • 1
  • 12
  • 23
1
vote
2 answers

Setting specific time period value in xts/zoo dataset

Trying to generate a third variable, called "var", to the dataset that only has a value of 100 for the date "2010-09-24" and NA for all other time periods. > dataset weight 2010-10-04 52495 2010-10-01 53000 2010-09-30 52916 2010-09-29…
gabriel
  • 399
  • 2
  • 7
  • 17
1
vote
1 answer

How to assign exact index() to xts object

I want to set the specific dates of an xts object but it shifts the dates one day. aapl <- as.xts(read.zoo(textConnection(" 2007-04-26, 98.84 2007-04-27, 99.92 2007-04-30, 99.80 2007-05-01, 99.47 2007-05-02, 100.39"),…
J D
  • 11
  • 1
1
vote
1 answer

Strange behaviour while accessing elements in an XTS

I have an XTS that is part of a list returns$sig and from that XTS, I pull out a set of elements based on some conditions and store the Index in a variable tstart. > tstart <- index(returns$sig[which(returns$sig != lag(returns$sig,1) & returns$sig…
mchangun
  • 9,814
  • 18
  • 71
  • 101
1
vote
1 answer

zoo and utc time with microseconds

The dataset has utc time with microseconds TIME,DATA1,DATA2 1350359123.325330,661.00,765.00 1350359123.491836,661.00,765.50 However, I am unable to do the utc format conversion and microseconds at the same time. I have already asked a similar…
shoonya
  • 292
  • 1
  • 10
1
vote
1 answer

Calculate Option Prices from a Multivariate XTS of Volatilities and Spot Prices

Here is my code for downloading spot prices and calculating realized volatilities for a bunch of indices. library(quantmod) library(PerformanceAnalytics) library(RQuantLib) tickers.index = c("^RUT","^STOXX50E","^HSI") myEnv <-…
mchangun
  • 9,814
  • 18
  • 71
  • 101
1
vote
2 answers

split.xts at a custom time

I am currently using split.xts in the form of split(xts.obj,'days') to create lists of intra-day data, so that each element of the list represents one day. This breaks up a day from midnight to (just before) midnight the next day is there a way to…
h.l.m
  • 13,015
  • 22
  • 82
  • 169
1
vote
2 answers

creating a variable for lookback window length return greater than x%

I am currently using R to do some research and I was wondering if anybody had any smart ideas or any prepackaged functions on how to create the following variable: I have a univariate price series of say daily closing prices of a financial asset,…
h.l.m
  • 13,015
  • 22
  • 82
  • 169
1
vote
1 answer

R special data frame

I'm asking a question follwing the one I asked yesterday in this post : Random Forests for Variables selection. I managed to find out for each quarter the most significant technical trading rules. I've built a data frame to put the names of these…
marino89
  • 899
  • 1
  • 10
  • 16
1
vote
1 answer

R Rolling Random Forest for Variables Selection

I've got a daily OHLC dataset of the Euro Stoxx 50 index since 2008 which looks like that : Open High Low Close Volume Adjusted 2008-01-02 4393.53 4411.59 4330.73 4339.23 0 4339.23 2008-01-03 4335.91 4344.36 4312.34…
marino89
  • 899
  • 1
  • 10
  • 16
1
vote
1 answer

Error with specifyModel

I'm facing this problem and can't solve it : Here is the code : library(quantmod) library(TTR) library(randomForest) getSymbols('^STOXX50E', src='yahoo') equity.index<-STOXX50E myReturnsSign = function(x) sign(Delt(Cl(x),type="log"))[-1] mySMA…
marino89
  • 899
  • 1
  • 10
  • 16