[R-SIG-Finance] Rsolnp for Portfolio Optimization with Turnover Constraints

2011-06-27 Thread Robert Harlow
Hi, I am trying to use Rsolnp in a portfolio optimization context. While I know that my current example is solvable as QP, my risk function, which is variance right now, could become more complicated later. Basically, I want to start with an equal weighted portfolio, and then minimize risk wit

[R-SIG-Finance] rugarch: solnp vs nlminb default control parameters

2011-10-31 Thread Robert Harlow
Hi, First off, this is a fantastic package, so very well done Alexios. I am going to use the external regressor option in the rugarch package. In order to do double check that everything is working properly, I decided to fit a standard garch(0,1) where i use the lag of the residual as my ext

Re: [R-SIG-Finance] Garch Bootstrap forecast

2012-01-18 Thread Robert Harlow
There is extensive documentation available on R Cran including: http://cran.r-project.org/web/packages/rugarch/rugarch.pdf and also a very nice vignette here that explains what the rolling estimation does (section 5): http://cran.r-project.org/web/packages/rugarch/vignettes/Introduction_to_the_rug

Re: [R-SIG-Finance] Forecasting

2012-01-31 Thread Robert Harlow
?ugarchroll Change the n.ahead parameter in the function. You can specify whether there is a mean model or not with ugarchspec. Follow the the example provided in the ugarchroll example, and then explore the resultant object (called sp500.bktest). On Tue, Jan 31, 2012 at 7:36 AM, Papa Senyo w

Re: [R-SIG-Finance] Forecasting

2012-01-31 Thread Robert Harlow
, VaR.alpha = c(0.01, 0.025, 0.05)) On Tue, Jan 31, 2012 at 8:49 AM, Papa Senyo wrote: > Please, can you just cite an example via mail to me may a reproducible > one. Kindly hope to hearing from you soon. > Kind regards > Papa > > -- > *Da

[R-SIG-Finance] Efficient CVaR Scenario Optimization for a Large number of Scenarios

2012-02-15 Thread Robert Harlow
Hi, I am running into a memory issue when I try to run a mean-CVaR optimization on a large number of scenarios. I am running R 32-bit on windows (see sessionInfo() output below). I have attached code to display the problem below (using a sample from a random multi-variate normal distribution a

Re: [R-SIG-Finance] Efficient CVaR Scenario Optimization for a Large number of Scenarios

2012-02-15 Thread Robert Harlow
%*% rep(1/3,3), alpha) > # we are estimating [VaR AND the weights] > sol = nloptr( > x0 = c(q1,rep(1/3,3)), > eval_f = func.cvar, > eval_grad_f = grad.cvar, > lb = c(-1, rep( wmin, 3) ), > ub = c( 0, rep( wmax, 3) ), > opts = ctrl, > eval_g_ineq = func.ineq, > eval_jac_g_ineq

Re: [R-SIG-Finance] Efficient CVaR Scenario Optimization for a Large number of Scenarios

2012-02-16 Thread Robert Harlow
, samps, hurd){ z <- samps %*%w tail.v <- z[z<=hurd] if(length(tail.v) == 0) tail.v <- 0 -(length(tail.v)/length(z))*mean(tail.v) } cvarStar(rep(1/3,3), samps, -.05) On Wed, Feb 15, 2012 at 6:01 PM, Robert Harlow wrote: > Wow, this is fantastic Alexios. Thank you ve

Re: [R-SIG-Finance] Efficient CVaR Scenario Optimization for a Large number of Scenarios

2012-02-16 Thread Robert Harlow
tensively covered (for the problem of the partial > moment to the power 1 there is an LP representation, for the power 2 a QP > representation, and for the rest or general LPM problem you can definitely > represent it as a proper NLP). > > Regards, > Alexios > > On 16/0

Re: [R-SIG-Finance] writing a loop

2012-05-16 Thread Robert Harlow
This seems more like an R-Help question than an R-Finance Question, but here goes: For the year example, you could use the month.day.year from the chron package (here I chose to add a column to the data frame that adds the day): library(xts) library(chron) n <- 100 df <- data.frame(Date = as.POSIX

Re: [R-SIG-Finance] Incorrect SVD Calculation

2012-06-28 Thread Robert Harlow
Robert, First off, this is a pretty interesting phenomenon, and let me start off by saying that I have not figured out what is going on. However, I do have some more information to contribute: I am unable to recreate the bug in MATLAB, which uses a different subroutine from LAPACK: DGESVD wher

Re: [R-SIG-Finance] Incorrect SVD Calculation

2012-06-28 Thread Robert Harlow
hich > > R's 'svd' throws an error because of non-convergence > > in the algorithm. Changing the order of the rows > > makes it go away. > > > > Pat > > > > > > On 28/06/2012 16:52, Robert Harlow wrote: > > > >>

Re: [R-SIG-Finance] Regime Switching models

2012-11-02 Thread Robert Harlow
depmixS4 works pretty well. "Markov Regime Switching" can be implemented in a variety of ways...read the vignette to learn how to specify the model you want. On Fri, Nov 2, 2012 at 6:56 AM, jaimie villanueva < jaimie.villanu...@gmail.com> wrote: > Hi R users, > > I'm wondering if is there a good

[R-SIG-Finance] Finding the Feasible Region of a Generic Mean-Variance Problem

2012-11-30 Thread Robert Harlow
Hi, I apologize if this is trivially simple or exists elsewhere, but I couldn't find exactly what I am looking for through searching the web. Basically, I would like to display what the feasible set of portfolios are for a given linearly constrained problem. What the code below does, is, given

[R-SIG-Finance] RQuantLib AsianOption Function

2012-12-21 Thread Robert Harlow
Hi, I am ran the following example with RQuantLib's AsianOption function: AsianOption("geometric", "put", underlying=80, strike=85, div=-0.03, riskFree=0.05, maturity=0.25, vol=0.2) and it worked fine. If I change the averageType parameter to "arithmetic", it crashes R. AsianOption("arithmetic

Re: [R-SIG-Finance] RQuantLib AsianOption Function

2012-12-21 Thread Robert Harlow
I should add that I realize the arithmetic version is not fully written in RQuantLib, I am mainly wondering why it crashes instead of throwing an error or warning. Thanks, -Bob On Fri, Dec 21, 2012 at 11:19 AM, Robert Harlow wrote: > Hi, > I am ran the following example with RQuan

[R-SIG-Finance] Embarassingly Simple Questions on rmgarch

2013-08-13 Thread Robert Harlow
Hi, I was wondering where the rmgarch.tests folder is. In the vignette, it says that examples are in the "rmgarch.tests folder of the source," but I do not know exactly what that means and cannot find it in the directory where the library is installed (on windows). Also, I wanted to ask if any

Re: [R-SIG-Finance] Embarassingly Simple Questions on rmgarch

2013-08-13 Thread Robert Harlow
it from CRAN and unpack/extract. > > I've installed it on Fedora 19 without problem...you do need to follow the > instructions of Rmpfr/Bessel/fftw on installing the required dependencies > first (see their readme files in the src installation). > > Regards, > Alexios &g

Re: [R-SIG-Finance] Quandl error: Error in getCurlHandle() : could not find function "getClass"

2014-01-21 Thread Robert Harlow
It looks like Rscript loads your .Rprofile file on startup, which is located in ~/.Rprofile. You could just add library(methods) to your .Rprofile file and it should fix the issue. http://stackoverflow.com/questions/19680462/rscript-does-not-load-methods-package-r-does-why-and-what-are-the-conseq

Re: [R-SIG-Finance] Applying transformations to timeSeries objects

2014-06-20 Thread Robert Harlow
Check out ?diff and ?lag. Also, it's kind of a personal preference, but xts is a pretty attractive alternative to timeSeries that many of us use. library(xts) set.seed(10) x <- xts(rnorm(10), Sys.Date()+1:10) diff(x) x - lag(x) On Fri, Jun 20, 2014 at 8:14 AM, nacho wrote: > Hi guys, > > Fir

Re: [R-SIG-Finance] Optimization

2014-07-29 Thread Robert Harlow
Walmir, In order for anyone to help you, please follow the posting guide (see link below). You need to put a reproducable example in your question and attaching .csv files is generally not necessary, so try to avoid it if possible. What did you try? Which specific function "didn't work"? Be spe

Re: [R-SIG-Finance] Optimization

2014-07-29 Thread Robert Harlow
The issue has nothing to do with fPortfolio. You are not parsing your input file correctly, run: indices <- read.table("indices.csv", sep = ";", dec = ",", header = TRUE) head(indices) sapply(indices, class) Notice that your variable types are not numeric, such that it is impossible to take an a

Re: [R-SIG-Finance] How to add lagged values to rugarch-model

2014-11-05 Thread Robert Harlow
Lasse, Your problem is that you have NAs in your external regressor matrix. Since you lagged it twice, you have 2 NAs. Try the code below. Thanks for the reproducible example, it made it really easy. Bob require(rugarch) require(quantmod) x = runif(n = 1000, min = -5, max = 100) ext.reg_lagged

Re: [R-SIG-Finance] RQuantLib: AmericanOptionImpliedVolatility bug

2017-05-26 Thread Robert Harlow
Charles, my suggestion (which I doubt you will like) is to wrap your calls to implied volatility root finders (quant lib or any others) in a try block that returns NA on error. Your example (very little or no time value) can be common if you are using mid prices from bid-ask quotes. Note that whe

Re: [R-SIG-Finance] getting a subset corresponding to a list element

2017-05-26 Thread Robert Harlow
Hi Michael, Try not to post twice - this is really more of a general R question. To answer the question, however, turn each element of your resultlist into an xts (or zoo) object so that you have a list of xts objects (called xtsList for example.) Then call do.call("merge", xtsList). Also, yo

Re: [R-SIG-Finance] RQuantLib: AmericanOptionImpliedVolatility bug

2017-05-27 Thread Robert Harlow
ave been more desirable) > By changing the engine I managed a workaround but I thought RQL team (or > someone else having the same problem) could be interested with that > non-desirable behavior. > > Regards > > > From: Robert Harlow [mailto:rharlo...@gmail.com] >

[R-SIG-Finance] quadprogXT package

2017-06-04 Thread Robert Harlow
All, I put out a package on CRAN last weekend that extends quadprog so that constraints involving absolute values (e.g. book size and turnover in a financial context) are handled in addition to allowing absolute value (L1) considerations in the objective function, which can handle linear transact

Re: [R-SIG-Finance] Problems when estimating GARCH parameters with fGarch

2017-11-03 Thread Robert Harlow
Have you tried rugarch or just "garch" in the tseries package? Reproducible examples are always helpful as well. > On Nov 2, 2017, at 1:56 PM, Curtis Miller wrote: > > Hello all, > > I have encountered bad behavior in fGarch's garchFit() function used for > estimating the parameters of a GAR

Re: [R-SIG-Finance] Question quadprogXT

2018-03-06 Thread Robert Harlow
Hi Antoine, Yes - it handles turnover constraints. Check out the second to last example from ?solveQPXT. Bob On Tue, Mar 6, 2018 at 9:03 AM, Antoine wrote: > Hello Bob, > > First of all, thanks for your R Package quadprogXT, I hope that I will use > it for my turnover constraint (in financial