xts

Rolling regression return multiple objects

筅森魡賤 提交于 2019-12-13 12:23:11
问题 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 the results to be returned in discrete objects based on the type of results. The example provided in the link above sucessfully creates thr rolling predictions, but I need some assistance packaging and writing out the rolling model diagnostics: In the

Why does R xts plot only show a single column with nc=2?

↘锁芯ラ 提交于 2019-12-13 07:43:31
问题 On one machine, plot.xts correctly displays data in two columns: On another, things look very different: The code for both is the same: library(zoo) library(xts) library(xtsExtra) sessionInfo() timezone = "UTC" Sys.setenv(TZ=timezone) sampleData = "Time (UTC),CPU,Runqueue,Blocked,MemoryFree,PageIns,ContextSwitches,Wait,Steal 2014-10-15 16:12:11,20,0,0,12222172,0,2549,0,0 2014-10-15 16:12:12,27,1,0,12220732,0,3619,0,0 2014-10-15 16:12:13,30,0,0,12220212,0,2316,0,0" data = as.xts(read.zoo(text

How to convert a daily times series into an averaged weekly?

放肆的年华 提交于 2019-12-13 05:49:17
问题 I am wishing to (arithmetically) average daily data and thus convert my daily time series into a weekly one. Following this thread: How does one compute the mean of weekly data by column using R? , I am using the xts library. # Averages daily time series into weekly time series # where my source is a zoo object source.w <- apply.weekly(source, colMeans) The problem I am having is that it averages the series taking tuesday through next monday data. I am searching for options to average my

How to split an xts object in multiple ways?

邮差的信 提交于 2019-12-13 05:23:54
问题 I have the following data: xtsdata <- structure(c(0.44696179, 0.395227931, 0.477439822, 0.295309508, 0.712614891, 0.689317114, 0.599395023, 0.610971864, 0.337625508, 0.529290134, 0.596002106, 0.412324483, 0.244831259, 0.443123542, 0.484748065, 0.686165972, 0.711764909, 0.604578061, 0.42144923, 0.669898641, 0.735845192, 0.592157589, 0.81714156, 0.380346873, 0.684386001, 0.672967504, 0.508142689, 0.244274776, 0.548213564, 0.417804342, 0.612475603, 0.665148957, 0.756447435, 0.582448567, 1, 1, 1,

convert a daily series into weekly changing the index to fridays in all weeks regardless of the true date

江枫思渺然 提交于 2019-12-13 03:59:13
问题 I'm trying to convert a daily series into a weekly one ending on Fridays. There are missing values for each series and therefore merge function leave some NAs. I have tried with na.locf and to.weekly but didn't work for me. I'm creating a weekly date object containg all fridays in that period and, because some weeks end on wednesdays or thursdays for some series, I can't match those indexes. Ideally I would like to overwrite the date of the last value in those weeks not ending on fridays.

Split data frame into multiple data frames based on information in a xts object

孤街浪徒 提交于 2019-12-13 02:18:16
问题 I really need your help on the following issue: I have two data frames - one containing a portfolio of securities with ISIN and Cluster information. > dfInput TICKER CLUSTER SECURITY.NAME 1 LU0937588209 High Yield Prime Capital Access SA SICAV- 2 LU0694362343 High Yield ECM CREDIT FUND SICAV - ECM Hi 3 IE0030390896 High Yield Putnam World Trust - Global Hi 4 LU0575374342 EM Debt Ashmore SICAV - Emerging Marke 5 LU0493865678 EM Debt Ashmore SICAV - Emerging Marke 6 LU0972237696 EM Debt

Storing the xts object returned by getSymbols

馋奶兔 提交于 2019-12-13 01:09:01
问题 I'm trying to collect mutual fund performance data via open and close prices from quantmod. I have scraped a list of 5000 some funds and am trying to loop through and get one open and close price for each fund. I'm having difficulty calling the xts object yielded by getSymbols() as it is called invisibly into the environment. Since the object is stored as its ticker name, I tried calling it by its ticker name. Code so far: ## loop thru list and use quantmod to calculate performance from 1/2

plot.xts + abline not quite accurate?

纵饮孤独 提交于 2019-12-13 00:16:34
问题 I am using xtsExtra to plot some scatter graphs of xts objects and wanted to draw a horizontal line through zero but it looks like its in the wrong place...please see the code below? is this a bug? set.seed(123) require(xts) f <- xts(rnorm(100,0.0001,0.003),Sys.Date()-c(100:1)) f1 <- xts(rnorm(100,0.0001,0.003),Sys.Date()-c(100:1)) require(xtsExtra) plot(f,f1) abline(h=0,col='red') 回答1: Jeff Ryan may have answered this here: Try, abline(v=.index(X)[50], col="red") Note the "dot" in .index .

performing previous tick aggregation using lapply and split

老子叫甜甜 提交于 2019-12-12 22:23:00
问题 I am trying to solve this issue for past 3 months. Please help. I have tick data (Price and Volume) for many stocks belonging to a single exchange. Each stock has its own .rds file on the hard disk. I am interested in cleaning it up: merge multiple same time stamps by taking median subset data for exchange hours only aggregate it over 20 minutes by previous tick aggregation I know that the function aggregatets in highfrequency package can perform the previous tick aggregation operation.

From daily time series to weekly time series in R xts object

一世执手 提交于 2019-12-12 20:34:09
问题 I'm using the zoo and xts package for analysing financial data. ts package is not very suitable since financial series have weekend with no data available. I read about the apply function availbale in the xts package apply.daily(x, FUN, ...) apply.weekly(x, FUN, ...) apply.monthly(x, FUN, ...) apply.quarterly(x, FUN, ...) apply.yearly(x, FUN, ...) this apply function over calendar periods and thought that something like that will work in order to get the end of week value but it seems not to