Tag Info

Hot answers tagged

4

The NS model should be fit directly to bond prices. If you have the prices of all the Treasuries, you should use those directly. See this paper for how the Fed does it http://www.federalreserve.gov/pubs/feds/2006/200628/200628pap.pdf The "Daily Treasury Yield Curve Rates" are already fitted par yields (they're fitted using a cubic spline model to on-the-run ...


3

You can use Matlab too, that, in my humble opinion, is simpler than R from a syntax point of view. The model you need for is run by the Matlab function arima that can be used with seasonality option to do what you have to do. Here you can find an example and a brief explanation of the model. Type ctrl + F and search for: "Specify a seasonal ARIMA model" ...


3

A free to use Excel Add-on providing QuantLib-backed derivatives pricing analytics directly in Excel is available at http://www.deriscope.com Disclosure: answerer is author of the package.


2

There is no guarantee that the optimization method always converges! In an introduction the author of the package recommends using the "hybrid" solver, which starts out with the "solnp" and goes through the other solvers, if it doesn't converge. According to him, this should at least guarantee convergence in 90 % of the cases. ...


2

If you wander about the theoretical result of fitting parameters, the book GARCH Models, Structure, Statistical Inference and Financial Applications of FRANCQ and ZAKOIAN provides a step-by-step explanation. I think that it is not a big problem to implement these steps to R.


2

I would suggest you to add spreads to the implied hazard rates, spreads that you regress on the macroeconomic factors. Then you stress by calculating the spreads corresponding to the stressed factors.


2

I'm going to separate your question in two. The key thing you're asking is that how does Return.rebalancing treat your different frequencied and number of asset return and weight objects. Data munging: It subsets the first ncol(weight) columns of R (as ncol(edhec) > ncol(weights) ncol R is now 11. Checks if the first date in R is less than the first date ...


2

Actually, neither of your two results are quite correct. As explained in the Details for the Return.calculate function, most of the PerformanceAnalytics functions use discrete returns, not log returns. To get the correct results, you will have to convert your data from log returns to simple returns. Compare the charts from the following: ...


2

The documentation of the R package PerformanceAnalytics provides examples for both the Return.annualized() and Return.cumulative() functions. The annualized return scales up sub-annual returns to an annual return. You may observe the difference by typing Return.annualized (without any parameters) in your R console to see the functions implementation. Look ...


2

Use PortfolioAnalytics See my previous response here: http://quant.stackexchange.com/a/16002/2154 , you will find links to the documentation there. You can use the constraint function to add a factor exposure constraint of 0. use add.constraint(your_portfolio_name,type='factor_exposure',B = your_vector_of_betas,lower=0,upper=0)


2

For a Ornstein-Uhlenbeck process, the maximum likelihood parameters are the ones from least squares regression. If your process is: $$ dX=\kappa (\theta-X)dt+\sigma dW $$ you can do a linear regression in the form $$ \frac{dX}{dt}=a+bX+\epsilon $$ So your parameters will be: $$ \kappa=-b $$ $$ \theta=-\frac{a}{b} $$ $$ \sigma=std(\epsilon dt) $$


2

Similar to Juan Gil's answer but a bit differently I would say the following based on this: The OU process $$dX_t = \kappa(\theta-X_t)dt + \sigma dW_t$$ can be (Euler-Maryuama discretization) discretized at times $n \Delta t,n=1,\ldots,\infty $ which gives with $t = k \Delta t$ $$ X_{k+1} - X_k = \kappa \theta \Delta t -\kappa X_k \Delta t + \sigma (W_{k+1} ...


2

Both R and Python can do this very nicely. For Python you would need the pandas package and its dependencies. pandas has a lot of basic statistics, but for more advanced statistics like it looks like you want to do, you can use the statsmodels package, which can work directly with pandas data types. It can also download the csv files directly off the ...


2

There are a couple of issues with your example. First, for this ticker, there is a problem with the Yahoo price data for the period 2014-11-26 through 2014-12-03 in which the prices drop about 80% and then return to their trend line. This appears to be related to a stock split which Yahoo isn't handling properly and isn't real. Its causing part of your ...


2

In the paper you cited in the question, the equation (1) is not the equation of state in kalman filter model, but an $AR(3)$ estimated via OLS as shown in Stock & Watson (2002). What the authors estimated in the paper using the Kalman filter is the latent variables $f_t,_h$ and the relative lags through which they estimated both the equation (1) and ...


1

Not too sure about the second part of your questions but as far as VaR, R has some pretty neat functions. First I took you subset A and converted it to discrete returns since using actual prices for VaR may be a bit harder to interpret. # Load PerformanceAnalytics for VaR & Calculating Returns library("PerformanceAnalytics") # Calculate Returns a ...


1

There are two answers to your question If you want to use the Neston-Nandi model, you can use it directly with the parameters that you already show above: model = list(omega = 0.000001, alpha = 0.5, beta = 0.4) In r, the fOptions package has an HN model that can use them: HNGOption(TypeFlag, model, S, X, Time.inDays, r.daily) If you want to calculate ...


1

Nothing to be worried about: Method is the type of correlation which is not a graphical parameter. The method argument is being passed to the pairs function... The function is saying this not a graphical parameter It can be fixed in the source code (or just ignore it!)


1

This is a feature, when you pass a vector it's because the risk free rate has changed over time. E.g. you can assume a constant or changing risk free rate as each period of returns can have an associated risk free rate.


1

Why not just use PortfolioAnalytics, as if your matrix is non positive definite you will have problems using non optimization approaches. Here is an example taken from my blog: retmat is a matrix of returns library(PortfolioAnalytics) moms_portfolio = portfolio.spec(assets=colnames(retmat)) moms_portfolio = ...


1

The mean equation specification for ARIMAX(8,0,0)(5,0,1)[7] (as in the R code above): $$ (1 - \phi_1L^1 - \ldots - \phi_8L^8)(1-\Phi_1L^7 - \Phi_2L^{14} - \ldots - \Phi_5L^{35})y_t = \beta x_t + (1 + \Theta_1L^7)\varepsilon_t $$ where $x_t$ is the holiday dummy variable. Equivalent ARIMA fit in Matlab (+ GARCH and forecasting): % specify seasonal ...


1

I have the same problem as you. Up to my knowledge, there is no package allowing to combine seasonal ARIMA process with GARCH effects.


1

It is a classical misunderstanding, your model is right, you always have a acf equal to one at lag zero (and not one) since if there is no lag acf = covariance(x , x_lag 0) / variance x = variance x / variance x = 1. So you need to pay attention to the x axis , some software displays ACF starting at lag zero and some others from 1 (which make better ...


1

Did you try rmgarch package of R ? http://cran.r-project.org/web/packages/rmgarch/index.html http://unstarched.net/r-examples/rmgarch/mgarch-comparison-using-the-hong-li-misspecification-test/


1

There is no such thing as "free" option data. This is free -->http://www.nasdaq.com/symbol/aapl/option-chain You could crawl that. But to get the actual ticks or intraday data, you will unfortunately have to pay. I strongly suggest you find a college business program that has option data ticks and reach out to them. Best of luck, JL


1

You can pass in the parameters are you estimating with EWMA or GARCH using the mu (mean), sigma (co/variance) m3 (co/skewness) and m4(co/kurtosis) arguments. e.g. blahblah = EWMA(my_time_series) VaR(my_time_series,mu=blahblah)


1

I found out that the upper time series is the result of a call > tail(Return.rebalancing(edhec,weights)) portfolio.returns 2009-03-31 0.005082048 2009-04-30 0.022982981 2009-05-31 0.037432398 2009-06-30 0.011107189 2009-07-31 0.025580507 2009-08-31 0.017983519 (by optical comparison. ;-) ) A glance ...


1

PortfolioAnalytics, has the ability to optimize portfolios based on factors or whatever groups/characteristics you enter. https://r-forge.r-project.org/R/?group_id=579 Please refer to the vignette in the package in the package PortfolioAnalytics (https://r-forge.r-project.org/scm/viewvc.php/pkg/PortfolioAnalytics/vignettes/?root=returnanalytics I use it ...


1

Are you aware of the findata.org site and its directory? The code is also in a bazaar repository as well as GitHub repo.


1

I like Quantlib http://quantlib.org/index.shtml http://cran.r-project.org/web/packages/RQuantLib/index.html The QuantLib project is aimed at providing a comprehensive software framework for quantitative finance. QuantLib is a free/open-source library for modeling, trading, and risk management in real-life. QuantLib is written in C++ with a clean object ...



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