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

learn more… | top users | synonyms

3
votes
2answers
152 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 ...
1
vote
0answers
23 views

R quantstrat backtest with dollar based position sizing

I am attempting to tweak a quantstrat based backtest but have run into an issue. The maxPos limits are share based, and I would rather use a fixed dollar amount instead. So I've tried generating a ...
3
votes
2answers
80 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 ...
0
votes
0answers
15 views

ROC — Output from Calculating Stock Returns Producing Lower Numbers Than Actual

I tried this on stack exchange, but think it is a better question here. I am beginning user and I need help with an error / bad output I am getting when calculating returns (using ROC) on stock ...
0
votes
0answers
51 views

Is this R back-testing code correct

I am new to R back-testing and I have tried to make a back-testing strategy (a modified simple moving average crossover)in quantstrat and it failed. My skills in programming is average and the syntax ...
0
votes
0answers
17 views

Return.portfolio error from PerformanceAnalytics package

When using the PerformanceAnalytics package of R, I am getting an error from the Return.portfolio function whenever I ask it to rebalance_on any frequency. If the rebalance parameter is removed, the ...
0
votes
1answer
77 views

What is the logic behind this backtesting code in R

I am new to R and I have found this simple backtesting code and can you explain me what is happening here. ...
5
votes
1answer
157 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: ...
0
votes
0answers
53 views

Ledoit-Wolf portfolio weights calculation

I am trying to implement the Ledoit-Wolf minimum variance portfolio strategy on a real-world stock dataset. ...
3
votes
1answer
72 views

Tools/R-code to create gain/loss-asymmetry plots

The gain/loss asymmetry is a well known stylized fact: It basically states that real financial time series take longer for going up than going down. To detect it a heavy statistical machinery is ...
0
votes
1answer
52 views

FORECASTING Model AR(1) in an Autoregressive Form The Pi´s Parameters

Ive been implementing a little exercise to obtain the first 2 forecasting points of an AR(1) process. And i want to have the forecasting ponts using the three forms: Im folowing this pdf ...
2
votes
1answer
135 views

Rebalancing portfolio weights

I have a matrix of returns and weights for every time period. ...
3
votes
1answer
123 views

Are all stocks and stock indexes just white noise

In the paper Super-Whiteness of Returns Spectra from Erhard Reschenhofer of University of Vienna it is commented the following "Until the late 70’s the spectral densities of stock returns and stock ...
2
votes
1answer
82 views

Fit linear model to higher moments of CAPM

How can one fit a linear model to the higher moments of CAPM in R? Fitting a linear model to the second moment (classical CAPM) would be ...
0
votes
0answers
43 views

Issues with +100 symbols in Quantstrat, Erratic Trades

I've tested my code against individual symbols and very small groups of symbols. I'm finding the more symbols I add the fewer trades I get. For instance, if I just include the first five symbols, all ...
0
votes
0answers
53 views

Forecast of ARMA-GARCH model in R

I managed to forecast a GARCH model yesterday and run a Monte Carlo simulation on R. Nevertheless, I can't do the same with an ARMA-GARCH. I tested 4 different method but without achieving an ...
0
votes
2answers
64 views

How to get list of all symbols in fred database?

I am trying to query every single series in the fred database using r. I have checked out both the quantmod and fImport packages, and they work fine, though it seems that quantmod fits my use a bit ...
0
votes
0answers
31 views

Interpretation of Johansen cointegration test in R

I am using urca package of R for Johansen Cointegration test in 2 stocks datas( A and B. My question is very elementar, but have cause some problems for me. How I interpret the critical values, for ...
0
votes
1answer
75 views

how do I loop through all the stocks with quantmod and ttr?

I just started with quantmod package. If I want to select stocks based on their recent performance, then I need to loop through all the stocks in, say, NYSE. So I need: get all the stock symbols ...
0
votes
0answers
35 views

How to construct a cointegrating vector using more than 2 price series in R?

I use now this code from hier Why does the following data fail my cointegration test? with slightly modification of possibility to load something directly from Dropbox file storage . ...
2
votes
2answers
99 views

Any package to run VAR-GARCH or VECM-GARCH models in R?

I need to estimate a multivariate VECM-GARCH (or simply VAR-GARCH) in R. Browsing on the internet, I did not find anything yet. Do you know if such kind of packages exists? Please, note that a BEKK ...
0
votes
2answers
122 views

Fractals indicator (Bill Williams) R Quantstrat

Hi has anyone seen or know how to create an indicator for fractals in quantstrat? fractals explained http://forex-indicators.net/bill-williams/fractals example code (only interested in type 1 ...
0
votes
0answers
57 views

Can you tell me what this RBloomberg formula means?

I've been asked to re-create a spreadsheet that used RBloomberg using a different data source. But I'm having trouble figuring out exactly what one of the spreadsheet's formulas does. Can anyone tell ...
4
votes
2answers
202 views

good R package for vectorized option pricing

I am using for now the package fOptions but it doesn't allow for vectorized computation of black76 prices and delta. Which package can be used to do that? As noted ...
0
votes
1answer
60 views

Accuracy of GARCH& ARCH forecast

I'm learing ARCH&GARCH model. I have four questions that I don't know the answers 1st: ARCH & GARCH are often used to evaluate equities. Does it mean that ARCH and GARCH are fitter for high ...
2
votes
1answer
47 views

VaR calculation accuracy/comparison/effectiveness through different R packages

My question is what would be the better( in terms of estimation accuracy) method of VaR calculation among below two:, also any small code snippet will be great as a starting point for me. 1st method: ...
3
votes
1answer
91 views

Simulate (imaginary) asset prices using random numbers that follow a Frank Copula

I didn't understand how to simulate asset prices by using non normal random numbers. I am assuming that it would be incorrect to use the standard Geometric Brownian Motion, since it is based solely ...
-3
votes
1answer
67 views

Constant decreasing volatility, GARCH forecasting

I am trying to forecast the volatility using GARCH modelling in R. I fit an ARMA(1,1)-GARCH(1,1) model, but my sigma predictions are constantly decreasing. Anybody know why? ...
0
votes
1answer
25 views

Residuals in the Ljung box test

does anybody know what type of residuals is used in the Ljung box test in R? raw or standardized? Because basically when I fit a GARCH model using garchFit, the summary() function gives me all the ...
1
vote
1answer
90 views

Forecasting using GARCH in R

I am using the predict and ugarchforecast functions in R. When I fit my models and try to forecast, I get either only increasing or decreasing values for sigma, does anyone know why? Thank you ...
1
vote
0answers
116 views

GARCH modelling and forecasting

I have a few questions regarding GARCH modelling and forecasting and it would be great if someone could help me. I am modelling the log return of oil spot prices using various GARCH models: GARCH, ...
0
votes
1answer
100 views

How to create a basket of currency pairs with the lowest correlation in R?

My strategy is designed to buy and sell all assets of a universe and rebalance periodically. It goes either long or short. To limit risk exposure to a single currency I would like the assets in the ...
4
votes
2answers
236 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}$, ...
23
votes
7answers
2k 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 ...
3
votes
0answers
75 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 ...
0
votes
0answers
30 views

comparison of speech signal processing and financial data

I have read that in speech signal processing analysis when voice is segmented in brief temporary segments the series segments transitions from being non stationary to stationary. My question is if ...
1
vote
2answers
147 views

Kalman filtering

Is it possible to the extract the latent factor f from the following equations using kalman smoothing? f is the unobserved state value while z is observed series. From the literature i could read ...
0
votes
1answer
102 views

Technical Analysis - OBV indicator calculation in R

Here is a few references about OBV calculations: http://ta.mql4.com/indicators/volumes/on_balance_volume ...
2
votes
1answer
129 views

rollapply with Arima model: testing for stability of coefficients

I am trying to fit an arima model on a rolling window using rollapply.My aim is to plot a graph of the evolution of the coefficient, plot the error and the standard deviation. well i encountered the ...
2
votes
1answer
103 views

out-of-sample variance using rolling window

I am currently working on the comparison of the constructed portfolios using out-of-sample variance criteria. I am going to use rolling window procedure for the comparison. First, I choose a window ...
1
vote
3answers
139 views

Building custom indices; getting data from web; stats analysis; Python or R?

I would like to build a couple of custom indices. I would like to be able to enter ticker(s) into an input and have ohlc, volume, qualitative ...data downloaded from yahoofinance, google finance, ...
2
votes
2answers
86 views

Calculate efficient frontier using fPortfolio with incomplete set of returns

I want to calculate the efficient frontier for a set of 140 assets using returns from the past 10 years. However, some of these assets came into existence only more recently, so for some assets I have ...
1
vote
2answers
143 views

How can I estimate the Ornstein-Uhlenbeck paramters of some mean reverting data that I have on R?

I have mean reverting data (Difference of 2 stock prices, that I want to do pairs trading on). I want to simulate my own mean reverting data as similar as possible to the real data that I have. The ...
0
votes
1answer
231 views

Portfolio optimzation : efficient frontier with respect to risk aversion parameter with R

I am currently trying to write a little script in R to determine the optimal weights given a fixed risk aversion parameter. The problem I have is that by increasing the risk aversion parameter I think ...
1
vote
0answers
74 views

How can I do a dynamic GARCH model using extended Kalman filter in R?

Today I was reading an article quoted here, in this article is proposed an adaptive (dynamic) Garch model. How can I do it in R? The use of extended Kalman filter or particle filter is indifferent. I ...
3
votes
0answers
67 views

DCC GARCH - Specificating of ARCH and GARCH parameter Matrices STATA

The command in STATA to calculate the DCC model of two variables is: mgarch dcc ( x1 x2=, noconstant) , arch(1) garch(1) distribution(t) $$ \begin{bmatrix} ...
3
votes
1answer
105 views

Fitting transition matrices in R by solving for coefficient

I'm using various matrices to impute a fitted transition matrix for credit ratings by solving for a variable [S]. Essentially the idea is to determine a base matrix and stress matrix to compare to a ...
2
votes
0answers
106 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 ...
0
votes
1answer
110 views

Quantiles, Value-at-Risk and log normal random walks…

Sorry, that's probably quite a bunch of silly questions, but I just got lost a bit and need to dot all the i's and cross some t's :). Let's say we have a series of returns (like this one we may get ...
2
votes
1answer
112 views

Why annualized return and cumultive return aren't equal over 1-year period with Performance Analytics package in R?

I use Performance Analytics package in R to compare annualized and cumulative return of a portfolio. My expectation is that both should be equal over a period of 1-year but results tell me I'm wrong. ...