[R] Cramer-von Mises test
I have found the Kolmogorov-Smirnov (ks.test) and Anderson-Darling (ad.test in package ADGofTest) goodness of fit tests, but was wondering whether there's a package implementing the Cramer-von Mises test for a general distribution (i.e. not just the one for the normal distribution in the nortest package). Any suggestions? Regards, Sean. -- Sean Carmody Twitter: http://twitter.com/seancarmody Stable: http://mulestable.net/sean The Stubborn Mule Blog: http://www.stubbornmule.net Forum: http://mulestable.net/ __ 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] Cramer-von Mises test
Thanks Peter...I hadn't some across the sos package before, but I'm sure I'll be putting it to good use from now on! Sean. On Mon, Jul 19, 2010 at 2:55 PM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2010-07-18 22:04, Sean Carmody wrote: I have found the Kolmogorov-Smirnov (ks.test) and Anderson-Darling (ad.test in package ADGofTest) goodness of fit tests, but was wondering whether there's a package implementing the Cramer-von Mises test for a general distribution (i.e. not just the one for the normal distribution in the nortest package). Any suggestions? Sean, Here's one way you can investigate this yourself: 1. install and load package 'sos'; 2. issue: findFn(Cramer-von Mises test) or, for a little wider scope: findFn(Cramer-von Mises) (in place of 'findFn', you can use '???') -Peter Ehlers Regards, Sean. -- Sean Carmody Twitter: http://twitter.com/seancarmody Stable: http://mulestable.net/sean The Stubborn Mule Blog: http://www.stubbornmule.net Forum: http://mulestable.net/ __ 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.
[R] Vector recycling and zoo
I am a bit confused about the different approaches taken to recycling in plain data frames and zoo objects. When carrying out simple arithmetic, dataframe seem to recycle single arguments, zoo objects do not. Here is an example x - data.frame(a=1:5*2, b=1:5*3) x a b 1 2 3 2 4 6 3 6 9 4 8 12 5 10 15 x$a/x$a[1] [1] 1 2 3 4 5 x - zoo(x) x$a/x$a[1] 1 1 I feel understanding this difference would lead me to a greater understanding of the zoo module! Sean. -- Sean Carmody Twitter: http://twitter.com/seancarmody Stable: http://mulestable.net/sean The Stubborn Mule Blog: http://www.stubbornmule.net Forum: http://mulestable.net/ [[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.
Re: [R] Vector recycling and zoo
Thanks David, You comment made me realise that whereas when x is a data frame, x$a is a numeric vector, when x is of class zoo, x$a is also of class zoo, so the following does what I was expecting: x$a/as.numeric(x$a[1]) Sean. On Sun, May 16, 2010 at 9:25 PM, David Winsemius dwinsem...@comcast.netwrote: On May 16, 2010, at 2:00 AM, Sean Carmody wrote: I am a bit confused about the different approaches taken to recycling in plain data frames and zoo objects. When carrying out simple arithmetic, dataframe seem to recycle single arguments, zoo objects do not. Here is an example x - data.frame(a=1:5*2, b=1:5*3) x a b 1 2 3 2 4 6 3 6 9 4 8 12 5 10 15 x$a/x$a[1] [1] 1 2 3 4 5 x - zoo(x) x$a/x$a[1] 1 1 I feel understanding this difference would lead me to a greater understanding of the zoo module! I think you do have misunderstandings about the zoo package but I do not think it is in the area of vector recycling. Notice the effect of your application of the zoo function to x: x$a 1 2 3 4 5 2 4 6 8 10 x$a[1] 1 2 You have in effect transposed the elements in x and are now getting a two element column vector when requesting x$a[1]. The term vector recycling is applied to situations where short vectors are reused starting with their first elements until the necessary length is achieved. For instance if you request: data.frame(x=1:2, y=letters[1:10]) x y 1 1 a 2 2 b 3 1 c 4 2 d 5 1 e 6 2 f 7 1 g 8 2 h 9 1 i 10 2 j Or plot(1:10, col=c(red,green)) Sean. -- Sean Carmody -- Sean Carmody Twitter: http://twitter.com/seancarmody Stable: http://mulestable.net/sean The Stubborn Mule Blog: http://www.stubbornmule.net Forum: http://mulestable.net/ [[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.
Re: [R] How to right-align labels in dotchart
Thanks very much John, that works. I had tried using las=1 inside the dotchart function itself, but it seems to be one of those occasions where the par parameter is over-ridden by the main plotting function. You can see the results here: http://www.stubbornmule.net/2009/10/asylum-seekers/ Now if only I can nudge the labels a little further to the right... Regards, Sean. On Sat, Oct 17, 2009 at 5:05 AM, John Kane jrkrid...@yahoo.ca wrote: Oops replying to the wrong post but anyway does this do what you want? aa - c(3,6,3,5,8) lbs - c('cat','goat', 'elephant', 'horse', 'whale') dotchart(aa, pch=(16), col = 1:5, main=A Dotchart) axis(side = 2, seq_along(aa), lbs, las=1) --- On Thu, 10/15/09, Sean Carmody seancarm...@gmail.com wrote: From: Sean Carmody seancarm...@gmail.com Subject: [R] How to right-align labels in dotchart To: R Help Mailing List r-help@r-project.org Received: Thursday, October 15, 2009, 7:51 PM I have only just discovered the joys of the dotchart (since I am reading William Cleveland's -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody [[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. __ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody [[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.
[R] How to right-align labels in dotchart
I have only just discovered the joys of the dotchart (since I am reading William Cleveland's -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody [[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.
Re: [R] How to right-align labels in dotchart
Pressed send too soon (apologies). Meant to say I have only just discovered the joys of the dotchart (since I am reading William Cleveland's The Elements of Graphing Data). However, I cannot work out how to change the alignment of the text labels from left to right. Regards, Sean. On Fri, Oct 16, 2009 at 10:51 AM, Sean Carmody seancarm...@gmail.comwrote: I have only just discovered the joys of the dotchart (since I am reading William Cleveland's -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody [[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.
Re: [R] Draw plot.table axis on right hand side
Dieter Menne wrote: With an ordinary plot, to customise the axis it is possible to suppress drawing the axis and then call Axis. I have been trying to change the location of the y-axis on a plot.table plot to the right hand side, but cannot even work out how to suppress drawing the labels. Thanks for the nice example. plot calls mosaicplot, and looking at the code it seems that the labels are rather hard-wired. Even dirty tricks like setting the margins do not help, and data$a - c(, , , , )[data$x] neither. So I would recommend to use package vcd instead, which has very detailed detail handling. Dieter Thanks Dieter. I see vcd had a detailed vignette. That should help me get to grips with mosaic, which does appear to be extremely flexible. -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody [[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.
[R] Draw plot.table axis on right hand side
With an ordinary plot, to customise the axis it is possible to suppress drawing the axis and then call Axis. I have been trying to change the location of the y-axis on a plot.table plot to the right hand side, but cannot even work out how to suppress drawing the labels. Here is a toy example of the sort of plot I am working with. Any suggestions as to how to have the axis on the right hand side not the left hand side would be appreciated. set.seed(2) data - data.frame(x= floor(runif(80)*5)+1, y=floor(runif(80)*5)+1) data$a - c(Cow, Dog, Fish, Mouse, Frog)[data$x] data$b - c(Banana, Apple, Pear, Orange, Melon)[data$y] plot(table(data$a, data$b), col=rainbow(5), las=1, main=) Regards, Sean. -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody [[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.
Re: [R] Plot Fonts in Windows vs Mac OSX
Thanks for the reponse Winston. Your chart (http://stdout.org/~winston/X/r-antialias/pch.html) illustrates my problem perfectly. I did experiment with Cairo, with no success in improving the display. In the blog post you linked to, the following comment appeared: If you don't have anti-aliasing on your system (and can't recompile R to enable it), you can use the poor-man's anti-aliasing trick: generate the graph in double the resolution, and display it at half the size. Does this mean that the standard Windows binary for R is not compiled with anti-aliasing enabled? Also, I have tried the trick of using larger graphics reduced in the browser, but I have found that the results look a little blurry. I am yet to produce a png plot on Windows that looks anything like as good as the ones produced on the Mac. Regards, Sean. On Sat, Jul 4, 2009 at 1:35 AM, Winston Changwinstonchang2...@u.northwestern.edu wrote: On Thu, Jul 2, 2009 at 7:11 PM, Sean Carmody seancarm...@gmail.com wrote: I have been plotting the same charts using png on a Windows machine and on a Mac OSX and the quality of the resulting images, particularly in relation to the fonts, look far superior in the plots produced on the Mac. Is there any way I can enhance the quality of the plots produced on the Windows machine? I have also tried using win.metafile on the Windows machine and the quality looks the same as the png. The obvious solution would be to just use the Mac, but that's not an option in the office! I have been searching the archives on this topic to no avail (although I can vouch for the perspicacity of my choice of search terms), so any help would be greatly appreciated! Your issue probably has to do with antialiasing. See number 8 in this list: http://blog.revolution-computing.com/2009/01/10-tips-for-making-your-r-graphics-look-their-best.html You can supposedly work around it using the Cairo package and CairoPNG() instead of png(), as shown here: http://www.mailund.dk/index.php/2009/01/25/antialias-plotting-in-r-using-cairo/ However, in my experience, the fonts don't work right in Windows XP with CairoPNG. You can see it in this chart I made using different rendering methods on different platforms (scroll down to CairoPNG). http://stdout.org/~winston/X/r-antialias/pch.html I posted about a related issue a little while back but never got a response hopefully someone else will be able to explain how to make it work! -Winston -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody __ 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.
[R] Plot Fonts in Windows vs Mac OSX
I have been plotting the same charts using png on a Windows machine and on a Mac OSX and the quality of the resulting images, particularly in relation to the fonts, look far superior in the plots produced on the Mac. Is there any way I can enhance the quality of the plots produced on the Windows machine? I have also tried using win.metafile on the Windows machine and the quality looks the same as the png. The obvious solution would be to just use the Mac, but that's not an option in the office! I have been searching the archives on this topic to no avail (although I can vouch for the perspicacity of my choice of search terms), so any help would be greatly appreciated! Regards, Sean. -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody __ 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] Remove Columns by Name from zoo object
Perfect, works like a charm. Thanks Gabor. Sean. On Mon, Nov 10, 2008 at 11:35 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: On Mon, Nov 10, 2008 at 12:31 AM, Sean Carmody [EMAIL PROTECTED] wrote: The tricks for removing columns specified by name from data frames such as x$mycol - NULL That only works for data frames since they are based on lists but not for objects like matrix, ts and zoo which are not based on lists. Try this: library(zoo) z - zoo(cbind(a = 1:2, b = 3:4, c = 5:6)) # all but b z - z[, colnames(z) != b] z z - zoo(cbind(a = 1:2, b = 3:4, c = 5:6)) # all but b and c z - z[, ! colnames(z) %in% c(b, c)] z -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody __ 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.
[R] Remove Columns by Name from zoo object
The tricks for removing columns specified by name from data frames such as x$mycol - NULL (and others described here http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames:remove_columns_by_name) do not seem to work for a zoo object. Any suggestions as to how to do this, or is my best bet to coerce to a data.frame, remove the column and coerce back to zoo? -- Sean Carmody The Stubborn Mule http://www.stubbornmule.net http://twitter.com/seancarmody __ 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.
[R] Is it possible to do fancy area plots?
Does anyone have any ideas about how you could use R to produce a fancy area plot like this one in the NY Times? http://tinyurl.com/6rr22g Regards, Sean, [[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.
Re: [R] Is it possible to do fancy area plots?
After a bit more searching, I've discovered that this chart is a variant of the treemap or map of the market. I'll play around with the sample code posted here https://stat.ethz.ch/pipermail/r-sig-finance/2006q2/000880.html, but if anyone's taken that further, I'd be keen to know. I'm happy to use the more conventional box approach than circles and irregular areas. Sean. On Fri, May 9, 2008 at 11:35 AM, Charilaos Skiadas [EMAIL PROTECTED] wrote: On May 8, 2008, at 9:11 PM, Sean Carmody wrote: Does anyone have any ideas about how you could use R to produce a fancy area plot like this one in the NY Times? http://tinyurl.com/6rr22g I certainly hope not, I wouldn't want my favorite statistics program to produce an area graph where the sizes of the areas are not proportional to the percentages represented, and where the shapes of the areas are so irregular as to make effective area comparisons near impossible... Unless my eyes are seriously deceiving me, which is quite possible. It would be interesting however, to find out how such a graph is constructed. I wonder if hyperbolic geometry enters the picture. Regards, Sean, Haris Skiadas Department of Mathematics and Computer Science Hanover College [[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.