An open source programming language and software environment for statistical computing and graphics.
-7
votes
0answers
79 views
Compute a time series of daily volatilities in R [closed]
I want to use the ewma algorithm to compute a time series of daily volatilities. My $\lambda=0.97$. The start volatility is from the first $50$ returns. I want to take a vector of returns, a decay ...
2
votes
0answers
57 views
How to simulate a Geometric Binomial Process with state/tie dependent increments?
I want to simulate a geometric binomial process with state/time dependent increments.
So the model is given by
\begin{align}R_t=\frac{X_t}{X_{t-1}}\end{align}
\begin{align}P(R_t=u)=p(X_{t-1},t) ...
2
votes
2answers
100 views
RQuantLib, Hoadley and Bloomberg YAS: fixed rate bond pricing differences?
I'm trying to price a fixed rate bond one year from now on.
The bond is the PEUGOT 7 ⅜ 03/06/18, whose ISIN code is FR0011439975. I'm using such a specific example because in this way everyone can ...
1
vote
2answers
216 views
backtesting options strategies in R
I would like to backtest an options strategy in R. I require the ability to delta hedge and rebalance to options in the portfolio at different frequencies (daily, monthly,etc.) What packages are the ...
6
votes
1answer
207 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
...
8
votes
0answers
87 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:
...
1
vote
0answers
87 views
Interpolate option volatility in delta space in R
I have a bunch of deltas and option implied vols at those deltas. I would like to interpolate them in R. Interpolating them in delta space seems difficult, since normally you would like the ATM calls ...
3
votes
0answers
60 views
RQuantLib: any difference between FixedRateBond() and FixedRateBondPriceByYield() with flat term structure?
Please, consider the following functions from RQuantLib package:
FixedRateBond()
...
2
votes
0answers
108 views
Philips-Ouliaris test for cointegration
I'm trying to implement cointegration tests using the R urca package. I've figured out the Johansen test (ca.jo), but I'm having trouble with the Philips-Ouliaris test (ca.po). I have two questions:
...
1
vote
0answers
79 views
analyze strategy performance with given matrix of weights/time and weekly returns in R
I have a matrix of 259 weekly returns, 50 assets and a portfolio composition for each of the 259 weeks. I would like to test the performance of the portfolio during 52 weeks, rebalancing every 12 ...
1
vote
0answers
85 views
Error term/Innovation process in ARCH/GARCH processes?
I am wondering about the distribution of the error term/innovation process in a ARCH/GARCH process and its implementation, I am not sure about some points. The basic assumption is
...
1
vote
0answers
274 views
portfolio optimization with a loop
I am attempting to minimize the variance of a 3 stock portfolio using optimization within a loop. What I have done is calculated the stock returns and cov matrix from dates 1980-01-01 to 1989-12-31 ...
1
vote
1answer
132 views
Cointegration tests
I'm trying to figure out how to perform cointegration tests in R between 2 time series. I'm using po.test from the package ...
2
votes
0answers
49 views
3
votes
2answers
180 views
Fitting distributions to financial data using volatility model to estimate VaR
I want to fit a distribution to my financial data using a volatility model to estimate the VaR. So in case of a normal distribution, this would be very easy, I assume the returns to follow a normal ...
3
votes
2answers
188 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 ...
2
votes
0answers
153 views
Markov-Switching E-GARCH with R
I am looking for a R library for modeling a Markov-Switching E-GARCH process.
In other questions at StackExchange related to GARCH models, the package rugarch is often mentionned. Do you recommend it ...
1
vote
0answers
159 views
R ARMA-GARCH rugarch package doesn't always converge
I'm trying to compute the standard ARMA(1,1)-GARCH(1,1) as shown in this answer for an entire index,just to store in a database to quickly lookup values for back ...
10
votes
0answers
141 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 ...
2
votes
1answer
569 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 ...
7
votes
3answers
522 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 ...
3
votes
2answers
258 views
Using the termstrc package in R
I am attempting to use the function estim_nss from the termstrc package in R to find the spot curve from constant maturity rates published by the Fed. I am using this package because I will need to ...
0
votes
0answers
155 views
retrieving historical data from Interactive Brokers using R [closed]
I found that is possible to retrieve historical data from IB from R using the IBrokers package. However, their website states that the data only goes up to one year back? thus, is it possible to loop ...
0
votes
2answers
918 views
Kalman Filter Equity Example
I am looking out for some material where I can study about Kalman Filter applied to Equity using Excel or R?
7
votes
2answers
208 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 ...
3
votes
3answers
362 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 ...
2
votes
1answer
90 views
Aftcast Generation
Aftcast is a way of simulating equity curves for different start years, usually from a large sample data ~100 years. Its kind of like start date sensitivity testing but in my case, I incorporated ...
2
votes
2answers
346 views
ROC: difference between discrete and continuous?
Using the ROC function in the R package TTR, there is a choice between continuous (the default) and discrete, but with no guidance on which you choose when. In the code the difference is:
...
2
votes
0answers
735 views
Backtest pair trade strategy in R
I am looking for some tips on how to run a simple backtest on a pairtrading strategy intraday using eg. 30minute bars.
I have calculated the spread, ...
2
votes
0answers
85 views
Option symbol conversion [closed]
Maybe more of a programming question,
Is there a Ruby gem to facilitate conversion of an option symbol notation from one form to another?
For example, one source provides TZA1220J18
but an API for ...
2
votes
1answer
3k 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 ...
3
votes
2answers
841 views
GJR-GARCH Model In R
Any idea how to estimate GJR-GARCH models in R? Is there any particular library like fGarch that supports such models?
5
votes
1answer
313 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 ...
2
votes
1answer
383 views
How can I get intra-day prices via API into R?
I am able to retrieve prices for IVV using this code
library(quantmod)
getSymbols("IVV")
names(IVV)
[1] "IVV.Open" "IVV.High" "IVV.Low" "IVV.Close" ...
5
votes
2answers
3k 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 ...
11
votes
3answers
3k 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 / ...
3
votes
0answers
220 views
How to balance two Forex crosses correctly to do a linear regression?
I have two cross and an account in EUR:
EUR/USD
GBP/USD
I would like to do a balanced linear regression using R. With "balanced" I mean that I would like to normalize it by calculating the ...
17
votes
2answers
706 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 ...
8
votes
1answer
308 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.
7
votes
1answer
563 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 ...
7
votes
1answer
402 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 ...
14
votes
5answers
2k 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 ...
1
vote
1answer
2k views
How to get a list of stocks symbol of a specific exchange? [duplicate]
Possible Duplicate:
Where to download list of all common stocks traded on NYSE, NASDAQ and AMEX?
Is it possible to download a list of stocks that belong to a specific exchange (e.g. NASDAQ, ...
9
votes
2answers
2k 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:
...
6
votes
2answers
632 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 ...
5
votes
0answers
463 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
...
3
votes
1answer
759 views
How do I backtest a convertible bond arbitrage strategy in R/Matlab?
Since no one was able to answer my previous question, I am going to try to backtest a modern convertible bond arbitrage strategy myself (perhaps I'll report the results back here, if you're lucky :)). ...
4
votes
2answers
475 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 ...
6
votes
2answers
1k 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) ...
6
votes
3answers
1k views
R code for Ornstein-Uhlenbeck process
Can any one help me with some R code to run Ornstein-Uhlenbeck process?

