[R-SIG-Finance] Optimx help
Error Message: fn is Linn Function has 10 arguments par[ 1 ]: 0 ? 0 ? 1 In Bounds par[ 2 ]: 0 ? 0 ? 1 In Bounds In Bounds par[ 3 ]: 0 ? 0 ? 1 In Bounds In Bounds In Bounds par[ 4 ]: -Inf ? 1.001 ? Inf In Bounds In Bounds In Bounds In Bounds par[ 5 ]: -Inf ? 1.001 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds par[ 6 ]: -Inf ? 1.001 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds par[ 7 ]: -Inf ? 1.001 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds par[ 8 ]: -Inf ? 1 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds par[ 9 ]: -Inf ? 1 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds par[ 10 ]: -Inf ? 1 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds Error in optimx(init.par, Linn, gr = NULL, method = L-BFGS-B, hessian = TRUE, : Cannot evaluate function at initial parameters My function: optimx(init.par,Linn,gr=NULL,method= L-BFGS-B, hessian=TRUE, control = list(trace=1,factr=1e3),lower=c(0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf)) How to solve this problem ? Regards, Serdar -- View this message in context: http://r.789695.n4.nabble.com/Optimx-help-tp4645666.html Sent from the Rmetrics mailing list archive at Nabble.com. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] ugarchfit function of rugarch package needs at least 100 data points.
I agree with Eric. His suggestion is simple and likely to give about as good of an answer as possible. On 09/10/2012 21:22, Eric Zivot wrote: While GARCH parameter estimates can be quite variable (as Pat has nicely shown), the resulting volatility forecasts tend to be much more stable (at least in the short term). If the goal is short-term vol forecasting then one doesn't really care too much about the GARCH point estimates. The important long-term parameters are the unconditional vol and the persistence of the GARCH process as these dictate where and how fast the vol forecasts evolve. For the short term, most GARCH forecasts look a lot like simple EWMAs. So if you only have 100 obvs and want to get a simple short-term forecast, use an EWMA. That's the riskMetrics approach. -Original Message- From: r-sig-finance-boun...@r-project.org [mailto:r-sig-finance-boun...@r-project.org] On Behalf Of Patrick Burns Sent: Tuesday, October 09, 2012 1:05 PM To: r-sig-finance@r-project.org Subject: Re: [R-SIG-Finance] ugarchfit function of rugarch package needs at least 100 data points. The blog post: http://www.portfolioprobe.com/2012/09/17/variability-of-garch-estimates/ shows how variable garch results are using 2000 daily observations. Even if there is a way to get your model fit, I doubt that it would mean very much. If you do find a way, I would suggest that you create multiple datasets that are simulations of the model the same size as your data. Then estimate the model on the simulations and see how variable those model estimates are. They will be very variable, I predict. Pat On 09/10/2012 19:58, Tanvir Khan wrote: Right now I'm trying to fit a GJR Garch model on the inflation rate of my country, Bangladesh, but the problem is the function ugarchfit of the rugarch package requires at least 100 data points to run. I have yearly (12 months average) data and my country is not even 50 years old! So, is there any way to use this function to fit a data with less than 100 observations? Any type of suggestion will be extremely helpful. -- Patrick Burns patr...@burns-stat.com http://www.burns-stat.com http://www.portfolioprobe.com/blog twitter: @portfolioprobe ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. -- Patrick Burns patr...@burns-stat.com http://www.burns-stat.com http://www.portfolioprobe.com/blog twitter: @portfolioprobe ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Optimx help
Please don't cross-post to both R-SIG-Finance and the general R-help list, where you've already received a response. Michael On Wed, Oct 10, 2012 at 8:54 AM, nserdar snes1...@hotmail.com wrote: Error Message: fn is Linn Function has 10 arguments par[ 1 ]: 0 ? 0 ? 1 In Bounds par[ 2 ]: 0 ? 0 ? 1 In Bounds In Bounds par[ 3 ]: 0 ? 0 ? 1 In Bounds In Bounds In Bounds par[ 4 ]: -Inf ? 1.001 ? Inf In Bounds In Bounds In Bounds In Bounds par[ 5 ]: -Inf ? 1.001 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds par[ 6 ]: -Inf ? 1.001 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds par[ 7 ]: -Inf ? 1.001 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds par[ 8 ]: -Inf ? 1 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds par[ 9 ]: -Inf ? 1 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds par[ 10 ]: -Inf ? 1 ? Inf In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds In Bounds Error in optimx(init.par, Linn, gr = NULL, method = L-BFGS-B, hessian = TRUE, : Cannot evaluate function at initial parameters My function: optimx(init.par,Linn,gr=NULL,method= L-BFGS-B, hessian=TRUE, control = list(trace=1,factr=1e3),lower=c(0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf)) How to solve this problem ? Regards, Serdar -- View this message in context: http://r.789695.n4.nabble.com/Optimx-help-tp4645666.html Sent from the Rmetrics mailing list archive at Nabble.com. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Optimx help
I do not understand what other guy mentioned about my problem. So I asked in this part. Please explain other guy opinion about my problem. Regards, Serdar -- View this message in context: http://r.789695.n4.nabble.com/Optimx-help-tp4645666p4645723.html Sent from the Rmetrics mailing list archive at Nabble.com. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] Optimx help
Please don't crosspost. Ask other guy for clarification, not us. On Wed, Oct 10, 2012 at 10:37 AM, nserdar snes1...@hotmail.com wrote: I do not understand what other guy mentioned about my problem. So I asked in this part. Please explain other guy opinion about my problem. Regards, Serdar -- View this message in context: http://r.789695.n4.nabble.com/Optimx-help-tp4645666p4645723.html Sent from the Rmetrics mailing list archive at Nabble.com. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
[R-SIG-Finance] MACD crash problem
All, Here is some reproducible code that causes R to crash while running the MACD function in the TTR library. The problem seems to be when the nSlow and nSig parameters are so large that the function is not able to calculate the moving average length denoted by nSig. Now that I know what the problem is I can avoid it, but it would be nice if the MACD function returned an error instead of crashing R (unless its just my setup-R 2.15.1 64-bit win7). Maybe someone can confirm for me by testing out the code below. The first call to MACD should work as many times as you call it, as expected. However the second one causes problems because the data in temp is too short to product a moving average over 22 data points. This crashes R almost always, but occasionally it does work once or twice. That's why I used for loops to make my point. First lets see if other people have the same results that I do. If so, it would be nice if MACD produced an error instead of crashing R. Thanks, Roger library(TTR) temp - 1:60 for (i in 1:10) x - MACD(temp, nFast=15, nSlow=40, nSig=21) # Works fine print(okay so far) for (i in 1:10) x - MACD(temp, nFast=15, nSlow=40, nSig=22) # Crashes R print(bet you don't see this) Roger J. Bos, CFA Rothschild Asset Management, Inc. Tel +1 (212) 403-5471 Email roger@rothschild.commailto:roger@rothschild.com 1251 Avenue of the Americas, NY, NY 10020 *** This message is for the named person's use only. It may\...{{dropped:15}} ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] MACD crash problem
On 10/10/2012 12:38 PM, Bos, Roger wrote: Here is some reproducible code that causes R to crash while running the MACD function in the TTR library. The problem seems to be when the nSlow and nSig parameters are so large that the function is not able to calculate the moving average length denoted by nSig. Now that I know what the problem is I can avoid it, but it would be nice if the MACD function returned an error instead of crashing R (unless its just my setup-R 2.15.1 64-bit win7). Maybe someone can confirm for me by testing out the code below. The first call to MACD should work as many times as you call it, as expected. However the second one causes problems because the data in temp is too short to product a moving average over 22 data points. This crashes R almost always, but occasionally it does work once or twice. That's why I used for loops to make my point. First lets see if other people have the same results that I do. If so, it would be nice if MACD produced an error instead of crashing R. Thanks, Roger library(TTR) temp - 1:60 for (i in 1:10) x - MACD(temp, nFast=15, nSlow=40, nSig=21) # Works fine print(okay so far) for (i in 1:10) x - MACD(temp, nFast=15, nSlow=40, nSig=22) # Crashes R print(bet you don't see this) This is reproducible for me with TTR-0.21-1 on 64 bit linux, and with svn r135 from R-Forge. Regards, - Brian ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] [R] NA When Setting Options to See Fractions of Seconds
I've moved this to R-SIG-Finance thinking there might be a more relevant audience. RMW On Tue, Oct 9, 2012 at 7:49 PM, Alex Zhang alex.zh...@ymail.com wrote: Dear all, I just found a weird behavior of the timeDate related functions Sys.timeDate() and as.timeDate(). Both of them take place when showing fractions of seconds and I think they might have the same source. Do you know if it should be considered a bug of Sys.timeDate()? Also, what is a good way to generate timeDate with fractions of seconds from strings? I know I can just get the whole part of seconds and add fractions to it. That is a little bit unnecessarily awkward IMO. Thanks! - Alex Below is my whole session: R version 2.15.1 (2012-06-22) -- Roasted Marshmallows Platform: i386-pc-mingw32/i386 (32-bit) require(timeDate) Sys.timeDate() New_York [1] [2012-10-09 14:35:21] options(digits.secs=3) Sys.timeDate() New_York [1] [NA] Warning message Sys.time() [1] 2012-10-09 14:43:45.303 EDT as.timeDate(2012-10-09 14:43:45.303 EDT) New_York [1] [NA] Warning message as.timeDate(2012-10-09 14:43:45.303) New_York [1] [NA] Warning message [[alternative HTML version deleted]] __ r-h...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
[R-SIG-Finance] quantmod::getOptionChain() errors
getOptionChain(F) Error in puts[, 2] : incorrect number of dimensions getOptionChain(MNT) Error in strsplit(opt, tr)[[1]] : subscript out of bounds sessionInfo() R version 2.15.1 (2012-06-22) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] plyr_1.7.1 XML_3.9-4 RCurl_1.95-0.1 bitops_1.0-4.1 [5] quantmod_0.3-20 TTR_0.21-1 xts_0.8-6 zoo_1.7-7 [9] Defaults_1.1-1 loaded via a namespace (and not attached): [1] grid_2.15.1lattice_0.20-6 tcltk_2.15.1 tools_2.15.1 -rex ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] quantmod::getOptionChain() errors
getOptionChain(F) $calls Strike Last Chg Bid Ask VolOI F121020C10001.0 9.07 0.00 8.90 9.202 1 F121020C60006.0 4.30 0.00 3.95 4.005 182 F121020C70007.0 3.00 0.00 2.97 3.00 10 753 F121020C80008.0 1.98 -0.13 1.97 2.00 145 1781 F121020C90009.0 0.98 -0.11 0.98 1.00 2489 16158 F121012C95009.5 0.56 0.01 0.47 0.50 177 1164 F121012C0001 10.0 0.06 -0.08 0.06 0.08 1029 3054 F121020C0001 10.0 0.14 -0.07 0.13 0.14 2539 77492 F121012C00010500 10.5 0.01 0.00 NA 0.01 155 7191 F121012C00011000 11.0 0.01 0.00 NA 0.021 250 F121020C00011000 11.0 0.01 0.00 0.01 0.02 823 68043 F121012C00011500 11.5 0.01 0.00 NA 0.018 8 F121020C00012000 12.0 0.01 0.00 NA 0.022 5342 F121020C00013000 13.0 0.01 0.00 NA 0.012 3035 F121020C00014000 14.0 0.02 0.00 NA 0.011 161 $puts Strike Last Chg Bid Ask VolOI F121020P50005.0 0.03 0.00 NA 0.01 329 329 F121020P70007.0 0.01 0.00 NA 0.02 50 1382 F121020P80008.0 0.01 0.00 NA 0.021 16347 F121020P90009.0 0.01 0.00 0.01 0.02 20 24760 F121012P95009.5 0.01 0.00 NA 0.01 125 162 F121012P0001 10.0 0.10 0.04 0.07 0.09 2250 10813 F121020P0001 10.0 0.17 0.06 0.14 0.16 3249 25705 F121012P00010500 10.5 0.53 0.14 0.50 0.538 1079 F121012P00011000 11.0 1.03 0.10 1.00 1.02 89 5 F121020P00011000 11.0 1.03 0.10 1.01 1.04 148 11512 F121020P00012000 12.0 2.03 0.11 2.01 2.03 94 1271 F121020P00013000 13.0 3.17 0.00 3.00 3.051 941 F121020P00014000 14.0 4.10 0.00 4.00 4.05130 F121020P00015000 15.0 4.95 0.00 5.00 5.054 4 F121020P00016000 16.0 6.55 0.00 5.65 6.10139 $symbol [1] F packageVersion(quantmod) [1] ‘0.3.20’ Sys.time() [1] 2012-10-10 16:53:41 CDT Works for me, at the moment. Make sure the data is really coming back. You may have some other issue in the connection. Or just bad luck in terms of which Yahoo server that got hit. Also, MNT isn't valid in Yahoo land. So that is failing for other reasons. http://finance.yahoo.com/lookup?s=mnt Jeff On Wed, Oct 10, 2012 at 4:37 PM, rex r...@nosyntax.net wrote: getOptionChain(F) Error in puts[, 2] : incorrect number of dimensions getOptionChain(MNT) Error in strsplit(opt, tr)[[1]] : subscript out of bounds sessionInfo() R version 2.15.1 (2012-06-22) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8[7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] plyr_1.7.1 XML_3.9-4 RCurl_1.95-0.1 bitops_1.0-4.1 [5] quantmod_0.3-20 TTR_0.21-1 xts_0.8-6 zoo_1.7-7 [9] Defaults_1.1-1 loaded via a namespace (and not attached): [1] grid_2.15.1lattice_0.20-6 tcltk_2.15.1 tools_2.15.1 -rex ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go. -- Jeffrey Ryan jeffrey.r...@lemnica.com www.lemnica.com ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
Re: [R-SIG-Finance] quantmod::getOptionChain() errors
Jeff Ryan jeff.a.r...@gmail.com [2012-10-10 14:56]: getOptionChain(F) $calls Strike Last Chg Bid Ask VolOI F121020C10001.0 9.07 0.00 8.90 9.202 1 F121020C60006.0 4.30 0.00 3.95 4.005 182 [...] $puts Strike Last Chg Bid Ask VolOI F121020P50005.0 0.03 0.00 NA 0.01 329 329 F121020P70007.0 0.01 0.00 NA 0.02 50 1382 F121020P80008.0 0.01 0.00 NA 0.021 16347 [...] Works for me, at the moment. Make sure the data is really coming back. You may have some other issue in the connection. Or just bad luck in terms of which Yahoo server that got hit. I started another R session and it works. Still didn't work in the other session. Exited R, reloaded and now it works. Sorry for the false alarm. :( Also, MNT isn't valid in Yahoo land. So that is failing for other reasons. Ah, that was a typo. It was MNTA that I was looking at in the browser. Thanks for the quick response and the extremely useful quantmod package! -rex ___ R-SIG-Finance@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.