Re: [R] Making TIFF images with rtiff
Let us be clear that TIFF is not a format, it is a collection of formats and for example my camera's RAW images are TIFFs, as are Adobe's DNG files. (See e.g. http://en.wikipedia.org/wiki/TIFF.) So the journals concerned are misusing the term. It is very easy to convert either JPEGs or PNGs to a TIFF subformat with ImageMagick, PhotoShop or other tools, and the bitmap() driver can write several versions of TIFF by converting from postscript (transparently to the user). I think the complaints in this thread are a bit rich given how much R aleady provides. We thought about adding a few TIFF formats to PNG, JPEG and BMP but agreed it was not worth effort (especially given the vagueness with which 'TIFF' is used and stories about journals rejecting perfectly valid TIFF files). [I don't recall anyone ever writing to thank us for the PNG or JPEG or bitmap drivers, and lack of appreciation does play a part.] An 8-bit TIFF device is not going to produce better images than the PNG one, just larger files. (It could if you rendered HDR TIFF images, but the journal will not be able to cope with those.) On Thu, 11 Jan 2007, Inman, Brant A. M.D. wrote: Many medical journals and publishers require that images, whether photographs or line art, be submitted as high resolution .TIFF images. One option for R users is to produce an image in one format and to convert it to a .TIFF file using a second software program. My experience has been that this option often results in images of poorer quality, often with blurry contours, and a loss of resolution. A second and better option would be to make .TIFF files directly from the graphic output of R. As TIFF is collection of bitmap formats, the blurriness is intrinisic to the format. You are not telling us what you converted *from* (nor what sort of images these are nor what convertor you used): for most R applications PNG is the right image format to convert from and conversion from PNG to TIFF will be lossless. (PS/PDF are not image formats, but also good starting points for conversion.) I recently noticed that there is a library called rtiff that may be able to do this. However, I have not been able to get it to work, principally because I do not know how to install the required supporting software, libtiff and tiffio.h, correctly on my computer. I am running R 2.4.0 on a Windows XP machine. So far I have done the following: 1) Loaded the rtiff library Do you mean 'package'? There is a precompiled Windows build: did you use that? What it needs is libtiff3.dll, which is in the software you downloaded: put it in R_HOME/rtiff/libs or somewhere on your PATH. (Sadly, the package is lacking adequate instructions.) 2) Downloaded and installed the TIFF library 3.8.2 (complete package and sources) from the following website: http://gnuwin32.sourceforge.net/packages/tiff.htm I would like to ask the R experts for help with the following things: 1) Where do I get the tiffio.h file? It is part of the libtiff software you downloaded, but it says it is only needed to install from the sources. 2) Where do I install or relocate the tiffio.h and TIFF library to so that rtiff will work? Thanks for your help. Brant Inman Mayo Clinic __ R-help@stat.math.ethz.ch 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. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch 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] levelplot not adjusting colors
col.region changes both colors in plot and colorkey. try: x - seq(pi/4, 5 * pi, length = 100) y - seq(pi/4, 5 * pi, length = 100) levelplot(z~x*y) #default levelplot(z~x*y,col.regions=rainbow(24)) #custom color On 1/11/07, Bram Kuijper [EMAIL PROTECTED] wrote: Hi all, I try to make a levelplot from the Trellis graphics package of count data given a certain x and y variable. The problem is that I can adjust the colorkey colors, but the colors of the actual values in the plot will be unchanged if I change the colorkey. e.g. my_lvl_plot - levelplot(my_z ~ my_x * my_y, colorkey = list(col=some_color_vector)) will result in a levelplot that draws new colors in the colorkey, but still draws the default colors in the plotting space. anybody ideas how to change also the colors in the plotting space to the values depicted in the color key? thanks, Bram __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] a way to control xlim in multhist?
Thanks in advance for any suggestions: I am using the 'multhist' function in the 'plotrix' package to display histograms of some variable 'x' given some value of another variable 'z' -- for example, separate histograms for some variable according to sex (or another dichotomous) variable. Thus I am using something like the following: multhist(list(x[z==1],x[z==0]),...). This generates histograms well enough, but because one cannot control the 'xlim' parameter the x-axis labels are very odd (or rather, strictly speaking, you CAN control it, but doing so does not change the x-axis value labels in the same way that it would if you were using the simple 'hist' command). More specifically, the labels almost always seem to progress in increments of 5 or 0.5, depending on the scale (see, for example, this graph: http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=82). Moreover, if x is, say, a categorical variable with possible values of 1 through 5, the x-axis labels will remain in the base-5 form (e.g., 0.5, 1.5, 2.5, etc.) rather than taking on the various categorical values, regardless of any xlim specification. I realize that the issue here is that multhist relies on the 'barplot' function, so I have attempted to hack the xlim change there. But no dice. So the bottom line is: is there a way to control x-axis scale and labeling through xliim when using multhist? Thanks, Justin Gengler Also: for a concrete demonstration of what I mean, compare the following: #1 mh - list(rnorm(200, mean=100, sd=10), rnorm(200, mean=100, sd=10)) multhist(mh) #2 multhist(mh,xlim=c(0,20)) __ R-help@stat.math.ethz.ch 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] mean on a table
Petr Pikal wrote: Hi On 11 Jan 2007 at 23:11, Farrel Buchinsky wrote: Not that I know of. When I get back to the office I will check it out. I certainly do not recall having created one. I wonder if a library I am working with maybe created a mean function. How do I figure out if I have a loose cannon mean function on the run in my system? easiest way would by to type mean or mean.default Also, methods(mean) (a rogue mean.table wouldn't be caught by the above) and do a traceback() at the fault to see what is actually being called. __ R-help@stat.math.ethz.ch 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] labels outliers in boxplot
Dear R-users, Following is part of my data, where slide has 36 levels and block 48 levels. I have done boxplot for each slide on the same graph. There are outliers for each slide and I tried to use indentify functtion to identify outliers in such a way that when I click on an outlier or point, the points will be labelled by either their block or ID or by both but without success. How can I make it work or are there other ways to do it than using identify function? Thanks in advance, Jenny, dat1[1:10,] y Slide Block ID Control 1 0.03147823 1 1 IgG-human 5 2 -0.23815974 1 1 LPPAANDVSVLTAAR 0 3 -0.71926359 1 1 HTKHYRVVSKPAALV 0 4 -0.14607826 1 1 FVALPAATADAYATT 0 5 0.89553073 1 1 NYPAMMAHAGDMAGY 0 6 -0.67587100 1 1 RRALRQIGVLERPVG 0 7 0.32636034 1 1 DCGTIRVGSFRGRWL 0 8 -1.44057259 1 1 MAKLSTDELLDAFKE 0 9 -0.37064338 1 1 LELSDFVKKFEETFE 0 10 -0.20387233 1 1 VSRRAKVDVLIVHTT 0 tb_ncs-subset(dat1,dat1$Control==1) ### this data contains only negative controls par(las=2,mar=c(10.1,4.1,4.1,2.1)) boxplot(split(tb_ncs$y,tb_ncs$Slide),col=orange, cex=.65, outline=TRUE,main=Negative control response of each patient, cex.main=1, font.main=1, col.main=blue, names=c(1:35,B)) grid(nx=NA, ny=NULL) ### grid over boxplot legend(bottomright, B = Buffer + sec,text.col=blue) out.block- identify(tb_ncs$y,tb_ncs$Slide) _ Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda __ R-help@stat.math.ethz.ch 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] Regression lines
My simpleminded understanding of simple regression is that when plotting regression lines for x on y and y on x in the same plot, the lines should cross each other at the respective means. But, given the R function below, abline (lm(y~x)) works fine, but abline (lm(x~y)) does not. Why? function () { attach (attitude) x - rating y - learning detach (attitude) plot (x, y) abline(v=mean(x)) abline(h=mean(y)) abline (lm(y~x)) abline (lm(x~y)) } __ R-help@stat.math.ethz.ch 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] Regression lines
Try this version of your function and then think about it tst - function () { attach (attitude) x - rating y - learning detach (attitude) plot (x, y) abline(v=mean(x)) abline(h=mean(y)) abline (lm(y~x)) cc - coef(lm(x ~ y)) abline (-cc[1]/cc[2], 1/cc[2]) } My simpleminded understanding of simple regression is that when plotting regression lines for x on y and y on x in the same plot, the lines should cross each other at the respective means. But, given the R function below, abline (lm(y~x)) works fine, but abline (lm(x~y)) does not. Why? function () { attach (attitude) x - rating y - learning detach (attitude) plot (x, y) abline(v=mean(x)) abline(h=mean(y)) abline (lm(y~x)) abline (lm(x~y)) } [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch 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] labels outliers in boxplot
because given data is a part of your data, I cannot examine, however, try: ##out.block-identify(tb_ncs$y,tb_ncs$Slide) out.block-identify(tb_ncs$Slide,tb_ncs$y) On 1/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear R-users, Following is part of my data, where slide has 36 levels and block 48 levels. I have done boxplot for each slide on the same graph. There are outliers for each slide and I tried to use indentify functtion to identify outliers in such a way that when I click on an outlier or point, the points will be labelled by either their block or ID or by both but without success. How can I make it work or are there other ways to do it than using identify function? Thanks in advance, Jenny, dat1[1:10,] y Slide Block ID Control 1 0.03147823 1 1 IgG-human 5 2 -0.23815974 1 1 LPPAANDVSVLTAAR 0 3 -0.71926359 1 1 HTKHYRVVSKPAALV 0 4 -0.14607826 1 1 FVALPAATADAYATT 0 5 0.89553073 1 1 NYPAMMAHAGDMAGY 0 6 -0.67587100 1 1 RRALRQIGVLERPVG 0 7 0.32636034 1 1 DCGTIRVGSFRGRWL 0 8 -1.44057259 1 1 MAKLSTDELLDAFKE 0 9 -0.37064338 1 1 LELSDFVKKFEETFE 0 10 -0.20387233 1 1 VSRRAKVDVLIVHTT 0 tb_ncs-subset(dat1,dat1$Control==1) ### this data contains only negative controls par(las=2,mar=c(10.1,4.1,4.1,2.1)) boxplot(split(tb_ncs$y,tb_ncs$Slide),col=orange, cex=.65, outline=TRUE,main=Negative control response of each patient, cex.main=1, font.main=1, col.main=blue, names=c(1:35,B)) grid(nx=NA, ny=NULL) ### grid over boxplot legend(bottomright, B = Buffer + sec,text.col=blue) out.block- identify(tb_ncs$y,tb_ncs$Slide) _ Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] Regression lines
On Fri, 12 Jan 2007, Tom Backer Johnsen wrote: My simpleminded understanding of simple regression is that when plotting regression lines for x on y and y on x in the same plot, the lines should cross each other at the respective means. But, given the R function below, abline (lm(y~x)) works fine, but abline (lm(x~y)) does not. Why? function () { attach (attitude) x - rating y - learning detach (attitude) plot (x, y) abline(v=mean(x)) abline(h=mean(y)) abline (lm(y~x)) abline (lm(x~y)) } The axes are getting reversed: xylm - lm(x~y) newdata - data.frame(y=0:80) lines(predict(xylm, newdata), newdata$y, col=blue) gets them back. Roger __ R-help@stat.math.ethz.ch 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. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch 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] Regression lines
On Fri, 12 Jan 2007, Tom Backer Johnsen wrote: My simpleminded understanding of simple regression is that when plotting regression lines for x on y and y on x in the same plot, the lines should cross each other at the respective means. But, given the R function below, abline (lm(y~x)) works fine, but abline (lm(x~y)) does not. Why? Where did you tell it 'x' was the abscissa and 'y' the ordinate? (Nowhere: R is lacking a mind_read() function!) From the help page: reg is a regression object with a coef method. If this returns a vector of length 1 then the value is taken to be the slope of a line through the origin, otherwise, the first 2 values are taken to be the intercept and slope. There are some changes in R-devel, but not to recognize names of coefficients. function () { attach (attitude) x - rating y - learning detach (attitude) plot (x, y) abline(v=mean(x)) abline(h=mean(y)) abline (lm(y~x)) abline (lm(x~y)) } __ R-help@stat.math.ethz.ch 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. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch 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] Regression lines
Tom Backer Johnsen wrote: My simpleminded understanding of simple regression is that when plotting regression lines for x on y and y on x in the same plot, the lines should cross each other at the respective means. But, given the R function below, abline (lm(y~x)) works fine, but abline (lm(x~y)) does not. Why? Well, abline() in fact plots a line using the estimated coefficients for intercept and slope and assumes you have plotted LeftHandSideOfFormula against RightHandSideOfFormula. If you did vice versa, abline() does not respect your mistake. Uwe Ligges function () { attach (attitude) x - rating y - learning detach (attitude) plot (x, y) abline(v=mean(x)) abline(h=mean(y)) abline (lm(y~x)) abline (lm(x~y)) } __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] image() and nonsquare matrices
How do I draw non-square matrices with image() and get the axes right? Try 1: a - matrix(rnorm(100),20,5) image(1:20,1:5,a,asp=1,xlab=label here) # No good because the axes don't touch the image Try 2: image(1:20,1:5,a,asp=1,axes=F,xlab=label here) axis(side=1,pos=0) # No good because the x axis label is floating far from the x axis. Try 3: image(1:20,1:5,a,asp=1,axes=F,xlab=,ylab=) axis(side=1,pos=0) # No good because the x axis label is absent. How to use image() with a non-square matrix and make axes and labels appear correctly? -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ R-help@stat.math.ethz.ch 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] .C interface and Strings...
Dear R users, I am trying to include C code into R via the .C interface. I have read that arguments passed to a C function have to be correctly DEreferenced. This is something that can be easily done for numbers (integers or float) by adding a * before the reference like for instance: #includeR.h void hellofct(int *n) { int i; for (i=0;i*n;i++) { Rprintf(Hello, world!\n); } } However, I can not figure out how that can be achieved for strings. My prototype function would be something like: #includeR.h void displaystring(char *str) { Rprintf(String displayed:%s\n, ); } any hints? Thx. Stéphane. -- == Stephane CRUVEILLER Ph. D. Genoscope - Centre National de Sequencage Atelier de Genomique Comparative 2, Rue Gaston Cremieux CP 5706 91057 Evry Cedex - France Phone: +33 (0)1 60 87 84 58 Fax: +33 (0)1 60 87 25 14 EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED] === __ R-help@stat.math.ethz.ch 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] Regression lines
Prof Brian Ripley wrote: Where did you tell it 'x' was the abscissa and 'y' the ordinate? (Nowhere: R is lacking a mind_read() function!) Please stop complaining about missing features. Patches will be considered. Oh, it's you, Brian. Never mind then. You'll get to it, I'm sure. ;-) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch 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] Regression lines
This should do the trick: mind_reader - function() { ll - letters[round(runif(6, 1, 26))] ff - ll[1] for (ix in 2:length(ll)) { ff - paste(ff, ll[ix], sep = ) } if (exists(ff)) { cat(The function that you were thinking of is) return(ff) } else { cat(please update libopenmind to the patched or development version) } } Prof Brian Ripley wrote: R is lacking a mind_read() function!) [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch 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] image() and nonsquare matrices
Robin Hankin wrote: How do I draw non-square matrices with image() and get the axes right? Try 2: image(1:20,1:5,a,asp=1,axes=F,xlab=label here) axis(side=1,pos=0) # No good because the x axis label is floating far from the x axis. Its only no good if your plot device isnt a similar aspect ratio to your plot... Resize your graphics window and your label will float around... Barry __ R-help@stat.math.ethz.ch 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] Regression lines
ken knoblauch wrote: This should do the trick: mind_reader - function() { ll - letters[round(runif(6, 1, 26))] I see my paraNormal distribution package hasn't found its way to CRAN yet: http://tolstoy.newcastle.edu.au/R/help/05/04/1701.html Barry __ R-help@stat.math.ethz.ch 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] Regression lines
Barry Rowlingson wrote: ken knoblauch wrote: This should do the trick: mind_reader - function() { ll - letters[round(runif(6, 1, 26))] I see my paraNormal distribution package hasn't found its way to CRAN yet: http://tolstoy.newcastle.edu.au/R/help/05/04/1701.html LOL! Nice! Tom __ R-help@stat.math.ethz.ch 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] Regression lines
On 1/12/2007 5:56 AM, Barry Rowlingson wrote: ken knoblauch wrote: This should do the trick: mind_reader - function() { ll - letters[round(runif(6, 1, 26))] I see my paraNormal distribution package hasn't found its way to CRAN yet: http://tolstoy.newcastle.edu.au/R/help/05/04/1701.html It probably hasn't passed their checks. The CRAN folks never expect packages to pass. Duncan Murdoch __ R-help@stat.math.ethz.ch 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] .C interface and Strings...
Stephane Cruveiller said the following on 1/12/2007 4:15 AM: Dear R users, I am trying to include C code into R via the .C interface. I have read that arguments passed to a C function have to be correctly DEreferenced. This is something that can be easily done for numbers (integers or float) by adding a * before the reference like for instance: #includeR.h void hellofct(int *n) { int i; for (i=0;i*n;i++) { Rprintf(Hello, world!\n); } } However, I can not figure out how that can be achieved for strings. My prototype function would be something like: #includeR.h void displaystring(char *str) { Rprintf(String displayed:%s\n, ); } any hints? Yes, Section 5.2 in Writing R Extensions. untested displaystring.c: #includeR.h void displaystring(char **str, int *n) { int i; for(i = 0; i *n; i++) Rprintf(String displayed:%s\n, str[i]); } displaystring.dll: R CMD SHLIB displaystring.c displaystring.R: dyn.load(displaystring) displaystring - function(x) { .C(displaystring, x, length(x)) invisible() } displaystring(c(A, B)) /untested HTH, --sundar __ R-help@stat.math.ethz.ch 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] Maximum likelihood acf
Hello! I am looking for a function which computes the maximum likelihood estimator of the autocorrelation function for a gaussian time series. Does a such function already exist in R? The estimator by default in R, acf(), uses the method of moments. Thanks a lot, Alain -- Alain Guillet Statistician and Computer Scientist Institut de statistique - Université catholique de Louvain Bureau d.126 Voie du Roman Pays, 20 B-1348 Louvain-la-Neuve Belgium tel: +32 10 47 30 50 __ R-help@stat.math.ethz.ch 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] labels outliers in boxplot
Dear talepande, Thanks for your suggestion, I have already tried to use it, but the identify function gave me only the observation number everytime I clicked on any point.What I want is instead of obervation numbers it would be block and/or slide numbers. Any other idea how I can make it works ? Thanks --- talepanda [EMAIL PROTECTED] skrev: because given data is a part of your data, I cannot examine, however, try: ##out.block-identify(tb_ncs$y,tb_ncs$Slide) out.block-identify(tb_ncs$Slide,tb_ncs$y) On 1/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear R-users, Following is part of my data, where slide has 36 levels and block 48 levels. I have done boxplot for each slide on the same graph. There are outliers for each slide and I tried to use indentify functtion to identify outliers in such a way that when I click on an outlier or point, the points will be labelled by either their block or ID or by both but without success. How can I make it work or are there other ways to do it than using identify function? Thanks in advance, dat1[1:10,] y Slide Block ID Control 1 0.03147823 1 1 IgG-human 5 2 -0.23815974 1 1 LPPAANDVSVLTAAR 0 3 -0.71926359 1 1 HTKHYRVVSKPAALV 0 4 -0.14607826 1 1 FVALPAATADAYATT 0 5 0.89553073 1 1 NYPAMMAHAGDMAGY 0 6 -0.67587100 1 1 RRALRQIGVLERPVG 0 7 0.32636034 1 1 DCGTIRVGSFRGRWL 0 8 -1.44057259 1 1 MAKLSTDELLDAFKE 0 9 -0.37064338 1 1 LELSDFVKKFEETFE 0 10 -0.20387233 1 1 VSRRAKVDVLIVHTT 0 tb_ncs-subset(dat1,dat1$Control==1) ### this data contains only negative controls par(las=2,mar=c(10.1,4.1,4.1,2.1)) boxplot(split(tb_ncs$y,tb_ncs$Slide),col=orange, cex=.65, outline=TRUE,main=Negative control response of each patient, cex.main=1, font.main=1, col.main=blue, names=c(1:35,B)) grid(nx=NA, ny=NULL) ### grid over boxplot legend(bottomright, B = Buffer + sec,text.col=blue) out.block- identify(tb_ncs$y,tb_ncs$Slide) _ Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda __ R-help@stat.math.ethz.ch 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. _ Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda __ R-help@stat.math.ethz.ch 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] extract standard errors, write them to file
Hello I want to repeatedly extract coefficients and standard errors from a GLM and write them into a file (1row=all coefficients of model A, 2 row=all coefficients of model B, etc.). I can extract coefficients but not standard errors. furthermore I fail to write extracted values line by line into the predifined matrix G. I appreciate any idea to solve the problem best regards Lukas #-start code global - formula(logHRS~Ri + E + Co + LWD +Alwd +W + T2 + A + N + Sex + y) #1 richness_evenness- formula(logHRS~Ri + E + D1 + D2 +D3 +D4 + D5 + D6 + N + Sex + y)#2 all_models - c(global, richness_evenness) for (i in 1:length(all_models)) { ts.model - glm(all_models[[i]],family=gaussian,data=t.data) G- matrix(NA,length(all_models),length(all_models)) G- coefficients(ts.model) #regression coefficents (betas) } write.table(G, paste(t.url, file=Coefficients.txt), sep=\t, quote=F) #-end code- °°° Lukas Indermaur, PhD student eawag / Swiss Federal Institute of Aquatic Science and Technology ECO - Department of Aquatic Ecology Überlandstrasse 133 CH-8600 Dübendorf Switzerland Phone: +41 (0) 71 220 38 25 Fax: +41 (0) 44 823 53 15 Email: [EMAIL PROTECTED] www.lukasindermaur.ch __ R-help@stat.math.ethz.ch 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] Maximum likelihood acf
You will need to give us a reference, as the acf is not a parameter in a model in your description and MLEs apply to model parameters. Just possibly ar.mle is what you are looking for, perhaps plus ARMAacf? On Fri, 12 Jan 2007, Alain Guillet wrote: Hello! I am looking for a function which computes the maximum likelihood estimator of the autocorrelation function for a gaussian time series. Does a such function already exist in R? The estimator by default in R, acf(), uses the method of moments. Thanks a lot, Alain -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch 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] [R-pkgs] Dummy's guide to S4 methods: package Brobdingnag
Hello List. please find uploaded to CRAN a new package, Brobdingnag. This package does two things: (1) allows computation of very large numbers using a logarithmic representation. (2) provides a Hello, World example of S4 methods in use: there are two classes of object (brob and glub) and one virtual class (swift). The package includes a vignette that is a step-by-step guide to using S4 methods in the context of an R package. Enjoy Robin -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch 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] extract standard errors, write them to file
Indermaur Lukas said the following on 1/12/2007 7:55 AM: Hello I want to repeatedly extract coefficients and standard errors from a GLM and write them into a file (1row=all coefficients of model A, 2 row=all coefficients of model B, etc.). I can extract coefficients but not standard errors. furthermore I fail to write extracted values line by line into the predifined matrix G. I appreciate any idea to solve the problem best regards Lukas #-start code global - formula(logHRS~Ri + E + Co + LWD +Alwd +W + T2 + A + N + Sex + y) #1 richness_evenness- formula(logHRS~Ri + E + D1 + D2 +D3 +D4 + D5 + D6 + N + Sex + y)#2 all_models - c(global, richness_evenness) for (i in 1:length(all_models)) { ts.model - glm(all_models[[i]],family=gaussian,data=t.data) G- matrix(NA,length(all_models),length(all_models)) G- coefficients(ts.model) #regression coefficents (betas) } write.table(G, paste(t.url, file=Coefficients.txt), sep=\t, quote=F) #-end code- °°° Lukas Indermaur, PhD student eawag / Swiss Federal Institute of Aquatic Science and Technology ECO - Department of Aquatic Ecology Überlandstrasse 133 CH-8600 Dübendorf Switzerland Phone: +41 (0) 71 220 38 25 Fax: +41 (0) 44 823 53 15 Email: [EMAIL PROTECTED] www.lukasindermaur.ch __ R-help@stat.math.ethz.ch 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. Your code is barely readable because of poor spacing, but I believe you want: coef(summary(ts.model))[, 1:2] --sundar __ R-help@stat.math.ethz.ch 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] Regression lines
Fortune? On 1/12/07, Peter Dalgaard [EMAIL PROTECTED] wrote: Prof Brian Ripley wrote: Where did you tell it 'x' was the abscissa and 'y' the ordinate? (Nowhere: R is lacking a mind_read() function!) Please stop complaining about missing features. Patches will be considered. Oh, it's you, Brian. Never mind then. You'll get to it, I'm sure. ;-) -- Sarah Goslee http://www.functionaldiversity.org __ R-help@stat.math.ethz.ch 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] DF for GAM function (mgcv package)
On Friday 15 December 2006 22:38, BRENDAN KLICK wrote: For summary(GAM) in the mgcv package smooth the degrees of freedom for the F value for test of smooth terms are the rank of covariance matrix of \hat{beta} and the residuals df. I've noticed that in a lot of GAMs I've fit the rank of the covariance turns out to be 9. In Simon Wood's book, the rank of covariance matrix is usually either 9 or 99 (pages 239-230 and 259). Can anyone comment on why so many smooth terms have a denominator degree of freedom involving 9. Simon Wood writes r is usually determinted numerically, while forming the pseudoinverse of the covariance matrix, or with reference to the effective degrees of freedom of the term which doesn't really clarify the issue for me at least. The rank used for the covariance matrix is often the number of free coefficients associated with the term (i.e. k-1, the maximum EDF for the term less the identifiability constraint). The idea is to base the test statistic on the parts of the model space that are not completley supressed by the penalization of the terms, so if penalization is not very high then this may mean the whole space. 9 occurs frequently because by default k=10 for a 1-D smooth. Where 99 occurs it's because a basis dimension (k) of 100 was being employed. The rank used is less than k-1 when some subspace of the model space has been very heavily penalized, so that it should not contribute anything to the test statistic. Finally... these tests are not great, and only provide a rough guide to significance: the worst failing is the neglect of smoothing parameter uncertainty. See the final example in ?summary.gam to get an indication of how well/badly the p-values perform in practice. best, Simon Thanks. Brendan Klick Johns Hopkins University School of Medicine. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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. -- Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK +44 1225 386603 www.maths.bath.ac.uk/~sw283 __ R-help@stat.math.ethz.ch 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] R editor vs. Tinn-R
Have you used Tinn-R and what landmines await the inexperienced? I could not understand why a script that used to work stopped working. Look at these two scenarios I opened an excel spreadsheet and copied several cells to the clipboard Then Scenario 1 Executed from Tinn-R prelim-read.delim(clipboard) str(prelim) 'data.frame': 0 obs. of 1 variable: $ prelim..read.delim.clipboard.: logi Scenario 2 Executed from R editor prelim-read.delim(clipboard) str(prelim) 'data.frame': 18 obs. of 13 variables: -- Farrel Buchinsky Mobile: (412) 779-1073 __ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
Thanks to all the responders. Here are some replies to the comments: 1) Concerning the term TIFF format. It may be that the journals are misusing the term TIFF, but it would also appear that wikipedia is as well. The first sentence in the wiki link sent below states: Tagged Image File FORMAT (abbreviated TIFF) is a file FORMAT for mainly storing images, including photographs and line art. Either way, the semantics of the word TIFF are probably not that important for the current query. If a publisher wants images in TIFF, I would like to provide them in that format, regardless of whether or not I deem the request proper. After all they are the publishing experts! 2) Converting PNGs to TIFFs with Photoshop. This is principally what I have done in the past that has given the poor results that I have noted. I thought that it could be something that I was specifically doing wrong so I consulted the medical imaging and design department of my institution (Mayo Clinic) which informed me that there is often a loss of information, some times quite large, in these types of image format conversions. They suggested that it is best to work with the TIFFs from the start if possible, which is why I am trying to explore this option in R. It is interesting that my imaging department was able to convert the WMF format to TIFF with much better success. However, since Photoshop does not support WMFs, I am unable to do this myself. I have downloaded ImageMagick and will try that. 3)Lack of gratitude by R users. It is interesting to note upon reviewing the R-help files that many queries (perhaps even the majority?) do, in fact, convey gratitude. Unfortunately, I have also noted that there are several messages from R developers that appear to feel underappreciated. I suspect that one reason that R is experiencing an explosion of users is precisely that people appreciate and value the donation of free time provided by statistical experts--such as Harrell, Weigand, Ripley and Kort in this thread--for the development of accurate and powerful statistical software. Furthermore, the support provided for the software in the form of R-help is outstanding, again something that I think is part of the package deal that is attracting new users to R. In other words, one should not assume a general lack of gratitude on behalf of R-help users but should see the growth of R as evidence that the software and its developpers/supporters are indeed greatly valued. I do not think that R would be used much if people did not appreciate the nice packages, functions and help provided. Indeed, those of us that have access to multiple software programs (I have access to JMP, SPSS, SPLUS and SAS) choose R as our primary method of analysis because we feel that the sharing environment supported by CRAN is a better way of doing statistical computing. Enough said. 4)Flexible journal policies. Of 4 papers that I have submitted in the last 3 months for publication in 3 journals (all to cancer related journals), all were subjected to online file checkers that forced me to upload TIFF files instead of PDFs. Not only do they check the format, but also various other resolution related items. In other words, I would not have even made it past the online submission stage if I only PDFs to work with. 5)Using the bitmap function to make TIFFs. This sounds like a very attractive option. I have tried this option using the simple code below: - attach(cars) plot(speed ~ dist) # Simple plot to test bitmap(file='C:\\...\\test.tif',type = tifflzw, res = 1200) Error in system(paste(gsexe, -help), intern = TRUE, invisible = TRUE) : gswin32c.exe not found - Despite what the error message suggests, I do have a functional Ghostscript 8.54 program installed on my Windows XP machine with the executable found in the directory: C:\Program Files\gs\gs8.54\bin\gswin32c. I am not sure why R is not finding the program. I tried making a Windows environmental variable, R_GSCMD, with this system address but that did not have any success. Does the gswin32c file need to be in my R PATH? Brant Inman Mayo Clinic __ R-help@stat.math.ethz.ch 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 editor vs. Tinn-R
Farrel Buchinsky wrote: Have you used Tinn-R and what landmines await the inexperienced? Depending on which button you press in Tinn-R, the clipboard is used to transfer the commands to R, so sometimes you can't rely on the previous contents of the clipboard while using Tinn-R. If you use the (source)-versions of the buttons, the content of the clipboard should be preserved. Regards, Martin I could not understand why a script that used to work stopped working. Look at these two scenarios I opened an excel spreadsheet and copied several cells to the clipboard Then Scenario 1 Executed from Tinn-R prelim-read.delim(clipboard) str(prelim) 'data.frame': 0 obs. of 1 variable: $ prelim..read.delim.clipboard.: logi Scenario 2 Executed from R editor prelim-read.delim(clipboard) str(prelim) 'data.frame': 18 obs. of 13 variables: __ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
I have had good results post processing xfig output with fig2dev: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/60735.html http://finzi.psych.upenn.edu/R/Rhelp02a/archive/60762.html On 1/12/07, Inman, Brant A. M.D. [EMAIL PROTECTED] wrote: Thanks to all the responders. Here are some replies to the comments: 1) Concerning the term TIFF format. It may be that the journals are misusing the term TIFF, but it would also appear that wikipedia is as well. The first sentence in the wiki link sent below states: Tagged Image File FORMAT (abbreviated TIFF) is a file FORMAT for mainly storing images, including photographs and line art. Either way, the semantics of the word TIFF are probably not that important for the current query. If a publisher wants images in TIFF, I would like to provide them in that format, regardless of whether or not I deem the request proper. After all they are the publishing experts! 2) Converting PNGs to TIFFs with Photoshop. This is principally what I have done in the past that has given the poor results that I have noted. I thought that it could be something that I was specifically doing wrong so I consulted the medical imaging and design department of my institution (Mayo Clinic) which informed me that there is often a loss of information, some times quite large, in these types of image format conversions. They suggested that it is best to work with the TIFFs from the start if possible, which is why I am trying to explore this option in R. It is interesting that my imaging department was able to convert the WMF format to TIFF with much better success. However, since Photoshop does not support WMFs, I am unable to do this myself. I have downloaded ImageMagick and will try that. 3)Lack of gratitude by R users. It is interesting to note upon reviewing the R-help files that many queries (perhaps even the majority?) do, in fact, convey gratitude. Unfortunately, I have also noted that there are several messages from R developers that appear to feel underappreciated. I suspect that one reason that R is experiencing an explosion of users is precisely that people appreciate and value the donation of free time provided by statistical experts--such as Harrell, Weigand, Ripley and Kort in this thread--for the development of accurate and powerful statistical software. Furthermore, the support provided for the software in the form of R-help is outstanding, again something that I think is part of the package deal that is attracting new users to R. In other words, one should not assume a general lack of gratitude on behalf of R-help users but should see the growth of R as evidence that the software and its developpers/supporters are indeed greatly valued. I do not think that R would be used much if people did not appreciate the nice packages, functions and help provided. Indeed, those of us that have access to multiple software programs (I have access to JMP, SPSS, SPLUS and SAS) choose R as our primary method of analysis because we feel that the sharing environment supported by CRAN is a better way of doing statistical computing. Enough said. 4)Flexible journal policies. Of 4 papers that I have submitted in the last 3 months for publication in 3 journals (all to cancer related journals), all were subjected to online file checkers that forced me to upload TIFF files instead of PDFs. Not only do they check the format, but also various other resolution related items. In other words, I would not have even made it past the online submission stage if I only PDFs to work with. 5)Using the bitmap function to make TIFFs. This sounds like a very attractive option. I have tried this option using the simple code below: - attach(cars) plot(speed ~ dist) # Simple plot to test bitmap(file='C:\\...\\test.tif',type = tifflzw, res = 1200) Error in system(paste(gsexe, -help), intern = TRUE, invisible = TRUE) : gswin32c.exe not found - Despite what the error message suggests, I do have a functional Ghostscript 8.54 program installed on my Windows XP machine with the executable found in the directory: C:\Program Files\gs\gs8.54\bin\gswin32c. I am not sure why R is not finding the program. I tried making a Windows environmental variable, R_GSCMD, with this system address but that did not have any success. Does the gswin32c file need to be in my R PATH? Brant Inman Mayo Clinic __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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,
Re: [R] Making TIFF images with rtiff
Inman, Brant A. M.D. wrote: Thanks to all the responders. Here are some replies to the comments: 1) Concerning the term TIFF format. It may be that the journals are misusing the term TIFF, but it would also appear that wikipedia is as well. The first sentence in the wiki link sent below states: Tagged Image File FORMAT (abbreviated TIFF) is a file FORMAT for mainly storing images, including photographs and line art. Either way, the semantics of the word TIFF are probably not that important for the current query. If a publisher wants images in TIFF, I would like to provide them in that format, regardless of whether or not I deem the request proper. After all they are the publishing experts! 2) Converting PNGs to TIFFs with Photoshop. This is principally what I have done in the past that has given the poor results that I have noted. I thought that it could be something that I was specifically doing wrong so I consulted the medical imaging and design department of my institution (Mayo Clinic) which informed me that there is often a loss of information, some times quite large, in these types of image format conversions. They suggested that it is best to work with the TIFFs from the start if possible, which is why I am trying to explore this option in R. It is interesting that my imaging department was able to convert the WMF format to TIFF with much better success. However, since Photoshop does not support WMFs, I am unable to do this myself. I have downloaded ImageMagick and will try that. 3)Lack of gratitude by R users. It is interesting to note upon reviewing the R-help files that many queries (perhaps even the majority?) do, in fact, convey gratitude. Unfortunately, I have also noted that there are several messages from R developers that appear to feel underappreciated. I suspect that one reason that R is experiencing an explosion of users is precisely that people appreciate and value the donation of free time provided by statistical experts--such as Harrell, Weigand, Ripley and Kort in this thread--for the development of accurate and powerful statistical software. Furthermore, the support provided for the software in the form of R-help is outstanding, again something that I think is part of the package deal that is attracting new users to R. In other words, one should not assume a general lack of gratitude on behalf of R-help users but should see the growth of R as evidence that the software and its developpers/supporters are indeed greatly valued. I do not think that R would be used much if people did not appreciate the nice packages, functions and help provided. Indeed, those of us that have access to multiple software programs (I have access to JMP, SPSS, SPLUS and SAS) choose R as our primary method of analysis because we feel that the sharing environment supported by CRAN is a better way of doing statistical computing. Enough said. 4)Flexible journal policies. Of 4 papers that I have submitted in the last 3 months for publication in 3 journals (all to cancer related journals), all were subjected to online file checkers that forced me to upload TIFF files instead of PDFs. Not only do they check the format, but also various other resolution related items. In other words, I would not have even made it past the online submission stage if I only PDFs to work with. 5)Using the bitmap function to make TIFFs. This sounds like a very attractive option. I have tried this option using the simple code below: - attach(cars) plot(speed ~ dist)# Simple plot to test bitmap(file='C:\\...\\test.tif',type = tifflzw, res = 1200) Error in system(paste(gsexe, -help), intern = TRUE, invisible = TRUE) : gswin32c.exe not found - Despite what the error message suggests, I do have a functional Ghostscript 8.54 program installed on my Windows XP machine with the executable found in the directory: C:\Program Files\gs\gs8.54\bin\gswin32c. I am not sure why R is not finding the program. I tried making a Windows environmental variable, R_GSCMD, with this system address but that did not have any success. Does the gswin32c file need to be in my R PATH? It needs to be in your Path. If you open up a DOS box and type gswin32c, I bet you get the same error message. You can fix this by editing the Path (via My Computer/Properties/Advanced/Environment variables, as you seem to know). If you use the R_GSCMD route, you may get in trouble with the embedded space in Program Files (dir/x c: will tell you the equivalent space-free name). Also, remember that environment changes do not affect running programs so you may need to exit R and restart. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED])
[R] Within-subject factors in lme
Dear R-users I'm considering a repeated measures experiment where two within-subject factors A (2 levels) and B (3 levels) have been measured for each of 14 subjects, S. I wish to test the effect of factor A. I know that a variance component model with random effects S, S:A, S:B and S:A:B can be fitted using aov: aov( y ~ A*B + Error(S/(A*B)) ) If there is no significant interaction, the test for the effect of A is carried out in the S:A error strata. How can a test for the effect of A be performed using lme from the nlme package? ( lme( y ~ A*B, random=~1|S/(A*B)) is apparently not correct ) Thanks in advance for your advice. Kim. __ R-help@stat.math.ethz.ch 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 the PPS samples i needed in R?
Dear friends, I want to do a unequal probability sampling, that is, Probability Proportionate to size, Is it right for the following programs? Say my original dataset is: ID Population 1 100 2 200 3 300 IF the population is large ,then the corresponding ID has the large Probability to be selected. sample(A$ID, size=2, replace = FALSE, prob = A$population) #suppose the dataset name is A. Is it the PPS samples i needed ? Any suggestions are greatly welcome. -- With Kind Regards, oooO: (..): :\.(:::Oooo:: ::\_)::(..):: :::)./::: ::(_/ : [***] Zhi Jie,Zhang ,PHD Tel:86-21-54237149 [EMAIL PROTECTED] Dept. of Epidemiology,school of public health,Fudan University Address:No. 138 Yi Xue Yuan Road,Shanghai,China Postcode:200032 [***] oooO: (..): :\.(:::Oooo:: ::\_)::(..):: :::)./::: ::(_/ : __ R-help@stat.math.ethz.ch 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] Maximum likelihood acf
Prof. Brian Ripley, You are right, my question was not clear. In fact, I want to estimate the k first components of the acf, i.e. I want to estimate the k parameters (c(0),c(1),...c(k-1)), where c is the autocorrelation function, by a maximum likelihood estimator. Alain Prof Brian Ripley a écrit : You will need to give us a reference, as the acf is not a parameter in a model in your description and MLEs apply to model parameters. Just possibly ar.mle is what you are looking for, perhaps plus ARMAacf? On Fri, 12 Jan 2007, Alain Guillet wrote: Hello! I am looking for a function which computes the maximum likelihood estimator of the autocorrelation function for a gaussian time series. Does a such function already exist in R? The estimator by default in R, acf(), uses the method of moments. Thanks a lot, Alain -- Alain Guillet Statistician and Computer Scientist Institut de statistique - Université catholique de Louvain Bureau d.126 Voie du Roman Pays, 20 B-1348 Louvain-la-Neuve Belgium tel: +32 10 47 30 50 __ R-help@stat.math.ethz.ch 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] wafer map drawing
Hello R-Users! Does anyone know of a package to draw/analyze silicon wafer maps? Here are some examples http://www.java2s.com/Code/Java/Chart/JFreeChartWaferMapChartDemo.htm http://dp.pdf.com/site/products/wafermap/binmap.html I've google'd and searched CRAN with no luck. It seems possible for R, given the hexbin and hist2d graphs I saw at the Graph gallery. Thanks, Sam [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Maximum likelihood acf
On Fri, 12 Jan 2007, Alain Guillet wrote: Prof. Brian Ripley, You are right, my question was not clear. In fact, I want to estimate the k first components of the acf, i.e. I want to estimate the k parameters (c(0),c(1),...c(k-1)), where c is the autocorrelation function, by a maximum likelihood estimator. And does ARMAacf applied to the result of ar.mle not do just that? An accessible reference would help us, if not. Alain Prof Brian Ripley a écrit : You will need to give us a reference, as the acf is not a parameter in a model in your description and MLEs apply to model parameters. Just possibly ar.mle is what you are looking for, perhaps plus ARMAacf? On Fri, 12 Jan 2007, Alain Guillet wrote: Hello! I am looking for a function which computes the maximum likelihood estimator of the autocorrelation function for a gaussian time series. Does a such function already exist in R? The estimator by default in R, acf(), uses the method of moments. Thanks a lot, Alain -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
Thank you Peter Dalgaard. When I open a DOS box and type gswin32c, I do indeed get an error message saying that it can't find the program. I edited the Windows system environmental variable Path and the user environmental variable PATH (wasn't sure which to edit), to contain the follwing after a semicolon C:\Program Files\gs\gs8.54\bin\. This effectively fixed the Dos box problem. I now get a GS prompt when I type gswin32c. When I restart R and use the following code, I no longer get an error message. attach(cars) bitmap(file='C:\\Documents and Settings\\m007704\\Desktop\\test.tif', + type = tifflzw, res = 1200) plot(speed ~ dist) Alas, if it was only that easy! When I look on my desktop (to which the file address above correctly refers to), there is no image file of any sort to be found. Any ideas as to what I am doing wrong? Brant Inman - It needs to be in your Path. If you open up a DOS box and type gswin32c, I bet you get the same error message. You can fix this by editing the Path (via My Computer/Properties/Advanced/Environment variables, as you seem to know). If you use the R_GSCMD route, you may get in trouble with the embedded space in Program Files (dir/x c: will tell you the equivalent space-free name). Also, remember that environment changes do not affect running programs so you may need to exit R and restart. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch 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] Within-subject factors in lme
Dear Kim, as far as I understandyour problem correct the specification of the model in lme is: lme( fixed=y ~ A*B, random=~1|S) Thilo On Friday 12 January 2007 15:54, Kim Mouridsen wrote: Dear R-users I'm considering a repeated measures experiment where two within-subject factors A (2 levels) and B (3 levels) have been measured for each of 14 subjects, S. I wish to test the effect of factor A. I know that a variance component model with random effects S, S:A, S:B and S:A:B can be fitted using aov: aov( y ~ A*B + Error(S/(A*B)) ) If there is no significant interaction, the test for the effect of A is carried out in the S:A error strata. How can a test for the effect of A be performed using lme from the nlme package? ( lme( y ~ A*B, random=~1|S/(A*B)) is apparently not correct ) Thanks in advance for your advice. Kim. __ R-help@stat.math.ethz.ch 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. -- Thilo Kellermann Department of Psychiatry und Psychotherapy RWTH Aachen University Pauwelstr. 30 52074 Aachen Tel.: +49 (0)241 / 8089977 Fax.: +49 (0)241 / 8082401 E-Mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
Inman, Brant A. M.D. wrote: Thank you Peter Dalgaard. When I open a DOS box and type gswin32c, I do indeed get an error message saying that it can't find the program. I edited the Windows system environmental variable Path and the user environmental variable PATH (wasn't sure which to edit), to contain the follwing after a semicolon C:\Program Files\gs\gs8.54\bin\. This effectively fixed the Dos box problem. I now get a GS prompt when I type gswin32c. When I restart R and use the following code, I no longer get an error message. attach(cars) bitmap(file='C:\\Documents and Settings\\m007704\\Desktop\\test.tif', + type = tifflzw, res = 1200) plot(speed ~ dist) Alas, if it was only that easy! When I look on my desktop (to which the file address above correctly refers to), there is no image file of any sort to be found. Any ideas as to what I am doing wrong? Hmmm You may be missing a final dev.off() or/and you need the space-free version of Documents and Settings (dir/x c:\). Beyond that, I'm out of ideas -- I don't use Windows all that often. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
How about dev.off() after your plot! It is easy as you predicted :-) Janusz. Inman, Brant A. M.D. wrote: Thank you Peter Dalgaard. When I open a DOS box and type gswin32c, I do indeed get an error message saying that it can't find the program. I edited the Windows system environmental variable Path and the user environmental variable PATH (wasn't sure which to edit), to contain the follwing after a semicolon C:\Program Files\gs\gs8.54\bin\. This effectively fixed the Dos box problem. I now get a GS prompt when I type gswin32c. When I restart R and use the following code, I no longer get an error message. attach(cars) bitmap(file='C:\\Documents and Settings\\m007704\\Desktop\\test.tif', + type = tifflzw, res = 1200) plot(speed ~ dist) Alas, if it was only that easy! When I look on my desktop (to which the file address above correctly refers to), there is no image file of any sort to be found. Any ideas as to what I am doing wrong? Brant Inman - It needs to be in your Path. If you open up a DOS box and type gswin32c, I bet you get the same error message. You can fix this by editing the Path (via My Computer/Properties/Advanced/Environment variables, as you seem to know). If you use the R_GSCMD route, you may get in trouble with the embedded space in Program Files (dir/x c: will tell you the equivalent space-free name). Also, remember that environment changes do not affect running programs so you may need to exit R and restart. __ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
Peter Dalgaard wrote: Inman, Brant A. M.D. wrote: Thank you Peter Dalgaard. When I open a DOS box and type gswin32c, I do indeed get an error message saying that it can't find the program. I edited the Windows system environmental variable Path and the user environmental variable PATH (wasn't sure which to edit), to contain the follwing after a semicolon C:\Program Files\gs\gs8.54\bin\. This effectively fixed the Dos box problem. I now get a GS prompt when I type gswin32c. When I restart R and use the following code, I no longer get an error message. attach(cars) bitmap(file='C:\\Documents and Settings\\m007704\\Desktop\\test.tif', + type = tifflzw, res = 1200) plot(speed ~ dist) Alas, if it was only that easy! When I look on my desktop (to which the file address above correctly refers to), there is no image file of any sort to be found. Any ideas as to what I am doing wrong? Hmmm You may be missing a final dev.off() or/and you need the space-free version of Documents and Settings (dir/x c:\). Beyond that, I'm out of ideas -- I don't use Windows all that often. I'm on WinXP Pro and the following puts test.tif on the Desktop for me: attach(cars) bitmap(file='C:\\DOCUME~1\\CHARLE~1\\Desktop\\test.tif', type = tifflzw, res = 1200) plot(speed ~ dist) dev.off() It does not work with spaces in the path. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
On Fri, 12 Jan 2007, Inman, Brant A. M.D. wrote: Thanks to all the responders. Here are some replies to the comments: [...] 3)Lack of gratitude by R users. It is interesting to note upon reviewing the R-help files that many queries (perhaps even the majority?) do, in fact, convey gratitude. Unfortunately, I have also noted that there are several messages from R developers that appear to feel underappreciated. I suspect that one reason that R is experiencing an explosion of users is precisely that people appreciate and value the donation of free time provided by statistical experts--such as Harrell, Weigand, Ripley and Kort in this thread--for the development of accurate and powerful statistical software. Furthermore, the support provided for the software in the form of R-help is outstanding, again something that I think is part of the package deal that is attracting new users to R. In other words, one should not assume a general lack of gratitude on behalf of R-help users but should see the growth of R as evidence that the software and its developpers/supporters are indeed greatly valued. I do not think that R would be used much if people did not appreciate the nice packages, functions and help provided. Indeed, those of us that have access to multiple software programs (I have access to JMP, SPSS, SPLUS and SAS) choose R as our primary method of analysis because we feel that the sharing environment supported by CRAN is a better way of doing statistical computing. Enough said. I see no mention by anyone of 'gratitude', and nothing relevant above to a thread about graphics devices and formats 'unfortunately'. What _I_ actually said was [I don't recall anyone ever writing to thank us for the PNG or JPEG or bitmap drivers, and lack of appreciation does play a part.] and people _do_ write to thank us for other additions. Areas that people do show appreciation for do tend to get more attention, and things which get frequent negative comment, less. Had several people said 'the png() device is very useful but what I really need is a TIFF variant', it might exist. What happened is that people commented (and continued to comment) about the difficulty of use and (for some) poor quality of output of the png() and jpeg() devices and separately about the bitmap() device. The idea of adding TIFF variants (which would have identical image quality) was dropped as a result. So my comment was specific and factual. - For my i686 box rebooted into Windows XP, Sys.putenv(GS_CMD='C:/packages/gs/gs8.53/bin/gswin32c.exe') bitmap(test.tif, type=tiff24nc) ... dev.off() works. Note that gs's documentation says TIFF is a loose collection of formats, now largely superceded by PNG except in applications where backward compatibility or special compression is required. (that is a collection of formats is clear from a reading of the whole Wikipedia entry). I have little idea which of these formats publishers will accept. I once had one who asked for 32-bit CMYK TIFF and then could not read what gs wrote (and had to subcontract the work to a printer who could). It really is the case that 'loose collection' is true and causes problems. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
At 8:07 AM + 1/12/07, Prof Brian Ripley wrote: Let us be clear that TIFF is not a format, it is a collection of formats and for example my camera's RAW images are TIFFs, as are Adobe's DNG files. (See e.g. http://en.wikipedia.org/wiki/TIFF.) So the journals concerned are misusing the term. It is very easy to convert either JPEGs or PNGs to a TIFF subformat with ImageMagick, PhotoShop or other tools, and the bitmap() driver can write several versions of TIFF by converting from postscript (transparently to the user). I think the complaints in this thread are a bit rich given how much R aleady provides. We thought about adding a few TIFF formats to PNG, JPEG and BMP but agreed it was not worth effort (especially given the vagueness with which 'TIFF' is used and stories about journals rejecting perfectly valid TIFF files). [I don't recall anyone ever writing to thank us for the PNG or JPEG or bitmap drivers, and lack of appreciation does play a part.] [ remainder omitted ] Then let me correct that omission right now. I appreciate these graphics drivers very much, especially the PNG driver that I now use routinely for placing R-generated graphics into so-called presentation software such as Microsoft PowerPoint. I remember very well how inconvenient I used to find it to transfer graphics into such documents, i.e., those of both MS Word and MS PowerPoint. Not so any longer. Thank you, -Don -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ R-help@stat.math.ethz.ch 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] Within-subject factors in lme
Dear Thilo Thanks for your suggestion. I guess the model you are fitting here has only a single random effect term, namely subject. If the effect of A depends on S, one needs to include an additional random effects term for the S:A interaction. With lme I can get output for the effect of A which is very similar to the aov output using lme( y ~ A + B, random=~ 1|S/A ) but here I have cheated by not including factor B in the 'random=' terms. But the output from anova( lme( y ~ A + B, random=~ 1|S/A ) ) is numDF denDF F-value p-value (Intercept) 154 388.4006 .0001 B254 154.0193 .0001 A113 4.4581 0.0547 where the last line appears equivalent to the aov output: Error: Subject:Treatment Df Sum Sq Mean Sq F value Pr(F) A 1 0.66074 0.66074 4.4581 0.05467 . Residuals 13 1.92676 0.14821 But I still need to account for the random S:B interaction. I can see a similar issue has been discussed earlier, see eg https://stat.ethz.ch/pipermail/r-help/2006-August/111018.html Here, lme( y ~ A*B, random=~1|S ) was also suggested (essentially), but this gives quite different results from aov and the lme example above. In this particular case I get numDF denDF F-value p-value (Intercept) 167 388.3976 .0001 B 267 104.8436 .0001 A 167 10.3707 0.002 I have seen instances of something like random=list(S=pdBlocked(list(pdIdent(~A-1)..., but I can't get this to work (and I have no idea what this does). Best regards, Kim. 2007/1/12, Thilo Kellermann [EMAIL PROTECTED]: Dear Kim, as far as I understandyour problem correct the specification of the model in lme is: lme( fixed=y ~ A*B, random=~1|S) Thilo On Friday 12 January 2007 15:54, Kim Mouridsen wrote: Dear R-users I'm considering a repeated measures experiment where two within-subject factors A (2 levels) and B (3 levels) have been measured for each of 14 subjects, S. I wish to test the effect of factor A. I know that a variance component model with random effects S, S:A, S:B and S:A:B can be fitted using aov: aov( y ~ A*B + Error(S/(A*B)) ) If there is no significant interaction, the test for the effect of A is carried out in the S:A error strata. How can a test for the effect of A be performed using lme from the nlme package? ( lme( y ~ A*B, random=~1|S/(A*B)) is apparently not correct ) Thanks in advance for your advice. Kim. __ R-help@stat.math.ethz.ch 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. -- Thilo Kellermann Department of Psychiatry und Psychotherapy RWTH Aachen University Pauwelstr. 30 52074 Aachen Tel.: +49 (0)241 / 8089977 Fax.: +49 (0)241 / 8082401 E-Mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch 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] Help for RFA
Respected Sir I am very new user of R. I am trying to use RFA package for Regional frequency analysis of rainfall data. Sir I am not understanding the example given in refference manual data(region) reganalysis(region) Sir in this example how can I make my own data(region) and what are the rows and columns of region . Sir I request you to please guide me in this respect. Best Regards AMINA [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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 editor vs. Tinn-R
The only button I pressed was the send line button in version 1.19.1.5. I changed my command to prelim-read.delim(source(clipboard)) and still got the same problem. I do not know how to use the source versions of the buttons. Can you please tell me more? Thanks Farrel Martin Becker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Farrel Buchinsky wrote: Have you used Tinn-R and what landmines await the inexperienced? Depending on which button you press in Tinn-R, the clipboard is used to transfer the commands to R, so sometimes you can't rely on the previous contents of the clipboard while using Tinn-R. If you use the (source)-versions of the buttons, the content of the clipboard should be preserved. Regards, Martin I could not understand why a script that used to work stopped working. Look at these two scenarios I opened an excel spreadsheet and copied several cells to the clipboard Then Scenario 1 Executed from Tinn-R prelim-read.delim(clipboard) str(prelim) 'data.frame': 0 obs. of 1 variable: $ prelim..read.delim.clipboard.: logi Scenario 2 Executed from R editor prelim-read.delim(clipboard) str(prelim) 'data.frame': 18 obs. of 13 variables: __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] quilt.plot
Dear all, I have a problem with plotting. I have an irregular set of data, where latitude is listed from bigger to smaller values. So, I cannot plot with image.plot. On the other hand, quilt.plot solves the problem, but it can't take the definition of color. It gives the feedback: Error in image.plot(out.p, col = tim.colors(64), ...) : formal argument col matched by multiple actual arguments The question is: is there a way to define the color palette in quilt.plot? Thanks in advance, Dunja Weather analysis and forecasting division Meteorological and Hydrological Service Gric 3, Zagreb HR-1, Croatia Tel: +385 1 4565 783 Fax: +385 1 4565 757 __ R-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
Several R Helpers pointed out that I forgot to include the dev.off() statement in my code. This solved my problem with one caviat: the output file address cannot have any spaces in it (as pointed out by Chuck Cleland). For instance: # This file location works great bitmap(file='C:\\temp\\test.tif', type = tifflzw, res = 1200) plot(speed ~ dist) dev.off() # This file location does not work, despite being accurate bitmap(file='C:\\Documents and Settings\\m007704\\Desktop\\test.tif', type = tifflzw, res = 1200) plot(speed ~ dist) dev.off() For the benefit of those that may need to make TIFF files in the future and don't know how to do it, I will recapitulate below the steps required to produce a TIFF file using R on a Windows XP machine. 1) Download and install a current version of Ghostscript. You probably need GPL(GNU General Public License) version of Ghostscript. For Windows, the correct file to download is called: gs854w32-gpl.exe. To download this file, go to one of the following websites: http://www.cs.wisc.edu/~ghost/ http://sourceforge.net/projects/ghostscript/ 2) Add Ghostscript to a Windows environmental variable. Right click on the My Computer icon on your desktop. Select: Properties Advanced Environmental Variables. You will see 2 boxes, one for user variables and one for system variables. In the user variables section, highlight the variable called PATH and then click edit. Click on the variable value box and go to the end of whatever is written there (don't erase it). Enter the following after the last bit of text: ;C:\Program Files\gs\gs8.54\bin\. This is the location on you computer where it can find the gswin32c.exe file that it needs to start Ghostscript. 3) Use the bitmap function to produce a TIFF Now you should be ready to make a TIFF. The following code is a simple example that you can use to see if everything is set up right on your PC. attach(cars) bitmap(file='C:\\temp\\test.tif', type = tifflzw, res = 1200) plot(speed ~ dist) dev.off() This should produce a TIFF file called 'test.tif' in the 'temp' directory of your PC. If you do not have a directory of this name, substitute for one that exists (or create one). Note that the file argument does not seem to handle and spaces in the directory address, so select an address without spaces in it. Note also that, as pointed out by Ripley in this thread, there are different TIFF formats which can be made with R. My understanding is that the different formats have to do with different image compression algorithms, but you can read more about these details (and clues to why TIFF files seem to be prefered by some publishers and imaging software makers) at: http://en.wikipedia.org/wiki/Comparison_of_graphics_file_formats You can also type ?bitmap to see what R can output for you and read more about the TIFF file format at: http://en.wikipedia.org/wiki/Tiff I regret that I cannot comment on Unix or Mac computers as it has been nearly 15 years since I have used these types of machines and I therefore have no knowledge whatsoever that might be of use for users of these systems. Brant Inman __ R-help@stat.math.ethz.ch 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 editor vs. Tinn-R
Zitat von Farrel Buchinsky [EMAIL PROTECTED]: The only button I pressed was the send line button in version 1.19.1.5. I changed my command to prelim-read.delim(source(clipboard)) The problem is not using the wrong R-command, but using a (Tinn-R) button that leads to a replacement of the current (windows) clipboard... and still got the same problem. I do not know how to use the source versions of the buttons. Can you please tell me more? There are three button groups on the left of the Send line button, containing two buttons each. The left button of each of these three button groups has the same name as the right button of each group, apart from having a (source) suffix. Now it should be obvious what was meant with '(source)-version of buttons'. There is no such version for the Send line button, so you have to select the corresponding line and use the Send selection (source) button, e.g. Thanks Farrel Regards, Martin Martin Becker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Farrel Buchinsky wrote: Have you used Tinn-R and what landmines await the inexperienced? Depending on which button you press in Tinn-R, the clipboard is used to transfer the commands to R, so sometimes you can't rely on the previous contents of the clipboard while using Tinn-R. If you use the (source)-versions of the buttons, the content of the clipboard should be preserved. Regards, Martin I could not understand why a script that used to work stopped working. Look at these two scenarios I opened an excel spreadsheet and copied several cells to the clipboard Then Scenario 1 Executed from Tinn-R prelim-read.delim(clipboard) str(prelim) 'data.frame': 0 obs. of 1 variable: $ prelim..read.delim.clipboard.: logi Scenario 2 Executed from R editor prelim-read.delim(clipboard) str(prelim) 'data.frame': 18 obs. of 13 variables: __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] Making TIFF images with rtiff
Prof Brian Ripley sent the following at 12/01/2007 08:07: Let us be clear that TIFF is not a format, it is a collection of formats ... snip ... [I don't recall anyone ever writing to thank us for the PNG or JPEG or bitmap drivers, and lack of appreciation does play a part.] ... rest snipped ... I hope I'm not going to turn out to be one a deluge of people now who hit the list with this but, I think you have a real point there. I sometimes wince at the tartness of some responses on this list but I owe you and many other people a completely unredeemable debt both for R itself including all its drivers, libraries, extraordinary portability, etc., etc. _AND_ for the fantastic quality of the advice that is given away daily here. If it's any consolation, I've started offering workshops to conferences in my own area to introduce novices away from SPSS and other packages (I loved SAS for a long time) and onto R. Trouble is, if I succeed, that'll probably only increase the rate of feature requests and questions here. Perhaps the sheer unredeemable nature of the debt to you all is part of what makes us quiet. Cheers all, Chris P.S. as ever, really helpful information re TIFFs confirming things I utterly failed to convince a printers and a subeditor about last year, fortunately the editor was a friend and we ended up getting the paper accepted with PS graphics as files! -- Chris Evans [EMAIL PROTECTED] Skype: chris-psyctc Professor of Psychotherapy, Nottingham University; Consultant Psychiatrist in Psychotherapy, Notts PDD network; Research Programmes Director, Nottinghamshire NHS Trust; Hon. SL Institute of Psychiatry, Hon. Con., Tavistock Portman Trust *If I am writing from one of those roles, it will be clear. Otherwise* *my views are my own and not representative of those institutions* __ R-help@stat.math.ethz.ch 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] zero margin / marginless plots (in lattice?)
On Thu, 11 Jan 2007, David Forrest wrote: Thanks. The xaxs|yaxs='i' works well for the base graphics. Is there an additional parameter in play for lattice graphics? The closest I could gotten is the below which still leaves a bit of a margin: xy-data.frame(x=c(0,1,1,0,0),y=c(0,1,0,0,1)) xyplot(y~x,xy,scales=list(axs='i',draw=FALSE),type='l',xlab=NULL,ylab=NULL) Hi again, If there isn't a way to completely eliminate the margins in lattice/grid plots, is there a way to find the graphic device extents as measured in data coordinates? Dave Dave On Wed, 10 Jan 2007, Marc Schwartz wrote: On Wed, 2007-01-10 at 21:18 -0600, David Forrest wrote: Hi, I'd like to produce a marginless or zero margin plot so that the pixel coordinates represent the mathematics. xy-data.frame(x=c(0,1,1,0,0),y=c(0,1,0,0,1)) png('junk.png',width=300,height=300) par(mar=c(0,0,0,0)) plot(xy$x,xy$y,xlim=c(0,1),ylim=c(,1)) dev.off() The resultant file has about a 10 pixel margin around these lines, and I'm not sure what parameter or function is controlling this offset. Any hints? Thanks for your time, Dave By default, the axis ranges are extended by +/- 4%. You can change this by using: plot(xy$x, xy$y, xlim = c(0, 1), ylim = c(0, 1), xaxs = i, yaxs = i) where 'xaxs' and 'yaxs' set the axis ranges to the actual data ranges. See ?par for more information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch 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. -- Dr. David Forrest [EMAIL PROTECTED](804)684-7900w [EMAIL PROTECTED] (804)642-0662h http://maplepark.com/~drf5n/ __ R-help@stat.math.ethz.ch 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 editor vs. Tinn-R
On 1/12/07, Martin Becker [EMAIL PROTECTED] wrote: Depending on which button you press in Tinn-R, the clipboard is used to transfer the commands to R, so sometimes you can't rely on the previous contents of the clipboard while using Tinn-R. If you use the (source)-versions of the buttons, the content of the clipboard should be preserved. Something odd is going on. I can confirm that read.delim(clipboard) works from R, but not from Tinn-R. What seems odd is that the contents of the clipboard _are_ preserved after the Tinn-R send, so that a subsequent paste or read.delim(clipboard) from R works correctly. Perhaps Tinn-R restores the contents of the clipboard after sending to R such that the R command runs before the restore takes place? jab -- John Bollinger, CFA, CMT www.BollingerBands.com If you advance far enough, you arrive at the beginning. __ R-help@stat.math.ethz.ch 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 editor vs. Tinn-R
Instead of discussing this odd behaviour of TINN-R, I would prefer a discussion on importing data through the clipboard. In my opinion it isn't a good a idea to import data with the clipboard. I know that it's a quick and dirty way to get your data fast into R. But I see two major drawbacks. First of all you have no chance of checking what data you imported. This is important when you need to check your results a few days (weeks, months or even years) later. A second drawback is that you won't feel the need to store your data in an orderly fashion. Which often leads to a huge pile of junk, instead of a valuable dataset... Cheers, Thierry -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] namens BBands Verzonden: vr 12-1-2007 19:47 Aan: R-Help Onderwerp: Re: [R] R editor vs. Tinn-R On 1/12/07, Martin Becker [EMAIL PROTECTED] wrote: Depending on which button you press in Tinn-R, the clipboard is used to transfer the commands to R, so sometimes you can't rely on the previous contents of the clipboard while using Tinn-R. If you use the (source)-versions of the buttons, the content of the clipboard should be preserved. Something odd is going on. I can confirm that read.delim(clipboard) works from R, but not from Tinn-R. What seems odd is that the contents of the clipboard _are_ preserved after the Tinn-R send, so that a subsequent paste or read.delim(clipboard) from R works correctly. Perhaps Tinn-R restores the contents of the clipboard after sending to R such that the R command runs before the restore takes place? jab -- John Bollinger, CFA, CMT www.BollingerBands.com If you advance far enough, you arrive at the beginning. __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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 editor vs. Tinn-R
Thierry: Instead of discussing this odd behaviour of TINN-R, I would prefer a discussion on importing data through the clipboard. In my opinion it isn't a good a idea to import data with the clipboard. I know that it's a quick and dirty way to get your data fast into R. But I see two major drawbacks. First of all you have no chance of checking what data you imported. This is important when you need to check your results a few days (weeks, months or even years) later. A second drawback is that you won't feel the need to store your data in an orderly fashion. Which often leads to a huge pile of junk, instead of a valuable dataset... - I do not understand this. I do this all the time, easily check the data in R (which has all sorts of powerful capabilities to do this), and easily store the data as part of the .Rdata file that also contains functions, transformations, analyses, etc. that I have used on the data. I do not know what is more orderly and useful than that! So would you care to elaborate? Bert Gunter Genentech Nonclinical Statistics South San Francisco, CA 94404 __ R-help@stat.math.ethz.ch 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] PCA (prcomp) details info.
Hello everybody, I'm handling a matrix dataset composed by a number of variables much higher than the objects (900 vs 100) and performing a prcomp (centered and scaled) PCA on it. What I get is a Loadings (rotation) matrix limited by my lower number of objects and thus 900x100 instead of 900x900. If I try to manually calculate the matrix scores multiplying the original variables (centered and scaled) for such a loadings matrix I cannot obtain the same values calculated by R and stored on the prcomp$x matrix (100x100). If I repeat the same with a dataset matrix where the number of variables is lower than the number of objects my manual calculation works perfectly and I get the same results of the prcomp$x scores matrix. Can someone help me to find a way to manual calculate the scores in the first case? Where is the difference in the calculation if in the second case everything works? Thanks a lot, Francesco Savorani. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] R2WinBugs and Compare DIC versus BIC or AIC
Dear All 1) I'm fitting spatial CAR models using R2Winbugs and although everything seems to go reasonably well (or I think so) the next message appears from WINBUGS 1.4 window: gen.inits() Command #Bugs: gen.inits cannot be executed (is greyed out) The question is if this message means that something is wrong and the results are consequently wrong, or Can I assume it as a simple warning message???... I've tried to fit the model using just WinBugs (not calling form R) and gen.inits command is available and the results obtain are practically the same... 2) The other question is, once several bayesian CAR models are fitted I use DIC to model selection How can I compare DIC with AIC or BIC obtain for a spatial glm? I mean for example: - DIC of 300 and Pd of 32 versus - BIC of 220 and Effective dimension (measured of trace of hat matrix) equal to 14 * I've read that DIC is intended as a generalisation of Akaike's Information Criterion (AIC), but is it possible to compare them simply looking which is the lowest??? Thanks, Dae-Jin Lee [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] zero margin / marginless plots (in lattice?)
On Thu, 11 Jan 2007, David Forrest wrote: Thanks. The xaxs|yaxs='i' works well for the base graphics. Is there an additional parameter in play for lattice graphics? The closest I could gotten is the below which still leaves a bit of a margin: xy-data.frame(x=c(0,1,1,0,0),y=c(0,1,0,0,1)) xyplot(y~x,xy,scales=list(axs='i',draw=FALSE),type='l',xlab=NULL,ylab=NULL) From an old email of Depayan's I see these margins in lattice are are due to 'padding' and this lattice theme seems to eliminate them: theme.novpadding - list(layout.heights = list(top.padding = 0, main.key.padding = 0, key.axis.padding = 0, axis.xlab.padding = 0, xlab.key.padding = 0, key.sub.padding = 0, bottom.padding = 0), layout.widths = list(left.padding = 0, key.ylab.padding = 0, ylab.axis.padding = 0, axis.key.padding = 0, right.padding = 0)) Then, using the quakes data example from ?xyplot : library(stats) xyplot(lat~long,quakes, scales=list(axs='i',draw=FALSE), ,xlab=NULL,ylab=NULL,par.settings = theme.novpadding) ...Then this graphic should drop nicely into GoogleEarth with a boundingbox matching the data: range(quakes$lat);range(quakes$long) [1] -38.59 -10.72 [1] 165.67 188.13 dev.copy(png,width=400,height=400,file='quakes.png') and post it to the web and KMZ file as at: http://www.maplepark.com/drf5n/extras/R_xyplot_googleEarth.kmz Thanks. Dave On Wed, 10 Jan 2007, Marc Schwartz wrote: On Wed, 2007-01-10 at 21:18 -0600, David Forrest wrote: Hi, I'd like to produce a marginless or zero margin plot so that the pixel coordinates represent the mathematics. xy-data.frame(x=c(0,1,1,0,0),y=c(0,1,0,0,1)) png('junk.png',width=300,height=300) par(mar=c(0,0,0,0)) plot(xy$x,xy$y,xlim=c(0,1),ylim=c(,1)) dev.off() The resultant file has about a 10 pixel margin around these lines, and I'm not sure what parameter or function is controlling this offset. Any hints? Thanks for your time, Dave By default, the axis ranges are extended by +/- 4%. You can change this by using: plot(xy$x, xy$y, xlim = c(0, 1), ylim = c(0, 1), xaxs = i, yaxs = i) where 'xaxs' and 'yaxs' set the axis ranges to the actual data ranges. See ?par for more information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch 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. -- Dr. David Forrest [EMAIL PROTECTED](804)684-7900w [EMAIL PROTECTED] (804)642-0662h http://maplepark.com/~drf5n/ __ R-help@stat.math.ethz.ch 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] overdispersion
I would say rather that for binary data (binomial data with n=1) it is not possible to detect overdispersion from examination of the Pearson chi-square or the deviance. Overdispersion may be, and often is, nevertheless present. I am arguing that overdispersion is properly regarded as a function of the variance-covariance structure, not as a function of the sample data. The variance of a two-point distribution is a known function of the mean, providing that independence and identity of distribution can be assumed, or providing that the correlation structure is otherwise known and the mean is constant. That proviso is crucial! If there is some sort of grouping, it may be appropriate to aggregate data over the groups, yielding data that have a binomial form with n1. Over-dispersion can now be detected from the Pearson chi-square or from the deviance. Note that the quasi models assume that the multiplier for the binomial or other variance is constant with p; that may or may not be realistic. Generalized linear mixed models make their own different assumptions about how the variance changes as a function of p; again these may or may not be realistic. It is then the error structure that is crucial. To the extent that distracts from careful thinking about that structure, the term overdispersion is unsatisfactory. There's no obvious way that I can see to supply glm() with an estimate of the dispersion that has been derived independently of the current analysis. Especially in the binary case, this would sometimes be useful. John Maindonald email: [EMAIL PROTECTED] phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Mathematics Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. On 12 Jan 2007, at 10:00 PM, [EMAIL PROTECTED] wrote: From: Peter Dalgaard [EMAIL PROTECTED] Date: 12 January 2007 5:04:26 AM To: evaiannario [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch Subject: Re: [R] overdispersion evaiannario wrote: How can I eliminate the overdispersion for binary data apart the use of the quasibinomial? There is no such thing as overdispersion for binary data. (The variance of a two-point distribution is a known function of the mean.) If what you want to do is include random effects of some sort of grouping then you might look into generalized linear mixed models via lmer() from the lme4 package or glmmPQL from MASS. __ R-help@stat.math.ethz.ch 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] Free Webinar: Vendor Neutral Intro to Data Mining for Absolute Beginners, January 26, 2007
ONLINE VENDOR NEUTRAL INTRO TO DATA MINING FOR ABSOLUTE BEGINNERS (no charge) A non-technical data mining introduction for absolute beginners January 26, 2007, 10AM - 11AM PST Future Sessions (May 23, June 14, Sept 7) To register: contact [EMAIL PROTECTED] This one-hour webinar is a perfect place to start if you are new to data mining and have little-to-no background in statistics or machine learning. In one hour, we will discuss: **Data basics: what kind of data is required for data mining and predictive analytics; In what format must the data be; what steps are necessary to prepare data appropriately **What kinds of questions can we answer with data mining **How data mining models work: the inputs, the outputs, and the nature of the predictive mechanism **Evaluation criteria: how predictive models can be assessed and their value measured **Specific background knowledge to prepare you to begin a data mining project. Please do not hesitate to contact me if you have any questions or if you wish to register. Sincerely, Lisa Solomon [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch 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 editor vs. Tinn-R
Zitat von BBands [EMAIL PROTECTED]: On 1/12/07, Martin Becker [EMAIL PROTECTED] wrote: Depending on which button you press in Tinn-R, the clipboard is used to transfer the commands to R, so sometimes you can't rely on the previous contents of the clipboard while using Tinn-R. If you use the (source)-versions of the buttons, the content of the clipboard should be preserved. Something odd is going on. I can confirm that read.delim(clipboard) works from R, but not from Tinn-R. What seems odd is that the contents of the clipboard _are_ preserved after the Tinn-R send, so that a subsequent paste or read.delim(clipboard) from R works correctly. Perhaps Tinn-R restores the contents of the clipboard after sending to R such that the R command runs before the restore takes place? Sorry, my mistake: Apparently only Send file (source) preserves the clipboard while passing the source-command to R. Regards, Martin jab -- John Bollinger, CFA, CMT www.BollingerBands.com If you advance far enough, you arrive at the beginning. __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] overdispersion
John Maindonald wrote: I would say rather that for binary data (binomial data with n=1) it is not possible to detect overdispersion from examination of the Pearson chi-square or the deviance. Overdispersion may be, and often is, nevertheless present. I am arguing that overdispersion is properly regarded as a function of the variance-covariance structure, not as a function of the sample data. The variance of a two-point distribution is a known function of the mean, providing that independence and identity of distribution can be assumed, or providing that the correlation structure is otherwise known and the mean is constant. That proviso is crucial! I don't really disagree, of course. I was mainly being provocative. However, these models play tricks on our intuition. When people speak of overdispersion, they usually imply just what you said: independent data with the correct mean, but somehow a different variance - a mathematical impossibility for binary data. One particular thing to notice is that if the individual means are heterogeneous but sampled independently from the same underlying distribution; you still end up with a marginal binomial distribution. If they are not sampled independently, then you get departures from the binomial, but it may well be in the direction of underdispersion. For an extreme case, take a sample of 50 men and 50 women and count the number of people with breasts. (If you do the same thing with a random sample of 100 _people_, you get the binomial distribution again. Unless you're counting the number of breasts...) If there is some sort of grouping, it may be appropriate to aggregate data over the groups, yielding data that have a binomial form with n1. Over-dispersion can now be detected from the Pearson chi-square or from the deviance. Note that the quasi models assume that the multiplier for the binomial or other variance is constant with p; that may or may not be realistic. Generalized linear mixed models make their own different assumptions about how the variance changes as a function of p; again these may or may not be realistic. It is then the error structure that is crucial. To the extent that distracts from careful thinking about that structure, the term overdispersion is unsatisfactory. There's no obvious way that I can see to supply glm() with an estimate of the dispersion that has been derived independently of the current analysis. Especially in the binary case, this would sometimes be useful. John Maindonald email: [EMAIL PROTECTED] phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Mathematics Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. On 12 Jan 2007, at 10:00 PM, [EMAIL PROTECTED] wrote: From: Peter Dalgaard [EMAIL PROTECTED] Date: 12 January 2007 5:04:26 AM To: evaiannario [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch Subject: Re: [R] overdispersion evaiannario wrote: How can I eliminate the overdispersion for binary data apart the use of the quasibinomial? There is no such thing as overdispersion for binary data. (The variance of a two-point distribution is a known function of the mean.) If what you want to do is include random effects of some sort of grouping then you might look into generalized linear mixed models via lmer() from the lme4 package or glmmPQL from MASS. __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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 editor vs. Tinn-R
I just do not understand this. You are going to be amazed by what I tell you. Firstly thank you for orienting me to the Tinn-R source buttons. I selected the first two lines in my script that were as follows. prelim-read.delim(clipboard) str(prelim) Then I went over to Excel and copied the cells I wanted to read Then I went to Tinn-R and clicked on send selection (source) and this is what I got in the R Console source(file('clipboard')) 'data.frame': 1 obs. of 1 variable: $ prelim..read.delim.clipboard.: Factor w/ 1 level str(prelim): 1 Warning message: incomplete final line found by readTableHeader on 'clipboard' It did not even do the second command and it turned my command from prelim- read.delim(clipboard) to source(file('clipboard')) I then repeated the whole exercise, using send selection button and got this prelim-read.delim(clipboard) Warning message: incomplete final line found by readTableHeader on 'clipboard' str(prelim) 'data.frame': 1 obs. of 1 variable: $ prelim..read.delim.clipboard.: Factor w/ 1 level str(prelim): 1 In disgust, I closed Tinn-R and opened the same script in R-editor, selected the first two lines and ran them and got the same junk prelim-read.delim(clipboard) Warning message: incomplete final line found by readTableHeader on 'clipboard' str(prelim) 'data.frame': 1 obs. of 1 variable: $ prelim..read.delim.clipboard.: Factor w/ 1 level str(prelim): 1 In desperation I resorted to typing the commands directly in the R console which worked as expected. prelim-read.delim(clipboard) str(prelim) 'data.frame': 18 obs. of 13 variables: $ tag : int 742 742 749 749 747 747 745 745 727 727 ... $ left : int 1 0 1 0 1 0 1 0 1 0 ... $ Day.1 : int 2 2 0 0 2 1 1 2 2 1 ... $ Day.2 : int 2 2 0 2 3 1 1 2 3 2 ... $ Day.3 : int 2 2 1 1 3 1 2 2 3 1 ... $ Day.4 : int 2 2 1 1 3 1 1 2 3 2 ... $ Day.5 : int 2 1 2 2 3 2 1 3 3 1 ... $ Day.6 : int 3 2 2 2 3 2 0 3 2 2 ... $ Day.7 : int 3 2 1 1 3 1 1 2 3 3 ... $ Day.8 : int 3 2 2 1 3 3 3 3 3 2 ... $ Day.9 : int 2 2 1 1 2 2 1 2 3 3 ... $ Day.10: int 2 2 2 2 3 3 1 2 3 2 ... $ dissection: Factor w/ 7 levels clear,little pus,..: 1 6 4 5 5 4 7 7 4 4 ... What gives? What on earth is going on with the clipboard that only direct manipulation from the package works. It appears to me as if what is selected in the editor is being sent to the clipboard so that it can be put into the console and that in so doing it is knocking my Excel data from the number one position in the clipboard. Is this possible? To check this I went back to the R-editor because I was sure that I had got this to work from the R-editor before. You cannot believe what I found If I ran the two lines by first selecting them and then hitting Ctrl-R I ran into the same problem. But if I simply left my cursor in the first line and hit Ctrl-R, then the first line was executed and the cursor automatically dropped to the next line in my script. I hit Ctrl-R again and then got the expected structure output. I find this amazing and difficult to believe. Any insights? On 1/12/07, Martin Becker [EMAIL PROTECTED] wrote: Zitat von Farrel Buchinsky [EMAIL PROTECTED]: The only button I pressed was the send line button in version 1.19.1.5. I changed my command to prelim-read.delim(source(clipboard)) The problem is not using the wrong R-command, but using a (Tinn-R) button that leads to a replacement of the current (windows) clipboard... and still got the same problem. I do not know how to use the source versions of the buttons. Can you please tell me more? There are three button groups on the left of the Send line button, containing two buttons each. The left button of each of these three button groups has the same name as the right button of each group, apart from having a (source) suffix. Now it should be obvious what was meant with '(source)-version of buttons'. There is no such version for the Send line button, so you have to select the corresponding line and use the Send selection (source) button, e.g. Thanks Farrel Regards, Martin Martin Becker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Farrel Buchinsky wrote: Have you used Tinn-R and what landmines await the inexperienced? Depending on which button you press in Tinn-R, the clipboard is used to transfer the commands to R, so sometimes you can't rely on the previous contents of the clipboard while using Tinn-R. If you use the (source)-versions of the buttons, the content of the clipboard should be preserved. Regards, Martin I could not understand why a script that used to work stopped working. Look at these two scenarios I opened an excel spreadsheet and copied several cells to the clipboard Then Scenario 1 Executed from Tinn-R prelim-read.delim(clipboard) str(prelim) 'data.frame': 0 obs. of 1 variable: $
Re: [R] wafer map drawing
There is some information in Programming with Data by John Chambers. He has reference to a site ( http://cm.bell-labs.com/cm/ms/departments/sia/project/icmanuf/index.html) that you might want to check out. On 1/12/07, Walker, Sam [EMAIL PROTECTED] wrote: Hello R-Users! Does anyone know of a package to draw/analyze silicon wafer maps? Here are some examples http://www.java2s.com/Code/Java/Chart/JFreeChartWaferMapChartDemo.htm http://dp.pdf.com/site/products/wafermap/binmap.html I've google'd and searched CRAN with no luck. It seems possible for R, given the hexbin and hist2d graphs I saw at the Graph gallery. Thanks, Sam [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Maximum likelihood acf
In fact, I need it in the general case, not only for an ARMA process. Unfortunately, I have no reference to give so I will code it. Sorry for the trouble. Alain Prof Brian Ripley a écrit : On Fri, 12 Jan 2007, Alain Guillet wrote: Prof. Brian Ripley, You are right, my question was not clear. In fact, I want to estimate the k first components of the acf, i.e. I want to estimate the k parameters (c(0),c(1),...c(k-1)), where c is the autocorrelation function, by a maximum likelihood estimator. And does ARMAacf applied to the result of ar.mle not do just that? An accessible reference would help us, if not. Alain Prof Brian Ripley a écrit : You will need to give us a reference, as the acf is not a parameter in a model in your description and MLEs apply to model parameters. Just possibly ar.mle is what you are looking for, perhaps plus ARMAacf? On Fri, 12 Jan 2007, Alain Guillet wrote: Hello! I am looking for a function which computes the maximum likelihood estimator of the autocorrelation function for a gaussian time series. Does a such function already exist in R? The estimator by default in R, acf(), uses the method of moments. Thanks a lot, Alain -- Alain Guillet Statistician and Computer Scientist Institut de statistique - Université catholique de Louvain Bureau d.126 Voie du Roman Pays, 20 B-1348 Louvain-la-Neuve Belgium tel: +32 10 47 30 50 __ R-help@stat.math.ethz.ch 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] quilt.plot
Dunja Drvar wrote: Dear all, I have a problem with plotting. I have an irregular set of data, where latitude is listed from bigger to smaller values. So, I cannot plot with image.plot. On the other hand, quilt.plot solves the problem, but it can't take the definition of color. It gives the feedback: Error in image.plot(out.p, col = tim.colors(64), ...) : formal argument col matched by multiple actual arguments The question is: is there a way to define the color palette in quilt.plot? Hi Dunja, I think the problem is due to the position of the ... argument. In image.plot it is first, meaning that all other arguments have to be named. Thus when you pass col= as part of ... in quilt.plot, it is placed in the initial ... in the call to image.plot, generating two col= arguments. I think the quickest hack is to insert an explicit col= argument into the code for quilt.plot and add it into the call to image.plot within the function as below. function (x, y, z, nrow = 64, ncol = 64, grid = NULL, add.legend = TRUE, col=tim.colors(64), ...) { x - as.matrix(x) if (ncol(x) == 2) { z - y } if (ncol(x) == 1) { x - cbind(x, y) } if (ncol(x) == 3) { z - x[, 3] x - x[, 1:2] } out.p - as.image(z, x = x, nrow = nrow, ncol = ncol, na.rm = TRUE) if (add.legend) { image.plot(out.p, col = col, ...) } else { image(out.p, col = col, ...) } } The modified example: quilt.plot(ozone2$lon.lat, ozone2$y[16, ], add.legend = FALSE,col=rainbow(64)) works for me. Jim __ R-help@stat.math.ethz.ch 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] R on UNIX Sun-Solaris 10.0 vs. S-Plus
This is a general question to people who've installed R on a UNIX sparc-sun-solaris platform: Have you had any issues related to maintaining R on this platform, e.g., installations that didn't work, instances of R crashing and possibly requiring a new installation, etc? I'm especially interested in anyone who has experience with both R and S-Plus on this OS. Is there any reason to prefer one over the other considering ONLY installation and updating issues? I don't have experience with R on UNIX, but I'm guessing that it's not much (if any) more difficult to maintain than S-Plus. I'd appreciate input from anyone who has experience. Thanks, Paul Louisell 650-833-6254 [EMAIL PROTECTED] Research Associate (Statistician) Modeling Data Analytics ARPC [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] What command does the cin in R ?
Hi all, Sorry about the simple question, but I have searched the web with prompt , input etc. and never got the answer . thanks a lot tong __ R-help@stat.math.ethz.ch 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] labels outliers in boxplot
you can get them from return value, try: out.id-identify(tb_ncs$Slide,tb_ncs$y) out.block-tb_ncs[out.id,]$Block On 1/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear talepande, Thanks for your suggestion, I have already tried to use it, but the identify function gave me only the observation number everytime I clicked on any point.What I want is instead of obervation numbers it would be block and/or slide numbers. Any other idea how I can make it works ? Thanks --- talepanda [EMAIL PROTECTED] skrev: because given data is a part of your data, I cannot examine, however, try: ##out.block-identify(tb_ncs$y,tb_ncs$Slide) out.block-identify(tb_ncs$Slide,tb_ncs$y) On 1/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear R-users, Following is part of my data, where slide has 36 levels and block 48 levels. I have done boxplot for each slide on the same graph. There are outliers for each slide and I tried to use indentify functtion to identify outliers in such a way that when I click on an outlier or point, the points will be labelled by either their block or ID or by both but without success. How can I make it work or are there other ways to do it than using identify function? Thanks in advance, dat1[1:10,] y Slide Block ID Control 1 0.03147823 1 1 IgG-human 5 2 -0.23815974 1 1 LPPAANDVSVLTAAR 0 3 -0.71926359 1 1 HTKHYRVVSKPAALV 0 4 -0.14607826 1 1 FVALPAATADAYATT 0 5 0.89553073 1 1 NYPAMMAHAGDMAGY 0 6 -0.67587100 1 1 RRALRQIGVLERPVG 0 7 0.32636034 1 1 DCGTIRVGSFRGRWL 0 8 -1.44057259 1 1 MAKLSTDELLDAFKE 0 9 -0.37064338 1 1 LELSDFVKKFEETFE 0 10 -0.20387233 1 1 VSRRAKVDVLIVHTT 0 tb_ncs-subset(dat1,dat1$Control==1) ### this data contains only negative controls par(las=2,mar=c(10.1,4.1,4.1,2.1)) boxplot(split(tb_ncs$y,tb_ncs$Slide),col=orange, cex=.65, outline=TRUE,main=Negative control response of each patient, cex.main=1, font.main=1, col.main=blue, names=c(1:35,B)) grid(nx=NA, ny=NULL) ### grid over boxplot legend(bottomright, B = Buffer + sec,text.col=blue) out.block- identify(tb_ncs$y,tb_ncs$Slide) _ Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda __ R-help@stat.math.ethz.ch 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. _ Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda kalender. Dessutom 250 MB gratis, virusscanning och antispam. Få den på: http://se.mail.yahoo.com __ R-help@stat.math.ethz.ch 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] What command does the cin in R ?
try: readLines(n=1)-str On 1/13/07, Tong Wang [EMAIL PROTECTED] wrote: Hi all, Sorry about the simple question, but I have searched the web with prompt , input etc. and never got the answer . thanks a lot tong __ R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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.