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

learn more… | top users | synonyms

7
votes
0answers
158 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). ...
7
votes
0answers
632 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 ...
6
votes
0answers
146 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 ...
4
votes
0answers
1k views

FIGARCH estimation in R

I am trying to estimate a FIGARCH(1,1) model in R for Value-at-Risk purposes. As I understand it, the rugarch package does not support FIGARCH or FIEGARCH. To that end, I used the garchOxFit function ...
3
votes
0answers
40 views

Interpreting different factor models w.r.t. correlation matrix and min variance portfolio weights

Background In Eric Zivot's analysis of factor models he uses three models The sample (.sample) Single index model (.si) Barra factor industry model (.ind) PCA model (.pca) You can download his ...
3
votes
0answers
49 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 ...
3
votes
0answers
140 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 ...
3
votes
0answers
148 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 ...
3
votes
0answers
234 views

What R-packages for SOCP problems are there?

Currently, I am looking deeper into the topic of second-order cone programming. Could you suggest packages that solve SOCP-problems in R? With your answer, please provide a short description of ...
3
votes
0answers
197 views

RQuantLib: any difference between FixedRateBond() and FixedRateBondPriceByYield() with flat term structure?

Please, consider the following functions from RQuantLib package: FixedRateBond() ...
3
votes
0answers
694 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 ...
3
votes
0answers
347 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 ...
2
votes
0answers
34 views

Using Market Prices of Bonds to Model the Discount Curve with a Polynomial (Math + R)

I have a small program I'm building to interpolate the discount curve from a portfolio of benchmark bonds. If anyone has any guesses as to whether it's my process, or my code that's messed up I would ...
2
votes
0answers
55 views

Simulate correlated Geometric Brownian Motion in the R programming language

In response to this question: How to simulate correlated Geometric brownian motion for n assets? One of the responses provides an implementation in MATLAB: ...
2
votes
0answers
50 views

Johansen cointegration test interpretation in R

I want to test my time series for cointegration using the Johansen test in R. I got the following result and so I know now that at least 5 out of 9 of my time series are cointegrated. My question is, ...
2
votes
0answers
73 views

Liquidity Adjusted Asset Pricing Model

I have a data set with 4000 companies and I have calculated a liquidity measure of each of the company in the dataset as Where, Turnover is the monthly average ratio of daily volume to shares ...
2
votes
0answers
61 views

Behaviour of out of sample efficient frontier

I am comparing the efficient frontier of a set of portfolios that are in and out of sample. The first period is from 1991-01-03 until 1992-10-03 and the second one from 1992-10-03 until 1994-03-03. I ...
2
votes
0answers
75 views

Gaussian Time-varing copula in R

I want to estimate the parameters of time-varing Normal Copula using R. A bivariate Normal copula is defined as following: The dynamic equation of dependance parameter ρ is : So I need the ...
2
votes
0answers
97 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 ...
2
votes
0answers
77 views

Ledoit-Wolf portfolio weights calculation

I am trying to implement the Ledoit-Wolf minimum variance portfolio strategy on a real-world stock dataset. ...
2
votes
0answers
160 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 ...
2
votes
0answers
104 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 ...
2
votes
0answers
255 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, ...
2
votes
0answers
122 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
132 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: ...
2
votes
0answers
174 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
96 views

rugarch and rolling estimation

I use Rugarch for a long time in order to calibrate GARCH models on FX rates time series and perform simulations. I am trying to understand the ugarchroll method. However even if I can find plenty of ...
2
votes
0answers
319 views

Any one know how to implement the Heston and Rouwenhorst country-sector effects regression in R?

Heston and Rouwenhorst (1994) devised an empirical estimation strategy to decompose stock returns into three components: a pure industry effect, a pure country effect, and a world-factor return. ...
2
votes
0answers
134 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
0answers
788 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: ...
2
votes
0answers
142 views

What does negative gamma mean in APGARCH model?

I got a gamma of -0.1321677. ...
1
vote
0answers
44 views

Optimize a trading strategy created in excel with R

I have created quite a complex back test in excel spanning 15 years with 17 parameters. I would like to optimize the parameters which would give me maximum return given a maximum draw-down percentage. ...
1
vote
0answers
28 views

Cross-sectional Regression: Using calculated coefficient of first regression for a second regression as dependent variable

Hello stackexchange community! I am new to R and econometrics and and stuck in a step of the fama-macbeth (1973) regression, in which risk premia of stocks are estimated with a two-step regression ...
1
vote
0answers
57 views

How to calculate cumulative returns with one lag in R

I have a huge data frame with over 1000 column, which are companies(column headers) and in each column I have their estimated return(monthly). The sample period of the data frame in 11 years. I want ...
1
vote
0answers
75 views

How to fit a VAR + GARCH in R

I should create a VAR model with Garch error in R but i don't know how to do it and which package to use. The Vector Autoregressive model (or VECM) should also have covariates in it. Then I should ...
1
vote
0answers
90 views

Generating financial data

I am trying to generate monthly stock data using a one-factor model: $$R_{a,t} = \alpha + BR_{b,t}+\epsilon_{t}$$ The description says: $R_{a,t}$ is the excess asset returns vector, $\alpha$ is the ...
1
vote
0answers
103 views

Skewed Generalized Error Distribution's (SGED) pdf

I want to use the SGED distribution of Theodossiou for GARCH estimation, however, I am struggling to understand which is the correct pdf function of the distribution. Let me just say that the ...
1
vote
0answers
54 views

Portfolio Optimization with equal weight for assets selected

I have a data frame of bets, with 1 being a win and 0 being a loss. These bets are correlated so I cannot just pick the highest winning percentage. Goal is to get 2 optimizations, 1 for max sharpe ...
1
vote
0answers
40 views

RQuantLib FixedRateBondPriceByYield() Non-tradable error

How do I use FixedRateBondPriceByYield() function on maturity date that is earlier than today? I get "non tradable error" when applying on date older than today. ...
1
vote
0answers
144 views

Automated Import of 10-Q and 10-K Statements in XBRL Format from SEC.gov

I want to read financial statements in XBRL Format from the SEC site automatically. For instance the 10-Q File from Apple: ...
1
vote
0answers
49 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 ...
1
vote
0answers
66 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 ...
1
vote
0answers
36 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
0answers
185 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: ...
1
vote
0answers
149 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: ...
1
vote
0answers
1k 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 ...
1
vote
0answers
235 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., ...
1
vote
0answers
228 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 ...
1
vote
0answers
231 views

trading strategy outperforms passive strategy in absolute terms, but in returns vice versa. how could this be?

Background: I want to compare two trading strategies in term of profitability. The red one is an active trading strategy, which involves many entry and exit to a specific market. The blue one is a ...
1
vote
0answers
709 views

Calculating the VaR from a GARCH(1,1) with Student-t innovations

I'm self-studying several questions on Ruey S. Tsay's teaching page. I'm experiencing some difficulty getting the correct answer for final exam 2013 Problem B Question 3. Given a Student-t GARCH ...