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

learn more… | top users | synonyms

0
votes
0answers
11 views

How to write time-varying functions in R? Applied example

Let's say I want to use a Gaussian copula $$C_{R_t}(\eta_1, ..., \eta_n) = N_{R_t}(N^{-1}(\eta_1), ...,N^{-1}(\eta_n))$$ with a time-varying correlation matrix $R_t$. Through DCC we model the ...
2
votes
1answer
95 views

VEC GARCH (1,1) for 4 time series

I have to estimate a VEC GARCH(1,1) model in R. I already tried rmgarch, fGarch, ccgarch, mgarch, tsDyn. Has somebody estimated a model like that? ...
5
votes
1answer
154 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} ...
0
votes
0answers
15 views

Converting a factor vector in R [on hold]

If I have a factor vector with 3 levels, "", "No" and "Yes" how can I convert this to a binary factor vector with "na" if no answer , 1 for "Yes" and 0 for "No" ?
0
votes
0answers
12 views

R:log return calculation for panel data structure

I have a long form panel for hourly prices of stocks. I want to do log return calculation for this panel data structure. Below is my code: ...
1
vote
1answer
85 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
1answer
62 views

Generating random yields

I would like to test different methods for fitting a yield curve, like the Nelson-Siegel, cubic splines etc. I would like to generate random yield to maturity data, that somehow reflects the common ...
0
votes
1answer
40 views

Vasicek yield curve

Term structure is determined by a two-factor affine model (Vasicek). Using the monthly swap market data, we fit the model to match exactly the one-year and ten-year points along the swap curve ...
0
votes
0answers
19 views

How to Download Benchmark Weights in R on daily basis?

I would like to download benchmark weights on a daily basis in R for NSE Stock Exchange. Do we have any package in R for the same. If yes, then please help out with example code.
0
votes
0answers
59 views

Update Daily price from yahoo in R

I am trying to update daily prices from yahoo via below R code, but code is not working properly and i am not getting any error as such. One can see the reference code at following link. ...
1
vote
2answers
99 views

How many years of historical data is require for Portfolio Optimization?

I would like to know about below questions. How many years of historical data is require for Portfolio Optimization in R programming. Thanks Atul
3
votes
1answer
293 views

ARMA+GARCH prediction with package rugarch (R)

I am analyzing FTSE 100 series, from 2007-01-01 to 2010-12-31 (university exam homework). I have to use the data 'til 2010-11-30 as sample, and the remaining (23) observations as in-sample forecast ...
1
vote
2answers
36 views

type mismatch in Rquantlib Bond.cpp

I've been tracing back through bond.cpp and find the following in FloatingBond() : double dayCounter = Rcpp::as<double>(datemisc["dayCounter"]); ...
1
vote
1answer
314 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
83 views

Starting values for constrOptim() in R

I want to perform a constraint optimization for Maximum Likelihood Estimation in R to forecast volatility of returns. The probleme is that my initial values aren't in the permitted region. Is there ...
1
vote
1answer
57 views

Issues in estimating VaR with GARCH

I am currently trying to figure out how to estimate the value at risk using the rugarch package in R. I've come to a result, but it seems a bit excessive. Here's my code: ...
6
votes
1answer
177 views

Obtaining risk-neutral probability from option prices

Suppose I have the following data (for the current stock and option prices of the Bank of America) Strike Last IV Probability 4 8 5.43 0.5813566 0.0000000 7 11 2.45 0.2868052 ...
1
vote
1answer
77 views

Is it possible to download stock-data countrywise with quantmod package for R?

Is it possible to download stock-data countrywise with quantmod package for R ? Hi, I'm wondering if it's possible to download equities countrywise. Let's say i want all data from the Finnish ...
3
votes
1answer
72 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 ...
2
votes
2answers
55 views

Automate selection of BIC-minimizing ARIMA(1,0,X) model

I want to estimate an ARIMA(1,0,X) model. The MA(X) in the model is selected to minimize BIC. I have the following code employing the function auto.arima from ...
1
vote
0answers
53 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. ...
0
votes
0answers
28 views

Evaluation of Bayesian GARCH

I am using the bayesGARCH package to estimate Bayesian GARCH models and I was wondering how to evaluate them in terms of precision of forecast or at least the quality of the model. I have encountered ...
5
votes
1answer
97 views

Bloomberg & R: Accessing multiple securities with getBars() in R

I am attempting to access 1 minute trade data for 50 securities using Bloomberg API (rblpapi). Following is the code I got from the CRAN: ...
2
votes
0answers
37 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 ...
8
votes
4answers
19k 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 ...
1
vote
0answers
156 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
1answer
132 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
0answers
47 views

Package for multivariate Garch Vech model for R?

I`m new to programming and searching a package for R which inherents the estimation for a Vech Garch(1,1). This is a multivariate Garch model which forms the residuals and the covariance matrix from a ...
0
votes
1answer
44 views

How to create time series with lagged in R [closed]

Would anyone else advise me, how to create time series with lagged in R. I would the result is the difference with lagged, there is a function Delt() but the result is the percentage change. Please ...
2
votes
0answers
71 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
53 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, ...
0
votes
0answers
13 views

How to set the mean matrix in fPortfolio package in R

I'm doing a mean-variance analysis of 5 ETF's and insted of using the sample mean i used a time series model to forecast it. I want to do a backtest of a tangency portfolio getting the weights with ...
2
votes
1answer
87 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 . ...
7
votes
0answers
170 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
29 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
43 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
126 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
90 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
44 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
29 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
39 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
36 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
48 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
37 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
61 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
85 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, ...
3
votes
1answer
331 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 ...
4
votes
2answers
111 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
60 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
51 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 ...