Re: [R] Colors in R
may be this is of some help http://research.stowers-institute.org/efg/R/Color/Chart/ _ Arun Kumar Saha, FRM QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST Visit me at: http://in.linkedin.com/in/ArunFRM _ -- View this message in context: http://r.789695.n4.nabble.com/Colors-in-R-tp3665423p3665440.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] About DCC-garch model...
Dear Windseav, I found that it is quite subjective because the effect of initial value will dilute after couple of time periods, hence whatever value you put there never matters. However I found that common practice is to put the unconditional variance/covariance/correlation for the first period. I can recall (sometimes back I probably checked) that fgarch package (or may be something related, I cant recall now) put average sum-square of the observations as the estimated variance for the 1st period. Thanks, _ Arun Kumar Saha, FRM QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST Visit me at: http://in.linkedin.com/in/ArunFRM _ -- View this message in context: http://r.789695.n4.nabble.com/About-DCC-garch-model-tp3579140p3579489.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] About DCC-garch model...
Hi Marcin, I do not think you can just ignore the past period's estimate (or I misunderstood your statement?)(M)GARCH estimation is essentially an iterative procedure, therefore you need to have something as the starting value. Thanks, _ Arun Kumar Saha, FRM QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST Visit me at: http://in.linkedin.com/in/ArunFRM _ -- View this message in context: http://r.789695.n4.nabble.com/About-DCC-garch-model-tp3579140p3581242.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] How to look up explanations for %in%?
?'%in%' Thanks, -- View this message in context: http://r.789695.n4.nabble.com/How-to-look-up-explanations-for-in-tp3235274p3235360.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] How to compare two square matrices
Dear Sabari, if you need a single number for comparison then there could be many options. You can calculate smallest absolute eigen value, or may be the determinant (i.e. a measure of volumn of matrices) or may be the smallest element in absolute term, depending on your research need. Thanks, -- View this message in context: http://r.789695.n4.nabble.com/How-to-compare-two-square-matrices-tp3085236p3085481.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] R optimization and curve()?
See ?persp Also there are some really good examples on 3D plots in rgl package. Best, -- View this message in context: http://r.789695.n4.nabble.com/R-optimization-and-curve-tp2992244p2992998.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] ARIMA models
To me what is looking most exotic is the different orders of integration of your models, which you are assuming starting from 1 through 5. All asymptotic results regrading the distribution of the model parameters based on the fact that original DGP has exactly 1 as the order of integration, because most of the real life scenarios which are non-stationary in nature can be well approximated with that. Therefore perhaps usual t-values can not be justified once you cross the limit as 1. Apart from that, in my belief you can just go ahead with different combinations of p and q parameters and choose the optimal one (based on some pre-fixed criteria like AIC/BIC or non-significance of model coefficients). However in each experiment you should fix the initial values of the time series and should keep it same for all experiment. Best regards, -- View this message in context: http://r.789695.n4.nabble.com/ARIMA-models-tp2957129p2964483.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Looking for a book/tutorial with the following context:
Patrick Burns has been my great source of resources in my R learnings. Most of the answers you would find from his stuffs only, see http://www.burns-stat.com/;. However for functions and their executions/debugging related quires we might find John Chambers (http://www.springer.com/statistics/computanional+statistics/book/978-0-387-75935-7) most helpful. Best regards, -- View this message in context: http://r.789695.n4.nabble.com/Looking-for-a-book-tutorial-with-the-following-context-tp2965206p2965410.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Combinations
Dear , 15 is very big number for me (perhaps for R as well :() so I have tried following: mat - expand.grid(rep(list(c(1, X, 2)),4)); mat[mat[,3]==2,] -- View this message in context: http://r.789695.n4.nabble.com/Combinations-tp2955065p2955338.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Converting a dataframe column from string to datetime
Is it okay with you? Reduce(rbind, lapply(lapply(v,function(x){strptime(x, %a %b %d %H:%M:%OS %Y)}), as.character)) -- View this message in context: http://r.789695.n4.nabble.com/Converting-a-dataframe-column-from-string-to-datetime-tp2853709p2869793.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Percentile rank for each element in list
Otherwise you can try following: x - c(1,5,100,300,250,200,550,900,1000) which(x==quantile(x,0.25,type=3)) This will always return number within your vector. See further information with ?'quantile' Thanks and regards, -- View this message in context: http://r.789695.n4.nabble.com/Percentile-rank-for-each-element-in-list-tp2529523p2530029.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Help -normal distribution
try qnorm(40/200) -- View this message in context: http://r.789695.n4.nabble.com/Help-normal-distribution-tp2309730p2309735.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] super class
Is this what you wanted? setClass(class1, representation(xc1=numeric, xc2=character)) setClass(class2, representation(cx1=character, cx2=numeric)) setClassUnion(combinedClass, c(class1,class2)) getClass(combinedClass) -- View this message in context: http://r.789695.n4.nabble.com/super-class-tp831608p2307894.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Correct statistical inference for linear regression models without intercept in R
What x and y represent? Are they non-stationary, trending? then you would get very high R2 (~97-99%) and very low p-value. Perhaps you land on the world of spurious regression. In this case forcing intercept to zero would not help you. Work with differenced series instead raw data. Thanks and regards, -- View this message in context: http://r.789695.n4.nabble.com/Correct-statistical-inference-for-linear-regression-models-without-intercept-in-R-tp2295193p2295230.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Option pricing models
Did you explore the fOptions package? Apart from lot of in-build functionalities you would see there lot of good references on options pricing. Thanks, -- View this message in context: http://r.789695.n4.nabble.com/Option-pricing-models-tp2295760p2295842.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] fatal error: unable to restore saved data
I had the same problem sometime back and could not settled it out in factory condition. Then onwards I run R from command prompt and it works property. A little bit cumbersome work for me as double clicking on desktop icon doesn't work. Arun, -- View this message in context: http://r.789695.n4.nabble.com/fatal-error-unable-to-restore-saved-data-tp2268985p2270844.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] prettyR
Sorry if I could not understand your problem properly. Are you looking for this type of example? assign(paste(x, 1, level, sep=), 4) x1level [1] 4 Thanks, -- View this message in context: http://r.789695.n4.nabble.com/prettyR-tp2245115p2245210.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] problem in using optim
just check whether some values in the parameter space forcing the log() function to apply logarithm on negative values !!! -- View this message in context: http://r.789695.n4.nabble.com/problem-in-using-optim-tp2133938p2133942.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Matrix
Sounds like you are looking for Kronecker Product between two matrices. If it is the case, you may work with A %x% B, A, B are two defined matrices. -- View this message in context: http://r.789695.n4.nabble.com/Matrix-tp2133212p2133287.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] lapply - function with arguments
another thought possibly fn = function(n, a=1, b=3) return(n*(a+b)) sapply(1:3, fn) -- View this message in context: http://n4.nabble.com/lapply-function-with-arguments-tp1838373p1838506.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] 4D plotting
3rd and 4th dimension can easily be accommodated in a 2d plot by using different color, shape of points etc. Therefore you can start with ggplot package. You might also want to look into here : http://had.co.nz/ggplot2/geom_point.html Best, Jared Nance wrote: Hello list, Thanks in advance for whatever help you can give me. I have a data set that I want to visualize that has four important dimensions (x,y,z,t). What I would like to be able to do is plot the three spatial coordinates using, say, scatterplot3d (or similar), and have the color of the plotted points be determined by the time coordinate. I've tried using scatterplot3d to do this, but without much success. Thanks again. -- Jared Nance University of Washington Center For Experimental Nuclear Physics and Astrophysics nanc...@phys.washington.edu __ R-help@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. -- View this message in context: http://n4.nabble.com/4D-plotting-tp949589p949594.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Statistical analysis
Rainfall data is widely accepted as Random walk process and hence it is non-stationary. Therefore if correlation or regression coef. is measured on raw data then you may land in the world of spurious measures. I would suggest you to check whether unit root is there in your data or not first. If it is there then estimate corr or any other statistical measure on differenced data. Best, cls59 wrote: Chris Li wrote: Hi all, I have got two datasets, one of them is rainfall data and the other one is groundwater level data. I would like to see whether there is a correlation between these two datasets and if there is, to what extent they are correlated. My stats background is limited, therefore any advice on which command I should use in R would be greatly appreciated. Thanks in advance. Chris Supposing you have two variables-- precipitation, p, and groundwater potential, h-- a simple test for linear correlation is to produce a scatterplot of h vs. p: plot( h ~ p ) If it looks linear, than it may be worthwhile to have R estimate the coefficient of correlation for the data: cor( p, h ) If the correlation coefficient is close to +/- 1, than your data is exhibiting a strong linear trend and a linear model may be appropriate: linModel - lm( h ~ p ) abline( linModel ) Good luck! -Charlie -- View this message in context: http://www.nabble.com/Statistical-analysis-tp25531331p25570612.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] help on vector auto-regressive model
Goodness to fit can be checked on looking at the PACF and/or ACF of estimated residuals. Also you might want to see how valid the normality assumption is on them. Generally joint normality is assumed on the data, so that innovation are multivariate white noise process. Luna Moon wrote: Hi all, I am asking this for my friend. In VAR models, how do we test the goodness-of-fit of a VAR model? More specifically in R? Moreover, are there assumptions on the joint distribution of the data in the model? Thanks a lot! [[alternative HTML version deleted]] __ R-help@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. -- View this message in context: http://www.nabble.com/help-on-vector-auto-regressive-model-tp25099737p25100636.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Confidence interval on parameters from optim function
Regrading your second question, I guess somehow you get undefined value like logarithm of zero of your target function for some unfortunate parameter values in the parameter space. Devred, Emmanuel wrote: Hi everyone, I have two questions: I would like to get confidence intervals on the coefficients derived from the optim() function. I apply optim() to a given function f res - optim(c(0.08,0.04,1.),f,NULL,method=L-BFGS-B,lower=c(0.,0.,0.)) And I would like to get the p-value and confidence intervals associated with res$par My second question deals with error message. I am doing a loop with the optim() function in it, when I get an error message like below, the loop is stopped, however I would like to change my initial values to avoid this error message and keep the loop going, so if it crashes when I am away the program can still run, any idea ? Error in optim(c(0.08, 0.04, 1), f, NULL, method = L-BFGS-B, lower = c(0, : L-BFGS-B needs finite values of 'fn' Thank you for any information on these two problems. Emmanuel --- Dr. Emmanuel Devred Bedford Institute of Oceanography, 1 Challenger Drive, Dartmouth, Nova Scotia, B2Y 4A2, Canada Ph: (1) 902 426-4681 Fax: (1) 902 426-9388 devr...@mar.dfo-mpo.gc.ca http://myweb.dal.ca/edevred/ --- [[alternative HTML version deleted]] __ R-help@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. -- View this message in context: http://www.nabble.com/Confidence-interval-on-parameters-from-optim-function-tp25044388p25046772.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.