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

learn more… | top users | synonyms

0
votes
0answers
78 views

Quadratic programming solve.QP's Lagrangians

Hi I am currently playing a little with Markowitz's portfolio optimization problem and from my computations I get that if we start from the following problem : $$ \underset{w}{\arg \max} \quad w'r ...
0
votes
0answers
27 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
135 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}$, ...
13
votes
4answers
636 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
50 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
25 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
120 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 ...
1
vote
1answer
41 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
95 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 ...
0
votes
1answer
47 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 ...
0
votes
0answers
73 views

building stocks screener using R and Quantmod

I am trying out R and Quantmod, my aim is to scan whatever stocks which match MACD crossover let's say 12 and 26 period, then print the stocks code on one Window. I have couple questions: How could ...
1
vote
3answers
99 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
57 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
86 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
159 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
57 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 ...
2
votes
0answers
39 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
89 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
82 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
62 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
71 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. ...
0
votes
0answers
76 views

R TTR/RSI does not behave like a Bloomberg RSI

The implementation of TTR:RSI differs slightly from the RSI calculated in Bloomberg, see more details here. I use in TTR the SMA, which simply calculates the mean, that is a walking window of: ...
0
votes
0answers
67 views

Using the R package “ termstrc ”

I am attempting to use the function estim_nss from the termstrc package in R. However, I am experiencing the following error: ...
0
votes
3answers
140 views

Portfolio Optimization - Zero beta portfolio

I am trying to solve a optimization portfolio in R in which I do the following constraints: Set weight sum to within a boundary Set return to a certain value Set portfolio beta to 0 The purpose ...
2
votes
1answer
106 views

Volatility updating rule using r

I'm trying to program a volatility updating rule using iteration. I start with the well know Heston-Nandi model where the returns dynamics are : with is iid standard normal randome variable, where ...
2
votes
0answers
34 views

How do I specify Thirty360::European day counter in RQuantLib

I am taking liberty to ask the following question in quantLib forum though this question is about RQuantLib I am trying to use RQuantLib to calculate clean price of a fixed coupon bond using a ...
0
votes
1answer
79 views

Chart Correlation warnings

when I run chart.Correlation I get a series of warnings. I get the identical warnings with chart.Correlation(managers[,1:2],method="pearson") Here is a short sample: ...
0
votes
1answer
41 views

Risk free rate for Performance Analytics

In [R] one can pass either a vector or scalar as the risk free rate. What is better? If I pass a vector to (for example) chart.riskreturnscatter then the sharpe ratio lines disappear. ...
1
vote
0answers
94 views

Stochastic Volatility CIR estimation

would anyone have a code (pref. Matlab or R) for any type of estimation (QML, GMM) not using option prices of a stochastic volatility model driven by a CIR process described below? \begin{equation} ...
1
vote
1answer
190 views

short-sale constraint with nonpositive-definite matrix in portfolio optimization

I need help about portfolio optimization in R. I have inverted matrix and I want to use it as an input in portfolio optimization. It was non-positive definite before I have handled it. In portfolio ...
2
votes
5answers
406 views

Is there any way to easily estimate and forecast seasonal ARIMA-GARCH model in any software?

I use R to estimate a seasonal ARIMA(8,0,0)(5,0,1)[7] model for the seasonal differences of logs of daily electricity prices: ...
1
vote
0answers
65 views

Ibrokers: reqMktData extremely slow when adding tickers

I am trying to snap prices in R for the latest price for a list of stocks (around 150). When I snap them for 2 stocks, it's almost instantaneous: ...
1
vote
1answer
55 views

Geometric Return & Performance Results for Quarterly Rebalancing

I have a Portfolio that is rebalanced every 3-months. The portfolio is made up of assets that have daily log-returns. I am a bit confused when charting the results using ...
2
votes
1answer
132 views

ARIMA model, cannot get rid of low order ACF spike

I've gone through all the steps to fit a good ARIMA model - I plotted the data, I looked at the ADF tests, I looked at the ACF plot with no AR and MA terms just a constants. I came up with an ...
2
votes
2answers
161 views

How to find the best fitting GARCH model for a portfolio composed of 3 ETFs in R?

I am doing a project for my class Financial Time Series in which I am trying to forecast my portfolio log returns using a GARCH fit. I am having a bit of trouble determining the best way to fit this ...
1
vote
0answers
100 views

Stationarity tests in the frequency domain for regression

Strict stationarity is the strongest form of stationarity. It means that the joint statistical distribution of any collection of the time series variates never depends on time. So, the mean, variance ...
2
votes
0answers
68 views

how to apply a simple copula model

I'm playing around with copulas and wanted to generate some sample based on copula techniques in R. For this purpose I applied the following algorithm: Generate three sample vectors coming from ...
2
votes
1answer
123 views

Does Nelson-Siegel require adjustments to yield curve input data?

I am attempting to gain a better understanding of the limitations of the Nelson-Siegel model as described in Estimating the Yield Curve Using the Nelson-Siegel Model. As I have been playing around ...
0
votes
0answers
499 views

Calculating the efficient frontier from expected returns and SD

I'm trying to calculate the efficient frontier (and the optimal portfolio at the Sharpe ratio) given two vectors for a portfolio: (1) expected returns and (2) historical standard deviations. I would ...
0
votes
0answers
24 views

garchOxFit in R-oxo file does not match

Could someone please help me with trying to get the Ox interface to work in R. I get the following errors as output: This version may be used for academic research and teaching only Link error: ...
1
vote
3answers
253 views

Daily option data

I am wondering where I can pull daily (hourly, by-the-minute, etc. even better) option data for a particular underlying. I would prefer a database I could scrape through and API, but would not mind ...
2
votes
0answers
102 views

negative transition probabilities in the heston model

I've been trying to implement a bivariate tree for pricing american options with the heston model in R using the paper of Beliaeva and Nawalkha ...
2
votes
2answers
197 views

Is there a way to adjust R PerformanceAnalytics function VaR with EWMA or GARCH method?

Is there a way to upgrade R PerformanceAnalytics function VaR with more risk sensitive approaches like EWMA or GARCH? Or is there another R package which can handle the issue?
0
votes
0answers
106 views

Asian option numerical pricing method generates a negative time value

I use R to write a function which simulates price path and calculates the value of an arithmetic Asian option. I found sometimes the value of the option can be lower than its intrinsic value, i.e., ...
6
votes
2answers
684 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 ...
5
votes
3answers
305 views

multiperiod optimization using R

I'm interested in multistage optimization problems. Are there any good R packages around to solve such problems over time? I'm not at all an expert in it, so maybe someone knows a good paper / lecture ...
1
vote
0answers
159 views

one-step-ahead Stochastic Volatility for 5-minute VWAP prices

I'm trying to run an SV model against prices of Euro/USD. For those not familiar with SV, its a volatility model in which each point gets its own volatility parameter $h_t$ with 3 main parameters that ...
2
votes
1answer
208 views

Stress Testing Methods

I'm working on the following task: Given quarterly data: a time series representing the 1-year realized (10 years of data) rates of default on a portfolio of mortgages a slew of ...
0
votes
1answer
1k views

Integrating R with Bloomberg

In the past, I have used the package RBloomberg to directly pull bloomberg data into R. I've also seen it go by the names Rbbg or R[Name Redacted]. It seems to me, however, that this package no longer ...
4
votes
1answer
701 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 ...