Tag Info

Hot answers tagged

5

I'm familiar with the library, but not with the way it is exported to R. Anyway: gearings are optional multipliers of the LIBOR fixing (some bonds might pay, for instance, 0.8 times the LIBOR) and spreads are the added spreads. In your case, the gearing is 1 and the spread is 0.0140 (that is, 140 bps; rates and spread must be expressed in decimal form). ...


5

It appears that you are re-running the regression with each new data point. Instead, you should use an update/online formula (see an excellent answer by the famous Dr. Huber at stats.se). You can find an implementation in the R package biglm. If it doesn't have all the features you need (no windowing out of old data) you can at least adapt it and use it ...


4

Have a look at fPortfolioBacktest. An example can be found here: https://r-forge.r-project.org/scm/viewvc.php/pkg/fPortfolioBacktest/man/portfolioBacktesting.Rd?view=markup&revision=4086&root=rmetrics Edit: you may want to try backtestPlot(smoothedPortfolios) to visualise the strategy performance.


4

You want to set the parameter n.roll to the number of n.ahead, n.roll rolling forecasts you want. (The n.ahead parameter controls how many steps ahead you want to forecast for each roll date.) Thus by setting n.roll to a number almost equal to your sample size, and critically setting the out.sample parameter almost equal to your sample size, you're telling ...


3

For R see the following packages: http://cran.r-project.org/web/packages/quantmod/index.html http://cran.r-project.org/web/packages/highfrequency/index.html http://cran.r-project.org/web/packages/TFX/index.html http://cran.r-project.org/web/packages/IBrokers/index.html For a broader overview this might help: ...


3

Your spread does not look similar to the random walk. Many of the observations are the same as the previous observation. This means most of the first differences are zero, which is why the test indicates your series has a unit-root. The current value is very good at explaining what the next value will be.


3

Assuming you already have a way to obtain hedge ratios and the like, your best available choice is probably blotter (used to be just quantstrat). You will find that it isn't necessarily oriented toward options. Generally for options backtesting, pros end up making their own or buying commercial software. There are tons of commercial providers, but I ...


2

Let's approximate the time to maturity to be 3 years and 10 months. Assume that coupon is paid on March 6 each year. Let face value $F=100$ and coupon $c=0.07375F$. Let the discount factor be $d(0,T)=e^{−r T}$ where $r=0.06535$. The price of the bond is $$ce^{−10/12 \bullet r}+ce^{−22/12 \bullet r}+ce^{−34/12 \bullet r}+(F+c)e^{−46/12 \bullet r}=103.24 \; ...


2

1.Is it correct, that the coefficients are now different to the coefficients of the arima output? It seems right that the ARMA coefficients are different. Indeed, in the second model, the GARCH component will capture fluctuations that the ARMA component will not have to capture, resulting in different ARMA parameter estimates. 2.This is the acf of ...


2

I believe all you need to cope is: A definition of cointegration from any statistics handbook, wikipedia or the like, An example code for the implementation in R, eg http://quanttrader.info/public/testForCoint.html that is often cited.


2

periodicity calls: p <- median(diff(.index(x))) if (is.na(p)) stop("can not calculate periodicity of 1 observation") p can be NA if x has 1 observation, or if you have missing values in your index (because there's no na.rm=TRUE in the median call. > xx <- xts(1:10, as.POSIXct(c(1:5,NA,7:10),origin='1970-01-01')) > periodicity(xx) Error in ...


1

For the first, people regularly compute VaR or CVaR over time and plot the results. For two and three, the documentation for the ETL function says that you can either calculate it using a Gaussian approach or Cornish-Fisher expansion. These are both analytical methods. The Gaussian approach uses only the mean and variance (effectively assuming that the ...


1

You cannot add a date column to an object returned by getSymbols or get.hist.quote. These function return matrices. Matrices can only store data of the same type, in this case the matrices contain double values (real numbers). You can add a column of class Date to the objects if you transform them into a data frame: For getSymbols: library(quantmod) ...


1

This is the equity line i got after i repeated your code. how is this good ? may be you have run with only one set of numbers. any ways here are a few things you can do to come closer to reality : take the close prices as lognormal distribution instead of a normal distribution. you are adding up the returns later on. this is only right if you have ...


1

Let me give you the perfect solution. Use Python. The charting, graphing and analysis can be done using the PyLab environment. You can integrate the code into R using the package called rPython. You can integrate it to C and many other languages. Python also comes with infinite more features. So instead of looking for a particular library, use Python. ...


1

The approach of reflecting is expensive, since the $d$-simplex has $d$ maximal faces, all of which have to be checked for intersection at each step. Additionally, if the random walk moves into a corner, the number of moves which have to be discarded can become very high. Depending on the configuration of the constraints this could well be your best solution. ...


1

fopen,fscan are in stdio.h but it looks like Ox has their own include file. For some reason it's commented out in garchOxModelling.ox, uncomment that line only. #include <oxstd.h> //#include <packages/gnudraw/gnudraw.h> I remember I had to change this line as well since I used a newer G@rch distro. It was /Garch42/ , I changed it to ...


1

The two eigenvectors are are ordered by maximum likelihood. The eigenvector is the cointegrating relationship and the weight is their coefficient, if they are used, in for example a VECM. To get the VECM-form, you need to to use the command cajorls()(restricted) or cajoorls()(unrestricted). The vec2var() gives you a level (undifferenced) representation of ...


1

This is definitely not a Kalman filter's issue: if you replace this line of code args <- eapply(env = env, FUN = function(x){ClCl(x)}) with this one args <- eapply(env = env, FUN = function(x){ClCl(x)})[Symbols] eapply() will keep the order of the original Yahoo query from quantmod. You can check and you will see each $\beta_{t}$ matches about ...


1

The standard answer to your question would be to do the maximum likelihood estimation. When you say "plug in $\sigma$" you can show that the sample estimate of $\sigma$ is actually the maximum likelihood estimate of $\sigma$ for the normal distribution. If I can assume that your data are IID then what you do is use your distribution with parameters ...


1

I would recommend using the Johansen-Procedure for determining the cointegration vector, the ca.jo-function from library(urca). After determining the cointegration rank, a normalized cointegration vector is produced by estimating a restricted VECM with the command cajorls().


1

I will start by saying that the paper that recommends the procedure is rather badly written, but since the issue is not of high difficulty I would dare to give a few hints that could suggest the answer. First of all, Michelle was trying to do this estimation of the VaR using a non-parametric procedure based on kernel estimation of the real density of the ...


1

Here is a example of fitting Garch on financial time series. Application for regime switching in trading. http://systematicinvestor.wordpress.com/2012/01/06/trading-using-garch-volatility-forecast/


1

I have written R code for some time-varying bivariate fat-tailed copula functions (ripped off Patton's Matlab code) and played around with various optimizers. You can then use Rsolnp, nloptr, alabama or DEoptim packages to find an optimisation solution. Here is some R code where I play around with different optimisation algorithms. Note that the data2.csv ...



Only top voted, non community-wiki answers of a minimum length are eligible