Re: [R] Building RGL for R-2.3 for Tiger 10.4.6 on PPC
This is rgl-0.66.2 On Apr 28, 2006, at 1:48 AM, Saptarshi Guha wrote: > Hi, > I just installed R-2.3 for Tiger 10.4.6 on a PPC. However, though i > successfully installed RGL on R.2.2, this time it doesn't compile. > I get this error when trying the R INSTALL command > > In file included from Texture.hpp:14, > from Material.hpp:5, > from BBoxDeco.hpp:16, > from BBoxDeco.cpp:1: > opengl.hpp:22:19: error: GL/gl.h: No such file or directory > opengl.hpp:23:20: error: GL/glu.h: No such file or directory > make: *** [BBoxDeco.o] Error 1 > > I'm not sure whats happening... my cocoa apps (some of which use > OpenGL) compile successfully. > > Thanks for your time. > Rgds > Saptarshi > > __ > 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 __ 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
Re: [R] Installing the Mac RGUI for OS X
Hi, I got it working(my fault - faulty install), however I get the same error as Anestis Antoniadis i.e the Quicktime errors. Rgds Saptarshi Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha No matter how much you do you never do enough. On Apr 28, 2006, at 1:53 AM, Saptarshi Guha wrote: > Hello, > Having installed R 2.3 for OS X Tiger 10.4.6(PPC), i tried running > the new R.app, but it hangs (spinning beachball). > Moreover, i can't install the RGUI from within the R-2.3 DMG, - it > tells me i must have R 10.4 installed ! (I have 10.4.6) > R 2.3 runs successfully from the command line however. > > > I tried compiling from sources, but Xcode has this error(i.e it > can't locate the R framework, though i know its been installed) > I really don't need to compile the RGUI, however as mentioned above > the RGUI contained within the R.2-3 DMG does not install > > Thanks > Saptarshi > > > >> cd /Users/yanger/Desktop/downloads/2006-04-28/Mac-GUI > /usr/bin/gcc-4.0 -o /Users/yanger/Desktop/downloads/2006-04-28/ > Mac-GUI/build/R.build/Deployment/R.build/Objects-normal/ppc/R -L/ > Users/yanger/Desktop/downloads/2006-04-28/Mac-GUI/build/Deployment -F/ > Users/yanger/Desktop/downloads/2006-04-28/Mac-GUI/build/Deployment - > filelist /Users/yanger/Desktop/downloads/2006-04-28/Mac-GUI/build/ > R.build/Deployment/R.build/Objects-normal/ppc/R.LinkFileList - > framework Cocoa -framework R -framework WebKit -framework Security - > framework ExceptionHandling -arch ppc -prebind -framework R - > isysroot /Developer/SDKs/MacOSX10.4u.sdk > /usr/bin/ld: can't locate framework for: -framework R > collect2: ld returned 1 exit status > > > [[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 __ 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
[R] Installing the Mac RGUI for OS X
Hello, Having installed R 2.3 for OS X Tiger 10.4.6(PPC), i tried running the new R.app, but it hangs (spinning beachball). Moreover, i can't install the RGUI from within the R-2.3 DMG, - it tells me i must have R 10.4 installed ! (I have 10.4.6) R 2.3 runs successfully from the command line however. I tried compiling from sources, but Xcode has this error(i.e it can't locate the R framework, though i know its been installed) I really don't need to compile the RGUI, however as mentioned above the RGUI contained within the R.2-3 DMG does not install Thanks Saptarshi > cd /Users/yanger/Desktop/downloads/2006-04-28/Mac-GUI /usr/bin/gcc-4.0 -o /Users/yanger/Desktop/downloads/2006-04-28/ Mac-GUI/build/R.build/Deployment/R.build/Objects-normal/ppc/R -L/ Users/yanger/Desktop/downloads/2006-04-28/Mac-GUI/build/Deployment -F/ Users/yanger/Desktop/downloads/2006-04-28/Mac-GUI/build/Deployment - filelist /Users/yanger/Desktop/downloads/2006-04-28/Mac-GUI/build/ R.build/Deployment/R.build/Objects-normal/ppc/R.LinkFileList - framework Cocoa -framework R -framework WebKit -framework Security - framework ExceptionHandling -arch ppc -prebind -framework R - isysroot /Developer/SDKs/MacOSX10.4u.sdk /usr/bin/ld: can't locate framework for: -framework R collect2: ld returned 1 exit status [[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
[R] R 2.3.0 OSX and Quicktime?
I just downloaded the 2.3.0 OS X Universal binary. When I launch it via the GU,I it opens the console window and while R is loading I get the following loading error message on the console repeated about 28 times: 2006-04-28 07:36:57.350 R[752] CFLog (21): Error loading /Library/ QuickTime/DivX 6 Decoder.component/Contents/MacOS/DivX 6 Decoder: error code 4, error number 0 (Symbol not found: ___eprintf Referenced from: /System/Library/Frameworks/QuickTime.framework/ Versions/A/QuickTime Expected in: /Library/Frameworks/R.framework/Resources/lib/libstdc+ +.6.dylib ) I have downloaded the last DivX 6 decoder for the mac but no difference. Any hints please? Best Anestis Prof. Anestis ANTONIADIS Laboratoire de Modelisation et Calcul(LMC-IMAG) Universite Joseph Fourier Tour IRMA B.P.53 38041 Grenoble CEDEX 9 FRANCE Tel:(33) (0) 476514306 Fax:(33) (0) 476631263 === [[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
[R] Building RGL for R-2.3 for Tiger 10.4.6 on PPC
Hi, I just installed R-2.3 for Tiger 10.4.6 on a PPC. However, though i successfully installed RGL on R.2.2, this time it doesn't compile. I get this error when trying the R INSTALL command In file included from Texture.hpp:14, from Material.hpp:5, from BBoxDeco.hpp:16, from BBoxDeco.cpp:1: opengl.hpp:22:19: error: GL/gl.h: No such file or directory opengl.hpp:23:20: error: GL/glu.h: No such file or directory make: *** [BBoxDeco.o] Error 1 I'm not sure whats happening... my cocoa apps (some of which use OpenGL) compile successfully. Thanks for your time. Rgds Saptarshi __ 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
Re: [R] R for Mac OS X: 10.3.9 is obsolete?
Dear all, >for now there is a binary and some packages - check out http:// >R.research.att.com/ (near the bottom of the page). Thank you so much! >Please use only if >you really have no way to upgrade to Tiger. At the moment, this is my case. > get a Tiger instead ;). I have something to say here, but... Thank you for the Panther binaries again! With best wishes, Alexey Shipunov __ 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
[R] Off topic: Job on R programing
R Users E-mail: r-help@stat.math.ethz.ch We look for a researcher (Ph.D. is requisite) who has a strong will to work with us in Tsukuba, Japan. The researcher must be quite familiar with R programing and regression techniques including nonparametric regression and neural networks. The period of employment is several months. If you get interested in this job, please refer to (69) at http://cse.naro.affrc.go.jp/takezawa/intro-1.html. E-mail: [EMAIL PROTECTED] * http://cse.naro.affrc.go.jp/takezawa/intro.html * __ 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
Re: [R] displaying numbers not in scientific notation
> 4.485107e-10 [1] 4.485107e-10 > options(scipen=100) > 4.485107e-10 [1] 0.04485107 ?options and search for scipen Gabor On Thu, Apr 27, 2006 at 11:24:49PM -0400, Brian Quinif wrote: > Sorry for asking such a simple question, but I couldn't find the > answer through a search... > > How can I get R to show me the values of estimates *not* in scientific > notation? > > When I use summary() after using lm() I am getting numbers like > 4.485107e-01, when what I want to see is 0.4485 > > Thanks, > > Brian > > __ > 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 -- Csardi Gabor <[EMAIL PROTECTED]>MTA RMKI, ELTE TTK __ 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
[R] displaying numbers not in scientific notation
Sorry for asking such a simple question, but I couldn't find the answer through a search... How can I get R to show me the values of estimates *not* in scientific notation? When I use summary() after using lm() I am getting numbers like 4.485107e-01, when what I want to see is 0.4485 Thanks, Brian __ 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
Re: [R] Problem calling xyplot() within a function
Steve Candy wrote: > Hi All > > I'm fairly new at R so there might be on obvious solution to my problem > with calling the lattice function xyplot( ) from my own function. > > The function script is given below. > > The problem is that the xyplot() call does not do anything! I just get a > blank graphics window and no error messages. > > The simple plot() function call works fine when not commented out so I > know the data is getting in OK and when I run the the same xyplot() > function call outside this function substituting the actual data frame > then xyplot( ) works fine. Comparing the data summary both inside and > outside the function showed that the data is identical. I put the > "require('lattice')" statement in because I thought it might help but it > did'nt. > > Any help as to why xyplot() is behaving differently to plot() and what I > need to do to get the function working would be much appreciated. > This is FAQ 7.22. http://cran.r-project.org/doc/FAQ/R-FAQ.html 7.22 Why do lattice/trellis graphics not work? The most likely reason is that you forgot to tell R to display the graph. Lattice functions such as xyplot() create a graph object, but do not display it (the same is true of Trellis graphics in S-Plus). The print() method for the graph object produces the actual display. When you use these functions interactively at the command line, the result is automatically printed, but in source() or inside your own functions you will need an explicit print() statement. --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
Re: [R] R 2.3.0 OS X Binary
Hi Joran Do you possibly have a saved workspace created after loading tcltk? Rob On Apr 27, 2006, at 11:15 AM, Joran Elias wrote: > I downloaded the 2.3.0 OS X Universal binary off of the Berkeley > mirror (found it on the R for Mac OS X link at the bottom of the > page). Installation went fine, but when I launch via the GUI it > opens the console window and then (after several seconds) quits with > no error message. > > I'm sorry I'm not very proficient with the Terminal, so I don't know > if I can use R 2.3.0 with that, or if it's only the GUI startup > that's causing the problem. > > I'm using a G4 Powerbook (PowerPC) laptop with OS X 10.4.6. A > universal binary ought to work, right? Or is there something else > going on? > > Just thought I'd let people know... > > > Joran > > __ > 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 __ 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
Re: [R] R for Mac OS X: 10.3.9 is obsolete?
Peter pretty much summed it up. Just two notes. On Apr 27, 2006, at 4:20 AM, Peter Dalgaard wrote: > "iit512" <[EMAIL PROTECTED]> writes: > >> Dear all, >> >> I am highly disappointed of the following decision: >> >> === ... Starting with R 2.3.0, CRAN binaries support Mac OS X 10.4 >> (Tiger) and higher only. === >> Not that we have a choice - Intel Macs are supported only with 10.4 and we don't have the resources to maintain two systems in parallel (and a set of compilers and libraries and packages and ...). >> [...] >> So, the question is, is there any volunteers who could produce R >> binaries for Mac OS X 10.3.9? Since it will be "unofficial", I >> will provide the Web space. > > I don't think alternative web space is necessary. There's no rule > that CRAN binaries have to be made by the core team, and some of > the Linux versions aren't. The real problem is whether anyone wants > to lock their precious Macs to an obsolete version of the OS... > For the time being I still have access to the old machine that I was using for 10.3 ppc builds. I can't promise that it will stay on 10.3 for long (it's a server that is used for other purposes, too), but for now there is a binary and some packages - check out http:// R.research.att.com/ (near the bottom of the page). Please use only if you really have no way to upgrade to Tiger. If anything breaks, it breaks - this is strictly unofficial and without any support. Remember - you can NOT use CRAN binaries on 10.3, so don't even try to install binary packages from CRAN for this one. And, please, don't fill any bug reports, either - get a Tiger instead ;). Cheers, Simon __ 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
Re: [R] stepwise regression
在 06-4-28,Jinsong Zhao<[EMAIL PROTECTED]> 写道: Dear all, I have encountered a problem when perform stepwise regression. The dataset have more 9 independent variables, but 7 observation. ~I think this is the problem. In R, before performing stepwise, a lm object should be given. fm <- lm(y ~ X1 + X2 + X3 + X11 + X22 + X33 + X12 + X13 + X23) However, summary(fm) will give: Residual standard error: NaN on 0 degrees of freedom Multiple R-Squared: 1, Adjusted R-squared: NaN F-statistic: NaN on 6 and 0 DF, p-value: NA In this situation, step() or stepAIC() will not give any useful information. I don't know why SAS could deal with this situation: PROC REG; MODEL y=X1 X2 X3 X11 X22 X33 X12 X13 X23/SELECTION=STEPWISE; RUN; Any help will be really appreciated. Wishes, Jinsong Zhao __ 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 -- 黄荣贵 Deparment of Sociology Fudan University __ 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
[R] stepwise regression
Dear all, I have encountered a problem when perform stepwise regression. The dataset have more 9 independent variables, but 7 observation. In R, before performing stepwise, a lm object should be given. fm <- lm(y ~ X1 + X2 + X3 + X11 + X22 + X33 + X12 + X13 + X23) However, summary(fm) will give: Residual standard error: NaN on 0 degrees of freedom Multiple R-Squared: 1, Adjusted R-squared: NaN F-statistic: NaN on 6 and 0 DF, p-value: NA In this situation, step() or stepAIC() will not give any useful information. I don't know why SAS could deal with this situation: PROC REG; MODEL y=X1 X2 X3 X11 X22 X33 X12 X13 X23/SELECTION=STEPWISE; RUN; Any help will be really appreciated. Wishes, Jinsong Zhao __ 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
Re: [R] function for linear regression with White std. errors
John, Thanks for the suggestion, but tomorrow I am teaching a little seminar for my department trying to convince people about how wonderful R is. These people are all Stata users, and they really like the idea that they only have to type ", robust" to get het. consistent std. errors. My pitch to a lot of them has been that R is a great and flexible tool which one doesn't have to be a programming whiz to use. If they have to start writing functions to do something as basic as this, then my colleagues will probably stay in Stata-land. I'm trying to prevent that! Regards, Brian 2006/4/27, John Fox <[EMAIL PROTECTED]>: > Dear Brian, > > How about sqrt(diag(hccm(mod)))? If that's too onerous, then you could > define a function to do it, e.g., > > wse <- function(mod) sqrt(diag(hccm(mod))) > > and then enter wse(mod). If you want a more complete, table-like summary of > the model using White standard errors, then you could easily write a > function to provide that. > > Regards, > John > > > John Fox > Department of Sociology > McMaster University > Hamilton, Ontario > Canada L8S 4M4 > 905-525-9140x23604 > http://socserv.mcmaster.ca/jfox > > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Brian Quinif > > Sent: Thursday, April 27, 2006 7:34 PM > > To: r-help@stat.math.ethz.ch > > Subject: [R] function for linear regression with White std. errors > > > > I would like to know if there is a function that will run a > > linear regression and report the White (heteroscedasticity > > consistent) std. > > errors. > > > > I've found the hccm() function in the car library, but that > > just gives me the White covariance matrix. I'd like to be > > able to see the White std. errors without having to do much > > more work, if possible. > > > > Thanks, > > > > Brian > > > > __ > > 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 > > __ 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
Re: [R] function for linear regression with White std. errors
Dear Brian, How about sqrt(diag(hccm(mod)))? If that's too onerous, then you could define a function to do it, e.g., wse <- function(mod) sqrt(diag(hccm(mod))) and then enter wse(mod). If you want a more complete, table-like summary of the model using White standard errors, then you could easily write a function to provide that. Regards, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Brian Quinif > Sent: Thursday, April 27, 2006 7:34 PM > To: r-help@stat.math.ethz.ch > Subject: [R] function for linear regression with White std. errors > > I would like to know if there is a function that will run a > linear regression and report the White (heteroscedasticity > consistent) std. > errors. > > I've found the hccm() function in the car library, but that > just gives me the White covariance matrix. I'd like to be > able to see the White std. errors without having to do much > more work, if possible. > > Thanks, > > Brian > > __ > 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 __ 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
Re: [R] scope of variable/object ?
You probably need to contact the developer of pamr but short of investigating it, a workaround might be to put a copy of myd2 into the global environment since it likely will at least look there, e.g. add this line to: assign("myd2", myd2, .GlobalEnv) domat. On 4/27/06, Tim Smith <[EMAIL PROTECTED]> wrote: > Hi, > > I must be missing something here...Essentially, a short piece of code works > if it's standalone, but doesn't work if it's divided into two functions. > > The code that works is: > > ### WORKS ### > > library(pamr) > > set.seed(120) > x <- matrix(rnorm(1000*20),ncol=20) > y <- sample(c(1:4),size=20,replace=TRUE) > mydata <- list(x=x,y=y) > mytrain <- pamr.train(mydata) > new.scales <- pamr.adaptthresh(mytrain,ntries = 1) > > > > But if I split the lines into two functions, then I get an error message > that reads : > 'Error in pamr.train(data = myd2, threshold = threshold, threshold.scale = > all.scales[i+ : object "myd2" not found.' > > The code that doesn't work is: > > > ### DOESN'T WORK > library(pamr) > > domat <- function(myd){ > myd2 <- myd >mytrain <- pamr.train(myd2) >new.scales <- pamr.adaptthresh(mytrain) > } > dom <- function(){ > set.seed(120) > x <- matrix(rnorm(1000*20),ncol=20) > y <- sample(c(1:4),size=20,replace=TRUE) > myda <- list(x=x,y=y) > domat(myda) > } > dom() > > # > > Did I do something really goofy? How can I find out what's happening? > > many thanks. > > > > > - > >[[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 > __ 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
Re: [R] deleting rows with the same ID if any meet a condition
[gblevins] >If x2 equal 2 then I want to delete all the rows for that person from >the dataframe--see Before and After below. >Before >x1 <- c(1,1,1,2,2,3,3,3) >x2 <- c(2,3,3,1,1,4,4,2) >x3 <- data.frame(x1,x2) >> x3 > x1 x2 >1 1 2 >2 1 3 >3 1 3 >4 2 1 >5 2 1 >6 3 4 >7 3 4 >8 3 2 >After > x1 x2 >1 2 1 >2 2 1 You might try: subset(x3, !x1 %in% x1[which(x2==2)]) -- François Pinard http://pinard.progiciels-bpi.ca __ 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
[R] function for linear regression with White std. errors
I would like to know if there is a function that will run a linear regression and report the White (heteroscedasticity consistent) std. errors. I've found the hccm() function in the car library, but that just gives me the White covariance matrix. I'd like to be able to see the White std. errors without having to do much more work, if possible. Thanks, Brian __ 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
[R] Problem calling xyplot() within a function
Hi All I'm fairly new at R so there might be on obvious solution to my problem with calling the lattice function xyplot( ) from my own function. The function script is given below. The problem is that the xyplot() call does not do anything! I just get a blank graphics window and no error messages. The simple plot() function call works fine when not commented out so I know the data is getting in OK and when I run the the same xyplot() function call outside this function substituting the actual data frame then xyplot( ) works fine. Comparing the data summary both inside and outside the function showed that the data is identical. I put the "require('lattice')" statement in because I thought it might help but it did'nt. Any help as to why xyplot() is behaving differently to plot() and what I need to do to get the function working would be much appreciated. thanks Steve --- Steven G Candy Applied Statistician Australian Antarctic Division 203 Channel Highway, KINGSTON Tasmania 7050 ph +61 3 6232 3135 "plot.fits.casal.trellis"<- function(data.df,xlim,ylim,XLAB,ylab) { require('lattice') frame( ) print(summary(data.df)) #plot(y=data.df$Mobs[data.df$year.f=="2004"], x=data.df$Mage.r[data.df$year.f=="2004"], # xlab = XLAB, ylab = ylab, ylim=ylim, xlim=xlim, type='p') xyplot(data.df$Mobs+data.df$Mfit ~ data.df$Mage.r | data.df$year.f, type=c("p","l"),pch=c("o","e"),cex=1.3, xlab = XLAB, ylab = ylab, ylim=ylim, xlim=xlim) } ___ Australian Antarctic Division - Commonwealth of Australia IMPORTANT: This transmission is intended for the addressee only. If you are not the intended recipient, you are notified that use or dissemination of this communication is strictly prohibited by Commonwealth law. If you have received this transmission in error, please notify the sender immediately by e-mail or by telephoning +61 3 6232 3209 and DELETE the message. Visit our web site at http://www.aad.gov.au/ ___ [[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
Re: [R] replacing a factor value in a data frame
Dave Roberts montana.edu> writes: > > Federico, > > There doesn't appear to be an instance of the value you want to > change in your example, so I had to improvise. Part of the problem may > be that the dataframe is composed of factors, and it's not possible to > convert the value of a factor to another value that's in the set of > possible values, given by the levels() function. So, if you want to > change GC to CG, but CG does not already exist in the set of possible > values you'll have to add it. E.g. > > > tmp <- data > > levels(tmp[,30]) <- c(levels(data[,30]),'CG') > > then, if the problem only occurs in one column it's an easy fix. > > > tmp[data=='GC'] <- 'CG' > > If GC occurs in multiple columns you'll either have to change the levels > for each column as I did just above, or work with a single column. > Since you don't have 30 columns in your example, let's pretend you want > to change all the instances of 'CC' in data$V5 to 'XX' > > > tmp <- data > > levels(tmp$V5) <- c(levels(data$V5),'XX') > > tmp$V5[data$V5=='CC'] <- 'XX' > > tmp > V4 V5 V6 V7 V8 V9 V10 > 1 TT GG TT AC AG AG TT > 2 AT XX TT AA AA AA TT > 3 AT XX TT AC AA TT > 4 TT XX TT AA AA AA TT > 5 AT CG TT CC AA AA TT > 6 TT XX TT AA AA AA TT > 7 AT XX TT CCTT > 8 TT XX TT AC AG AG TT > 9 AT XX TT CC AG TT > 10 TT XX TT CC GG GG TT > > Notice that the instances of 'CC' in tmp$V7 did not change. > > HTH, Dave Roberts > > OK So I have a complexity to add. I have a dataframe with about 6008 variables. 6000 of them are loci accross the genome. Inadvertently, we coded SNP data that did not satisfy quality control as "*". Somewhere along the line the genotypes of these snps became "0/0". The tdt test in dgc.genetics does not seem fond of this designation and would probably do better with it being NA. So how does one recode every instance of "0/0" to missing accross all 6000 variables? I believe that R has interpreted the genotype variables as character and therefore turned every one into a factor with levels. One simplification (if one could call it that), would be to revert to my long dataframe where all the genotypes are in one variable and change it there before reshaping to wide. Do not really want to do that since reshaping that very big dataframe takes a very long time (more than 35 minutes, and less than overnight). __ 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
Re: [R] as.numeric question
On 4/27/2006 5:24 PM, Paulo Brando wrote: > Dear all, > > Is there a way of keeping the actual information in a factor when > converting it to numeric? > > Example: > > What I want: > > as.numeric(factor(5:10)) > 5, 6, 7, 8, 9, 10 > > > How R works: > >>as.numeric(factor(5:10)) #R example on 'as.numeric' > [1] 1 2 3 4 5 6 > > Thank you very much. Convert to character first: > as.numeric(as.character(factor(5:10))) [1] 5 6 7 8 9 10 __ 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
[R] deleting rows with the same ID if any meet a condition
Hello R masters, This request is being made after searching through archive mailing list. I have a "many" table in a medical application where each injury a person suffers is recorded as a separate row. In my toy example below it means respondent #1 had three injuries and so on. If x2 equal 2 then I want to delete all the rows for that person from the dataframe--see Before and After below. I have thought about using match to first identify the IDs that have a 2 in x2 and then in a second step delete all rows that have matching IDs with this subset, but I have not been able to get it to work. Any help would be much appreciated. Before x1 <- c(1,1,1,2,2,3,3,3) x2 <- c(2,3,3,1,1,4,4,2) x3 <- data.frame(x1,x2) > x3 x1 x2 1 1 2 2 1 3 3 1 3 4 2 1 5 2 1 6 3 4 7 3 4 8 3 2 After x1 x2 1 2 1 2 2 1 R 2.3.0 Windows XP Thanks! Greg Blevins The Market Solutions Group [[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
Re: [R] Find a word
grep("Ball",words.array) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexandra R. M. de Almeida Sent: Thursday, April 27, 2006 4:27 PM To: R-Group Subject: [R] Find a word Dear R users, I have the following problem: I have an array with pasted words and I woul like to know the position of the vector that have another especific word. Let make an example: This tis the array: words.array<-c("RedBall","PinkBall","YellowTable","BlueBall") And I would like to know the positions its (words.array) that have the word "Ball". Someone knows how I cand do this!? Thanks Alexandra Almeida Alexandra R. Mendes de Almeida - Imposto de Renda 2006: o prazo esta acabando. Faga ja a sua declaragco no site da Receita Federal. [[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
Re: [R] Error: C stack usage is too close to the limit
On 04/27/06 22:06, Prof Brian Ripley wrote: > On Thu, 27 Apr 2006, Jonathan Baron wrote: > > > I get this error on one computer running Fedora Core 5 but not on > > another one, when I start R from Xemacs using ESS. After I get > > the error with Xemacs, I get it even without using Xemacs. I > > haven't tried all possibilities, because I have found discussion > > of this problem on the R-devel mailing list, so clearly some > > people understand it. (Not me.) I'm posting here in case > > someone has a suggestion about what to do about it, for users, as > > opposed to developers. Apparently R-2.3-patched did not fix it, > > but probably that will change at some point. > > The discussion there was about embedded uses of R: that is presumably not > what you are doing. I also thought that one of the things in that thread, from Rossini, specifically referred to ESS. Jon __ 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
[R] scope of variable/object ?
Hi, I must be missing something here...Essentially, a short piece of code works if it's standalone, but doesn't work if it's divided into two functions. The code that works is: ### WORKS ### library(pamr) set.seed(120) x <- matrix(rnorm(1000*20),ncol=20) y <- sample(c(1:4),size=20,replace=TRUE) mydata <- list(x=x,y=y) mytrain <- pamr.train(mydata) new.scales <- pamr.adaptthresh(mytrain,ntries = 1) But if I split the lines into two functions, then I get an error message that reads : 'Error in pamr.train(data = myd2, threshold = threshold, threshold.scale = all.scales[i+ : object "myd2" not found.' The code that doesn't work is: ### DOESN'T WORK library(pamr) domat <- function(myd){ myd2 <- myd mytrain <- pamr.train(myd2) new.scales <- pamr.adaptthresh(mytrain) } dom <- function(){ set.seed(120) x <- matrix(rnorm(1000*20),ncol=20) y <- sample(c(1:4),size=20,replace=TRUE) myda <- list(x=x,y=y) domat(myda) } dom() # Did I do something really goofy? How can I find out what's happening? many thanks. - [[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
Re: [R] add city and point in the map
> From: YIHSU CHEN <[EMAIL PROTECTED]> > Date: Thu, 27 Apr 2006 10:50:49 -0400 > > I'm trying to use packages "maps" and "mapdata" (see blow) to display > the research resutls on map (Mid-Atlantic region). In particular, I > need to mark a number of points in the map by giving their latitude and > longitude information. For instance, I would like to mark a point on > (long, lat) =(75.56027, 39.09271). Also, I need to mark several cities > that I suspect might not in the "world.cities" database such as > Baltimore, etc. Presumably, I can do the same thing by finding out the > lat and long infor of Baltimroe and add text next to the point I mark. > > Thanks a billion > > Yihsu > > > library(maps) > library(mapdata) > state.list <- c("maryland","new jersey","west virginia", > "virginia","ohio","delaware","pennsylvania","kentucky","indiana","north > carlina") > map("state",state.list) > map.cities(x=world.cities, Country="US",minpop=10) > Several things: 1) the US is west of longitude 0, so you need longitude -75.56027 2) map.cities uses x=world.cities by default, so you don't need to specify it in your call, but if you do specify it, you need to precede it with a call to: data(world.cities) [I guess this is a bug, perhaps just at the documentation level] 3) map.cities takes country= as an argument, not Country= 4) The US is identified in the maps package as USA, so you would use country="USA" (but you don't need country= anyway, beacause your map is only of the USA, so there are no cities to exclude). 5) Baltimore is in world.cities, try map.cities(minpop=50, label=T) 6) If you really want North Carolina, you need to spell it correctly So what you need is: library(maps) # library(mapdata) # not needed for this state.list <- c("maryland", "new jersey", "west virginia", "virginia", "ohio", "delaware", "pennsylvania", "kentucky", "indiana", "north carolina") map("state", state.list) map.cities(minpop=10) Hope this helps, Ray Brownrigg __ 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
[R] Find a word
Dear R users, I have the following problem: I have an array with pasted words and I woul like to know the position of the vector that have another especific word. Let make an example: This tis the array: words.array<-c("RedBall","PinkBall","YellowTable","BlueBall") And I would like to know the positions its (words.array) that have the word "Ball". Someone knows how I cand do this!? Thanks Alexandra Almeida Alexandra R. Mendes de Almeida - Imposto de Renda 2006: o prazo está acabando. Faça já a sua declaração no site da Receita Federal. [[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
Re: [R] Incomplete Trio in TDT analysis
Steve Buyske stat.rutgers.edu> writes: > >I don't know of any of these methods that are > implemented in R. Perhaps they are in the package that you are using > but forgot to name. Sorry about that. Forgot to add that I was using dgc.genetics which is a modification on Warnes' Genetics package. __ 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
[R] as.numeric question
Dear all, Is there a way of keeping the actual information in a factor when converting it to numeric? Example: What I want: as.numeric(factor(5:10)) 5, 6, 7, 8, 9, 10 How R works: >as.numeric(factor(5:10)) #R example on 'as.numeric' [1] 1 2 3 4 5 6 Thank you very much. Paulo Paulo M. Brando Instituto de Pesquisa Ambiental da Amazonia (IPAM) Santarem, PA, Brasil. Av. Rui Barbosa, 136. Fone: + 55 93 3522 55 38 www.ipam.org.br E-mail: [EMAIL PROTECTED] [[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
Re: [R] plot cdf
[Romain Francois] >[...] it would be useful to add an option 'ask' in 'example', maybe >with a default to TRUE in interactive mode Seconded. `example(...)' would be more friendly for the average use. -- François Pinard http://pinard.progiciels-bpi.ca __ 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
[R] R interface to ImageMagick
Hi, I was wondering if anyone is aware of an R interface to ImageMagick (www.imagemagick.org)? Since R does not support a lot of image processing functions, having such an interface could be very useful. Alternatively, ImageMagick has a couple of different interfaces (including to C and C++). I was wondering if one can use these to call ImageMagick functions from R. I am posting a similar question on the imagemagick mailing lists too. Thanks for the help, Firas. __ 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
Re: [R] Error: C stack usage is too close to the limit
On Thu, 27 Apr 2006, Jonathan Baron wrote: > I get this error on one computer running Fedora Core 5 but not on > another one, when I start R from Xemacs using ESS. After I get > the error with Xemacs, I get it even without using Xemacs. I > haven't tried all possibilities, because I have found discussion > of this problem on the R-devel mailing list, so clearly some > people understand it. (Not me.) I'm posting here in case > someone has a suggestion about what to do about it, for users, as > opposed to developers. Apparently R-2.3-patched did not fix it, > but probably that will change at some point. The discussion there was about embedded uses of R: that is presumably not what you are doing. Is your shell stack limit set the same, and high enough? -- 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
Re: [R] Symbol __f95_sign not found.
Have you reconfigured and recompiled R? If your conpilers have been updated, you may well need to do so. On Thu, 27 Apr 2006, Rolf Turner wrote: > Our computing services people have recently reconfigured the Sun > compilers structure on our network, and I can no longer install, on > our Sun/Solaris machine, a certain package (spatstat) with which I am > heavily involved. (The same problem may well pertain to other > packages as well; I haven't yet experimented except with spatstat.) > > Strictly speaking I can ***install*** it, but when I try > to ***load*** it I get an error message: > > ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== > > library(spatstat) > Error in dyn.load(x, as.logical(local), as.logical(now)) : >unable to load shared library > '/home/faculty/rolf/Rlib/spatstat/libs/spatstat.so': > ld.so.1: R: fatal: relocation error: file > /home/faculty/rolf/Rlib/spatstat/libs/spatstat.so: symbol __f95_sign: > referenced symbol not found > Error in library(spatstat) : .First.lib failed for 'spatstat' > ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== > > so something is going wrong with the install. > > I did nm on spatstat.so, and sure enough got > > ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== > $ nm spatstat.so | grep f95 > [189] |185004| 4|OBJT |LOCL |0|20 |__f95__happiness >. >. >. > [195] |185008| 4|OBJT |LOCL |0|20 |__f95__happiness > [512] | 0| 0|FUNC |GLOB |0|UNDEF |__f95_sign > ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== > > so, yep, it's undefined. But what do I do about it? > > The ``R CMD INSTALL spatstat'' runs without complaint. > > Where is ``__f95_sign'' coming from? How do I rearrange things so > that this symbol *can* be found? Could someone please gently > point me in the right direction? I haven't a clue where to start. :-( > > Thanks for any hints. > > cheers, > > Rolf Turner > [EMAIL PROTECTED] > > P. S. Version info: > > > version > _ > platform sparc-sun-solaris2.9 > arch sparc > os solaris2.9 > system sparc, solaris2.9 > status > major2 > minor2.0 > year 2005 > month10 > day 06 > svn rev 35749 > language R > > P^2. S. What's with this ``__f95__happiness'' jazz??? > > __ > 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 > -- 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
Re: [R] plot cdf
Le 27.04.2006 18:06, Martin Maechler a écrit : >> "ronggui" == ronggui <[EMAIL PROTECTED]> >> on Thu, 27 Apr 2006 19:27:04 +0800 writes: >> > > ronggui> I think curve is one option. for example , I can > ronggui> use "curve(pnorm,-5,5)" to plot the normal cdf. > > ronggui> use ?curve to get the usage. > > Or Luck might mean the *empirical* cdf, and then > plot(ecdf(..)) > solves it; type > example(ecdf) > to see a few examples -- maybe after first saying >par(ask = TRUE) > > Martin Maechler, ETH Zurich > About that, i think it would be useful to add an option 'ask' in 'example', maybe with a default to TRUE in interactive mode Romain -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php +---+ | Romain FRANCOIS - http://francoisromain.free.fr | | Doctorant INRIA Futurs / EDF | +---+ __ 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
[R] Error: C stack usage is too close to the limit
I get this error on one computer running Fedora Core 5 but not on another one, when I start R from Xemacs using ESS. After I get the error with Xemacs, I get it even without using Xemacs. I haven't tried all possibilities, because I have found discussion of this problem on the R-devel mailing list, so clearly some people understand it. (Not me.) I'm posting here in case someone has a suggestion about what to do about it, for users, as opposed to developers. Apparently R-2.3-patched did not fix it, but probably that will change at some point. Jon -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron __ 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
[R] Symbol __f95_sign not found.
Our computing services people have recently reconfigured the Sun compilers structure on our network, and I can no longer install, on our Sun/Solaris machine, a certain package (spatstat) with which I am heavily involved. (The same problem may well pertain to other packages as well; I haven't yet experimented except with spatstat.) Strictly speaking I can ***install*** it, but when I try to ***load*** it I get an error message: ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== > library(spatstat) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/home/faculty/rolf/Rlib/spatstat/libs/spatstat.so': ld.so.1: R: fatal: relocation error: file /home/faculty/rolf/Rlib/spatstat/libs/spatstat.so: symbol __f95_sign: referenced symbol not found Error in library(spatstat) : .First.lib failed for 'spatstat' ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== so something is going wrong with the install. I did nm on spatstat.so, and sure enough got ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== $ nm spatstat.so | grep f95 [189] |185004| 4|OBJT |LOCL |0|20 |__f95__happiness . . . [195] |185008| 4|OBJT |LOCL |0|20 |__f95__happiness [512] | 0| 0|FUNC |GLOB |0|UNDEF |__f95_sign ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== so, yep, it's undefined. But what do I do about it? The ``R CMD INSTALL spatstat'' runs without complaint. Where is ``__f95_sign'' coming from? How do I rearrange things so that this symbol *can* be found? Could someone please gently point me in the right direction? I haven't a clue where to start. :-( Thanks for any hints. cheers, Rolf Turner [EMAIL PROTECTED] P. S. Version info: > version _ platform sparc-sun-solaris2.9 arch sparc os solaris2.9 system sparc, solaris2.9 status major2 minor2.0 year 2005 month10 day 06 svn rev 35749 language R P^2. S. What's with this ``__f95__happiness'' jazz??? __ 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
Re: [R] relative frequency plot
Martin - Of course you are right. The documentation for truehist (and hist) explains that fact nicely, which is why I thought to send him there. Sorry for any confusion. Thanks, Erik Martin Maechler wrote: >>"Erik" == Erik Iverson <[EMAIL PROTECTED]> >>on Thu, 27 Apr 2006 13:44:16 -0500 writes: > > > Erik> See ?truehist in the MASS package. > > Not in this case! > truehist() also computes a density, > and its values on the "y axis" are not probabilities, either! > hist(*, freq = FALSE) > is fully sufficient here -- the problem of the original poster > was to understand that a density can have values larger than 1. > It may be interesting and is somewhat disappointing for us > "teachers of statistics" to see how many people have posted in > the past on this exact topic, sometimes even more or less > assuming that R was doing some things wrongly because it showed > densities (or density estimates as here) with values larger than > one... oh dear > "Mit der Dummheit kaempfen Goetter selbst vergebens." > - Friedrich Schiller, "Die Jungfrau von Orleans" > > Martin > > >> Philipp Pagel wrote: > >> On Thu, Apr 27, 2006 at 10:48:39AM -0700, [EMAIL PROTECTED] > >> wrote: > >> > >>> Hi All, > >>> > >>> I want to use "hist" to get the relative frequency > >>> plot. But the range of ylab is greater than 1,which I > >>> think it should be less than 1 since it stands for the > >>> probability. > >>> > >>> I'm confused. Could you please help me with it? > >> > >> > >> I was pretty confused by that, too at first. The solution > >> is that freq=False cause hist to plot the DENSITY rather > >> than frequency. And density is not necesssarily the same > >> as relative frequency. Excerpt from ?hist: > >> > >> density: values f^(x[i]), as estimated density values. If > >> 'all(diff(breaks) == 1)', they are the relative > >> frequencies 'counts/n' and in general satisfy sum[i; > >> f^(x[i]) (b[i+1]-b[i])] = 1, where b[i] = 'breaks[i]'. > >> > >> If you want relative distance try something like this: > >> > >> myhist = hist(x,breaks=52, plot=F) myhist$counts = > >> myhist$counts / sum(myhist$counts) > >> plot(myhist,main=NULL,border=TRUE,xlab="days",xlim=c(0,6),lty=2) > >> > >> Not exactly clean, though -- we are messing with the > >> myhist object... > >> > >> > >> cu Philipp > >> > > Erik> __ > Erik> R-help@stat.math.ethz.ch mailing list > Erik> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do > Erik> read the posting guide! > Erik> http://www.R-project.org/posting-guide.html __ 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
[R] document setReplaceMethod
Hi, How do I document setReplaceMethod, such as this, setGeneric("x<-", function(.Object, value) standardGeneric("myMethod<-")) setReplaceMethod("x", "myClass", function(.Object, value) { [EMAIL PROTECTED] <- value .Object } ) in the NAMESPACE file? Thanks, Jennifer __ 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
Re: [R] relative frequency plot
> "Erik" == Erik Iverson <[EMAIL PROTECTED]> > on Thu, 27 Apr 2006 13:44:16 -0500 writes: Erik> See ?truehist in the MASS package. Not in this case! truehist() also computes a density, and its values on the "y axis" are not probabilities, either! hist(*, freq = FALSE) is fully sufficient here -- the problem of the original poster was to understand that a density can have values larger than 1. It may be interesting and is somewhat disappointing for us "teachers of statistics" to see how many people have posted in the past on this exact topic, sometimes even more or less assuming that R was doing some things wrongly because it showed densities (or density estimates as here) with values larger than one... oh dear "Mit der Dummheit kaempfen Goetter selbst vergebens." - Friedrich Schiller, "Die Jungfrau von Orleans" Martin >> Philipp Pagel wrote: >> On Thu, Apr 27, 2006 at 10:48:39AM -0700, [EMAIL PROTECTED] >> wrote: >> >>> Hi All, >>> >>> I want to use "hist" to get the relative frequency >>> plot. But the range of ylab is greater than 1,which I >>> think it should be less than 1 since it stands for the >>> probability. >>> >>> I'm confused. Could you please help me with it? >> >> >> I was pretty confused by that, too at first. The solution >> is that freq=False cause hist to plot the DENSITY rather >> than frequency. And density is not necesssarily the same >> as relative frequency. Excerpt from ?hist: >> >> density: values f^(x[i]), as estimated density values. If >> 'all(diff(breaks) == 1)', they are the relative >> frequencies 'counts/n' and in general satisfy sum[i; >> f^(x[i]) (b[i+1]-b[i])] = 1, where b[i] = 'breaks[i]'. >> >> If you want relative distance try something like this: >> >> myhist = hist(x,breaks=52, plot=F) myhist$counts = >> myhist$counts / sum(myhist$counts) >> plot(myhist,main=NULL,border=TRUE,xlab="days",xlim=c(0,6),lty=2) >> >> Not exactly clean, though -- we are messing with the >> myhist object... >> >> >> cu Philipp >> Erik> __ Erik> R-help@stat.math.ethz.ch mailing list Erik> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do Erik> read the posting guide! Erik> http://www.R-project.org/posting-guide.html __ 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
Re: [R] relative frequency plot
See ?truehist in the MASS package. Philipp Pagel wrote: > On Thu, Apr 27, 2006 at 10:48:39AM -0700, [EMAIL PROTECTED] wrote: > >>Hi All, >> >>I want to use "hist" to get the relative frequency plot. But the range of >>ylab is greater than 1,which I think it should be less than 1 since it >>stands for the probability. >> >>I'm confused. Could you please help me with it? > > > I was pretty confused by that, too at first. The solution is that > freq=False cause hist to plot the DENSITY rather than frequency. And > density is not necesssarily the same as relative frequency. Excerpt from > ?hist: > > density: values f^(x[i]), as estimated density values. If > 'all(diff(breaks) == 1)', they are the relative frequencies > 'counts/n' and in general satisfy sum[i; f^(x[i]) > (b[i+1]-b[i])] = 1, where b[i] = 'breaks[i]'. > > If you want relative distance try something like this: > > myhist = hist(x,breaks=52, plot=F) > myhist$counts = myhist$counts / sum(myhist$counts) > plot(myhist,main=NULL,border=TRUE,xlab="days",xlim=c(0,6),lty=2) > > Not exactly clean, though -- we are messing with the myhist object... > > > cu > Philipp > __ 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
Re: [R] relative frequency plot
On Thu, Apr 27, 2006 at 10:48:39AM -0700, [EMAIL PROTECTED] wrote: > Hi All, > > I want to use "hist" to get the relative frequency plot. But the range of > ylab is greater than 1,which I think it should be less than 1 since it > stands for the probability. > > I'm confused. Could you please help me with it? I was pretty confused by that, too at first. The solution is that freq=False cause hist to plot the DENSITY rather than frequency. And density is not necesssarily the same as relative frequency. Excerpt from ?hist: density: values f^(x[i]), as estimated density values. If 'all(diff(breaks) == 1)', they are the relative frequencies 'counts/n' and in general satisfy sum[i; f^(x[i]) (b[i+1]-b[i])] = 1, where b[i] = 'breaks[i]'. If you want relative distance try something like this: myhist = hist(x,breaks=52, plot=F) myhist$counts = myhist$counts / sum(myhist$counts) plot(myhist,main=NULL,border=TRUE,xlab="days",xlim=c(0,6),lty=2) Not exactly clean, though -- we are messing with the myhist object... cu Philipp -- Dr. Philipp PagelTel. +49-8161-71 2131 Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186 Technical University of Munich Science Center Weihenstephan 85350 Freising, Germany and Institute for Bioinformatics / MIPS Tel. +49-89-3187 3675 GSF - National Research Center Fax. +49-89-3187 3585 for Environment and Health Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel __ 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
[R] R 2.3.0 OS X Binary
I downloaded the 2.3.0 OS X Universal binary off of the Berkeley mirror (found it on the R for Mac OS X link at the bottom of the page). Installation went fine, but when I launch via the GUI it opens the console window and then (after several seconds) quits with no error message. I'm sorry I'm not very proficient with the Terminal, so I don't know if I can use R 2.3.0 with that, or if it's only the GUI startup that's causing the problem. I'm using a G4 Powerbook (PowerPC) laptop with OS X 10.4.6. A universal binary ought to work, right? Or is there something else going on? Just thought I'd let people know... Joran __ 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
Re: [R] relative frequency plot
[EMAIL PROTECTED] writes: > Hi All, > > I want to use "hist" to get the relative frequency plot. But the range of > ylab is greater than 1,which I think it should be less than 1 since it > stands for the probability. No, it stands for density, as the y label says. The sum of the areas of the bars is 1. Put differently, if you rescale the x axis, the y axis needs rescaling by the inverse factor. > Here is my code: > > x<-c(1,1,1,0,0,1,1,5,1,1,0,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,1,1,4,1,0,2,1,1,1 > ,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1) > > hist(x,breaks=52,main=NULL,freq=FALSE,border=TRUE,xlab="days",xlim=c(0,6),yl > im=c(0,10),lty=2) > > > But when I tried the other vector,the ylab is less than 1.The code is: > > y<-c(6,4,6,6,4,6,5,4,7,5,6,6,8,6,17,9,8,4,6,3,5,8,7,12,5,10,6,4,6,13,7,6,6,2 > 5,4,9,9,6,6,6,6,6,9,4,5,5,4,10,5,7,6) > > hist(PLEX2[,2],breaks=52,main=NULL,freq=FALSE,border=TRUE,xlab="days",xlim=c > (0,30),ylim=c(0,1),lty=2) > > I'm confused. Could you please help me with it? > > Thank you! > > __ > 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 > -- 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
[R] relative frequency plot
Hi All, I want to use "hist" to get the relative frequency plot. But the range of ylab is greater than 1,which I think it should be less than 1 since it stands for the probability. Here is my code: x<-c(1,1,1,0,0,1,1,5,1,1,0,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,1,1,4,1,0,2,1,1,1 ,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1) hist(x,breaks=52,main=NULL,freq=FALSE,border=TRUE,xlab="days",xlim=c(0,6),yl im=c(0,10),lty=2) But when I tried the other vector,the ylab is less than 1.The code is: y<-c(6,4,6,6,4,6,5,4,7,5,6,6,8,6,17,9,8,4,6,3,5,8,7,12,5,10,6,4,6,13,7,6,6,2 5,4,9,9,6,6,6,6,6,9,4,5,5,4,10,5,7,6) hist(PLEX2[,2],breaks=52,main=NULL,freq=FALSE,border=TRUE,xlab="days",xlim=c (0,30),ylim=c(0,1),lty=2) I'm confused. Could you please help me with it? Thank you! __ 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
[R] no subject
Hi All, I want to use "hist" to get the relative frequency plot. But the range of ylab is greater than 1,which I think it should be less than 1 since it stands for the probability. Here is my code: x<-c(1,1,1,0,0,1,1,5,1,1,0,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,1,1,4,1,0,2,1,1,1 ,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1) hist(x,breaks=52,main=NULL,freq=FALSE,border=TRUE,xlab="days",xlim=c(0,6),yl im=c(0,10),lty=2) But when I tried the other vector,the ylab is less than 1.The code is: y<-c(6,4,6,6,4,6,5,4,7,5,6,6,8,6,17,9,8,4,6,3,5,8,7,12,5,10,6,4,6,13,7,6,6,2 5,4,9,9,6,6,6,6,6,9,4,5,5,4,10,5,7,6) __ 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
Re: [R] Error in readChar(): invalid UTF-8 input
On 4/27/2006 1:21 PM, [EMAIL PROTECTED] wrote: > I have R code to read a binary header file, consisting of several > readBin() and readChar() statements. I am currently using version R-2.2.1 > (on x86_64, RH EL4) and have received the following error > > Error in readChar(fid, n = 1) : invalid UTF-8 input in readChar() > > This is strange because (a) I was able to read in this file successfully > in previous versions of R (circa 2005) and (b) it doesn't fail all the > time; i.e., other readChar() statements work. > > When I access the header file using a different piece of software, it > gives the value "-1" for the field. > > What's going on? Probably the older versions of R were not trying to interpret the field as UTF-8: that's locale-dependent, and a relatively recent addition. Not all byte sequences are legal UTF-8 encodings, and it sounds as though R is trying to tell you that yours is not. To say more than this would require lots more information from you, for example a reproducible example. Can you write the same bytes that are in that field into a file by themselves, and read that file? Can you read the file using the current version of R (2.3.0)? What about on other platforms? 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
[R] Error in readChar(): invalid UTF-8 input
I have R code to read a binary header file, consisting of several readBin() and readChar() statements. I am currently using version R-2.2.1 (on x86_64, RH EL4) and have received the following error Error in readChar(fid, n = 1) : invalid UTF-8 input in readChar() This is strange because (a) I was able to read in this file successfully in previous versions of R (circa 2005) and (b) it doesn't fail all the time; i.e., other readChar() statements work. When I access the header file using a different piece of software, it gives the value "-1" for the field. What's going on? cheers... Brandon [[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
[R] Dringend.
Sehr geehter Ich bin Dr. John Bakele und ich bin der Leiter des Research Department Committee in der Standard Bank in Südafrika. Zur Zeit halte ich mich in den Niederlanden zu einer Fortbildung auf. Ich kontaktiere Sie bezüglich des Transfers einer sehr großen Summe Geldes vom Konto eines Verstorbenen. Ich weiß, daß eine Transaktion dieser Größenordnung zunächst bei jedem Besorgnis erregen wird und versichere ich Ihnen, daß sich um alles gekümmert wird.Aufgrund der Dringlichkeit der Angelegenheit habe ich mich entschlossen, Sie zu kontaktieren. Es geht um folgendes: Einer meiner Kollegen ist für das Konto von Gerald Welsh zuständig, der gemeinsam mit seiner Frau im October bei einem Flugzeugabsturz ums Leben kam. Er befand sich gemeinsam mit anderen Passagieren an Bord einer Egyptian Airline 990.( http://news.bbc.co.uk/1/world/americas/502503.stm ) Seit diesem Vorfall ist niemand seiner nächsten Verwandten mehr am Leben, der als sein Erbe Ansprüche auf das Guthaben auf seinem Konto erheben könnte. Wir können jedoch gemäß unserer Richtlinien das Geld nicht auszahlen, bevor jemand als Angehöriger und Erbe auftritt und seinen Anspruch geltend macht. Aufgrund dieser Entdeckung und der Übereinstimmung bitten meine Kollegen und ich Sie nun um Ihre Erlaubnis, Sie als nächsten Angehörigen des Verstorbenen anzugeben. Die gesamte Abwicklung und Dokumentation wird sorgfältig von mir durchgeführt, damit das Guthaben von 20.5 Millionen US$ an Sie als nächsten Angehörigen ausgezahlt werden kann. Andernfalls wird die gesamte Summe nach fünf Jahren in das Eigentum der Bank übergehen und die Direktoren der Bank werden sie untereinander aufteilen. Aufgrund dieser Tatsache habe ich mich entschlossen, mich an Sie zu wenden, damit Sie als Erbe auftreten können und nicht alles den Direktoren zugute kommt. Da aber die Person, die im Testament als Erbin genannt wird, mit ihm gemeinsam verstorben ist, haben wir vom Nachlaßverwalter den Auftrag bekommen, ein Familienmitglied des Verstorbenen ausfindig zu machen, daß das Erbe antreten kann. Wir bitten Sie, unseren Vorschlag anzunehmen und versichern Ihnen, daß alles absolut risikofrei für Sie ablaufen wird. Wir werden Sie mit 25% an der Transaktion beteiligen, den restlichen Betrag werden meine Kollegen und ich für. Falls Sie interessiert sind, schicken Sie mir bitte folgende Angaben: 1. Name/Firmen name um die erforderlichen Dokumente vorzubereitenp 2. Persönliche Telefon- und Fax-Nummern An meine privat E-mail : [EMAIL PROTECTED], mit Ihrer vertraulichen Telefon-Nr., Fax-Nr., E-mail Anschrift, damit ich Ihnen die weiteren relevanten Details in dieser Sache mitteilen kann. Vielen Dank im voraus. Wir bitten sie eindringlich, die Angelegenheit vertraulich zu behandeln. Bitte antworten Sie mir schnellstmöglich und Gott segne sie. Mit freundlichen grussen. Dr. John Bakele . __ 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
Re: [R] Looking for an unequal variances equivalent of the KruskalWallis nonparametric one way ANOVA
Why not bootstrap or simulate (e.g. permutation test)? Sounds like exactly the sort of situation for which it's designed. -- Bert > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard > Sent: Thursday, April 27, 2006 8:39 AM > To: Mike Waters > Cc: R-help@stat.math.ethz.ch > Subject: Re: [R] Looking for an unequal variances equivalent > of the KruskalWallis nonparametric one way ANOVA > > "Mike Waters" <[EMAIL PROTECTED]> writes: > > > Well fellow R users, I throw myself on your mercy. Help me, > the unworthy, > > satisfy my employer, the ungrateful. My feeble ramblings follow... > > > > I've searched R-Help, the R Website and done a GOOGLE > without success for a > > one way ANOVA procedure to analyse data that are both > non-normal in nature > > and which exhibit unequal variances and unequal sample > sizes across the 4 > > treatment levels. My particular concern is to be able to > discrimintate > > between the 4 different treatments (as per the Tukey HSD in > happier times). > > > > To be precise, the data exhibit negative skew and > platykurtosis and I was > > unable to obtain a sensible transformation to normalise > them (obviously > > trying subtracting the value from range maximum plus one in > this process). > > Hence, the usual Welch variance-weighted one way ANOVA > needs to be replaced > > by a nonparametric alternative, Kruskal-Wallis being ruled > out for obvious > > reasons. I have read that, if the treatment with the fewest > sample numbers > > has the smallest variance (true here) the parametric tests > are conservative > > and safe to use, but I would like to do this 'by the book'. > > What are the sample sizes like? Which assumptions are you willing to > make _under the null hypothesis_? > > If it makes sense to compare means (even if nonnormal), then a > Welch-type procedure might suffice if the DF are large. > > pairwise.wilcox.test() might also be a viable alternative, with a > suitably p-adjustment. This would make sense if you believe that the > relevant null for comparison between any two treatments is that they > have identical distributions. (With only four groups, I'd be inclined > to use the Bonferroni adjustment, since it is known to be > conservative, but not badly so.) > > -- >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 > __ 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
Re: [R] losing x-label when exporting to PNG
--- "Marc Schwartz (via MN)" <[EMAIL PROTECTED]> wrote: > On Thu, 2006-04-27 at 08:43 -0400, John Kane wrote: > > I have a simple barplot that looks fine in the R > > graphics device window. However when I export it > to > > png I am losing the x-label. It must be an > obvious > > problem but I cannot see it. Trying to resize the > plot > > does not seem to help. Code is below. > > > > Any help gratefully received. > > > > ## Start Code > > > > Groups <-c(21.8,45, 43, 17.2, 8.3, 18) > > names(Groups) <- c("Exeter", "Halifax", > "Moosonee", > > "Ottawa", > > "Montr�al", "Saskatoon") > > # Here we are setting the font to Bold and addin > some > > lines to the bottom > > # margin of the graph, 6 vs default of 5, to give > us > > more room with the angled > > # labels. > > > > par(font=2,mar= (c(6, 4, 4, 2) + 0.1)) > > > > Mycolours <- c("red", "blue", "green", "yellow", > > "orange" ,"purple") > > > > # --plot to screen > > -- > > mp <- barplot(Groups, beside=T , > > horiz=F , las=1, ylim=c(0,60), axisnames=F, > > font.lab=2, col=Mycolours > > ) > > text(mp, par("usr")[3] - 1.5, srt = 45, adj = 1, > > labels = names(Groups), xpd = T , > > cex=.75, > >) > > > > mtext(side = 1, line=5, text="% of Services above > > thresholds ") > > mtext(side=2, line=2.5, text="Percent") > > title(main="") > > box() > > # ---plot to png > > file-- > > png('gr_%04d.png', width=600, height=400) > > mp <- barplot(Groups, beside=T , > > horiz=F , las=1, ylim=c(0,60), axisnames=F, > > font.lab=2, col=Mycolours > > ) > > text(mp, par("usr")[3] - 1.5, srt = 45, adj = 1, > > labels = names(Groups), xpd = T , > > cex=.75, > >) > > > > mtext(side = 1, line=5, text="% of Services above > > thresholds ") > > mtext(side=2, line=2.5, text="Percent") > > title(main="") > > box() > > > > dev.off() > > > > End code # > > John, > > I suspect that you might want to find a cushioned > wall first, in case > you might want to bang your head against it... ;-) > > If your PNG file is created using exactly the code > you have above, you > have neglected to include the par() statement to > adjust the margins > AFTER calling png(). Note that the prior par() > statement is apropos to > your screen plot device and will not affect the > png() device. > > So insert the same par() call AFTER the png() call > and you should be > good to go. > > HTH, > > Marc Schwartz > Just a minute while I go get my neighbour's motorcycle helmet. You will be able to hear the padded thumps. How embarassing! Thanks. __ 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
Re: [R] add city and point in the map
YIHSU CHEN jhu.edu> writes: > > Dear Helpers: > > I'm trying to use packages "maps" and "mapdata" (see blow) to display the research resutls on map > (Mid-Atlantic region). In particular, I need to mark a number of points in the map by giving their latitude > and longitude information. For instance, I would like to mark a point on (long, lat) =(75.56027, You can use library(mapproj) and the function mapproject() to do this. mapproject converts longitude and latitude to x and y projections on a plot, as in the following: map('usa') locations <- mapproject(longitude, latitude) points(locations) -Alan -- -Alan Schussman / Graduate Associate University of Arizona Department of Sociology __ 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
Re: [R] Looking for an unequal variances equivalent of the KruskalWallis nonparametric one way ANOVA
Peter, Thank you for your prompt response. The degrees of freedom for the 6 treatment means range from 33 to 48, so are relatively large. The Levene test for homogeneity of variance is giving values of 13 to 14 for each of the 5 subjective measures being analysed (i.e. highly significant for thos d.o.f.), with skewness significant at p<0.0001 and kurtosis generally around p<0.01 to p<0.02. I have run Bonferroni adjusted pairwise comparisons of the means, which give approximately the same levels of significance as for the straightforward Welch comparisons. Regards, Mike -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: 27 April 2006 16:39 To: Mike Waters Cc: R-help@stat.math.ethz.ch Subject: Re: [R] Looking for an unequal variances equivalent of the KruskalWallis nonparametric one way ANOVA "Mike Waters" <[EMAIL PROTECTED]> writes: > Well fellow R users, I throw myself on your mercy. Help me, the > unworthy, satisfy my employer, the ungrateful. My feeble ramblings follow... > > I've searched R-Help, the R Website and done a GOOGLE without success > for a one way ANOVA procedure to analyse data that are both non-normal > in nature and which exhibit unequal variances and unequal sample sizes > across the 4 treatment levels. My particular concern is to be able to > discrimintate between the 4 different treatments (as per the Tukey HSD in happier times). > > To be precise, the data exhibit negative skew and platykurtosis and I > was unable to obtain a sensible transformation to normalise them > (obviously trying subtracting the value from range maximum plus one in this process). > Hence, the usual Welch variance-weighted one way ANOVA needs to be > replaced by a nonparametric alternative, Kruskal-Wallis being ruled > out for obvious reasons. I have read that, if the treatment with the > fewest sample numbers has the smallest variance (true here) the > parametric tests are conservative and safe to use, but I would like to do this 'by the book'. What are the sample sizes like? Which assumptions are you willing to make _under the null hypothesis_? If it makes sense to compare means (even if nonnormal), then a Welch-type procedure might suffice if the DF are large. pairwise.wilcox.test() might also be a viable alternative, with a suitably p-adjustment. This would make sense if you believe that the relevant null for comparison between any two treatments is that they have identical distributions. (With only four groups, I'd be inclined to use the Bonferroni adjustment, since it is known to be conservative, but not badly so.) -- 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 __ 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
Re: [R] losing x-label when exporting to PNG
On Thu, 2006-04-27 at 08:43 -0400, John Kane wrote: > I have a simple barplot that looks fine in the R > graphics device window. However when I export it to > png I am losing the x-label. It must be an obvious > problem but I cannot see it. Trying to resize the plot > does not seem to help. Code is below. > > Any help gratefully received. > > ## Start Code > > Groups <-c(21.8,45, 43, 17.2, 8.3, 18) > names(Groups) <- c("Exeter", "Halifax", "Moosonee", > "Ottawa", > "Montréal", "Saskatoon") > # Here we are setting the font to Bold and addin some > lines to the bottom > # margin of the graph, 6 vs default of 5, to give us > more room with the angled > # labels. > > par(font=2,mar= (c(6, 4, 4, 2) + 0.1)) > > Mycolours <- c("red", "blue", "green", "yellow", > "orange" ,"purple") > > # --plot to screen > -- > mp <- barplot(Groups, beside=T , > horiz=F , las=1, ylim=c(0,60), axisnames=F, > font.lab=2, col=Mycolours > ) > text(mp, par("usr")[3] - 1.5, srt = 45, adj = 1, > labels = names(Groups), xpd = T , > cex=.75, >) > > mtext(side = 1, line=5, text="% of Services above > thresholds ") > mtext(side=2, line=2.5, text="Percent") > title(main="") > box() > # ---plot to png > file-- > png('gr_%04d.png', width=600, height=400) > mp <- barplot(Groups, beside=T , > horiz=F , las=1, ylim=c(0,60), axisnames=F, > font.lab=2, col=Mycolours > ) > text(mp, par("usr")[3] - 1.5, srt = 45, adj = 1, > labels = names(Groups), xpd = T , > cex=.75, >) > > mtext(side = 1, line=5, text="% of Services above > thresholds ") > mtext(side=2, line=2.5, text="Percent") > title(main="") > box() > > dev.off() > > End code # John, I suspect that you might want to find a cushioned wall first, in case you might want to bang your head against it... ;-) If your PNG file is created using exactly the code you have above, you have neglected to include the par() statement to adjust the margins AFTER calling png(). Note that the prior par() statement is apropos to your screen plot device and will not affect the png() device. So insert the same par() call AFTER the png() call and you should be good to go. 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
Re: [R] plot cdf
> "ronggui" == ronggui <[EMAIL PROTECTED]> > on Thu, 27 Apr 2006 19:27:04 +0800 writes: ronggui> I think curve is one option. for example , I can ronggui> use "curve(pnorm,-5,5)" to plot the normal cdf. ronggui> use ?curve to get the usage. Or Luck might mean the *empirical* cdf, and then plot(ecdf(..)) solves it; type example(ecdf) to see a few examples -- maybe after first saying par(ask = TRUE) Martin Maechler, ETH Zurich ronggui> 2006/4/27, Nongluck Klibbua ronggui> <[EMAIL PROTECTED]>: >> hi, I would like to know what is the function to plot >> cdf. Thanks, Luck __ 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
Re: [R] State space AR models in R: some examples
Check out the sspir package and http://www.jstatsoft.org/index.php?vol=16 On 4/27/06, Pablo Almaraz <[EMAIL PROTECTED]> wrote: > Hi all, > > Does anyone have an example of an autoregressive (AR) time-series model > specified as a state space model in R? That is, I want to go beyond the > locally linear (constant) model, and fit the following Gaussian AR state > process model: > > Xt = a + (1+b)*Xt-1 + epsilon > > ,where the model for the observation process is > > Yt = Xt + tau > > I have information of the tau's (observation variance) for each > observation in the time-series, and it would be perfect to include this > information during the fitting routine. I have actually coded this as a > WinBUGS code (pasted below), but I'm not quite sure it works as it > should. I would be extremely thanked if anyone could submit an example > of an R code fitting the above problem. Gibb's sampler for solving the > problem would be great, I'm not sure whether the Kalman filter would > work well with only 30 data points (?). Additional details, corrections > and/or help would probably save my life at least for a while. > > Thank you all > Cheers > > Pablo > > WinBUGS state-space R code: > ## > model; >{ > > # Parameters and priors >alpha ~ dnorm(0,0.01) # Intrinsic rate of increase >b ~ dnorm(0,0.01) >beta[1] <- b-1 # First-order density-dependence >sigma ~ dunif(0, 1000) # State process SD >isigma2 <- pow(sigma, -2) # State process 1/var ># isigma2 ~ dgamma(0.01,0.01) > > # Initial state value >n.exp[1] ~ dnorm(n[1],tau[1]) > > # State process model >for(j in 1:(N-1)){ >n.exp.mu[j+1] <- alpha + b*n.exp[j] # First-order Gompertz > model >n.exp[j+1] ~ dnorm(n.exp.mu[j+1], isigma2) >} > > # Observation process model >for(j in 1:(N-1)){ >n[j+1] ~ dnorm(n.exp[j+1],tau[j+1]) >} >} > > # Loge-transformed and standardized time-series data > > list(N=28, > n=c(-0.24645, 0.015312, 0.442262, -0.05879, -0.17308, -0.03778, > 0.120961, -0.04383, 0.002507, 0.073278, -0.11684, 0.003657, -0.07375, > 0.05006, -0.04489, -0.00826, -0.06713, 0.682228, 0.032058, -0.33254, > -0.50432, 0.176914, 0.249793, 0.01672, -0.30581, -0.19617, 0.158579, > 0.185296), > tau=c(2.38351, 2.351379, 49.12811, 10.01703, 11.68982, 3.846619, > 1.999254, 1.6685, 3.011932, 5.661051, 168.2524, 1.581, 25.74985, > 50.29332, 3.03117, 7.65013, 3.376606, 17.34871, 4.215985, 2.455294, > 7.685724, 1.918054, 5.588953, 8.503541, 0.5666, 0.923611, 4.986243, > 10.36613)) > > # Inits for MC 1 > list(alpha = 0.5, b = -1, sigma = 0.5) > > # Inits for MC 2 > list(alpha = 1, b = 0.01, sigma = 1) > > # Inits for MC 3 > list(alpha = 0.01, b = 1, sigma = 0.01) > > ### End (not run) > > -- > > Pablo Almaraz García > Estación Biológica de Doñana (CSIC) > Pabellón del Perú, Avda. Mª Luísa s/n > E-41013, Sevilla > SPAIN > > E-mail: almaraz[AT]ebd[DOT]csic[DOT]es > webpage: http://www.almaraz.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 > __ 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
[R] [R-pkgs] pls package: bugfix release 1.2-1
Version 1.2-1 of the pls package is now available on CRAN. This is mainly a bugfix-release. If you fit multi-response models, you are strongly engouraged to upgrade! The main changes since 1.2-0 are - Fixed bug in kernelpls.fit() that resulted in incorrect results when fitting mulitresponse models with fewer responses than predictors - Changed default radii in corrplot() - It is now possible to select the radii of the circles in corrplot See the file CHANGES in the sources for all changes. The pls package implements partial least squares regression (PLSR) and principal component regression (PCR). Features of the package include - Several plsr algorithms: orthogonal scores, kernel pls and simpls - Flexible cross-validation - A formula interface, with traditional methods like predict, coef, plot and summary - Functions for extraction of scores and loadings, and calculation of (R)MSEP and R2 - A simple multiplicative scatter correction (msc) implementation - Functions for plotting predictions, validation statistics, coefficients, scores, loadings, biplots and correlation loadings. -- Bjørn-Helge Mevik ___ R-packages mailing list [EMAIL PROTECTED] 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
Re: [R] random walk on graph
I did not look at your code in detail, but I see a potential problem in your inner loop. I think you intended k to be in 2,3,...N+1. What you get from your code is (2:N)+1 according to the operator precedence rules. You need 2:(N+1). HTH, -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Blabac Sent: Thursday, April 27, 2006 11:28 AM To: r-help@stat.math.ethz.ch Subject: [R] random walk on graph Hi all, I'm having issues coding a random walk on a fully connected, undirected graph G with probability transition matrix P = (p_ij). Here is what I have so far ... for(i in 1:n){ for(m in 1:M){ x <- as.vector(matrix(rep(0,N+1),nc=N+1)) x[1] <- i for(k in 2:N+1){ y <- as.vector(matrix(rep(0,n),nc=n)) r <- runif(1) c <- c(0,cumsum(P[x[k-1],])) for(j in 1:n){ y[j] <- (r >= c[j] & r < c[j+1]) } x[k] <- which(y == 1) } L[i,m] <- x[N+1] } } its giving me the error: Error in "[<-"(`*tmp*`, k, value = integer(0)) : nothing to replace with no matter what I do I cant fix it ... any suggestions ? Thanks Eric Blabac PhD Student - ASU Dept of Mathematics/Statistics __ 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 __ 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
Re: [R] summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
> "roger" == roger bos <[EMAIL PROTECTED]> > on Thu, 27 Apr 2006 11:06:36 -0400 writes: roger> Robin, I still don't know what the problem is, but roger> your example works on my R-2.3.0pat (created on roger> 4/24/2006). You may want to try the patched version roger> if you are not already running it. roger> Thanks, roger> Roger >> x <- 1:10; y <- 10:1; summary(lm(x~y)) .. but that also works on R 2.3.0 - for me. and probably almost everyone. Robin is also seeing other strange behavior of R 2.3.0 (when starting X11() only when running under ESS). My current guess would go in the direction that Robin's software or hardware *infrastructure* (i.e. those parts ``below R'') is acting up for some reason. Can we get a bit more feedback, on this: For whom does x <- 1:10; y <- 10:1; summary(lm(x~y)) give a bus error (or other kind of crash) ? Thanks, Martin roger> On 4/27/06, Robin Hankin <[EMAIL PROTECTED]> roger> wrote: >> Hi Roger >> >> good point. I can reproduce the error much more simply: >> >> >> >> > x <- 1:10 > y <- 10:1 > summary(lm(x~y)) >> >> Call: lm(formula = x ~ y) >> >> Residuals: >> >> *** caught bus error *** address 0x18, cause 'invalid >> alignment' >> >> Traceback: 1: sort(x, partial = unique(c(lo, hi))) 2: >> quantile.default(resid) 3: quantile(resid) 4: >> structure(quantile(resid), names = nam) 5: >> print.summary.lm(list(call = lm(formula = x ~ [snip] >> >> On 27 Apr 2006, at 15:44, roger bos wrote: >> >> > I don't know if this is causing the error, by in your >> traceback I > saw sort() > was used and sort now removes >> all the attributes when it sorts. I > used to > use >> sort() to sort dates in character format and now it turns >> them > into > integers and is breaking all my code. The >> problem with upgrading > is your > never know what the >> end result will be on your code. Check and see > if your >> > data needs the attributes to remain in order to >> function properly. >> > >> > >> > >> > On 4/27/06, Robin Hankin <[EMAIL PROTECTED]> >> wrote: >> >> >> >> Hi >> >> >> >> -- >> Robin Hankin Uncertainty Analyst National Oceanography >> Centre, Southampton European Way, Southampton SO14 3ZH, >> UK tel 023-8059-7743 >> >> roger> [[alternative HTML version deleted]] roger> __ roger> R-help@stat.math.ethz.ch mailing list roger> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE roger> do read the posting guide! roger> http://www.R-project.org/posting-guide.html __ 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
[R] Widget inserts NA instead of entered data
I am relatively new to R and extremely new to widgets. Any help would be greatly appreciated! The script below is a portion of a larger script in which the user has entered the number of files representing their transcription factor (in this case 2) and their control (again 2). In this portion, I would like the user to indicate which files (from 1-4, in this case) are transcription factor data (1 and 2) and which are control (3 and 4). The problem is that whenever I run the script and enter "1" and "2" and "3" and "4"in the widget boxes, the values returned at "NA" and "2" and "NA" and "4". Does anyone know why the first values are being returned as NA? Any ideas on how to fix this? I am using R 2.2.1 on Windows XP Pro. Thanks! library(tkWidgets) library(widgetTools) PWEnv<-new.env(hash=TRUE, parent=parent.frame(1)) tf.count.2<-2 ctrl.count.2<-2 entry2<- entryBox(wName = "entry2", wValue= "", wEnv=PWEnv) entry3<- entryBox(wName = "entry3", wValue="", wEnv=PWEnv) label4<-label(wName="label4", wValue="Please enter the number for one of the _635 files that represent your transcription factor.", wEnv=PWEnv) label5<-label(wName="label5", wValue="Please enter the number for one of the _635 files that represent your controls.", wEnv=PWEnv) for (i in 1:tf.count.2){ pWidgets<-list(topRow=list(label4=label4), textRow=list(entry2=entry2)) aWidget<-widget(wTitle="Assign Experimental Files", pWidgets, env=PWEnv) tf<-c() tf[i]<-wValue(pWidgets(aWidget)[["textRow"]][["entry2"]])} for (i in 1:ctrl.count.2){ pWidgets<-list(topRow=list(label5=label5), textRow=list(entry3=entry3)) aWidget<-widget(wTitle="Assign Control Files", pWidgets, env=PWEnv) ctrl<-c() ctrl[i]<-wValue(pWidgets(aWidget)[["textRow"]][["entry3"]])} > ctrl [1] NA "4" > tf [1] NA "2" > Windy Berkofsky-Fessler Graduate School of Biological Sciences Mount Sinai School of Medicine New York, NY 10029 __ 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
Re: [R] Looking for an unequal variances equivalent of the Kruskal Wallis nonparametric one way ANOVA
"Mike Waters" <[EMAIL PROTECTED]> writes: > Well fellow R users, I throw myself on your mercy. Help me, the unworthy, > satisfy my employer, the ungrateful. My feeble ramblings follow... > > I've searched R-Help, the R Website and done a GOOGLE without success for a > one way ANOVA procedure to analyse data that are both non-normal in nature > and which exhibit unequal variances and unequal sample sizes across the 4 > treatment levels. My particular concern is to be able to discrimintate > between the 4 different treatments (as per the Tukey HSD in happier times). > > To be precise, the data exhibit negative skew and platykurtosis and I was > unable to obtain a sensible transformation to normalise them (obviously > trying subtracting the value from range maximum plus one in this process). > Hence, the usual Welch variance-weighted one way ANOVA needs to be replaced > by a nonparametric alternative, Kruskal-Wallis being ruled out for obvious > reasons. I have read that, if the treatment with the fewest sample numbers > has the smallest variance (true here) the parametric tests are conservative > and safe to use, but I would like to do this 'by the book'. What are the sample sizes like? Which assumptions are you willing to make _under the null hypothesis_? If it makes sense to compare means (even if nonnormal), then a Welch-type procedure might suffice if the DF are large. pairwise.wilcox.test() might also be a viable alternative, with a suitably p-adjustment. This would make sense if you believe that the relevant null for comparison between any two treatments is that they have identical distributions. (With only four groups, I'd be inclined to use the Bonferroni adjustment, since it is known to be conservative, but not badly so.) -- 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
[R] random walk on graph
Hi all, I'm having issues coding a random walk on a fully connected, undirected graph G with probability transition matrix P = (p_ij). Here is what I have so far ... for(i in 1:n){ for(m in 1:M){ x <- as.vector(matrix(rep(0,N+1),nc=N+1)) x[1] <- i for(k in 2:N+1){ y <- as.vector(matrix(rep(0,n),nc=n)) r <- runif(1) c <- c(0,cumsum(P[x[k-1],])) for(j in 1:n){ y[j] <- (r >= c[j] & r < c[j+1]) } x[k] <- which(y == 1) } L[i,m] <- x[N+1] } } its giving me the error: Error in "[<-"(`*tmp*`, k, value = integer(0)) : nothing to replace with no matter what I do I cant fix it ... any suggestions ? Thanks Eric Blabac PhD Student - ASU Dept of Mathematics/Statistics __ 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
[R] Venkatraman ROC comparison
Hi, I wonder if anyone has the code for ROC comparison based on Venkatraman permutation test procedure. I have searched R site. Milos Zarkovic ** Milos Zarkovic MD, Ph.D. Associate Professor of Internal Medicine Institute of Endocrinology Dr Subotica 13 11000 Beograd Serbia Tel +381-63-202-925 Fax +381-11-685-357 Email [EMAIL PROTECTED] ** [[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
[R] Looking for an unequal variances equivalent of the Kruskal Wallis nonparametric one way ANOVA
Well fellow R users, I throw myself on your mercy. Help me, the unworthy, satisfy my employer, the ungrateful. My feeble ramblings follow... I've searched R-Help, the R Website and done a GOOGLE without success for a one way ANOVA procedure to analyse data that are both non-normal in nature and which exhibit unequal variances and unequal sample sizes across the 4 treatment levels. My particular concern is to be able to discrimintate between the 4 different treatments (as per the Tukey HSD in happier times). To be precise, the data exhibit negative skew and platykurtosis and I was unable to obtain a sensible transformation to normalise them (obviously trying subtracting the value from range maximum plus one in this process). Hence, the usual Welch variance-weighted one way ANOVA needs to be replaced by a nonparametric alternative, Kruskal-Wallis being ruled out for obvious reasons. I have read that, if the treatment with the fewest sample numbers has the smallest variance (true here) the parametric tests are conservative and safe to use, but I would like to do this 'by the book'. TVMIA, Regards, Mike __ 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
Re: [R] summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
Robin, I still don't know what the problem is, but your example works on my R-2.3.0pat (created on 4/24/2006). You may want to try the patched version if you are not already running it. Thanks, Roger > x <- 1:10 > y <- 10:1 > summary(lm(x~y)) Call: lm(formula = x ~ y) Residuals: Min 1Q Median -0.0007998 -0.0005271 -0.0002555 3QMax 0.0006438 0.0009573 Coefficients: Estimate Std. Errort value (Intercept) 11. 0.00047274 23268659197056500 y -0.99978000 0.7619-13125293946147946 Pr(>|t|) (Intercept) <0.0002 *** y <0.0002 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.000692 on 8 degrees of freedom Multiple R-Squared: 1, Adjusted R-squared: 1 F-statistic: 1.723e+32 on 1 and 8 DF, p-value: < 0.00022 On 4/27/06, Robin Hankin <[EMAIL PROTECTED]> wrote: > > Hi Roger > > good point. I can reproduce the error much more simply: > > > > > x <- 1:10 > > y <- 10:1 > > summary(lm(x~y)) > > Call: > lm(formula = x ~ y) > > Residuals: > > *** caught bus error *** > address 0x18, cause 'invalid alignment' > > Traceback: > 1: sort(x, partial = unique(c(lo, hi))) > 2: quantile.default(resid) > 3: quantile(resid) > 4: structure(quantile(resid), names = nam) > 5: print.summary.lm(list(call = lm(formula = x ~ > [snip] > > On 27 Apr 2006, at 15:44, roger bos wrote: > > > I don't know if this is causing the error, by in your traceback I > > saw sort() > > was used and sort now removes all the attributes when it sorts. I > > used to > > use sort() to sort dates in character format and now it turns them > > into > > integers and is breaking all my code. The problem with upgrading > > is your > > never know what the end result will be on your code. Check and see > > if your > > data needs the attributes to remain in order to function properly. > > > > > > > > On 4/27/06, Robin Hankin <[EMAIL PROTECTED]> wrote: > >> > >> Hi > >> > > -- > Robin Hankin > Uncertainty Analyst > National Oceanography Centre, Southampton > European Way, Southampton SO14 3ZH, UK > tel 023-8059-7743 > > [[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
[R] State space AR models in R: some examples
Hi all, Does anyone have an example of an autoregressive (AR) time-series model specified as a state space model in R? That is, I want to go beyond the locally linear (constant) model, and fit the following Gaussian AR state process model: Xt = a + (1+b)*Xt-1 + epsilon ,where the model for the observation process is Yt = Xt + tau I have information of the tau's (observation variance) for each observation in the time-series, and it would be perfect to include this information during the fitting routine. I have actually coded this as a WinBUGS code (pasted below), but I'm not quite sure it works as it should. I would be extremely thanked if anyone could submit an example of an R code fitting the above problem. Gibb's sampler for solving the problem would be great, I'm not sure whether the Kalman filter would work well with only 30 data points (?). Additional details, corrections and/or help would probably save my life at least for a while. Thank you all Cheers Pablo WinBUGS state-space R code: ## model; { # Parameters and priors alpha ~ dnorm(0,0.01) # Intrinsic rate of increase b ~ dnorm(0,0.01) beta[1] <- b-1 # First-order density-dependence sigma ~ dunif(0, 1000) # State process SD isigma2 <- pow(sigma, -2) # State process 1/var # isigma2 ~ dgamma(0.01,0.01) # Initial state value n.exp[1] ~ dnorm(n[1],tau[1]) # State process model for(j in 1:(N-1)){ n.exp.mu[j+1] <- alpha + b*n.exp[j] # First-order Gompertz model n.exp[j+1] ~ dnorm(n.exp.mu[j+1], isigma2) } # Observation process model for(j in 1:(N-1)){ n[j+1] ~ dnorm(n.exp[j+1],tau[j+1]) } } # Loge-transformed and standardized time-series data list(N=28, n=c(-0.24645, 0.015312, 0.442262, -0.05879, -0.17308, -0.03778, 0.120961, -0.04383, 0.002507, 0.073278, -0.11684, 0.003657, -0.07375, 0.05006, -0.04489, -0.00826, -0.06713, 0.682228, 0.032058, -0.33254, -0.50432, 0.176914, 0.249793, 0.01672, -0.30581, -0.19617, 0.158579, 0.185296), tau=c(2.38351, 2.351379, 49.12811, 10.01703, 11.68982, 3.846619, 1.999254, 1.6685, 3.011932, 5.661051, 168.2524, 1.581, 25.74985, 50.29332, 3.03117, 7.65013, 3.376606, 17.34871, 4.215985, 2.455294, 7.685724, 1.918054, 5.588953, 8.503541, 0.5666, 0.923611, 4.986243, 10.36613)) # Inits for MC 1 list(alpha = 0.5, b = -1, sigma = 0.5) # Inits for MC 2 list(alpha = 1, b = 0.01, sigma = 1) # Inits for MC 3 list(alpha = 0.01, b = 1, sigma = 0.01) ### End (not run) -- Pablo Almaraz García Estación Biológica de Doñana (CSIC) Pabellón del Perú, Avda. Mª Luísa s/n E-41013, Sevilla SPAIN E-mail: almaraz[AT]ebd[DOT]csic[DOT]es webpage: http://www.almaraz.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
Re: [R] summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
Hi Roger good point. I can reproduce the error much more simply: > x <- 1:10 > y <- 10:1 > summary(lm(x~y)) Call: lm(formula = x ~ y) Residuals: *** caught bus error *** address 0x18, cause 'invalid alignment' Traceback: 1: sort(x, partial = unique(c(lo, hi))) 2: quantile.default(resid) 3: quantile(resid) 4: structure(quantile(resid), names = nam) 5: print.summary.lm(list(call = lm(formula = x ~ [snip] On 27 Apr 2006, at 15:44, roger bos wrote: > I don't know if this is causing the error, by in your traceback I > saw sort() > was used and sort now removes all the attributes when it sorts. I > used to > use sort() to sort dates in character format and now it turns them > into > integers and is breaking all my code. The problem with upgrading > is your > never know what the end result will be on your code. Check and see > if your > data needs the attributes to remain in order to function properly. > > > > On 4/27/06, Robin Hankin <[EMAIL PROTECTED]> wrote: >> >> Hi >> -- 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
[R] add city and point in the map
Dear Helpers: I'm trying to use packages "maps" and "mapdata" (see blow) to display the research resutls on map (Mid-Atlantic region). In particular, I need to mark a number of points in the map by giving their latitude and longitude information. For instance, I would like to mark a point on (long, lat) =(75.56027, 39.09271). Also, I need to mark several cities that I suspect might not in the "world.cities" database such as Baltimore, etc. Presumably, I can do the same thing by finding out the lat and long infor of Baltimroe and add text next to the point I mark. Thanks a billion Yihsu library(maps) library(mapdata) state.list <- c("maryland","new jersey","west virginia", "virginia","ohio","delaware","pennsylvania","kentucky","indiana","north carlina") map("state",state.list) map.cities(x=world.cities, Country="US",minpop=10) __ 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
[R] Comparing two time series?
I have got pairs of time series, where one usually is shorter (n typically about 5400) than the other (n typically about 52000). I would like to calculate the ccf for these series, but I haven't found a smart way to let the shorter "slide" along the longer one in steps. Manually splitting the longer series into shorter ones of the same length as the shorter is possible, but tedious. Any suggestions, either for doing it (i e the ccf calculations for series of different lengths) in one round or for doing a split of a long series into shorter pieces? (I know I have seen a description of the later in the documentation, but now I can't find where it was...) Robert __ 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
Re: [R] summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
I don't know if this is causing the error, by in your traceback I saw sort() was used and sort now removes all the attributes when it sorts. I used to use sort() to sort dates in character format and now it turns them into integers and is breaking all my code. The problem with upgrading is your never know what the end result will be on your code. Check and see if your data needs the attributes to remain in order to function properly. On 4/27/06, Robin Hankin <[EMAIL PROTECTED]> wrote: > > Hi > > [macOSX 10.4.6; R-2.3.0] > > I have encountered a difference in behaviour between R-2.2.1 and > R-2.3.0 when > performing a linear model. Transcript follows for R-2.3.0 (R-2.2.1 > worked as > expected). How to make R-2.3.0 perform as R-2.2.1 did? > > > > > dput(x) > c(29.13, 29.88, 30.09, 29.99, 29.74, 29.64, 29.65, 29.7, 30.04, > 29.89, 29.96, 29.65, 28.76, 28.41, 28.38, 29.55, 29.76, 29.75, > 29.84, 29.85, 29.75, 29.99, 29.32, 29.38, 28.97, 28.48, 29.06, > 28.74, 29.23, 29.16, 29.19, 29.23, 29.17, 29.25, 29.24, 29.22, > 29.15, 29.15, 28.78, 29.28, 29.31, 29.44, 29.28, 29.47, 29.28, > 29.32, 29.39, 29.27, 28.68, 28.73, 28.09, 28.19, 29.1, 29.1, > 29.14, 29.48, 29.48, 29.39, 29.39, 29.22, 28.95, 29.11, 27.94, > 28.32, 27.98, 28.22, 28.89, 29.4, 29.28, 29.66, 30.05, 30.12, > 30.09, 29.85, 29.99, 29.92, 28.44, 28.92, 28.92, 28.94, 28.97, > 28.95, 29.39, 29.26, 29.7, 29.48, 29.72, 29.71, 29.84, 29.59, > 29.17, 29.39, 29.27, 29.39, 28.53, 29.32, 29.32, 28.44, 29.39, > 28.55, 29.39, 29.46, 29.73, 30.01, 30.11, 30.25, 30.37, 30.22, > 30.33, 30.35, 30.38, 30.25, 29.27, 27.34) > > dput(y) > c(36, 72.43, 37.57, 72.78, 55.88, 38.41, 79.79, 32, 56.92, 69.72, > 63.53, 50.94, 82.82, 50.77, 41.05, 75.62, 64, 63.04, 35.83, 91.71, > 93.29, 42.16, 65.57, 60.05, 27.38, 83.64, 67.6, 39, 53.21, 54.24, > 49.58, 34.29, 81.5, 48.94, 64.84, 32.86, 66.71, 41.67, 42.27, > 45.22, 51.23, 64.03, 58, 48.15, 59.8, 72.94, 40.33, 56.82, 32, > 75.32, 49.25, 44.38, 27.5, 37, 40.22, 33.63, 43, 49.92, 36, 63.78, > 41.74, 58.07, 37.5, 41.27, 54.28, 51.39, 49.92, 93, 33.75, 30.81, > 102.31, 67.95, 64.48, 47, 33.56, 42.44, 44.25, 63.93, 38.92, > 74.47, 58.46, 35.25, 94.45, 40.71, 38.35, 78.26, 65.1, 89.54, > 43.34, 34.71, 37.83, 62.45, 31.43, 38.14, 50, 75.77, 88.14, 60.14, > 42.02, 36.79, 34.9, 46.33, 47.55, 35.67, 75.41, 28.6, 61.29, > 62.43, 59.08, 46.3, 84.56, 43.96, 91.68, 41.67) > > summary(lm(x~y)) > > Call: > lm(formula = x ~ y) > > Residuals: > > *** caught bus error *** > address 0x18, cause 'invalid alignment' > > Traceback: > 1: sort(x, partial = unique(c(lo, hi))) > 2: quantile.default(resid) > 3: quantile(resid) > 4: structure(quantile(resid), names = nam) > 5: print.summary.lm(list(call = lm(formula = x ~ y), terms = x ~ > y, residuals = c(-0.0990169973225879, 0.442597843688031, > 0.852002363105233, 0.550595790280227, 0.397266369114154, > 0.397197434926506, 0.170497520598225, 0.493863613052272, > 0.691317410416682, 0.468099457217023, 0.573507201772172, > 0.335523922927148, -0.736834541760754, -0.903503651131917, > -0.877903767920926, 0.0943505569140546, 0.370818730053123, > 0.366310076543096, 0.6119 > [snip] > > > > > -- > 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 > [[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
Re: [R] Plotting Data Frame
Hi That is default behaviour, see the help page pch - character string or vector of 1-characters or integers for plotting characters, see points. The first character is the plotting- character for the first plot, the second for the second, etc. The default is the digits (1 through 9, 0) then the letters. Use other options e.g. type, lty, pch if you want to modify appearance of the matplot output. Or use matlines. It seems to me that you are messing ts.plots and matplots. It is always good to follow posting guide and give a small, **reproducible** example which depicts what you did and explain how your atempts failed. Without your data it is hard to decide what you want and how you shall do it. Seems to me that plot(, ylim=) for (i in 6:18) { lines(time, data[,i]) } could be what you want but it is only a guess. HTH Petr On 27 Apr 2006 at 15:22, Ana Florencia Silbering wrote: From: "Ana Florencia Silbering" <[EMAIL PROTECTED]> To: "'Petr Pikal'" <[EMAIL PROTECTED]> Subject:RE: [R] Plotting Data Frame Date sent: Thu, 27 Apr 2006 15:22:46 +0200 > Thank you very much, unfortunatelly matplot doesn´t work. I tried: > x=c(1:13) time=matrix(x,ncol=13,nrow=1) matplot(time~data[1;6:18]) But > this gives out an a graph with the numbers from 1 to 10 and the > alphabet... I have tried all other options too. I think the problem is > that the structure of the data frame. Thanks again for your time. Ana > > --- > Ana Florencia Silbering > Departament of Biology - Universität Konstanz > Universitätsstraße 10 - M11 > D-78457 Konstanz > Germany > > Tel.: (+49 7531) 88 - 4642 > Fax: (+49 7531) 88 - 3894 > email: [EMAIL PROTECTED] > --- > > > -Original Message- > From: Petr Pikal [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 27, 2006 12:34 PM > To: Ana Florencia Silbering; r-help@stat.math.ethz.ch > Subject: Re: [R] Plotting Data Frame > > > Hi > > > On 27 Apr 2006 at 12:19, Ana Florencia Silbering wrote: > > From: "Ana Florencia Silbering" > <[EMAIL PROTECTED]> > To: > Date sent:Thu, 27 Apr 2006 12:19:51 +0200 > Subject: [R] Plotting Data Frame > > > Dear R community members, > > I think I am asking a very simple question, but I really looked up > > in the faqs and manuals and found nothing helpful. I am trying to > > plot a data frame with the following structure (this is just a small > > extract): > > > > glo conc odor line series X1 X2 X3 X4X5 > > X6 > > X7 X8 X9 X10 X11X12X13 > >10 AIR LN1 UP -0.488 -0.242 -0.143 0.008 0.142 0.075 > > -0.031 -0.077 0.095 -0.345 -0.187 0.201 0.524 > > 20 AIR LN1 UP 0.482 0.209 0.448 0.338 0.295 > > 0.140 > > 0.157 -0.043 -0.341 -0.601 -0.517 -0.335 0.070 > > 50 AIR LN1 UP -0.294 0.214 0.409 0.048 0.198 > > -0.081 > > 0.001 -0.005 -0.136 -0.572 -0.286 0.021 -0.042 > > 70 AIR LN1 UP -0.488 -0.203 0.104 -0.123 0.112 > > -0.140 > > 0.049 -0.016 -0.080 -0.130 0.105 0.272 0.882 > > 10 AIR LN2 UP -0.643 -0.038 -0.201 -0.089 0.113 > > -0.055 > > 0.013 0.012 -0.064 -0.063 0.123 0.002 -0.099 > > 20 AIR LN2 UP -0.510 0.364 0.619 0.565 0.634 > > 0.167 > > 0.209 -0.300 -0.615 -0.528 -0.400 -0.623 -0.312 > > 50 AIR LN2 UP 0.350 0.737 0.183 0.563 0.406 > > 0.169 > > -0.155 -0.189 0.036 0.051 0.297 0.014 -0.380 > > 70 AIR LN2 UP -0.450 -0.234 -0.526 -0.587 -0.068 > > -0.187 > > 0.124 0.070 0.141 0.159 0.356 0.505 0.648 > > > > Where the first 5 columns (glo, conc, odor, line, series) are > > different categorizing factors and the rest are values of a variable > > over time. I would like to plot the values of the independent > > variable > > > over time with one line for each of the groups defined by the > > categorical factors. I have tried something like extracting the time > > series for a particular group with, for example data[1,6:18] and > > plotting that against a vector time=c(1:13), but that does not > > work. > > Did you want > > matplot(time,data[,6:18]) > > or maybe combination plot and lines > or maybe xyplot from lattice package. > > HTH > Petr > > > > > Is there any way of making such a plot or should I rearrange the > > data so that time is also a factor specified by a column? > > > > Thank you very much in advance. > > Ana > > --- > > Ana Florencia Silbering > > Departament of Biology - Universität Konstanz Universitätsstraße 10 > > - M11 D-78457 Konstanz Germany > > > > Tel.: (+49 7531) 88 - 4642 > > Fax: (+49 7531) 88 - 3894 > > email: [EMAIL PROTECTED] > > --- > >
[R] summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
Hi [macOSX 10.4.6; R-2.3.0] I have encountered a difference in behaviour between R-2.2.1 and R-2.3.0 when performing a linear model. Transcript follows for R-2.3.0 (R-2.2.1 worked as expected). How to make R-2.3.0 perform as R-2.2.1 did? > dput(x) c(29.13, 29.88, 30.09, 29.99, 29.74, 29.64, 29.65, 29.7, 30.04, 29.89, 29.96, 29.65, 28.76, 28.41, 28.38, 29.55, 29.76, 29.75, 29.84, 29.85, 29.75, 29.99, 29.32, 29.38, 28.97, 28.48, 29.06, 28.74, 29.23, 29.16, 29.19, 29.23, 29.17, 29.25, 29.24, 29.22, 29.15, 29.15, 28.78, 29.28, 29.31, 29.44, 29.28, 29.47, 29.28, 29.32, 29.39, 29.27, 28.68, 28.73, 28.09, 28.19, 29.1, 29.1, 29.14, 29.48, 29.48, 29.39, 29.39, 29.22, 28.95, 29.11, 27.94, 28.32, 27.98, 28.22, 28.89, 29.4, 29.28, 29.66, 30.05, 30.12, 30.09, 29.85, 29.99, 29.92, 28.44, 28.92, 28.92, 28.94, 28.97, 28.95, 29.39, 29.26, 29.7, 29.48, 29.72, 29.71, 29.84, 29.59, 29.17, 29.39, 29.27, 29.39, 28.53, 29.32, 29.32, 28.44, 29.39, 28.55, 29.39, 29.46, 29.73, 30.01, 30.11, 30.25, 30.37, 30.22, 30.33, 30.35, 30.38, 30.25, 29.27, 27.34) > dput(y) c(36, 72.43, 37.57, 72.78, 55.88, 38.41, 79.79, 32, 56.92, 69.72, 63.53, 50.94, 82.82, 50.77, 41.05, 75.62, 64, 63.04, 35.83, 91.71, 93.29, 42.16, 65.57, 60.05, 27.38, 83.64, 67.6, 39, 53.21, 54.24, 49.58, 34.29, 81.5, 48.94, 64.84, 32.86, 66.71, 41.67, 42.27, 45.22, 51.23, 64.03, 58, 48.15, 59.8, 72.94, 40.33, 56.82, 32, 75.32, 49.25, 44.38, 27.5, 37, 40.22, 33.63, 43, 49.92, 36, 63.78, 41.74, 58.07, 37.5, 41.27, 54.28, 51.39, 49.92, 93, 33.75, 30.81, 102.31, 67.95, 64.48, 47, 33.56, 42.44, 44.25, 63.93, 38.92, 74.47, 58.46, 35.25, 94.45, 40.71, 38.35, 78.26, 65.1, 89.54, 43.34, 34.71, 37.83, 62.45, 31.43, 38.14, 50, 75.77, 88.14, 60.14, 42.02, 36.79, 34.9, 46.33, 47.55, 35.67, 75.41, 28.6, 61.29, 62.43, 59.08, 46.3, 84.56, 43.96, 91.68, 41.67) > summary(lm(x~y)) Call: lm(formula = x ~ y) Residuals: *** caught bus error *** address 0x18, cause 'invalid alignment' Traceback: 1: sort(x, partial = unique(c(lo, hi))) 2: quantile.default(resid) 3: quantile(resid) 4: structure(quantile(resid), names = nam) 5: print.summary.lm(list(call = lm(formula = x ~ y), terms = x ~ y, residuals = c(-0.0990169973225879, 0.442597843688031, 0.852002363105233, 0.550595790280227, 0.397266369114154, 0.397197434926506, 0.170497520598225, 0.493863613052272, 0.691317410416682, 0.468099457217023, 0.573507201772172, 0.335523922927148, -0.736834541760754, -0.903503651131917, -0.877903767920926, 0.0943505569140546, 0.370818730053123, 0.366310076543096, 0.6119 [snip] -- 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
[R] modelling heteroscedasticity in a randomized cluster model
Hello, Having a randomized cluster model and assuming heteroscedasticity at the second level, I like to estimate the variance components for the (two) different arms seperately. How can this been done (in R or S-Plus)? Kind regards, Elly Korendijk Department of Methodology and Statistics Faculty of Social Sciences Universiteit Utrecht Heidelberglaan 2, De Uithof P.O. Box 80140, 3508 TC Utrecht, The Netherlands Telephone: +31 30 253 14 90 / 44 38 Fax: +31 30 253 57 97 E-mail:[EMAIL PROTECTED] [[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
[R] package pamr: pamr.adapthresh() ---- Take 2!
Hi, Sorry about the earlier formatting errors... I was working on a classification problem using the pamr package. I used the pamr.adaptthresh() function to find the optimal accuracy of the classifier. I must not be doing it right, since it doesn't return the threshold values for optimum classification. For example,if I run it on a dataset, I get the following result using pamr.adaptthresh(): predicted true (1) (2) (1) 32 8 (2) 5 17 i.e a mis-classification of (5 + 8 ) / ( 32 + 8 + 5 + 17) However, if I just use an arbitrary threshold (in this case, I chose '2'), I get the following result: predicted true (1) (2) (1) 35 5 (2) 5 17 i.e a mis-classification of (5 + 5) / ( 32 + 8 + 5 + 17), which is clearly better than the one that I got from using pamr.adaptthresh(). Am I doing something wrong? What do I need to do to ensure that pamr.adaptthresh() returns the least mis-classification error rate? I have tried using different values for 'ntries', and 'reduction factor' in pamr.adaptthresh(), without any success. I have reproduced my code below. Any comments would be appreciated! thanks. ### CODE # library(multtest) # golub library(siggenes) # SAM library(e1071) # support vector m/c library(base) library(graphics) library(pamr) library(bootstrap) rm(list = ls()) gc() makeColon <- function(){ # This dataset has 24 cancer, and 9 normal samples n2 <- read.table("data/Colon.data",header = FALSE,sep = ",") cancdat <- n2[,n2[1,]== 'tumor'] normdat <- n2[,n2[1,]== 'normal'] cancdat <- cancdat[-1,] normdat <- normdat[-1,] mat <- as.matrix(cbind(cancdat,normdat)) actclass <- rep(c(1, 2), c(ncol(cancdat), ncol(normdat))) return(list(mat,actclass)) } m <- makeColon() mat <- m[[1]] actclass <- m[[2]] mat <- matrix(as.numeric(mat),nrow(mat),ncol(mat)) geneid = as.character(1:nrow(mat)) gs = as.character(1:nrow(mat)) mydata <- list(x= mat,y=factor(actclass),geneid = geneid ,genenames=gs) mytrain <- pamr.train(mydata) new.scales <- pamr.adaptthresh(mytrain,ntries = 10, reduction.factor = 0.9) mytrain2 <- pamr.train(mydata,threshold.scale = new.scales) mycv <- pamr.cv(mytrain2,mydata,nfold = 10) res1 <- pamr.confusion(mycv, threshold = mytrain2$threshold.scale,extra = FALSE) print(res1) res2 <- pamr.confusion(mycv, threshold = 2,extra = FALSE) print(res2) ### END CODE ### - [[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
[R] package pamr: pamr.adaptthresh() error rates
Hi, I was working on a classification problem using the pamr package. I used the pamr.adaptthresh() function to find the optimal accuracy of the classifier. I must not be doing it right, since it doesn't return the threshold values for optimum classification. For example,if I run it on a dataset, I get the following result using pamr.adaptthresh(): predicted true (1) (2) (1) 32 8 (2) 5 17 i.e a mis-classification of (5 + 8 ) / ( 32 + 8 + 5 + 17) However, if I just use an arbitrary threshold (in this case, I chose '2'), I get the following result: predicted true (1) (2) (1) 35 5 (2) 5 17 i.e a mis-classification of (5 + 5) / ( 32 + 8 + 5 + 17), which is clearly better than the one that I got from using pamr.adaptthresh(). Am I doing something wrong? What do I need to do to ensure that pamr.adaptthresh() returns the least mis-classification error rate? I have tried using different values for 'ntries', and 'reduction factor' in pamr.adaptthresh(), without any success. I have reproduced my code below. Any comments would be appreciated! thanks. ### CODE # library(base) library(graphics) library(pamr) rm(list = ls()) gc()makeColon <- function(){# This dataset has 24 cancer, and 9 normal samples n2 <- read.table("data/Colon.data",header = FALSE,sep = ",") cancdat <- n2[,n2[1,]== 'tumor'] normdat <- n2[,n2[1,]== 'normal'] cancdat <- cancdat[-1,] normdat <- normdat[-1,] mat <- as.matrix(cbind(cancdat,normdat)) actclass <- rep(c(1, 2), c(ncol(cancdat), ncol(normdat))) return(list(mat,actclass))} m <- makeColon() mat <- m[[1]] actclass <- m[[2]] mat <- matrix(as.numeric(mat),nrow(mat),ncol(mat)) geneid = as.character(1:nrow(mat)) gs = as.character(1:nrow(mat)) mydata <- list(x= mat,y=factor(actclass),geneid = geneid ,genenames=gs) mytrain <- pamr.train(mydata) new.scales <- pamr.adaptthresh(mytrain,ntries = 10, reduction.factor = 0.9) mytrain2 <- pamr.train(mydata,threshold.scale = new.scales) mycv <- pamr.cv(mytrain2,mydata,nfold = 10) res1 <- pamr.confusion(mycv, threshold = mytrain2$threshold.scale,extra = FALSE) print(res1) res2 <- pamr.confusion(mycv, threshold = 2,extra = FALSE) print(res2) ### END CODE ### - [[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
[R] losing x-label when exporting to PNG
I have a simple barplot that looks fine in the R graphics device window. However when I export it to png I am losing the x-label. It must be an obvious problem but I cannot see it. Trying to resize the plot does not seem to help. Code is below. Any help gratefully received. ## Start Code Groups <-c(21.8,45, 43, 17.2, 8.3, 18) names(Groups) <- c("Exeter", "Halifax", "Moosonee", "Ottawa", "Montréal", "Saskatoon") # Here we are setting the font to Bold and addin some lines to the bottom # margin of the graph, 6 vs default of 5, to give us more room with the angled # labels. par(font=2,mar= (c(6, 4, 4, 2) + 0.1)) Mycolours <- c("red", "blue", "green", "yellow", "orange" ,"purple") # --plot to screen -- mp <- barplot(Groups, beside=T , horiz=F , las=1, ylim=c(0,60), axisnames=F, font.lab=2, col=Mycolours ) text(mp, par("usr")[3] - 1.5, srt = 45, adj = 1, labels = names(Groups), xpd = T , cex=.75, ) mtext(side = 1, line=5, text="% of Services above thresholds ") mtext(side=2, line=2.5, text="Percent") title(main="") box() # ---plot to png file-- png('gr_%04d.png', width=600, height=400) mp <- barplot(Groups, beside=T , horiz=F , las=1, ylim=c(0,60), axisnames=F, font.lab=2, col=Mycolours ) text(mp, par("usr")[3] - 1.5, srt = 45, adj = 1, labels = names(Groups), xpd = T , cex=.75, ) mtext(side = 1, line=5, text="% of Services above thresholds ") mtext(side=2, line=2.5, text="Percent") title(main="") box() dev.off() End 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
[R] pamr package: pamr.adaptthresh() error rates
Hi, I was working on a classification problem using the pamr package. I used the pamr.adaptthresh() function to find the optimal accuracy of the classifier. I must not be doing it right, since it doesn't return the threshold values for optimum classification. For example,if I run it on a dataset, I get the following result using pamr.adaptthresh(): predicted true (1) (2) (1) 32 8 (2) 5 17 i.e a mis-classification of (5 + 8 ) / ( 32 + 8 + 5 + 17) However, if I just use an arbitrary threshold (in this case, I chose '2'), I get the following result: predicted true (1) (2) (1) 35 5 (2) 5 17 i.e a mis-classification of (5 + 5) / ( 32 + 8 + 5 + 17), which is clearly better than the one that I got from using pamr.adaptthresh(). Am I doing something wrong? What do I need to do to ensure that pamr.adaptthresh() returns the least mis-classification error rate? I have tried using different values for 'ntries', and 'reduction factor' in pamr.adaptthresh(), without any success. I have reproduced my code below. Any comments would be appreciated! thanks. ### CODE # library(multtest) # golub library(siggenes) # SAM library(e1071) # support vector m/c library(base) library(graphics) library(pamr) library(bootstrap) rm(list = ls()) gc() makeColon <- function(){ # This dataset has 24 cancer, and 9 normal samples n2 <- read.table("data/Colon.data",header = FALSE,sep = ",") cancdat <- n2[,n2[1,]== 'tumor'] normdat <- n2[,n2[1,]== 'normal'] cancdat <- cancdat[-1,] normdat <- normdat[-1,] mat <- as.matrix(cbind(cancdat,normdat)) actclass <- rep(c(1, 2), c(ncol(cancdat), ncol(normdat))) return(list(mat,actclass)) } m <- makeColon() mat <- m[[1]] actclass <- m[[2]] mat <- matrix(as.numeric(mat),nrow(mat),ncol(mat)) geneid = as.character(1:nrow(mat)) gs = as.character(1:nrow(mat)) mydata <- list(x= mat,y=factor(actclass),geneid = geneid ,genenames=gs) mytrain <- pamr.train(mydata) new.scales <- pamr.adaptthresh(mytrain,ntries = 10, reduction.factor = 0.9) mytrain2 <- pamr.train(mydata,threshold.scale = new.scales) mycv <- pamr.cv(mytrain2,mydata,nfold = 10) res1 <- pamr.confusion(mycv, threshold = mytrain2$threshold.scale,extra = FALSE) print(res1) res2 <- pamr.confusion(mycv, threshold = 2,extra = FALSE) print(res2) ### END CODE ### - [[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
Re: [R] gmane?
Assuming you are aware that the dir pages at gmane provide the key links for each group, googling for: dir gmane r-help gets it as the first hit. On 4/27/06, Jose Quesada <[EMAIL PROTECTED]> wrote: > Thanks all, > > It was very surprising that I couldn't find it. I searched > news.gmane.orgfor r-help, and nothing popped up. > > -Jose > > > On 4/27/06, Sundar Dorai-Raj <[EMAIL PROTECTED]> wrote: > > > > > > Jose Quesada wrote: > > > Hi All, > > > > > > I recently found gmane > > > > > > http://gmane.org/ > > > > > > It's a system to covert mail to news and back, with the nice property of > > > keeping > > > a searchable archive... Very convenient if you are subscribed to many > > lists > > > and > > > don't want to have your mail box cluttered. I use it to read several > > mailing > > > lists already, but R is not available there. > > > > > > I wonder if the admins know about gmane and if they think it'd be a good > > > idea to > > > have R-help added there. Quoting from their site: > > > > > > "To get a new mailing list added, use the subscription form. Almost any > > > mailing > > > list can be added. Just include subscription information. Mailing list > > > archives > > > can be imported into Gmane." > > > > > > What do you think? > > > -- > > > Cheers, > > > -Jose > > > -- > > > Jose Quesada, PhD. > > > > > > [EMAIL PROTECTED] Dept. of Psychology > > > http://www.andrew.cmu.edu/~jquesada Sussex University > > > Brighton, UK > > > > > > [[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 > > > > R-help is already there. > > > > Go to http://www.r-project.org/ and click the "Search" link. There's a > > link to Gmane there. The relevant group for R-help is called > > gmane.comp.lang.r.general. > > > > I agree that Gmane is very useful. > > > > --sundar > > > > > > -- > Cheers, > -Jose > -- > Jose Quesada, PhD. > > [EMAIL PROTECTED] Dept. of Psychology > http://www.andrew.cmu.edu/~jquesada Sussex University > Brighton, UK > >[[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 > __ 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
Re: [R] gmane?
Thanks all, It was very surprising that I couldn't find it. I searched news.gmane.orgfor r-help, and nothing popped up. -Jose On 4/27/06, Sundar Dorai-Raj <[EMAIL PROTECTED]> wrote: > > > Jose Quesada wrote: > > Hi All, > > > > I recently found gmane > > > > http://gmane.org/ > > > > It's a system to covert mail to news and back, with the nice property of > > keeping > > a searchable archive... Very convenient if you are subscribed to many > lists > > and > > don't want to have your mail box cluttered. I use it to read several > mailing > > lists already, but R is not available there. > > > > I wonder if the admins know about gmane and if they think it'd be a good > > idea to > > have R-help added there. Quoting from their site: > > > > "To get a new mailing list added, use the subscription form. Almost any > > mailing > > list can be added. Just include subscription information. Mailing list > > archives > > can be imported into Gmane." > > > > What do you think? > > -- > > Cheers, > > -Jose > > -- > > Jose Quesada, PhD. > > > > [EMAIL PROTECTED] Dept. of Psychology > > http://www.andrew.cmu.edu/~jquesada Sussex University > > Brighton, UK > > > > [[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 > > R-help is already there. > > Go to http://www.r-project.org/ and click the "Search" link. There's a > link to Gmane there. The relevant group for R-help is called > gmane.comp.lang.r.general. > > I agree that Gmane is very useful. > > --sundar > -- Cheers, -Jose -- Jose Quesada, PhD. [EMAIL PROTECTED] Dept. of Psychology http://www.andrew.cmu.edu/~jquesada Sussex University Brighton, UK [[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
Re: [R] plot cdf
I think curve is one option. for example , I can use "curve(pnorm,-5,5)" to plot the normal cdf. use ?curve to get the usage. 2006/4/27, Nongluck Klibbua <[EMAIL PROTECTED]>: > hi, > I would like to know what is the function to plot cdf. > Thanks, > Luck > > __ > 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 > -- 黄荣贵 Deparment of Sociology Fudan University __ 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
Re: [R] [Rd] as.factor: changed behaviour for Date class
The change is not in as.factor: it is in sort (as called by factor) and it is documented in the NEWS file. Why do you expect as.factor to convert a Date object to character and then to factor? Please do the conversion explicitly. On Thu, 27 Apr 2006, Antonio, Fabio Di Narzo wrote: > Dear all, > I have noticed a little change in the behaviour of as.factor from R-2.2.1 to > R-2.3.0, and can't find it in the NEWS. > > In R-2.3.0: >> times <- 1:5 >> class(times) <- "Date" >> as.factor(times) > [1] 1 2 3 4 5 > Levels: 1 2 3 4 5 > > In R-2.2.1: >> as.factor(times) > [1] 1970-01-02 1970-01-03 1970-01-04 1970-01-05 1970-01-06 > Levels: 1970-01-02 1970-01-03 1970-01-04 1970-01-05 1970-01-06 > > Is this the intended behaviour? > Note that the change is reflected on other functions which seems to use > as.factor internally, for example 'tapply'. > Consider the following code: > > times <- 1:5 > class(times) <- "Date" > id <- rep(times, each=2) > vals <- rep(1:2,5) > tapply(vals, id, mean) > > Under R-2.2.1 this gives: > 1970-01-02 1970-01-03 1970-01-04 1970-01-05 1970-01-06 > 1.51.51.51.51.5 > > But under R-2.3.0 the output is: > 1 2 3 4 5 > 1.5 1.5 1.5 1.5 1.5 > > Antonio, Fabio Di Narzo. > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > -- 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
[R] problems with "compareTreecalcs" function
Hi, I created an rpart object using 10-fold cross validation while creating the tree. What i wish i could do now is to compare estimated cross-validation error rates between different selection rules, for an approximately equal random division of the data into a training and test set. I eventually found the function "compareTreecalcs", within the package DAAG. However, apparently this function does not work... either i get some unexpected problems with the length of the data (nonetheless, the same formual DOES work with rpart) or an invalid prediction error. Any suggestions? i would appreciate it if you could give me some hints. Thanks in advance for the answer and the precious time you might waste... Giorgio Chiacchiera con i tuoi amici in tempo reale! http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com [[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
Re: [R] gmane?
Jose Quesada wrote: > Hi All, > > I recently found gmane > > http://gmane.org/ > > It's a system to covert mail to news and back, with the nice property of > keeping > a searchable archive... Very convenient if you are subscribed to many lists > and > don't want to have your mail box cluttered. I use it to read several mailing > lists already, but R is not available there. > > I wonder if the admins know about gmane and if they think it'd be a good > idea to > have R-help added there. Quoting from their site: > > "To get a new mailing list added, use the subscription form. Almost any > mailing > list can be added. Just include subscription information. Mailing list > archives > can be imported into Gmane." > > What do you think? > -- > Cheers, > -Jose > -- > Jose Quesada, PhD. > > [EMAIL PROTECTED] Dept. of Psychology > http://www.andrew.cmu.edu/~jquesada Sussex University > Brighton, UK > > [[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 R-help is already there. Go to http://www.r-project.org/ and click the "Search" link. There's a link to Gmane there. The relevant group for R-help is called gmane.comp.lang.r.general. I agree that Gmane is very useful. --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
Re: [R] gmane?
They can be found here: http://dir.gmane.org/gmane.comp.lang.r.announce Announcements about the development of the R Project for Statistical Computing and the availability of new code. (read-only) http://dir.gmane.org/gmane.comp.lang.r.deal Learning Bayesian networks in R - the 'deal' package http://dir.gmane.org/gmane.comp.lang.r.debian Discussion of the Debian port of the statistical software GNU R http://dir.gmane.org/gmane.comp.lang.r.devel R language developers list http://dir.gmane.org/gmane.comp.lang.r.general The `main' R mailing list, a language and environment for statistical computing and graphics. http://dir.gmane.org/gmane.comp.lang.r.geo Discussion of geographical data in the statistical software GNU R http://dir.gmane.org/gmane.comp.lang.r.gr R Special Interest Group on gRaphical models http://dir.gmane.org/gmane.comp.lang.r.gui Discussion of the Graphical User Interface for the statistical software GNU R http://dir.gmane.org/gmane.comp.lang.r.mac R Special Interest Group on Macintosh Development and Porting, both for MacOS 8.6 - 9.x and MacOS X http://dir.gmane.org/gmane.comp.lang.r.r-metrics Mailing list for discussions relating to use of GNU R in 'finance', i.e. financial engineering, financial economics, empirical finance, computational finance, ... On 4/27/06, Jose Quesada <[EMAIL PROTECTED]> wrote: > Hi All, > > I recently found gmane > > http://gmane.org/ > > It's a system to covert mail to news and back, with the nice property of > keeping > a searchable archive... Very convenient if you are subscribed to many lists > and > don't want to have your mail box cluttered. I use it to read several mailing > lists already, but R is not available there. > > I wonder if the admins know about gmane and if they think it'd be a good > idea to > have R-help added there. Quoting from their site: > > "To get a new mailing list added, use the subscription form. Almost any > mailing > list can be added. Just include subscription information. Mailing list > archives > can be imported into Gmane." > > What do you think? > -- > Cheers, > -Jose > -- > Jose Quesada, PhD. > > [EMAIL PROTECTED] Dept. of Psychology > http://www.andrew.cmu.edu/~jquesada Sussex University > Brighton, UK > >[[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 > __ 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
Re: [R] gmane?
"Jose Quesada" <[EMAIL PROTECTED]> writes: > Hi All, > > I recently found gmane > > http://gmane.org/ > > It's a system to covert mail to news and back, with the nice property of > keeping > a searchable archive... Very convenient if you are subscribed to many lists > and > don't want to have your mail box cluttered. I use it to read several mailing > lists already, but R is not available there. > > I wonder if the admins know about gmane and if they think it'd be a good > idea to > have R-help added there. Quoting from their site: > > "To get a new mailing list added, use the subscription form. Almost any > mailing > list can be added. Just include subscription information. Mailing list > archives > can be imported into Gmane." > > What do you think? Tried gmane.comp.lang.r.* ?? -- 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
Re: [R] Plotting Data Frame
Hi On 27 Apr 2006 at 12:19, Ana Florencia Silbering wrote: From: "Ana Florencia Silbering" <[EMAIL PROTECTED]> To: Date sent: Thu, 27 Apr 2006 12:19:51 +0200 Subject:[R] Plotting Data Frame > Dear R community members, > I think I am asking a very simple question, but I really looked up in > the faqs and manuals and found nothing helpful. I am trying to plot a > data frame with the following structure (this is just a small > extract): > > glo conc odor line series X1 X2 X3 X4X5 X6 > X7 X8 X9 X10 X11X12X13 >10 AIR LN1 UP -0.488 -0.242 -0.143 0.008 0.142 0.075 > -0.031 -0.077 0.095 -0.345 -0.187 0.201 0.524 > 20 AIR LN1 UP 0.482 0.209 0.448 0.338 0.295 0.140 > 0.157 -0.043 -0.341 -0.601 -0.517 -0.335 0.070 > 50 AIR LN1 UP -0.294 0.214 0.409 0.048 0.198 -0.081 > 0.001 -0.005 -0.136 -0.572 -0.286 0.021 -0.042 > 70 AIR LN1 UP -0.488 -0.203 0.104 -0.123 0.112 -0.140 > 0.049 -0.016 -0.080 -0.130 0.105 0.272 0.882 > 10 AIR LN2 UP -0.643 -0.038 -0.201 -0.089 0.113 -0.055 > 0.013 0.012 -0.064 -0.063 0.123 0.002 -0.099 > 20 AIR LN2 UP -0.510 0.364 0.619 0.565 0.634 0.167 > 0.209 -0.300 -0.615 -0.528 -0.400 -0.623 -0.312 > 50 AIR LN2 UP 0.350 0.737 0.183 0.563 0.406 0.169 > -0.155 -0.189 0.036 0.051 0.297 0.014 -0.380 > 70 AIR LN2 UP -0.450 -0.234 -0.526 -0.587 -0.068 -0.187 > 0.124 0.070 0.141 0.159 0.356 0.505 0.648 > > Where the first 5 columns (glo, conc, odor, line, series) are > different categorizing factors and the rest are values of a variable > over time. I would like to plot the values of the independent variable > over time with one line for each of the groups defined by the > categorical factors. I have tried something like extracting the time > series for a particular group with, for example data[1,6:18] and > plotting that against a vector time=c(1:13), but that does not work. Did you want matplot(time,data[,6:18]) or maybe combination plot and lines or maybe xyplot from lattice package. HTH Petr > Is there any way of making such a plot or should I rearrange the data > so that time is also a factor specified by a column? > > Thank you very much in advance. > Ana > --- > Ana Florencia Silbering > Departament of Biology - Universität Konstanz > Universitätsstraße 10 - M11 > D-78457 Konstanz > Germany > > Tel.: (+49 7531) 88 - 4642 > Fax: (+49 7531) 88 - 3894 > email: [EMAIL PROTECTED] > --- > > > [[alternative HTML version deleted]] > > Petr Pikal [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
[R] as.factor: changed behaviour for Date class
Dear all, I have noticed a little change in the behaviour of as.factor from R-2.2.1 to R-2.3.0, and can't find it in the NEWS. In R-2.3.0: > times <- 1:5 > class(times) <- "Date" > as.factor(times) [1] 1 2 3 4 5 Levels: 1 2 3 4 5 In R-2.2.1: > as.factor(times) [1] 1970-01-02 1970-01-03 1970-01-04 1970-01-05 1970-01-06 Levels: 1970-01-02 1970-01-03 1970-01-04 1970-01-05 1970-01-06 Is this the intended behaviour? Note that the change is reflected on other functions which seems to use as.factor internally, for example 'tapply'. Consider the following code: times <- 1:5 class(times) <- "Date" id <- rep(times, each=2) vals <- rep(1:2,5) tapply(vals, id, mean) Under R-2.2.1 this gives: 1970-01-02 1970-01-03 1970-01-04 1970-01-05 1970-01-06 1.51.51.51.51.5 But under R-2.3.0 the output is: 1 2 3 4 5 1.5 1.5 1.5 1.5 1.5 Antonio, Fabio Di Narzo. [[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
[R] gmane?
Hi All, I recently found gmane http://gmane.org/ It's a system to covert mail to news and back, with the nice property of keeping a searchable archive... Very convenient if you are subscribed to many lists and don't want to have your mail box cluttered. I use it to read several mailing lists already, but R is not available there. I wonder if the admins know about gmane and if they think it'd be a good idea to have R-help added there. Quoting from their site: "To get a new mailing list added, use the subscription form. Almost any mailing list can be added. Just include subscription information. Mailing list archives can be imported into Gmane." What do you think? -- Cheers, -Jose -- Jose Quesada, PhD. [EMAIL PROTECTED] Dept. of Psychology http://www.andrew.cmu.edu/~jquesada Sussex University Brighton, UK [[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
[R] Plotting Data Frame
Dear R community members, I think I am asking a very simple question, but I really looked up in the faqs and manuals and found nothing helpful. I am trying to plot a data frame with the following structure (this is just a small extract): glo conc odor line series X1 X2 X3 X4X5 X6 X7 X8 X9 X10 X11X12X13 10 AIR LN1 UP -0.488 -0.242 -0.143 0.008 0.142 0.075 -0.031 -0.077 0.095 -0.345 -0.187 0.201 0.524 20 AIR LN1 UP 0.482 0.209 0.448 0.338 0.295 0.140 0.157 -0.043 -0.341 -0.601 -0.517 -0.335 0.070 50 AIR LN1 UP -0.294 0.214 0.409 0.048 0.198 -0.081 0.001 -0.005 -0.136 -0.572 -0.286 0.021 -0.042 70 AIR LN1 UP -0.488 -0.203 0.104 -0.123 0.112 -0.140 0.049 -0.016 -0.080 -0.130 0.105 0.272 0.882 10 AIR LN2 UP -0.643 -0.038 -0.201 -0.089 0.113 -0.055 0.013 0.012 -0.064 -0.063 0.123 0.002 -0.099 20 AIR LN2 UP -0.510 0.364 0.619 0.565 0.634 0.167 0.209 -0.300 -0.615 -0.528 -0.400 -0.623 -0.312 50 AIR LN2 UP 0.350 0.737 0.183 0.563 0.406 0.169 -0.155 -0.189 0.036 0.051 0.297 0.014 -0.380 70 AIR LN2 UP -0.450 -0.234 -0.526 -0.587 -0.068 -0.187 0.124 0.070 0.141 0.159 0.356 0.505 0.648 Where the first 5 columns (glo, conc, odor, line, series) are different categorizing factors and the rest are values of a variable over time. I would like to plot the values of the independent variable over time with one line for each of the groups defined by the categorical factors. I have tried something like extracting the time series for a particular group with, for example data[1,6:18] and plotting that against a vector time=c(1:13), but that does not work. Is there any way of making such a plot or should I rearrange the data so that time is also a factor specified by a column? Thank you very much in advance. Ana --- Ana Florencia Silbering Departament of Biology - Universität Konstanz Universitätsstraße 10 - M11 D-78457 Konstanz Germany Tel.: (+49 7531) 88 - 4642 Fax: (+49 7531) 88 - 3894 email: [EMAIL PROTECTED] --- [[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
Re: [R] What are the differences between ACF and PACF in time seriesanalysis?
Hello Michael, see as an online resource: http://www.statsoft.com/textbook/sttimser.html or get hold on a time series analysis textbook, like one of the monographies written by Hamilton; Luetkepohl; Brockwell & Davis; Harvey or Box & Jenkins, to name but a few. In a nutshell, PACF 'eliminates' intermediate autocorrelations compared to ACF, e.g. an AR(1) process will ordinarily have a slowly decaying ACF and a single spike in the PACF at lag 1. Both are utilised in the process of order determination in the context of the Box-Jenkins approach for time series modelling. Best, Bernhard Hi all, I am desperately looking for answer to my previous question: what are the differences between ACF and PACF in time series and their applications? I got confused a lot by these two functions in R... Already having ACF, why do people decide to create PACF? Thanks a lot [[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 * Confidentiality Note: The information contained in this mess...{{dropped}} __ 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
Re: [R] Memory usage and limit
R character vectors are stored as a list of character strings. On a 64-bit system, each string has an overhead of about 64 bytes. R nowadays shares strings if they are the same, but only for the first 'few': it gives up after 10,000 distinct strings. Nevertheless, for many distinct short strings this is very inefficient. On Wed, 26 Apr 2006, Min Shao wrote: > Hello everyone, > > I recently made a 64-bit build of R-2.2.1 under Solaris 9 using gcc v.3.4.2. That's an inadvisable version of gcc, with a bug in g77 which affects some R packages. > The server has 12GB memory, 6 Sparc CPUs and plenty of swap space. I was the > only user at the time of the following experiment. > > I wanted to benchmark R's capability to read large data files and used a > data set consisting of 2MM records with 65 variables in each row. All but 2 > of the variables are of the character type and the other two are numeric. > The whole data set is about 600 MB when stored as plain ASCII file. > > The following code was used in the benchmarking runs: > > c = list(var1=0, var2=0, var3="", var4="", .var65="") > A <- scan("test.dat", skip = 1, sep = ",", what = c, nmax=X, > quiet=FALSE) > summary(A) > where = 100 or 200 > > I made two runs with nmax=100 and nmax=200 respectively. The first > run completed successfully, in about hour of CPU time. However, the actual > memory usage exceeded 2.2GB, about 7 times of the acutal file size on disk. > The second run aborted when the memory usage reached 4GB. The error messgae > is "vector memory exhausted (limit reached?)". > > Three questions: > 1) Why were so much memory and CPU consumed to read 300MB of data? Since > almost all of the variables are character, I expected almost of 1-1 mapping > between file size on disk and that in memory > 2) Since this is a 64-bit build, I expected it could handle more than the > 600MB of data I used. What does the error message mean? I don't beleive the > vector length exceeded the theoretic limit of about 1 billion. > 3) The original file was compressed and I had to uncompress it before the > experiement. Is there a way to read compressed files directly in R > > Thanks so much for your help. > > Min > > [[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 > -- 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
Re: [R] ordered boxplots
you could use the 'at' argument of boxplot(), e.g., y <- c(sapply(c(10, -5, -10, 5, 0), rnorm, n = 100, sd = 1)) gr <- gl(5, 100, labels = LETTERS[1:5]) boxplot(y ~ gr, at = rank(tapply(y, gr, median))) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: "Thomas Hoffmann" <[EMAIL PROTECTED]> To: Sent: Thursday, April 27, 2006 10:36 AM Subject: [R] ordered boxplots > Dear List-Members, > > I would like to produce a ordered boxplot in which the categories > with > the smallest median are plotted at the left end and the box with the > largest median at the right. > > Thanks in advance for any advices > Thomas H. > > __ > 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 > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ 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
Re: [R] ordered boxplots
boxplot(count ~ spray, data = InsectSprays, col = "lightgray", at=with(InsectSprays, rank(tapply(count, spray, median Chuck Cleland a écrit : > ?reorder.factor shows the follwing example: > > bymedian <- with(InsectSprays, reorder(spray, count, median)) > > boxplot(count ~ bymedian, data = InsectSprays, > xlab = "Type of spray", ylab = "Insect count", > main = "InsectSprays data", varwidth = TRUE, > col = "lightgray") > > Thomas Hoffmann wrote: > >>Dear List-Members, >> >>I would like to produce a ordered boxplot in which the categories with >>the smallest median are plotted at the left end and the box with the >>largest median at the right. >> >>Thanks in advance for any advices >>Thomas H. >> >>__ >>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 >> > > -- --- [EMAIL PROTECTED] CNRS UMR 8090 - http://www-good.ibl.fr Génomique et physiologie moléculaire des maladies métaboliques I.B.L 2eme etage - 1 rue du Pr Calmette, B.P.245, 59019 Lille Cedex Tel : 33 (0)3.20.87.10.44 Fax : 33 (0)3.20.87.10.31 __ 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
Re: [R] ordered boxplots
?reorder.factor shows the follwing example: bymedian <- with(InsectSprays, reorder(spray, count, median)) boxplot(count ~ bymedian, data = InsectSprays, xlab = "Type of spray", ylab = "Insect count", main = "InsectSprays data", varwidth = TRUE, col = "lightgray") Thomas Hoffmann wrote: > Dear List-Members, > > I would like to produce a ordered boxplot in which the categories with > the smallest median are plotted at the left end and the box with the > largest median at the right. > > Thanks in advance for any advices > Thomas H. > > __ > 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 > -- 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
[R] ordered boxplots
Dear List-Members, I would like to produce a ordered boxplot in which the categories with the smallest median are plotted at the left end and the box with the largest median at the right. Thanks in advance for any advices Thomas H. __ 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
Re: [R] R for Mac OS X: 10.3.9 is obsolete?
"iit512" <[EMAIL PROTECTED]> writes: > Dear all, > > I am highly disappointed of the following decision: > > === ... Starting with R 2.3.0, CRAN binaries support Mac OS X 10.4 > (Tiger) and higher only. === > > Of course, > > === It is, however, possible to compile binaries for earlied OS X > versions from sources. === > > But the process, described on > http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Building-R-from-sources > consists of more than 9 steps and is much more complex than > installing R for Linux. And I think that most Mac users (like their > Windows colleagues) cannot compile any application from source... > > Even worse, I also suspect (there is no information, actually) that > from R 2.3.0 there will not be precompiled binaries of R packages > for Mac OS X < 10.4 in CRAN :-(( Once the tools are in place, it doesn't really look much different from the Linux process. One little hitch is that the current instructions don't tell you how to get a Fortran compiler except from the 2.3.x binaries, which is a bit of a catch-22. > So, the question is, is there any volunteers who could produce R > binaries for Mac OS X 10.3.9? Since it will be "unofficial", I will > provide the Web space. I don't think alternative web space is necessary. There's no rule that CRAN binaries have to be made by the core team, and some of the Linux versions aren't. The real problem is whether anyone wants to lock their precious Macs to an obsolete version of the OS... > With best wishes and regards, > > Alexey Shipunov -- 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
Re: [R] plotting multiple graphs in a single plot
you should use: plot(X, Y1, type='l', col='red', ylim = range(Y1, Y2, Y3)) lines(X, Y2, col='green') lines(X, Y3, col='blue') I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Thursday, April 27, 2006 6:06 AM Subject: [R] plotting multiple graphs in a single plot > Hi, > > I would like to plot multiple graphs in a single plot > frame. Something like this: > > plot(X, Y1, type='l', col='red') > lines(X, Y2, col='green') > lines(X, Y3, col='blue') > > etc. The problem with this approach is, however, that > the range of the y-axis will be set according to the > minimum and maximum values of Y1 only. I would like to > generate a plot that shows all the values of Y1, Y2, > and Y3, no matter what their ranges are. > > Is there an easy way to do this? > > Thanks > Klaus > > __ > 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 > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ 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
Re: [R] help
Hi I agree with Dieter. I think you are probably looking for some aggregation function (aggregate, tapply, by,...), but it is only a guess. Sometimes it help me to answer my questions myself before I actually post it to Rhelp when I try to elaborate an example using artificial simple data for others to understand what I am trying to do and how I fail. HTH Petr On 27 Apr 2006 at 6:20, Dieter Menne wrote: To: r-help@stat.math.ethz.ch From: Dieter Menne <[EMAIL PROTECTED]> Date sent: Thu, 27 Apr 2006 06:20:44 + (UTC) Subject:Re: [R] help > Anamika Chaudhuri yahoo.com> writes: > > > I was trying to calculate an age adjusted rate for which we have > > the > formula as > > sum(weight*rate)/sum(weight). I am using the framingham dataset > > called fram > here.I cant figure out how I > > could change the logical statement I have for the standard dataset > > (in red) > to calculate weight and > > calculating the wevents and atrisk(in red) > > ... lengthy code follows > > If you want to get an answer, provide as good subject line and a data > set (e.g. part of Framingham). Nobody loves to wade through so many > lines of code without the chance to check out what is intended. > > Dieter > > __ > 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 Petr Pikal [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
[R] R for Mac OS X: 10.3.9 is obsolete?
Dear all, I am highly disappointed of the following decision: === ... Starting with R 2.3.0, CRAN binaries support Mac OS X 10.4 (Tiger) and higher only. === Of course, === It is, however, possible to compile binaries for earlied OS X versions from sources. === But the process, described on http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Building-R-from-sources consists of more than 9 steps and is much more complex than installing R for Linux. And I think that most Mac users (like their Windows colleagues) cannot compile any application from source... Even worse, I also suspect (there is no information, actually) that from R 2.3.0 there will not be precompiled binaries of R packages for Mac OS X < 10.4 in CRAN :-(( So, the question is, is there any volunteers who could produce R binaries for Mac OS X 10.3.9? Since it will be "unofficial", I will provide the Web space. With best wishes and regards, Alexey Shipunov __ 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
[R] RMSE vs. RMSD
Hi R users This is not related to R but general stats terms. I f any one help me to figure out how they differ and when I need to use which one, i will appreciate it. I read several simulation studies and found that RMSE (Root Mean Square Error) and RMSD (Root Mean Square Difference) appered to be used interchangeablely. The formula for calculating for both RMSE and RMSD are, to me, the same. Are they the same or am I misunderstood ? TM __ 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