Rolling Origin Fama French

Today we continue our work on sampling so that we can run models on subsets of our data and then test the accuracy of the models on data not included in those subsets. In the machine learning prediction world, that’s often called our training data and our testing data, but we’re not going to do any machine learning prediction today. We’ll stay with our good’ol Fama French regression models for the reasons explained last time: the goal is to explore a new of sampling our data and I prefer to do that in the context of a familiar model and data set.

Read more

Share Comments ·

rsampling fama french

Today we will continue our work on Fama French factor models, but more as a vehicle to explore some of the awesome stuff happening in the world of tidy models. For new readers who want get familiar with Fama French before diving into this post, see here where we covered importing and wrangling the data, here where we covered rolling models and visualization, my most recent previous post here where we covered managing many models, and if you’re into Shiny, this flexdashboard.

Read more

Share Comments ·

2018 Sector Analysis Part 2

Welcome to the second installment of Reproducible Finance 2019! In the previous post, we looked back on the daily returns for several market sectors in 2018. Today, we’ll continue that theme and look at some summary statistics for 2018, and then extend out to previous years and different ways of visualizing our data.

Read more

Share Comments

battlefin presentation

Introducing R and RStudio + Statistical programming language -> by data scientists, for data scientists + Base R + 17,000 packages + RStudio + Shiny + sparklyr -> big data + tensorflow -> AI + Rmarkdown -> reproducible reports + database connectors + htmlwidgets Packages for today library(tidyverse) library(tidyquant) library(timetk) library(tibbletime) library(highcharter) library(PerformanceAnalytics) More packages for finance here: https://cran.

Read more

Share Comments

Looking back on 2018: part 1

Welcome to Reproducible Finance 2019! It’s a new year, a new beginning, the Earth has completed one more trip around the sun and that means it’s time to look back on the previous January to December cycle.

Read more

Share Comments ·

Many Factor Models

Today we will return to the Fama French (FF) model of asset returns and use it as a proxy for fitting and evaluating multiple linear models. In a previous post, we reviewed how to run the FF 3 factor model on a the returns of a portfolio. That is, we ran one model on one set of returns. Today we will run multiple models on multiple streams of returns, which will allow us to compare those models and hopefully build a code scaffolding that can be used when we wish to explore other factor models.

Read more

Share Comments · ·

ASFIP presentation

Load up our packages install.packages("tidyverse") install.packages("tidyquant") install.packages("timetk") install.packages("tibbletime") install.packages("broom") install.packages("dygraphs") devtools::install_github("jbkunst/highcharter") library(tidyverse) library(tidyquant) library(timetk) library(tibbletime) library(scales) library(highcharter) library(broom) library(PerformanceAnalytics) library(dygraphs) Introducing R + Statistical programming language -> by data scientists, for data scientists + Base R + 17,000 packages + RStudio + Shiny + sparklyr + tensorflow + Rmarkdown + database connectors + htmlwidgets Packages for finance library(PerformanceAnalytics) library(PortfolioAnalytics) library(TTR) library(tidyquant) library(quantmod) library(xts) List of packages for finance here: https://cran.

Read more

Share Comments

IB Webinar

First, install our packages: install.packages("tidyverse") install.packages("tidyquant") install.packages("timetk") install.packages("tibbletime") install.packages("scales") install.packages("broom") devtools::install_github("jbkunst/highcharter") Introducing R and RStudio + Statistical programming language -> by data scientists, for data scientists + Base R + 17,000 packages + RStudio + Shiny Packages for today library(tidyverse) library(tidyquant) library(timetk) library(tibbletime) library(scales) library(highcharter) library(broom) library(PerformanceAnalytics) List of packages for finance here: https://cran.

Read more

Share Comments

GDP via API

Today we will take a look at the GDP data that is released every quarter or so by the Bureau of Economic Analysis BEA. Before we get started, a big thank you to the BEA who work very hard to gather and clean this data, and then make it publicly available to us dataphiles. We are lucky to live in these data-rich times. I know it’s a government agency and tax-funded, but I’m saying thank you anyway.

Read more

Share Comments

Highcharting Jobs Friday

In honor of last week’s jobs report from the Bureau of Labor Statistics (BLS), today we will visualize jobs data with ggplot2 and then, more extensively, with highcharter. Our aim is to explore highcharter and its similarity with ggplot, and to create some nice interactive visualizations.

Read more

Share Comments

Fama French Write up Part One

In this post (based on a talk I gave at R in Finance 2018. The videos haven’t been posted yet but I’ll add a link when they have been), we lay the groundwork for a Shiny dashboard that allows a user to construct a portfolio, choose a set of Fama French factors, regress portfolio returns on the Fama French factors and visualize the results.

Read more

Share Comments

Copper/Gold and Ten-Year Treasuries

Today, we’ll revisit the relationship between the copper/gold price ratio and 10-year Treasury yields. Inflation and interest rates have been all the rage recently, along with the VIX (which we discussed several days ago here), and it feels like a good time to refresh on this concept.

Read more

Share Comments ·

VIX and Realized Volatility: updating our previous work

In a previous post, from way back in August of 2017, we explored the relationship between the VIX and the past, realized volatility of the S&P 500 and reproduced some an interesting work from AQR on the meaning of the VIX. With the recent market and VIX rollercoaster, this seemed a good time to revisit the old post, update some code and see if we can tweak the data visualizations to shed some light on the recent market activity.

Read more

Share Comments

Labor Cost Equity Strategy

A recent piece on Business Insider, available here if you are a BI Prime subscriber and similar piece available from CNBC here, discusses an idea from Goldman Sachs that rising labor costs (expected in 2018) should lead to outperformance by companies with relatively low labor costs as a percentage of expenses.1 In today’s post, we will construct an R code flow/template to examine the relationship between stock performance and labor costs, visualize the recent historical relationships that might have led to this hypothesis, and think about extensions at the end.

Read more

Share Comments

Introduction to Portfolio Returns

Continuing our previous work on returns, let’s combine our assets into one portfolio and calculate portfolio returns. By way of quick reminder, our ultimate goal is to build and analyze the returns of a 5-asset portfolio consisting of the following. + SPY (S&P500 fund) weighted 25% + EFA (a non-US equities fund) weighted 25% + IJS (a small-cap value fund) weighted 20% + EEM (an emerging-mkts fund) weighted 20% + AGG (a bond fund) weighted 10% A brief interlude on portfolios: a portfolio is a weighted collection of assets (its etymology harkens back to the Latin for “to carry sheets of paper”, which I suppose made its way to the world of investments because securities used to be sheets of paper).

Read more

Share Comments · · ·

Transform Daily Prices to Monthly Log Returns

In this post, we will review how to import ETF prices and transform them to monthly returns. We will use a few packages and for completeness, we will cover several paths to getting our desired end result. Obviously it’s not necessary to utilize all of our paths here. The intention is to show several methods so that the best one can be chosen for a given challenge or project. Let’s load up our packages.

Read more

Share Comments ·

The Vix and The Future

In a previous post, we examined the relationship between the VIX and the past, realized volatility of the S&P 500. Today, we’ll think about how/whether the VIX predicts future volatility and we’ll be reproducing some visualizations from this Bloomberg piece. Once again, the substance and ideas here are 100% attributable to Bloomberg - my goal is to reproduce and add to our R toolkit, and learn something about volatility. First, we grab the price history of the VIX and SP500, convert to returns, and calculate the rolling 20-day volatility of the SP500.

Read more

Share Comments ·

Realized Volatility and the VIX

Today we’ll explore the relationship between the VIX and the past, realized volatility of the S&P 500. The VIX is a measure of the expected future volatility of the S&P500 and it has been quite low recently. As a volatility nerd, I came across an interesting piece from AQR on the meaning of the VIX. As a reproducibility and R nerd, I decided to reproduce some of the findings using R.

Read more

Share Comments

Introduction to Volatility

This is the beginning of a series on portfolio volatility, variance, and standard deviation. I realize that it’s a lot more fun to fantasize about analyze stock returns, which is why television shows and websites constantly update the daily market returns and give them snazzy green and red colors. But good ol’ volatility is quite important in its own right, especially to finance geeks, aspiring finance geeks, and institutional investors. If you are, might become, or might ever work with/for any of those, this series should at least serve as a jumping-off point.

Read more

Share Comments ·


Read more

Share Comments ·