# Tagged Questions

An open source programming language and software environment for statistical computing and graphics.

17k views

### Switching from C++ to R - limitations/applications

I've only recently begun exploring and learning R (especially since Dirk recommended RStudio and a lot of people in here speak highly of R). I'm rather C(++) oriented, so it got me thinking - what are ...
7k views

### Is R being replaced by Python at quant desks?

I know the title sounds a little extreme but I wonder whether R is phased out by a lot of quant desks at sell side banks as well as hedge funds in favor of Python. I get the impression that with ...
7k views

### What tools exist for order book analysis and visualization?

What tools exist for order book analysis and visualization? In particular, if one wanted to examine a limit order book and understand how it changes throughout the day where would you turn for ...
2k views

### Tools in R for estimating time-varying copulas?

Are there libraries in R for estimating time-varying joint distributions via copulas? Hedibert Lopes has an excellent paper on the topic here. I know there is an existing packaged called copula but ...
8k views

### How to derive the implied probability distribution from B-S volatilities?

The general problem I have is visualization of the implied distribution of returns of a currency pair. I usually use QQplots for historical returns, so for example versus the normal distribution: ...
1k views

### Simulating Returns

I'll start this off with a rather broad question: I am trying to simulate returns of a large number of assets within a portfolio of different classes - equity and fixed income in a first step, say 100 ...
7k views

### R: How feasible is it to store — and work with — tick data in a database connected to R?

I'm looking to convert some tickdata .csv files into a database on a local disk and then use R to call the data and do my various analytics and modelling. What are some best practices / ...
6k views

### R: Fast and efficient way of running a multivariate regression across a (really) large panel (First pass of Fama MacBeth)

I am attempting to run a rolling multivariate regression (14 explanatory variables) across a panel of 5000 stocks: For each of the 5000 stocks, I run 284 regressions (by rolling over my sample ...
608 views

### Has any research used Bayesian networks to estimate risk factor betas?

Is there any published research on estimating the beta of a security with respect to one or more risk factors via Bayesian networks? I'd like to see if this is a promising angle of research.
5k views

### R code for Ornstein-Uhlenbeck process

Can any one help me with some R code to run Ornstein-Uhlenbeck process?
2k views

### robust portfolio optimization re-balancing with transaction costs

The optimal re-balancing strategy takes account of factors including i) objective function, ii) current portfolio weights, iii) expected return vector containing updated views/alpha forecasts, iv) ...
463 views

### Is there a website that lists replication code of financial papers?

There are lot of questions on this website related to the replication of the empirical part of financial papers. I noticed that some (honest) authors provide on their personal website some ...
811 views

### Thesis using Momentum strategies in R, tips on good books, guidelines etc on how to do the programming?

I am quite new to R and will be doing an empirical analysis of momentum strategies in R using a dataset from the index OSEAX from 1980 to 2014. The momentum strategy will for the most part resemble ...
585 views

### rugarch: Joint estimation leads to different results

I want to fit an ARMA-GARCH model to my data using rugarch package in R. First of all, I look at the acf and pacf: ...
520 views

### A non parametric study of VaR with kernel density

I'm working in order to compare the calculation of the VaR between the methodology of copulas and kernel density, all this by using the software r. The process that I follow is: Obtain a sample (...
3k views

### Hidden Markov Model & Its Application

I have started reading about HMM it gives an intuitive idea about what HMM is all about. I am looking out for example where its applied to Equity model using R / Excel. The material which I read so ...
21k views

### Calculating log returns using R

I am trying to calculate the log returns of a dataset in R using the usual log differencing method. However, the calculated data is simply a vector of zeroes. I can't see what I'm doing wrong. Here ...
2k views

### Is there a technique for using xts or zoo objects with options data (i.e., many entries per date) in R?

I am starting to work with options data from optionmetrics. I use data frames, but it seems like xts or zoo objects are the way to go for features and speed. I can't figure out the best work-around to ...
976 views

### How to compute modified-CVaR in the PerformanceAnalytics package?

My objective is to measure the modified-CVAR for a portfolio given its weights and matrix of security returns. Luckily the wonderful package PerformanceAnalytics has an ES() function that does just ...
712 views

### Are there any tools or useful algos for identifying corner portfolios?

Let's say I am performing mean-variance optimization subject to some weight constraints. I'd like to identify the set of corner portfolios so that I can interpolate the entire efficient frontier. A ...
442 views

### GBM 3d plot with R

I want to plot the density of the GBM in a 3d plot. So I have on one axis the stock price, on the other the time and on the z axis the density. At the end I want to produce this graph. The formula I ...
595 views

### Is creating constrained random portfolios a hard problem?

Creating random portfolios with weights $x_i$ can be thought of as sampling from the surface of a simplex given by $$Ex = f$$ and $$Ax \le b$$ Where $E$ and $A$ are constraint matrices for equality ...
20k views

### How to fit ARMA+GARCH Model In R?

I am currently working on ARMA+GARCH model using R. I am looking out for example which explain step by step explanation for fitting this model in R. I have time series which is stationary and I am ...
965 views

### Why does the following data fail my cointegration test?

I have some closing price data for two Australian banks which track each other very closely. http://dl.dropbox.com/u/12337149/stat/CBA.csv http://dl.dropbox.com/u/12337149/stat/WBC.csv Code from ...
6k views

### Forecasting using rugarch package

I want to do one step ahead in-sample forecasts. My data can be found here. This is just a data frame with the date as the rownames. I specify my model and do the fit and show the plots with ...
938 views

### How do I replicate John Hussman's recession forecasting methodology?

John Hussman has a recession forecasting methodology he often posts about on his blog, and I am trying to replicate it using publicly available data. I would like to assess his accuracy in predicting ...
4k views

### Popular R packages for Quantitative Finance

Which R packages (in this list or not) do you use in quant finance, why not an alternative, do you use it in production and if so, how? There is a list of most of the R packages related to Finance by ...
5k views

### Using variance ratios to test for mean reversion

Can you use the variance ratio test to determine whether or not a time series is mean reverting? I'm using the Lo.Mac function in the ...
184 views

### Imposing Restrictions on Cointegrating Vectors, R example

The code given below estimates a VEC model with 4 cointegrating vectors. It is a reproducible code, so just copy and paste into your R console (or script editor). ...
467 views

### R Backtesters: Quantstrat vs SIT

I am learning R, and want to start using a backtester. I have spent about a day reading all I can about R backtesters, and it seems there are 2 main contenders: quantstrat, which uses the packages ...
18k views

### How to interpret results of Johansen Test?

I have two time-series a & b. The objective is to find out whether two series are cointegrated or not. I am using Johansen Test in R to find this out. I am using urca package of R. Here is the ...
2k views

### How do Return.portfolio and Return.rebalancing work in Performance Analytics in R?

I have a question about the function Return.portfolio/Return.rebalancing from the Performance Analytics package in R. I take ...
1k views

### Tools/R code for predicting Dragon-Kings

The theory of the so called Dragon-Kings, esp. by Didier Sornette (ETH ZÃ¼rich), basically states that financial crises and crashes are predictable (contrary to the theory of black swans). The ...
2k views

### Cointegrating relationships - Johansen in R

I read the posts, How to interpret results of Johansen Test? and How to interpret the eigenmatrix from a Johansen cointegration test? But still I am quite confused by the output. I have a project with ...
179 views

### Computing Value at Risk for portfolio in R

I know how to compute VaR with long positions using PerformanceAnalytics. What about a portfolio consisting in two equities A and B, 100 USD long positions in each, and 2 stock options for the same ...
636 views

### Alternative to Block Bootstrap for Multivariate Time Series

I currently use the following process for bootstrapping a multivariate time series in R: Determine block sizes - run the function b.star in the np package which produces a block size for each series ...
2k views

### Quantmod: what's the difference between ROC(Cl(SPY)) and ClCl(SPY)

I feel like I'm missing something fundamental here, but I can't shake the feeling that these two series should be equivalent. /edit: there is also dailyReturn(Cl(SPY)). I've seen all 3 of these ...
374 views

### Hidden Markov Models methods for selecting optimal number of states

Package RHmm (R) I have a vector which I fit into a hmm model in an attempt to select an optimal number of states for a hidden markov model. ...
433 views

### Definition of gearings, spreads and curve in RQuantLib's Floating Rate Bond function

Consider the RQuantLib package function FloatingRateBond(). This takes as inputs gearings ...
195 views

### Obtaining risk-neutral probability from option prices

Suppose I have the following data (for the current stock and option prices of the Bank of America) Strike Last IV Probability 4 8 5.43 0.5813566 0.0000000 7 11 2.45 0.2868052 ...
1k views

### Generate tick data from candlestick

Is there software (or Python / R / ... scripts) to generate (pseudo) tick data from candlestick data. I have candlestick data (CSV format) from monthly timeframe (MN) to minute timeframe (M1) but ...
706 views

### The option values are different from two r package - foptions,rquantlib

The results are very different.I know the code from quantlib and the result of quantlib seem right(close to market price). Is there anyone know why the value from fOptions is so large or fOptions used ...
6k views

### GARCH model and prediction

I have a question about the prediction of volatility and returns of a time series. Basically it is a question about prediction in the ...
447 views

### Calculate turnover for portfolio

I am trying to calculate the turnover for a portfolio strategy. First I generate some random data and assign it dates: ...
425 views

### Is it too important that my residuals be normal? I am Using an ARMA/GARCH model

I am trying to fit an ARMA/GARCH model to a time series. I found that the best candidate is an ARMA(1,0) + GARCH(1,1) with gaussian white noise It has coefficients with p-values near cero and the ...
962 views

### Change periodicity on Rblpapi

So Dirk Eddelbuettel, Whit Armstrong, and John Laing released Rblpapi to CRAN recently, and it is awesome. I'm having some difficulty understanding how the overrides work though, hopefully someone can ...
835 views

### Use Trades as Input for PerformanceAnalytics

I'd like to use the PerformanceAnalytics R package to view various metrics from a list of trades with profit values. From looking at the documentation from the PerformanceAnalytics package that most ...
396 views

### R package for portfolio

In the context of modern portfolio theory, one often wishes to minimise $\mathbf{w}^{\mathrm{{\scriptstyle T}}}\boldsymbol{\Sigma}\mathbf{w}$ subject to $\mathbf{w}^{T}\boldsymbol{\mu}=c_{1}$, \$\left\...