Skip to content

Instantly share code, notes, and snippets.

timelyportfolio timelyportfolio

Block or report user

Report or block timelyportfolio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@timelyportfolio
timelyportfolio / Readme.md
Last active Aug 29, 2015
Ramnath NYT Baseball with Dimple
View Readme.md
@timelyportfolio
timelyportfolio / index.html
Last active Aug 29, 2015
work on @ramnathv datamaps plugin
View index.html
<!DOCTYPE html>
<meta name="description" content="Datamaps Hexbin Plugin" />
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/d3.hexbin.v0.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<!-- I recommend you host this file on your own, since this will change without warning -->
<script src="http://datamaps.github.io/scripts/datamaps.usa.js?v=1"></script>
<p>Datamaps Hexbin Plugin</p>
@timelyportfolio
timelyportfolio / index.html
Last active Aug 29, 2015
dimple.js max min issues with multiple series
View index.html
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://dimplejs.org/dist/dimple.v1.1.4.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.js' type='text/javascript'></script>
<style>
.rChart {
@timelyportfolio
timelyportfolio / code.R
Last active Aug 29, 2015
rCharts Polycharts Heatmap Issue # 77
View code.R
data.new <- data.frame(id = 1:1000)
data.new$Employer <- c("aaa","bbb","ccc","ddd","eee")[runif(n=1000,min=1,max=6)]
data.new$Type <- c("Nonacademic", "Postdoc", "Fixed Term Academic", "Other Tenure Track", "Research University")[runif(n=1000,min=1,max=6)]
data.new$Year <- c("2010","2011","2012","2013")[runif(n=1000,min=1,max=5)]
data.new <-
data.frame(xtabs( ~ Employer + Type + Year, data = data.new))
colnames(data.new)[4] <- "Value"
@timelyportfolio
timelyportfolio / code.R
Last active Aug 29, 2015
rCharts issue 77 - dimple example
View code.R
#install_github("rCharts","timelyportfolio",ref="dimple_layer")
require(rCharts)
data.new <- data.frame(id = 1:1000)
data.new$Employer <- c("aaa","bbb","ccc","ddd","eee")[runif(n=1000,min=1,max=6)]
data.new$Type <- c("Nonacademic", "Postdoc", "Fixed Term Academic", "Other Tenure Track", "Research University")[runif(n=1000,min=1,max=6)]
data.new$Year <- c("2010","2011","2012","2013")[runif(n=1000,min=1,max=5)]
data.new <-
data.frame(xtabs( ~ Employer + Type + Year, data = data.new))
View Makefile
example.md: example.Rmd
Rscript ./knit
example.ipynb: example.md
c://python27_64/scripts/notedown example.md | sed 's/%%r/%%R/' > example.ipynb
@timelyportfolio
timelyportfolio / code.R
Last active Aug 29, 2015
sp500 and vix nvd3 scatter with rCharts
View code.R
require(rCharts)
#nvd3 rCharts do not show up in Rstudio viewer
#so turn viewer off
options(viewer=NULL)
require(quantmod)
getSymbols(c("^VIX","^GSPC"),from="2012-01-01")
roc <- ROC(
na.omit(merge(VIX[,4],GSPC[,4])),
@timelyportfolio
timelyportfolio / Readme.md
Last active Aug 29, 2015
rCharts dimplejs rendition of bfast on S&P 500
View Readme.md

rCharts + dimplejs Visualization of bfast on S&P 500

Analyze breakpoints with the R package bfast with an interactive d3.js visualization using rCharts and the dimplejs library.

R bfast code from blog post

For a better understanding of bfast please see the following paper.

Verbesselt J, Hyndman R, Newnham G, Culvenor D (2010)
View code.R
hair_eye_male = subset(as.data.frame(HairEyeColor), Sex == "Male")
n1 <- nPlot(Freq ~ Hair,
group = 'Eye',
data = hair_eye_male,
type = 'multiBarChart'
)
n1
@timelyportfolio
timelyportfolio / Readme.md
Last active Aug 29, 2015
rCharts parallel coordinates version of market returns
View Readme.md

Quick combination of parallel coordinates and rCharts to show returns by year and annualized returns since 2007 of three index ETFs (SPY, EEM, and VEA). This could easily be extended to other risk/return data points on a much larger sets of indices, asset classes, or securities.

Thanks to d3.js, parallel coordinates, rCharts, R, and PerformanceAnalytics.

Data from Yahoo! Finance for personal educational use.

You can’t perform that action at this time.