Displaying 20 results from an estimated 200 matches similar to: "tidyquant error downloading symbols for Index"
2008 Sep 22
1
Help for SUR model
I am an R beginner and trying to run a SUR model in R framework.
subset(esasp500, Obs <=449 & Obs>=197, select = -Date) ->ev13sub
c(Obs>=397) & c(Obs<=399) ->d13
c(Obs>=400) & c(Obs<=449) ->f13
SP500*f13 ->SP500f13
BBC~SP500+d13+SP500f13 ->sur132
BOW~SP500+d13+SP500f13 ->sur133
CSK~SP500+d13+SP500f13 ->sur134
2007 Nov 09
1
Problem reading data in Rmetrics
Hi folks - After upgrading to the latest version of Rmetrics, I can't
read in data like I used to. Is anyone seeing the following? It seems
to truncate the dates after I use "as.timeSeries".
-John
SP500<-read.table("SP500.csv",header=TRUE,sep=",")
> head(SP500)
Date Open High Low Close Volume
1 08/04/06 1280.26 1292.92
2008 Jan 24
1
Error using Rmetrics to read data
Hi folks. This set of code used to work, but after upgrading to the
latest version of Rmetrics it no longer does. Any ideas?
SP500<-read.table("SP500.csv",header=TRUE,sep=",")
> head(SP500)
Date Open High Low Close Volume Close2
1 8/4/2006 1280.26 1292.92 1273.82 1279.40 2530970112 1279.40
2 8/3/2006 1278.22 1283.96 1271.25 1280.27
2011 Feb 19
4
Accessing DF index
I have a dataframe called x2. It seems to have a date column but I can't
access it or give it a name or convert it to a date. How do I refer to that
first column and make it a date ? When I try x2[1,] I get the second column.
head(x2)
FAIRX SP500 delta
2000-08-31 0.010101096 0.007426964 0.002674132
2000-09-29 0.096679730 -0.054966292 0.151646023
2000-10-31
2006 Nov 22
2
problems with garchFit
Hi all,
I post it on both r-help and r-finance since I don't know where is most
appropriate for this topic. Sorry if it bothers you.
I did garch fitting on S&P500 monthly returns with garchFit from fSeries. I
got same coefficients from all cond.dist except normal. I thought that is
probabaly usual for the data. But when I play with it, I got another
question.
I plot skew normal with
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
?
2012 Jan 28
1
Using the digest and t distribution.
Hello R community,
I have two questions:
The first might be one of the silliest ever posted here and I
apologize if I've missed some thing very obvious. It relates to using
this digest. When I subscribed to the forum, I had chosen the "digest"
option that bundles all mails every day into a single digest.
Now, I posted a question a while ago on the logistic regression
function and
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
2017 Oct 18
1
Problem with tq_mutate_xy() from the tidyquant package
I was able to reproduce the problem with this self-contained example. Maybe
it could be reproduced with an even smaller one ...
library(tidyquant) # Loads tidyverse, tidyquant, financial pkgs, xts/zoo
library(xts)
dtV <- as.Date("2017-01-01") + 1:100
locL <- list( foo=xts(rnorm(100), order.by=dtV), bar=xts(rnorm(100),
order.by=dtV) )
fullXts <- do.call(merge,locL)
smallXts
2018 Jan 18
3
Split charts with ggplot2, tidyquant
Could you provide some information on your data structure (e.g., are the
two time series in separate columns in the data)? The solution is fairly
straightforward once you have the data in the right structure. And I do
not think tidyquant is necessary for what you want.
Best,
Charlie
--
Charles Redmon
GRA, Center for Research Methods and Data Analysis
PhD Student, Department of Linguistics
2007 Jul 12
2
how to get the p-values from an lm function ?
Hi, dear R-users,
I am computing a liner regression by rating category using the 'by' function
as stated below:
tmp <- by(projet, rating, function(x) lm(defaults ~ CGDP+CSAVE+SP500, data =
x))
I would like to get not only the coefficients but also their p-values. I
can't find the command in the help pages to get them.
Does anyone have a suggestion ?
Thank you,
Benoit.
2018 Jan 18
0
Split charts with ggplot2, tidyquant
Hi Charlie,
I am comfortable to put the data in any way that works best. Here are two
possibilities: an xts and a data frame.
library(quantmod)
quantmod::getSymbols("SPY") # creates xts variable SPY
SPYxts <- SPY[,c("SPY.Close","SPY.Volume")]
SPYdf <- data.frame(Date=index(SPYxts),close=as.numeric(SPYxts$SPY.Close),
2009 Nov 20
2
Problem at adding lines on a graphics with lines() function
Hello, I am trying to plot a graphic with many lines with the following
command:
plot(datas[1:n,1],datas[1:n,2],type="l",main="SP500 Prices and Moving
Averages",xlab="Date",ylab="Prices",col="black")
lines(datas[1:n,1],datas[1:n,3],type="l",col="green",lty="solid")
But I just see the first curve. I have tried it on
2012 Dec 06
1
Fuction Error
I'm calling a list of symbols and then using a function to build a data
frame from that symbol list. It works great until I introduce this index
symbol from yahoo '^GSPC'. When and index symbol is introduced I get and
error which is below.
> Data <- symbolFrame(symbols)
Error in get(S) : object '^GSPC' not found
Since R does not like the ^ in front of a name it
2008 Sep 11
1
how to calcaulate matrices for two subsets
I am an R beginner and trying to run a market model using event study in
R framework.
First, I run a market model, that is lm(stock security~SP500 index,
subset=Obs[197, 396]) ->result1
Then I get predict results for a new dataset using predict (result1,
newdata=Obs[397,399]) ->pred1
Pred1 should have three numbers.
Now I need to calculate abnormal return by the formula stock
2007 Nov 24
5
how to calculate the return?
Hi, R-users,
data is a matrix like this
AMR BS GE HR MO UK SP500
1974 -0.3505 -0.1154 -0.4246 -0.2107 -0.0758 0.2331 -0.2647
1975 0.7083 0.2472 0.3719 0.2227 0.0213 0.3569 0.3720
1976 0.7329 0.3665 0.2550 0.5815 0.1276 0.0781 0.2384
1977 -0.2034 -0.4271 -0.0490 -0.0938 0.0712 -0.2721 -0.0718
1978 0.1663 -0.0452 -0.0573 0.2751 0.1372 -0.1346
2018 Jan 19
2
Split charts with ggplot2, tidyquant
So the general strategy for getting these into separate panels in ggplot
is to have a single variable that will be your response and a factor
variable that indexes which original variable it came from. This can be
accomplished in many ways, but the way I use is with the melt() function
in the reshape2 package.
For example,
library(reshape2)
plotDF <- melt(SPYdf,
??? ??? ??? ??? ??? ???
2018 Jan 21
1
Split charts with ggplot2, tidyquant
Thanks for the reminder about lattice! I did some searching and there's
a good example of manipulating the size of subplots using the `position`
argument (see pp. 202-203 in the Trellis Users Guide:
http://ml.stat.purdue.edu/stat695t/writings/Trellis.User.pdf). This is
not within the paneling environment with the headers like in other
trellis plots though, so you'll have to do a bit
2018 Jan 19
0
Split charts with ggplot2, tidyquant
Hi Charlie,
Thanks. This is helpful. As mentioned in my original question, I want to be
able to plot a few such charts on the same page,
say a 2 x 2 grid with such a chart for each of 4 different stocks. Using
your solution I accomplished this by making
a list pLst of your ggplots and then calling cowplot::plot_grid(
plotlist=pLst, nrow=2, ncol=2 ) That worked fine.
The one issue I have is that
2018 Jan 17
0
Split charts with ggplot2, tidyquant
A very common chart in the financial markets is a split chart with two time
series shown in two vertically stacked sub-charts.
A classic case would be the top panel showing the time series of historical
prices of some stock, and the bottom
panel showing the volume traded per day immediately below it. The common
x-axis is the dates of the time period covered.
I would like to create such a standard