similar to: Fuction Error

Displaying 20 results from an estimated 100 matches similar to: "Fuction Error"

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
2011 May 05
1
quantmod's addTA plotting functions
Hi, I'm having trouble with quantmod's addTA plotting functions. They seem to work fine when run from the command line. But when run inside a function, only the last one run is visible. Here's an example. test.addTA <- function(from = "2010-06-01") { getSymbols("^GSPC", from = from) GSPC.close <- GSPC[,"GSPC.Close"] GSPC.EMA.3
2010 Mar 16
1
Simple for-loop runs out of memory
I have the following simple for-loop, which makes R crash every time. The length of the vectors is about 1200 rows, 1 column. n = max(length(GSPC),length(FTSE)) for(i in 1:1000) { if (row.names(GSPC)[i]==row.names(FTSE)[i]){ } else { if (row.names(GSPC)[i]>row.names(FTSE)[i]){ GSPC<-rbind(GSPC[1:(i-1),],GSPC[(i-1):length(GSPC),]) row.names(GSPC)[i]=row.names(FTSE)[i] } else {
2011 May 07
2
Convenience-at-the-expense-of-clarity (was: quantmod's addTA plotting functions)
Thanks, Writing plot(addTA()) worked fine. I find myself with such mixed feelings about R. After finding that addTA worked fine at the command line but not in a function, I puzzled for a long time about what kind of virtual machine structure could possibly account for that. I couldn't think of any. It turns out that this isn't due to an R virtual machine structure. The reason addTA adds
2009 Aug 03
3
Help with data type
Hi there, Using a quantmod function, I calculate the daily change between two points in a time series. However, I don't think I am using the data correctly. Code: getSymbols("^GSPC", src="yahoo") CloseData <- Cl(GSPC) Delta <- diff(CloseData, lag=1) for (i in 3:length(Delta)) { if (Delta[i]>Delta[i-1]) sum <- sum + Delta } I can't seem to use the Delta
2011 Apr 29
3
why doesn't ifelse work ?
I have the following lines of code: ind <- rollapply(GSPC, 200, mean) signal <- ifelse(diff(ind, 5) > 0 , 1 , -1) signal[is.na(signal)] <- 0 I never get a value of -1 for signal even though I know diff(ind , 5) is less than zero frequently. It looks like when diff(ind , 5) is less than zero, signal gets set to 0 instead of - 1. Any ideas why ? Here's some information on ind and
2011 Jun 03
2
tkrplot Newbie
Hello, I am trying to write a tcltk based program that plots/manipulates xts/xoo time series objects. I have the code I used from ## http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tkrplot.html : ## require(quantmod) require(tcltk) library(tkrplot) Sys.setenv(TZ="GMT") getSymbols("^GSPC", from = "1960-01-01") Myhscale <- 2.5 # Horizontal scaling
2010 Aug 15
2
Adding colored background area to a time series plot
Hi, I am trying to add a rectangular colored background area to a plot of a time series of relative price changes. I believe that what I'm trying to do is very similar to the question and example given here: http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg73948.html http://www.mayin.org/ajayshah/KB/R/html/g5.html My problem/difference is that my time series looks like so: >
2011 Nov 10
2
Error in axis ????
I did an update of both rstudio and my packages. I had some trouble but was able to move a lot of the packages so most troubles seem to be behind me. But having a problem with code that previously ran fine. See below: require(quantmod) Loading required package: quantmod Loading required package: Defaults Loading required package: xts Loading required package: zoo Attaching package: ?zoo? The
2010 Dec 02
1
Downloading quote data from yahoo finance
Hi R users,   Thanks in advance.   I am using R 2.12.0 on Windows XP.   May I request you to assist me in the following please.   1. I am getting error while downloading quote data from yahoo finance.   The example code is below (taken from tseries help):   library(tseries)   con <- url("http://quote.yahoo.com") if(!inherits(try(open(con), silent = TRUE), "try-error")) {  
2012 Mar 10
1
Generating abnormal returns in R
Hello This is my first post on this forum and I hope someone can help me out. I have a datafile (weeklyR) with returns of +- 100 companies. I acquired this computing the following code: library("tseries"); tickers = c("GSPC" , "BP" , "TOT" , "ENI.MI" , "VOW.BE" , "CS.PA" , "DAI.DE" , "ALV.DE" ,
2011 May 15
4
DCC-GARCH model
Hello, I have a few questions concerning the DCC-GARCH model and its programming in R. So here is what I want to do: I take quotes of two indices - S&P500 and DJ. And the aim is to estimate coefficients of the DCC-GARCH model for them. This is how I do it: library(tseries) p1 = get.hist.quote(instrument = "^gspc",start = "2005-01-07",end =
2008 Jun 19
1
How can I shade the background area of a zoo time series object between specific dates?
Dear list members, How can I shade the background area of a zoo time series object between specific dates? eg. library(tseries) library(zoo) SP500<-get.hist.quote("^GSPC", start = "1990-01-01", quote = "Close") plot(SP500) How can I produce the same plot but with a (say) red background between 2007-04-12 and 2008-05-14 ?
2017 Jul 30
4
Kalman filter for a time series
I found an example at http://www.bearcave.com/finance/random_r_hacks/kalman_smooth.html shown below. But it seems the structSSM function has been removed from KFAS library so it won't run. Does anyone know how to fix the code so that it runs? library(KFAS) library(tseries) library(timeSeries) library(zoo) library(quantmod) getDailyPrices = function( tickerSym, startDate, endDate ) {
2012 Feb 11
1
object not found - Can not figure out why I get this error: Error in NROW(yCoordinatesOfLines) : object 'low' not found
Hi, I have been using R for over a year now. I am a very happy user. Thank you for making this happen. This is my first question to this list. I trying to add some functions to quantmod that would enable me to draw arbitrary lines and text and make sure they are redrawn. I have created following function: require(quantmod) # Add horizontal line to graph produced by quantmod::chart_Series()
2011 Oct 22
1
Help w/an old R program I've rediscovered and want to make work
I found an old R program I wrote som eyears back and I'd like to make work in 2.11.1 (or a more recent version), but am having two problems: 1. I can't seem to access the datafile it requires. I'm not sure where the default place that R looks to for files references within it is, or what exactly the format is for pulling in the data, by my own #comments from a few years ago
2017 Jul 30
0
Kalman filter for a time series
> structSSM Is no longer part of KFAS. All you needed to do was: library(KFAS) ?KFAS and you would have seen that if you went to the index. A structural state space model is now built up from its components, much like in LM. Look at; ?SSModel -Roy > On Jul 29, 2017, at 9:26 PM, Staff <rbertematti at gmail.com> wrote: > > I found an example at >
2011 May 12
2
DCC-GARCH model and AR(1)-GARCH(1,1) regression model
Hello, I have a rather complex problem... I will have to explain everything in detail because I cannot solve it by myself...i just ran out of ideas. So here is what I want to do: I take quotes of two indices - S&P500 and DJ. And my first aim is to estimate coefficients of the DCC-GARCH model for them. This is how I do it: library(tseries) p1 = get.hist.quote(instrument =
2007 Oct 15
0
oanda and yahoo get.hist.quote
Hello Alexander I doubt that such an analyis is very useful as the data is not sampled synchronously (equity close in the US for ^gspc and even that is not always at the same time, some average price from Oanda data). Also fx data from others sources as suggested in another mail on this list would not really help with this unless it is really sampled at exactly the same times as the equity
2007 Sep 01
1
Problem in downloading Yahoo Finance data from R
Hi R users, I have a problem in downloading Yahoo Finance data from R. I have tried an example given in R, to download. The error is given below: >library(fCalendar) > yahooImport("s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000&z=IBM&x=.csv ", file = "D:\\ Downlaod",source = "http://ichart.yahoo.com/table.csv?", save = FALSE,