This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(XML) | |
require(RCurl) | |
#' This function ruturns an XML tree of the RSS feed from the given URL. | |
#' | |
#' This function utilizes the (unofficial) Google Reader API to retrieve RSS | |
#' feeds. The advantage of access RSS feeds through the Google Reader API is that | |
#' you are not limited by the number of entries a website may included in their | |
#' feed. That is, Google maintains generally maintains a complete history of | |
#' entries from the RSS feed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(quantmod) | |
require(PerformanceAnalytics) | |
getSymbols("VFINX",from="1990-01-01",adjust=TRUE) | |
getSymbols("VBMFX",from="1990-01-01",adjust=TRUE) | |
perf <- na.omit(merge(monthlyReturn(VBMFX[,4]),monthlyReturn(VFINX[,4]))) | |
colnames(perf) <- c("VBMFX","VFINX") | |
#get 8 month RSI; randomly picked 8; no optimization | |
rsi<- lag(merge(RSI(perf[,1],n=8),RSI(perf[,2],n=8)),k=1) | |
#allocate between vbmfx and vfinx based on highest RSI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interactive charts and slides with R, googleVis and knitr | |
======================================== | |
```{r results='asis', echo=FALSE, message=FALSE, tidy=FALSE} | |
library(googleVis) | |
G <- gvisGeoChart(Exports, "Country", "Profit", | |
options=list(width=250, height=120), chartid="c1") | |
T <- gvisBarChart(Exports[,1:2], yvar="Profit", xvar="Country", | |
options=list(width=250, height=260, | |
legend='none'), chartid="c2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(lattice) | |
require(latticeExtra) | |
require(reshape2) | |
require(directlabels) | |
require(quantmod) | |
require(PerformanceAnalytics) | |
getSymbols("^GSPC",from="1900-01-01") | |
GSPC.monthly <- GSPC[endpoints(GSPC,"months"),4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#analyze asset allocation experience in Spain | |
require(lattice) | |
require(latticeExtra) | |
require(reshape2) | |
require(directlabels) | |
require(quantmod) | |
require(PerformanceAnalytics) | |
require(RQuantLib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svmComputeOneForecast = function( | |
id, | |
data, | |
response, | |
startPoints, | |
endPoints, | |
len, | |
history=500, | |
trace=FALSE, | |
kernel="radial", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################# | |
# Use R to recreate part of QMV the relative non-proportional hazard estimation graph (fig 2) from Licht (2011) | |
# Updated to keep only the middle 95% of simulations | |
# Christopher Gandrud (http://christophergandrud.blogspot.com/) | |
# 30 December 2012 | |
################# | |
#### Set Up #### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
garchAutoTryFit = function( | |
ll, | |
data, | |
trace=FALSE, | |
forecast.length=1, | |
with.forecast=TRUE, | |
ic="AIC", | |
garch.model="garch" ) | |
{ | |
formula = as.formula( paste( sep="", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## See http://gettinggeneticsdone.blogspot.com/2013/06/customize-rprofile.html | |
## Load packages | |
library(BiocInstaller) | |
## Don't show those silly significanct stars | |
options(show.signif.stars=FALSE) | |
## Do you want to automatically convert strings to factor variables in a data.frame? | |
## WARNING!!! This makes your code less portable/reproducible. |
OlderNewer