similar to: Adding dates to time series

Displaying 20 results from an estimated 3000 matches similar to: "Adding dates to time series"

2011 Oct 27
1
Correllogram of Daily Time Series
Hi there, What is the best way to get a time series of daily stock price observations into R (from excel). The time series are daily but there are spaces for w/e's and holidays etc. So I am not sure a ts object will be suitable but I am not sure what I should use? What ever package you recemmned i need to be able to run a corrolelagram. Thanks Hugh -- View this message in context:
2011 Jul 09
3
Confusing piece of R code
m0<-epxression((4*theta1*theta2-theta3^2)/(2*x*theta3^2)-0.5*theta1*x) params<-all.vars(m0) this reads all the params from m0 so theta1,2 and 3 correct? params<-params[-which(params=="x")] checks which params are multiplied by x? np<-length(params) for(i in 1:6){ esp<-get(sprintf("m%d",i-1))
2011 Oct 28
2
Split an array into arbirtary sizes
Hi there, I have a ts object that I would like wo split into arbirary sizes. Can'tfind how to do this? I realise its probaly very simple buy I can't sem to find the right function? -- View this message in context: http://r.789695.n4.nabble.com/Split-an-array-into-arbirtary-sizes-tp3948938p3948938.html Sent from the R help mailing list archive at Nabble.com.
2012 Sep 14
1
Parallel R
Hi there, I have a largish optimisation problem (10 years of daily observations). I want to optimise between 4 and 6 parameters. I'd like to utilise parallel computing if I can as I will have to run it with different starting values etc. I have a quad core PC with 16GB ram running windows 7. Having done a little reading it seems the two best options for me are: 1.) Use the academic
2011 May 23
6
Reading Data from mle into excel?
Hi there, I ran the following code: vols=read.csv(file="C:/Documents and Settings/Hugh/My Documents/PhD/Swaption vols.csv" , header=TRUE, sep=",") X<-ts(vols[,2]) #X dcOU<-function(x,t,x0,theta,log=FALSE){ Ex<-theta[1]/theta[2]+(x0-theta[1]/theta[2])*exp(-theta[2]*t) Vx<-theta[3]^2*(1-exp(-2*theta[2]*t))/(2*theta[2]) dnorm(x,mean=Ex,sd=sqrt(Vx),log=log) }
2009 Oct 02
1
xts dates spacings
Hello! Please help - can't find any options how to remove very big spaces between two dates containing intraday prices plotted by plot.xts. It looks like the following: on the left side of the plot window is the first bunch of points, the same is for the right hand side and a long line connecting them in the middle. I would want to merge them (cut spaces) somehow. In any case thanks for
2012 Aug 05
1
R: Help xts object Subset Date by Day of the Week
I have a xts object made of daily closing prices I have acquired using quantmod. Here is my code: library(xts) library(quantmod) library(lubridate) # Gets SPY data getSymbols("SPY") # Subset Prices to just closing price SP500 <- Cl(SPY) # Show day of the week for each date using 2-6 for monday-friday SP500wd <- wday(SP500) # Add Price and days of week together
2011 May 08
3
Another quantmod question
I'm having troubles with the names of columns. quantmod deal with stock quotes. I've created an array of the first 5 closing prices from Jan 2007. (Is there a problem that the name is the same as the variable name? There shouldn't be.) > close close 2007-01-03 1416.60 2007-01-04 1418.34 2007-01-05 1409.71 2007-01-08 1412.84 2007-01-09 1412.11 When I try to
2013 May 13
1
Math problem with xts objects
Hello, I coming across a strange problem doing math on an xts object. If I have an xts object of stock prices (perhaps 5 minute bars of open, high, low,close) and want to do some math, the results fail. For example: d$close[10] - d$open[10] works perfectly d$close[10] - d$open[9] fails. I just get an answer of "numeric(0) Index: numeric(0)". My guess is that xts is breaking
2023 Oct 17
1
transform a list of arrays to tibble
I work with a list of crypto assets daily closing prices in a xts class. Here is a limited example: asset.xts.lst <- list(BTCUSDT = structure(c(26759.63, 26862, 26852.48, 27154.15, 27973.45), dim = c(5L, 1L), index = structure(c(1697068800, 1697155200, 1697241600, 1697328000, 1697414400), tzone = "UTC", tclass = "Date"), class = c("xts", "zoo")), ETHUSDT
2018 Jan 07
1
help needed on quantmod....
dear members, I am using quantmod to work with stock prices... I am trying to append the data got from getQuote to the one got by getSymbols. The function is named "apnd". The code is as follows: function(x){ if ((class(x) == "xts") || (class(x) == "zoo")){ sym <- deparse(substitute(x))
2010 Feb 22
2
Creating regularly spaced time series from irregular one
Hello, I have a series of intraday (high-frequency) price data in the form of POSIX timestamp followed by the value. I sucesfuly loaded that into "its" package object. I would like to create from it a regularly spaced time series of prices (for example 1min, 5min, etc apart) so i could calcualte returns. There is an interpolation function locf() that for timestamp with value NA uses last
2008 May 22
1
Plotting 3 Time Series
Hi, I am fairly new to R so this may be easy for some. I have one column that is the Type="A, B' T" and I have another column that lists Price='894, 895, 896' I wanted to plot three different series based upon the Type...If B than xts..If T yts... How exactly do I do this? Thanks in advance -- View this message in context:
2011 Jan 22
1
Plotting by factor with xts
Hi all, I've got an xts time series of stock symbols and closing prices. > head(x) symbol close 2010-01-04 "AFB" "13.46" 2010-01-04 "AKP" "12.80" 2010-01-04 "APX" " 8.78" 2010-01-04 "AYN" "13.15" 2010-01-04 "BAF" "13.50" 2010-01-04 "BBF" "12.86" >
2023 Oct 17
1
transform a list of arrays to tibble
Arnaud, Short answer may be that the tibble data structure will not be supporting row names and you may want to simply save those names in an additional column or externally. My first thought was to simply save the names you need and then put them back on the tibble. In your code, something like this: save.names <- names(my.ret.lst) result.tib <- as_tibble_col(unlist(my.ret.lst),
2012 Jan 10
1
plotOHLC(alpha3): Error in plotOHLC(alpha3) : x is not a open/high/low/close time series
R version 2.12.0, 64 bit on Windows. Here is a short script that illustrates the problem: library(tseries) library(xts) setwd('C:\\cygwin\\home\\Ted\\New.Task\\NKs-01-08-12\\NKs\\tests') x = read.table("quotes_h.2.dat", header = FALSE, sep="\t", skip=0) str(x) y <- data.frame(as.POSIXlt(paste(x$V2,substr(x$V4,4,8),sep=" "),format='%Y-%m-%d
2012 Aug 01
1
Time Series Have Date Show Days of the Week
I used quantmod to pull in price data from the ticker SPY. The data has date and closing price. I would like to show the day of the week for each closing price. Is that possible? Also, I would like to add the back into the data frame in a new column without changing the structure of the data set if possible. SPY 2009-01-02 92.96 2009-01-05 92.85 2009-01-06 93.47
2009 Jun 17
1
loop help
Hi all, I'm stuck trying to get syntax correct for the follwing type of loop. I would like to find the column with the largest value in a given row, and create a new column with a categorical variable indicating which column the highest value of "i" comes from. too=data.frame(A=rnorm(10,1),B=rnorm(10,2),C=rnorm(10,1.5)) too$large=0 too$large=for (i in 1:length(too[,c(1,2,3)]))
2008 Apr 14
3
Merging daily and weekly data
Dear R-help group, I have a dataset with daily closing prices from a stock exchange (consecutive 5 trading days) from a firm trading a specific commodity. The date variable looks like: quote_date 20080411 With the format; yyyymmdd. Moreover, I have another data set with a (average) weekly price of the underlying commodity. The date variables in this dataset are only year and a week number. I
2010 Jul 14
2
Using which function with xts
Hi everyone: I did a search over the internet and still couldn't find answer to my problem. I have a series of prices that I'm trying to clean up by removing any prices greater than 3 times the standard deviations. So, say that prices are: price1 2010-06-18 08:00:06.916 2730 2010-06-18 08:00:07.005 2730 2010-06-18 08:00:07.005 2729 2010-06-18 08:00:07.451