# Tag Info

13

Of course it is fast enough. But what is fast enough? I know guys who trade off Excel sheets and they make millions, but those guys are clearly not active in high frequency space. So, it entirely depends on your trading frequency and average holding period. I also know of shops that run live trading systems by calling R functions, so, obviously Matlab ...

4

If I understand you correctly, then you have a filter defined for your portfolio that is defined by "1.". A) So you either filter out these bonds before you start anything that has to do with the optimization. This should be the way to go if you are interested in speeding up your program. B) If you want to do everything in the optimization, then you need ...

4

The corresponding process would be fractional brownian motion (see here) It is parametrized by the Hurst Exponent. On the referenced site you find a link to some matlab code for simulating realizations of fractional BM. If you want to see some fractional Gaussian Noise in action (Matlab) you can do so here. Further more you might want to look into ...

4

If I understand you right, you are talking specifically about Matlab's embedded code generation facility (see here: http://www.mathworks.ch/embedded-code-generation/). In my view, the answer to your question is clearly yes. This feature allows you to generate hardware specific code, e.g. for deployment on GPU's (video cards). It's used for aerospace ...

4

Write the equation as $\sigma_{MF} \to G(\sigma_{MF}) = 0$ (by subtracting $\sigma_{MF}^2$) and use a root finder. As how to solve $G(\sigma_{MF}) = 0$ in MatLab check the MatLab documentation (see e.g. "solver" there).

4

I found these nice lecture note by Karl Sigman on the web. On page three you see if $X\sim N(\mu,\sigma)$ then the moment generating function (mgf) of $X$ is given by $$M_X(s) = E(exp(sX)) = \exp( \mu s + \sigma^2 s^2 /2)$$ Thus for Brownian motion with drift $X_t$ you get $$M_{X_t}(s) = E(exp(s X_t)) = \exp( \mu t s + \sigma^2 s^2 t /2).$$ Finally for ...

4

The general idea For equity securities, a simple backtest will typically consist of two steps: Computation of the portfolio return resulting from your portfolio formation rule (or trading strategy) Risk-adjustment of portfolio returns using an asset pricing model Step 2 is simply a regression and computationally very simple in Matlab. What's trickier is ...

3

About the integration problem: Your integrand is highly oscillatory, and the adaptive quadrature of Matlab doesn't handle such integrands very well. In general, I would recommend Mathematica when Matlab's standard procedures don't perform well. In this case, a Levin-type method would perform much better. The reason that quadv produces NaN values is because ...

3

work you way from GARCH(4,4) to GARCH(0,0) removing the intercept too. 5*5*2-1 = 49 estimations Make sure your coefficients are all statistically significant at least to 95% confidence. Make sure you have no autocorrelation in your error terms. pacf and acf should be clean. Likelihood ratio tests assess whether you lose explaining power from ...

3

I would use a Metropolis Monte Carlo / simulated annealing approach to solve your problem. Start with an arbitrary fully invested portfolio which satisfies constraints (2), (3) and the cardinality constraint $N \le K$. Then choose one of the following trial moves: Select two bonds $i,j$ at random and perform a random weight shift $w_i \rightarrow w_i + ... 3 No, rng does not do the same as rand. rng sets the seed for the random number generator and rand generates random numbers. Also it can be seen in documentation that the rng function only accepts positive integers. Usually random number generator algorithms start with integers for the seed. For various examples: C random function takes the system clock as ... 3 To identify the number of AR and MA terms you still need to look at the ACF and PACF. To identify the orders of differencing, the easiest way is run an ARIMA model on the data with different orders of differencing (0,1,2) and with only a constant (no AR or MA term). Look at the standard deviation of these models, as well as the ACF plot - the optimal model ... 2 I'm not that familiar with MATLAB. However, in quadratic programming the main issue I've found is setting up the problem correctly and then the coding becomes much easier. As you noted this problem can be expressed as a quadratic cone problem and solved by quadprog but a good amount of more work needs to be done to get this in the correct form. You ... 2 You can express the Normal distribution by Sklar's Theorem in terms of Gaussian Marginals and Gaussian Copula as follows: $$F(x_1,...,x_n)=C(F(x_1),...,F(x_n))=C^{Gau}(N(x_1),...,N(x_n))$$ So the distribution equals the copula function with the respective inverse marginals as arguments. You can aswell combine any types of Copula and (continuous) different ... 2 It seems that implicitly you have a multi-objective optimization in mind, hence of course it may happen that you are not able to achieve all the objectives simultaneously. Let's say that output of a more general model is$f(x,y)$so that the output of the first model is$f(x,0) = f_0(x)$. Denoting market prices by$m_k$which in your case means$m_1 = A$and ... 2 The code is function v = portvar(asset,ws) %PORTVAR Portfolio variance. % V = PORTVAR(ASSET,WS) returns the variance for a portfolio of assets % where ASSET is a matrix of asset data and WS are the corresponding % weights of each asset. ASSET is an MxN matrix of N securities and % WS is a 1xN vector where each column of ASSET is a time series ... 2 Try fmincon for solving (1)-(4). 2 The clearest and most intuitive article I have seen so far is Kritzman et al., Regime Shifts: Implications for Dynamic Strategies in FAJ (May / June 2012) It not only shows how you can use HMM for financial modelling but it also goes through the actual estimation algorithm (Baum-Welch) step-by-step and even gives full Matlab-code. From the abstract: ... 2 It is difficult to say what is not working with your code. Try Matlab's quadratic programming function quadprog() instead. This function specializes in solving this optimization problem. The syntax is: $$x = quadprog(H,f,A,b,Aeq,beq,lb,ub)$$ 2 You should write some kernel functions in CUDA (Nvidia language) for your matlab code. Arrayfun is quite restrictive and not appropriate. Look at this link http://fr.mathworks.com/help/distcomp/run-cuda-or-ptx-code-on-gpu.html for more details about matlab and parallel computing. 1 The log likelihood function is indeed rather flat in the$\mu$-direction, for small time horizons (you used$T = 1$it looks like). As you may have noticed, increasing the number of observations but keeping the time horizon the same DOES NOT IMPROVE the accuracy of the estimate of$\mu$- this is a bit counterintuitive, if you ask me. But, increasing the ... 1 This is what often happens in optimization problems, i.e. some direction is almost flat. Google 'preconditioning'. Basically the idea is to rescale the variables, so that the Hessian has approx. same order of magnitude values on the diagonals. Also, that's not a stationary process, so estimation of mu can be difficult. BTW not sure if it's a very good idea ... 1 I have found the slides from Yollin very useful for portfolio optimization using R such as mean-variance, max-sharpe ratio portfolio etc. http://www.rinfinance.com/RinFinance2009/presentations/yollin_slides.pdf Also, there are some packages in R for this such as$PortfolioAnalytics$I believe : http://www.rinfinance.com/agenda/2014/workshop/RossBennett.pdf ... 1 So in short: in place of the input where you have cost of carry in usual Black Scholes you need the traded VIX-Futures price instead (which is not (!) the result of an application of the cost of carry formula) from the market and apply Black 76 -right? EDIT: Just like Gabriele wrote in the comment. The futures price is not (!) just the spot with interest ... 1 You can use a for-loop on your correlation series. for i=1:2000 simulation=copularnd('t',rho(i),NU,N)); 1 For Engle-Granger, I can see that you are returned a vector of 2 elements for each of the output arguments, hence you run two tests there. For the sake of clarity and the education of people interested in the post, we can say that: Since your$hValues\$ are both zero, we can say that there is a failure to reject the Null Hypothesis, which in this case is ...

1

Assume that instead of a possible portfolio of 1000 bonds, the portfolio may only contain M bonds. The input vector then needs to contain both the weightings and the choice of bonds, but how can you present the choice of bonds as an input vector? Consider sorting the candidate bonds by Macaulay duration. Given a single Macaulay duration value, then, you ...

1

If you want to create one (column) vector X of correlated random variates, then you premultiply it with the lower triangular matrix L. But when you create paths, every return observation is one vector of random numbers. It is then a matter of how you arrange your data: if these observations are columns in an matrix X, you compute LX. But if you have the ...

1

You can just take the diagonal of the var-cov matrix. This should give you the variance of each stock and then take sqrt of that for std. deviation. sd = sqrt(diag(vcm))

1

Assuming you're using http://www.mathworks.com/help/econ/jcitest.html, there is 1 cointegrating relationship. The function can also output p-values.

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