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

learn more… | top users | synonyms

8
votes
0answers
181 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). ...
1
vote
0answers
32 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 ...
0
votes
0answers
49 views

Spread Return and Mean Reversion Model

http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2399915 The above paper proposes an interesting method for modeling credit spreads. I have tried to implement it in R but keep obtaining unrealistic ...
1
vote
1answer
146 views

How to implement momentum strategy using R

I am trying to see if momentum strategy has a profitability in a bond market. I have a bond dataset which is a panel data and it is monthly. It looks something like the table below. For each month ...
2
votes
1answer
103 views

GJR-GARCH with $\alpha = 0$ as parameter estimate

I am estimating a GJR-GARCH(1,1) model with variance targeting in R. As data I am using returns on some stock indices. While calculating the GARCH models I obtain $\alpha=0$ for some indices. From ...
3
votes
0answers
47 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 ...
0
votes
0answers
30 views

Calculating returns when number of securities in a timeseries varies over time?

I have a timeseries of security returns in which the number of securities in the timeseries varies over time. More specifically, I have a universe of events where securities(their returns) are added ...
0
votes
0answers
45 views

How to estimate Simple Returns and Monthly Returns from daily stock price observations with Missing data in R

I have a data frame which has over 4000 columns and 3000 rows. Columns are companies and rows have daily stock closing price. The data is such that it has missing values but due to nature of the data ...
0
votes
0answers
41 views

Is there any function in quantmod to get Earning Date from Yahoo or Google

I want to get the a stock's next earning date from quantmod. I tried my best to go through the quantmod documentation to find such function. Pleae help me. Thanks
0
votes
0answers
52 views

Where and how can I get FX intraday data for use it in R?

I need FX data (the most accurate possible) for use in R. Right now I have developed a script in Java to download the CSV file (from Oanda) and use this file to read it in R, but I think that is a ...
1
vote
1answer
39 views

Disappear Standard Error in OxEdit/G@rch6 package

Hellow everyone, I'm new here. Please instruct me to do something. My problem is when I run FIGARCH(0,d,1), OxEdit still show me a matrix with variable names, coefficient, s.e, t-stat... like this ...
1
vote
1answer
66 views

Error when trying to estimate a Markov-switching Var model in R

I'm trying to estimate a Markov-switching VAR in R using the command msvar. These are the first 10 entries of my two time series. I have 798. When I try to run this I get an Error message ...
1
vote
1answer
89 views

how to calculate RMSE, MAE, given ugarchforecast results?

Given S&P500 returns for the past 20 years I fitted an ARMA(1,1)-GARCH(1,1) model using the rugarch package, so using ugarchspec() and the ugarchfit(), with different innovations distributions, i....
3
votes
1answer
337 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 $r_t=\sigma_t*\...
4
votes
2answers
136 views

ruGarch - Interpret test results

I'm working on a R project, trying to calibrate a GARCH (so far, (1,1) ) model to the yields of the STOXX50 index over the last 2 years. I've tried the garch function of the tseries package, but it ...
1
vote
0answers
64 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 ...
0
votes
0answers
52 views

VECM model with GARCH (1,1) error in R

I should create a VECM model with 8 lags and with Garch (1,1) error in R but i don't know how to do it and which package to use. The VECM should also have covariates in it. Then I should perform a ...
0
votes
1answer
65 views

CCC-Garch predict

So I'm trying to measure the VaR of 2 stock with a multivariate GARCH model, so im using the CCC model. I need to predict the standard-diviation and the mean but the ...
0
votes
0answers
29 views

Generating random numbers from the skew-t distribution

in another question I was trying to replicate density plots using random numbers coming from the skew-t distribution of Hansen (1994). Now I need to obtain a series of random numbers coming from this ...
3
votes
1answer
90 views

Density plot of the skew-t distribution

I am using the sgt package in R to recreate the plot from Hansen's paper ( available here http://www.ssc.wisc.edu/~bhansen/papers/ier_94.pdf on page 8) using random ...
2
votes
0answers
95 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 ...
11
votes
4answers
785 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 ...
11
votes
3answers
419 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 ...
0
votes
0answers
59 views

VAR(1) - GARCH(1,1) model estimation in R

Can someone please help in explaining the steps involved to estimate the parameters of VAR(1)-GARCH(1,1) model of Mcaleer 2003 in r. It is a multivariate GARCH model where the mean equation is ...
1
vote
2answers
106 views

Stochastic process theory question

*S follows a process $dS= mSdt + oSdz$ where m and o are constant. What is the probability followed by $ Y=(Se)^{(r-t)} $. If S follows a process $ dS= k (b-S) dt + oSdz $ where k, b, o are ...
0
votes
0answers
55 views

Rblpapi millisecond resolution

I'm using Rblapi to get tick data, using the nice getTicks function. Much to my dismay the index is rounded to the second, while milliseconds time stamp could be provided. Tried returnsAs xts, fts(?) ...
2
votes
0answers
80 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 ...
1
vote
1answer
315 views

Portfolio Management in R

I’ve been looking around for a R-package that will allow me to track my stock portfolio - basically I would like to enter stocks that I own, track the trades I make, calculate my open position & ...
7
votes
1answer
357 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 ...
0
votes
1answer
111 views

Log daily returns of multiple securities for multiple time period in R

I have dataset containing daily closing prices of 5413 companies from 2000 to 2014. I want to calculate daily log returns for the stocks as according to dates as log(Price today/Price yesterday). I ...
0
votes
0answers
53 views

Need to know What is not available in RQuantlib

If we explore CRAN RQuantlib package it says The 'RQuantLib' package makes parts of 'QuantLib' accessible from R. When I tried the package I have found vanilla/some exotic options, fixed income ...
4
votes
1answer
99 views

Calculate mean variance portfolio

I am trying to calculate the mean variance portfolio using the plug-in approach. First I generate some artificial data: x <- replicate(10,rnorm(1000)) Then I ...
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 ...
35
votes
7answers
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 ...
1
vote
0answers
42 views

How to form Decile Portfolios based on Liquidity measure with missing data in R

I have a dataframe with over 4000 companies data (as column) and have calculted their daily Quoted spread measure ( measures liquidity for each stock) for 15 years. And then from the daily have ...
2
votes
2answers
188 views

Augmented Dickey-Fuller Test/ Unit Root test on multiple time series dataframe in R

I have a dataset/dataframe in which I have calculated the daily log returns of five thousand companies and these companies are as column as well. I want carry out ADF test on this dataframe. I have ...
6
votes
1answer
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 ...
0
votes
0answers
90 views

Forecasting conditional variance using fGARCH

I am forecasting the conditional standard deviation using ARMA(1,0)-GJRGARCH(1,1) in R using the fGarch package. Here is a sample code: ...
0
votes
0answers
32 views

In what situations would cross validations scores be inaccurate?

I'm trying to fit a SVM model on times series stock return data, predicting a buy, hold, or sell signal of the stock. I'm using 10-fold cross validation (using the R package ...
2
votes
2answers
60 views

Problem with obtaining densities

For my research I need to obtain a series of densities, however, I am encountering some problems. The first problem is perhaps very simple, but the answer eludes me. Let's say I have an observation ...
1
vote
0answers
142 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 ...
2
votes
3answers
791 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 ...
0
votes
0answers
199 views

Forecasting conditional mean in ARMA-GARCH model (R/Matlab)

I am trying to forecast the conditional mean from a ARMA(1,0)-GARCH(1,1) model. The mean equation in my model is: $x_t = \mu + \delta x_{t-1} + h_t \epsilon_t$ where x is the variable (a return ...
2
votes
1answer
373 views

Portfolio Analytics Optimization

I have a large dataset, 10,000 investments I am trying to create an optimized portfolio for. The portfolio has 3 restrictions. Long Only, Only 50 assets can be selected and every invested asset has ...
0
votes
1answer
202 views

Transforming daily simple returns into weekly

I am trying to transform daily simple returns into weekly returns. I am using the following R code: ...
6
votes
2answers
660 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 ...
0
votes
0answers
27 views

Download DGS3MO from FRED with getSymbols - error

I follow the course "Mathematical topics in finance" from MIT courseware. I opened R and rendered Dr. Kempthorne's Case Study 3: Time Series from September 30, 2013 I am able to render the code and ...
0
votes
0answers
37 views

Solving inequality constraint

I am trying to solve the following inequality constraint: Given time-series data for N stocks, I am trying to construct a portfolio weight vector to minimize the variance of the returns. the ...
1
vote
0answers
67 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 ...
2
votes
1answer
67 views

Estimating Carma(2,1) parameters (using yuima package)

I am very new to R, and particularly to the yuima package, so I was hoping someone would be able to help me. I have some data (daily prices) that I wish to fit to ...