Re: [R] is there a formatted output in R?
Dear Andy and Michael, Please stick to the posting guide of this list... i.e. Be tolerant. Rudeness is never warranted, but sometimes `read the manual' is the appropriate response. Don't waste time discussing such matters on the list. Robert Duval On 3/11/06, Liaw, Andy [EMAIL PROTECTED] wrote: From: Michael Thank you for your reminder! I think you don't have to tell me to read the document. I beg to differ. I'd bet many here do feel you need to read the documentations more carefully. I have done that many times already. My feeling after reading the creating package manual is that my god, this job needs a Computer Science degree to do it. It is way too complicated. If an amateur like me can do it, I'm quite sure a CS degree is not needed. How many packages available on CRAN do you think were created by those with CS degrees? How many in R Core do you think have CS degrees? There should be simpler ways. There are, and this question has been asked and answered many times over on this very list. Please do learn to search the archive, as the posting guide asks you to. Andy __ 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] tapply with unequal length of arguments
Hi everyone, Is it possible to use tapply(x,y,mean) if not all groups of x by y are of the same length (for example if you have one missing observation)? I tried tapply(x,y,mean,na.omit=T) but it doesn't work! Steffi -- - Stefanie von Felten Doktorandin ETH Zürich Institut für Pflanzenwissenschaften ETH Zentrum, LFW A 2 Telefon: 044 632 85 97 Telefax: 044 632 11 53 e-mail: [EMAIL PROTECTED] http://www.ipw.agrl.ethz.ch/~svfelten/ und: Universität Zürich Institut für Umweltwissenschaften Winterthurerstrasse 190 8057 Zürich Telefon: 044 635 61 23 Telefax: 044 635 57 11 e-mail: [EMAIL PROTECTED] http://www.unizh.ch/uwinst/homepages/steffi.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] how to load files from a directory?
Hello. I have a lot of files that contain tables of data in a directory. I want to do the following in R but I don't know how: for i in 1 to the number of files { table[i]=read.table(file=file i) } The dimension of each table is different. All of these are tables of two dimensions. My first problem is to put all the file names in a table. Next, how I can load them using the command: read.table(file=file i) ? Thank in advance for your help, Arnau. __ 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] meta / lme
Hi I'm conducing a meta-analysis using the meta package. Here's a bit of code that works fine - tmp - metacont(samplesize.2, pctdropout.2, sddropout.2, samplesize.1, pctdropout.1, sddropout.1, data=Dataset, sm=WMD) I would now like to control for a couple of variables (continuous and categorical) that aren't in the equation. Is meta inappropriate for these purposes? If so, based on the above code, how would I add variables to the equation? Perhaps I should use lme weighting on sample size? Thoughts appreciated Thanks S. PS version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R ?? http://mail.nana.co.il [[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] boosting for multi-class classification
Hi List, I can't seem to find a package that implements boosting for multi-class classification. Does such a package exist? __ 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] how to load files from a directory?
file.names - c(table1, table2) #using fully qualified names table.list - list() i - 0 for(table.name in table.names) { i - i+1 table.list[[i]] - read.table(table.name) } Note the double sqare brackets. Use them also when accessing elements to have them returned as data.frames (single brackets would return a list of length 1 with the data frame being the only element) On 3/12/06, Arnau Mir [EMAIL PROTECTED] wrote: Hello. I have a lot of files that contain tables of data in a directory. I want to do the following in R but I don't know how: for i in 1 to the number of files { table[i]=read.table(file=file i) } The dimension of each table is different. All of these are tables of two dimensions. My first problem is to put all the file names in a table. Next, how I can load them using the command: read.table(file=file i) ? Thank in advance for your help, Arnau. __ 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] Misalignment of secondary axis on boxplot
Dear R-help, I am trying to overlay a secondary y-axis over a boxplot. The problem is that the point of the line does not correspond to the centrepoint of the boxplot, which makes presentation and interpretation sloppy. Could someone point out where I am going wrong please? #DATA f-factor(ld$Name[ld$Order==5],levels=c(SVR,MKF,DRCH,TNC,MTN,WLB,HMB)) g-c(0.0213750, 0.0017000, 0.0228150, 0.000, 0.0787800,NA, 0.0220400, 0.0471900, 0.0060500, NA, 0.0285600, 0.0079980, 0.000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.000, NA, 0.000, 0.000, 0.0723450, 0.0143520, 0.000, 0.1398600, 0.0032000, NA,NA,0.0500850,NA, 0.0038250, 0.000,0.0071250, 0.0394200, 0.000, 0.000,NA,0.000,NA, 0.000, 0.0246375, NA, NA, 0.0120750, 0.0076125,NA,NA,0.0153400, 0.0077000,NA) boxplot(g~f,ylab=,xlab=,main=) par(new=T) s.f-c(0.5085714, 1.578, 0.6071429, 0.523, 0.5916667,1.1742857, 0.7987500) plot(s.f,main=,ylab=,xlab=,type=b,axes=F,pch=19) axis(4) Thanks in advance, Sion (R 2.1.1) -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.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] nls start values
Wouldn't this be easier? vals - 1:100 names(vals) - sprintf(beta%d, 1:100) ## or ## names(vals) - paste(beta, 1:100, sep = ) --sundar Cal Stats wrote: Hi.. here is an example ss-NULL vals-1:100 for(i in 1:100){ ss-c(ss,paste(beta,i,=,vals[i],sep=)) } sss-paste(ss,collapse=,) now is there a way i can convert sss so that i can give the command nls(formula,start=sss) Thanks Harsh Charles Annis, P.E. [EMAIL PROTECTED] wrote: Please give us an EXAMPLE of the loop you have in mind. (It's likely that you can use simpler methods than a loop, but without an example we'd be guessing.) Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cal Stats Sent: Saturday, March 11, 2006 3:43 PM To: r-help@stat.math.ethz.ch Subject: [R] nls start values Hi, I have a large number of parameters to estimate in nls say 100: beta1--beta100 lets say i have 100 values in a vector is there a way where i can create the start vector for nls using a loop instead of individually filling the 100 values. Thanks Harsh - [[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 - [[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] Analyze Fmri package
Seungshin Rhee wrote: Hi, Can you please help me? Whenever I try to run f.ica.fmri.gui(), R crashes. In the GUI, I selected an *.img file and I checked the 'Create mask' box and I typed a name for the object and then I press 'Start' button. Then in the R Console window it said 'Reading...Whitening', but after the Whitening message an error window popped up and then R crashed. Did I do something wrong? I tryed to do same thing in the computer at the lab and in my computer, I got same result. I appreciate your help. Please report this problem together with a *reproducible* example to the package miantainer of Fmri. Uwe Ligges Regards, Seungshin Rhee [[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] tapply with unequal length of arguments
2006/3/12, Stefanie von Felten, IPWIfU [EMAIL PROTECTED]: Hi everyone, Is it possible to use tapply(x,y,mean) if not all groups of x by y are of the same length (for example if you have one missing observation)? Yes,It works. I tried tapply(x,y,mean,na.omit=T) but it doesn't work! What does it doesn't work mean exactly?Can you give an example and the error msg? Steffi -- - Stefanie von Felten Doktorandin ETH Zürich Institut für Pflanzenwissenschaften ETH Zentrum, LFW A 2 Telefon: 044 632 85 97 Telefax: 044 632 11 53 e-mail: [EMAIL PROTECTED] http://www.ipw.agrl.ethz.ch/~svfelten/ und: Universität Zürich Institut für Umweltwissenschaften Winterthurerstrasse 190 8057 Zürich Telefon: 044 635 61 23 Telefax: 044 635 57 11 e-mail: [EMAIL PROTECTED] http://www.unizh.ch/uwinst/homepages/steffi.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 -- 黄荣贵 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] Misalignment of secondary axis on boxplot
[EMAIL PROTECTED] wrote: Dear R-help, I am trying to overlay a secondary y-axis over a boxplot. The problem is that the point of the line does not correspond to the centrepoint of the boxplot, which makes presentation and interpretation sloppy. Could someone point out where I am going wrong please? 1. We do not have the object ld, hence we do not see anything ... 2. I guess you do not want to call lines() rather than plot() when adding elements to the boxplot Uwe Ligges #DATA f-factor(ld$Name[ld$Order==5],levels=c(SVR,MKF,DRCH,TNC,MTN,WLB,HMB)) g-c(0.0213750, 0.0017000, 0.0228150, 0.000, 0.0787800,NA, 0.0220400, 0.0471900, 0.0060500, NA, 0.0285600, 0.0079980, 0.000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.000, NA, 0.000, 0.000, 0.0723450, 0.0143520, 0.000, 0.1398600, 0.0032000, NA,NA,0.0500850,NA, 0.0038250, 0.000,0.0071250, 0.0394200, 0.000, 0.000,NA,0.000,NA, 0.000, 0.0246375, NA, NA, 0.0120750, 0.0076125,NA,NA,0.0153400, 0.0077000,NA) boxplot(g~f,ylab=,xlab=,main=) par(new=T) s.f-c(0.5085714, 1.578, 0.6071429, 0.523, 0.5916667,1.1742857, 0.7987500) plot(s.f,main=,ylab=,xlab=,type=b,axes=F,pch=19) axis(4) Thanks in advance, Sion (R 2.1.1) -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.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-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] tapply with unequal length of arguments
Stefanie von Felten, IPWIfU wrote: Hi everyone, Is it possible to use tapply(x,y,mean) if not all groups of x by y are of the same length (for example if you have one missing observation)? I tried tapply(x,y,mean,na.omit=T) but it doesn't work! See ?tapply which tells you that the argument ... is passed to FUN which is mean() in this case. mean() has an argument na.rm, see ?mean. So we get: tapply(x, y, mean, na.rm = TRUE) Please read the help pages more carefully. Uwe Ligges Steffi __ 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! installing R on Mac OS X 10.3.9
Question 1: install R..dmg How can I install R in ~/Applications and Rframework in ~/Library, instead of / Library? My preferred behavior is that if I choose /Applications for the app, framework goes into /Library; if I choose ~/Applications, libraries go into ~/Library (and don't ask me root password in this case). Question 2: build from source I built with this export CC=gcc export F77=g95 export CPPFLAGS=-Df2cFortran ./configure --with-blas=-framework vecLib --with-lapack make make goes quite a long way until ... /Users/zpzhang/Applications/g95-install/lib/gcc-lib/powerpc-apple- darwin6.8/4.0.1/libf95.a(string.o) definition of common __g95_null_string (size 1) /usr/bin/libtool: internal link edit command failed make[3]: *** [libR.dylib] Error 1 make[2]: *** [R] Error 2 make[1]: *** [R] Error 1 make: *** [R] Error 1 By the way, a lot of gcc: unrecognized option '-no-cpp-precomp' Any suggestions? thanks. Zepu __ 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] Misalignment of secondary axis on boxplot
Dear Uwe, Thankyou for your response. I tried lines(), without success. I have ammended the #DATA. so it should work now: #R-help example f-factor(c(MKF, DRCH, TNC, HMB, MKF, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, TNC, MTN, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, WLB, HMB),levels=c(SVR,MKF,DRCH,TNC,MTN,WLB,HMB)) g-c(0.0213750, 0.0017000, 0.0228150, 0.000, 0.0787800,NA, 0.0220400, 0.0471900, 0.0060500, NA, 0.0285600, 0.0079980, 0.000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.000, NA, 0.000, 0.000, 0.0723450, 0.0143520, 0.000, 0.1398600, 0.0032000, NA,NA,0.0500850,NA, 0.0038250, 0.000,0.0071250, 0.0394200, 0.000, 0.000,NA,0.000,NA, 0.000, 0.0246375, NA, NA, 0.0120750, 0.0076125,NA,NA,0.0153400, 0.0077000,NA) boxplot(g~f,ylab=,xlab=,main=) par(new=T) s.f-c(0.5085714, 1.578, 0.6071429, 0.523, 0.5916667,1.1742857, 0.7987500) plot(s.f,main=,ylab=,xlab=,type=b,axes=F,pch=19) axis(4) Best wishes, Sion Quoting Uwe Ligges [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Dear R-help, I am trying to overlay a secondary y-axis over a boxplot. The problem is that the point of the line does not correspond to the centrepoint of the boxplot, which makes presentation and interpretation sloppy. Could someone point out where I am going wrong please? 1. We do not have the object ld, hence we do not see anything ... 2. I guess you do not want to call lines() rather than plot() when adding elements to the boxplot Uwe Ligges #DATA f-factor(ld$Name[ld$Order==5],levels=c(SVR,MKF,DRCH,TNC,MTN,WLB,HMB)) g-c(0.0213750, 0.0017000, 0.0228150, 0.000, 0.0787800,NA, 0.0220400, 0.0471900, 0.0060500, NA, 0.0285600, 0.0079980, 0.000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.000, NA, 0.000, 0.000, 0.0723450, 0.0143520, 0.000, 0.1398600, 0.0032000, NA,NA,0.0500850,NA, 0.0038250, 0.000,0.0071250, 0.0394200, 0.000, 0.000,NA,0.000,NA, 0.000, 0.0246375, NA, NA, 0.0120750, 0.0076125,NA,NA,0.0153400, 0.0077000,NA) boxplot(g~f,ylab=,xlab=,main=) par(new=T) s.f-c(0.5085714, 1.578, 0.6071429, 0.523, 0.5916667,1.1742857, 0.7987500) plot(s.f,main=,ylab=,xlab=,type=b,axes=F,pch=19) axis(4) Thanks in advance, Sion (R 2.1.1) -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.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 -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.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] Numerical Derivatives in R
Hi, Suppose I have an arbitrary function: arbfun-function(x) {...} Is there a robust implementation of a numerical derivative routine in R which I can use to take it's derivative ? Something a bit more than simple division by delta of the difference of evaluating the function at x and x+delta... Perhaps there is a way to do this using D or deriv but I could not figure it out. Trying: eval(deriv(function(x) arbfun(x),x),1) does not seem to work. Thanks, Tolga __ 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] Misalignment of secondary axis on boxplot
Ah, I see. This is not that easy, I'd try something like: par(lend=1) bp - boxplot(g~f,ylab=,xlab=,main=) pu - par(usr) temp - 0.05*diff(range(s.f)) par(usr = c(pu[1:2], min(s.f)-temp, max(s.f)+temp)) lines(s.f,type=b,pch=19) axis(4) Uwe Ligges [EMAIL PROTECTED] wrote: Dear Uwe, Thankyou for your response. I tried lines(), without success. I have ammended the #DATA. so it should work now: #R-help example f-factor(c(MKF, DRCH, TNC, HMB, MKF, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, TNC, MTN, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, WLB, HMB),levels=c(SVR,MKF,DRCH,TNC,MTN,WLB,HMB)) g-c(0.0213750, 0.0017000, 0.0228150, 0.000, 0.0787800,NA, 0.0220400, 0.0471900, 0.0060500, NA, 0.0285600, 0.0079980, 0.000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.000, NA, 0.000, 0.000, 0.0723450, 0.0143520, 0.000, 0.1398600, 0.0032000, NA,NA,0.0500850,NA, 0.0038250, 0.000,0.0071250, 0.0394200, 0.000, 0.000,NA,0.000,NA, 0.000, 0.0246375, NA, NA, 0.0120750, 0.0076125,NA,NA,0.0153400, 0.0077000,NA) boxplot(g~f,ylab=,xlab=,main=) par(new=T) s.f-c(0.5085714, 1.578, 0.6071429, 0.523, 0.5916667,1.1742857, 0.7987500) plot(s.f,main=,ylab=,xlab=,type=b,axes=F,pch=19) axis(4) Best wishes, Sion Quoting Uwe Ligges [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Dear R-help, I am trying to overlay a secondary y-axis over a boxplot. The problem is that the point of the line does not correspond to the centrepoint of the boxplot, which makes presentation and interpretation sloppy. Could someone point out where I am going wrong please? 1. We do not have the object ld, hence we do not see anything ... 2. I guess you do not want to call lines() rather than plot() when adding elements to the boxplot Uwe Ligges #DATA f-factor(ld$Name[ld$Order==5],levels=c(SVR,MKF,DRCH,TNC,MTN,WLB,HMB)) g-c(0.0213750, 0.0017000, 0.0228150, 0.000, 0.0787800,NA, 0.0220400, 0.0471900, 0.0060500, NA, 0.0285600, 0.0079980, 0.000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.000, NA, 0.000, 0.000, 0.0723450, 0.0143520, 0.000, 0.1398600, 0.0032000, NA,NA,0.0500850,NA, 0.0038250, 0.000,0.0071250, 0.0394200, 0.000, 0.000,NA,0.000,NA, 0.000, 0.0246375, NA, NA, 0.0120750, 0.0076125,NA,NA,0.0153400, 0.0077000,NA) boxplot(g~f,ylab=,xlab=,main=) par(new=T) s.f-c(0.5085714, 1.578, 0.6071429, 0.523, 0.5916667,1.1742857, 0.7987500) plot(s.f,main=,ylab=,xlab=,type=b,axes=F,pch=19) axis(4) Thanks in advance, Sion (R 2.1.1) -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.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 -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.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] Misalignment of secondary axis on boxplot
Dear Uwe, That is fantastic, thankyou. Sion. Quoting Uwe Ligges [EMAIL PROTECTED]: Ah, I see. This is not that easy, I'd try something like: par(lend=1) bp - boxplot(g~f,ylab=,xlab=,main=) pu - par(usr) temp - 0.05*diff(range(s.f)) par(usr = c(pu[1:2], min(s.f)-temp, max(s.f)+temp)) lines(s.f,type=b,pch=19) axis(4) Uwe Ligges [EMAIL PROTECTED] wrote: Dear Uwe, Thankyou for your response. I tried lines(), without success. I have ammended the #DATA. so it should work now: #R-help example f-factor(c(MKF, DRCH, TNC, HMB, MKF, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, TNC, MTN, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, MTN, WLB, HMB, SVR, MKF, DRCH, TNC, WLB, HMB),levels=c(SVR,MKF,DRCH,TNC,MTN,WLB,HMB)) g-c(0.0213750, 0.0017000, 0.0228150, 0.000, 0.0787800,NA, 0.0220400, 0.0471900, 0.0060500, NA, 0.0285600, 0.0079980, 0.000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.000, NA, 0.000, 0.000, 0.0723450, 0.0143520, 0.000, 0.1398600, 0.0032000, NA,NA,0.0500850,NA, 0.0038250, 0.000,0.0071250, 0.0394200, 0.000, 0.000,NA,0.000,NA, 0.000, 0.0246375, NA, NA, 0.0120750, 0.0076125,NA,NA,0.0153400, 0.0077000,NA) boxplot(g~f,ylab=,xlab=,main=) par(new=T) s.f-c(0.5085714, 1.578, 0.6071429, 0.523, 0.5916667,1.1742857, 0.7987500) plot(s.f,main=,ylab=,xlab=,type=b,axes=F,pch=19) axis(4) Best wishes, Sion Quoting Uwe Ligges [EMAIL PROTECTED]: [EMAIL PROTECTED] wrote: Dear R-help, I am trying to overlay a secondary y-axis over a boxplot. The problem is that the point of the line does not correspond to the centrepoint of the boxplot, which makes presentation and interpretation sloppy. Could someone point out where I am going wrong please? 1. We do not have the object ld, hence we do not see anything ... 2. I guess you do not want to call lines() rather than plot() when adding elements to the boxplot Uwe Ligges #DATA f-factor(ld$Name[ld$Order==5],levels=c(SVR,MKF,DRCH,TNC,MTN,WLB,HMB)) g-c(0.0213750, 0.0017000, 0.0228150, 0.000, 0.0787800,NA, 0.0220400, 0.0471900, 0.0060500, NA, 0.0285600, 0.0079980, 0.000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.000, NA, 0.000, 0.000, 0.0723450, 0.0143520, 0.000, 0.1398600, 0.0032000, NA,NA,0.0500850,NA, 0.0038250, 0.000,0.0071250, 0.0394200, 0.000, 0.000,NA,0.000,NA, 0.000, 0.0246375, NA, NA, 0.0120750, 0.0076125,NA,NA,0.0153400, 0.0077000,NA) boxplot(g~f,ylab=,xlab=,main=) par(new=T) s.f-c(0.5085714, 1.578, 0.6071429, 0.523, 0.5916667,1.1742857, 0.7987500) plot(s.f,main=,ylab=,xlab=,type=b,axes=F,pch=19) axis(4) Thanks in advance, Sion (R 2.1.1) -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.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 -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.html -- Siôn Roberts Department of Geography, Queen Mary, University of London, London, E1 4NS. Tel: +44 20 7882 5400 http://www.geog.qmul.ac.uk/postgraduate/student/roberts.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] Numerical Derivatives in R
Tolga, Look at numericDeriv. arbfun - function(x) x^2 x - 3 numericDeriv(quote(arbfun(x)), x) [1] 9 attr(,gradient) [,1] [1,]6 --Gray On 3/12/06, Tolga Uzuner [EMAIL PROTECTED] wrote: Hi, Suppose I have an arbitrary function: arbfun-function(x) {...} Is there a robust implementation of a numerical derivative routine in R which I can use to take it's derivative ? Something a bit more than simple division by delta of the difference of evaluating the function at x and x+delta... Perhaps there is a way to do this using D or deriv but I could not figure it out. Trying: eval(deriv(function(x) arbfun(x),x),1) does not seem to work. Thanks, Tolga __ 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 -- Gray Calhoun Economics Department UC San Diego __ 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] Numerical Derivatives in R
Thanks Gray, Tolga Gray Calhoun wrote: Tolga, Look at numericDeriv. arbfun - function(x) x^2 x - 3 numericDeriv(quote(arbfun(x)), x) [1] 9 attr(,gradient) [,1] [1,]6 --Gray On 3/12/06, Tolga Uzuner [EMAIL PROTECTED] wrote: Hi, Suppose I have an arbitrary function: arbfun-function(x) {...} Is there a robust implementation of a numerical derivative routine in R which I can use to take it's derivative ? Something a bit more than simple division by delta of the difference of evaluating the function at x and x+delta... Perhaps there is a way to do this using D or deriv but I could not figure it out. Trying: eval(deriv(function(x) arbfun(x),x),1) does not seem to work. Thanks, Tolga __ 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 -- Gray Calhoun Economics Department UC San Diego __ 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] is there a formatted output in R? [User functions]
There is a slightly easier way to make your own functions available. 1. Set up a directory for your R configuration. I use d:\r\mhp. Copy .Rprofile, Rconsole, Rdevga there. 2. Set up a Windows environment variable R_USER pointing to that directory. For example: R_USER=d:\r\mhp The point of the preceding is to set R to load the same .Rprofile each time it starts. 3. Set up a separate directory for your own functions. I use d:\r\mhp\mhpmisc. 4. Put your own functions in the directory from step 3. Open R there. Source the functions. Save the workspace as .Rdata. 5. In your .Rprofile file, add a line like this: attach(d:/R/MHP/MHPmisc/.RData) Now your functions will be available from every instance of R you start up. If you have many functions, I have written an R script that searches the current directory for all of them, clears the workspace, sources them all, and saves the workspace. Reply to me by email if you want a copy. I have been told by Gurus that my method is too complicated, but I find it a lot simpler than creating a package. ...MHP Michael wrote on 3/11/2006 1:33 PM: Thank you for your reminder! I think you don't have to tell me to read the document. I have done that many times already. My feeling after reading the creating package manual is that my god, this job needs a Computer Science degree to do it. It is way too complicated. There should be simpler ways. Perhaps I don't need a package. I just need to be able to call my clearscreen function from all of my other scripts... Where do I put my clearscreen function? Is there a command similar to include in C++? Is there a path management that I can call clearscreen function from anywhere as long as its in path? On 3/11/06, Gavin Simpson [EMAIL PROTECTED] wrote: On Fri, 2006-03-10 at 22:50 -0800, Michael wrote: Great! It worked! Thank you so much! Now since it worked greatly, how can I put this function into my own library or package, so later on I can call this function from my other scripts? Thanks a lot! Michael, Read the two manuals that cover writing functions and preparing *packages* of code, which come with R or get them here: http://cran.r-project.org/manuals.html An Introduction to R and Writing R Extensions, After reading and digesting, if you still have questions then post them to the list. People here provide their time for free and it is not much to expect posters to try to help themselves out first - especially as the developers have gone to such great lengths to produce quality documentation that explains all of this. HTH G On 3/10/06, jim holtman [EMAIL PROTECTED] wrote: The archives had the following in it: [R] how to clear screen in R-console? - *This message*: [ Message body http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#start] [ More options http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#options2] - *Related messages*: [ Next message http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70723.html] [ Previous message http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70721.html] [ In reply tohttp://finzi.psych.upenn.edu/R/Rhelp02a/archive/70708.html] [ Next in thread http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70800.html] [ Replies http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70722.html#replies] *From*: Gabor Grothendieck ggrothendieckggrothendieck?Subject=Re:%20[R]%20how%20to%20clear%20screen%20in%20R-console? *Date*: Fri, 17 Feb 2006 12:36:51 -0500 Here is a version that uses rcom instead of RDCOMClient. This has the advantage that rcom is on CRAN. cls - function() { require(rcom) wsh - comCreateObject(Wscript.Shell) comInvoke(wsh, SendKeys, \014) invisible(wsh) } cls() # test On 2/17/06, Gabor Grothendieck ggrothendieck at gmail.com wrote: * Here is a translation of Norm Olsen's vbscript code into pure R. * * This is intended for use with the Windows Rgui interface. * On 3/10/06, Michael [EMAIL PROTECTED] wrote: something like sprintf in C? so I can do: print(sprintf(the correct result is %3.4f\n, myresult)); --- Also, I am desperately looking for a clear console screen function in R... 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 http://www.r-project.org/posting-guide.html -- Jim Holtman Cincinnati, OH +1 513 646 9390 (Cell) +1 513 247 0281 (Home) What the problem you are trying to solve? [[alternative HTML version deleted]]
Re: [R] Numerical Derivatives in R
Gray Calhoun [EMAIL PROTECTED] writes: Tolga, Look at numericDeriv. arbfun - function(x) x^2 x - 3 numericDeriv(quote(arbfun(x)), x) [1] 9 attr(,gradient) [,1] [1,]6 However, numericDeriv is not particularly intelligent. It is effectively doing what Tolga was trying not to. A more refined function could be a good idea, e.g. implementing higher order approximations, a tunable stepsize, box constraints... --Gray On 3/12/06, Tolga Uzuner [EMAIL PROTECTED] wrote: Hi, Suppose I have an arbitrary function: arbfun-function(x) {...} Is there a robust implementation of a numerical derivative routine in R which I can use to take it's derivative ? Something a bit more than simple division by delta of the difference of evaluating the function at x and x+delta... Perhaps there is a way to do this using D or deriv but I could not figure it out. Trying: eval(deriv(function(x) arbfun(x),x),1) does not seem to work. Thanks, Tolga __ 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 -- Gray Calhoun Economics Department UC San Diego __ 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
Re: [R] Numerical Derivatives in R
Actually, I did implement this using richardson extrapolation, but am having trouble vectorising it. For some reason, it fails within integrate... Anyone willing to look over the below and let me know what I am doing wrong, helps much appreciated. You can cut paste the below into the console.. XX richardson.grad - function(func, x10, d=0.01, eps=1e-4, r=6, show=F){ sapply(x10,function(x){ v - 2 # reduction factor. n - length(x) # Integer, number of variables. a.mtr - matrix(1, r, n) b.mtr - matrix(1, (r - 1), n) h - abs(d*x)+eps*(x==0.0) for(k in 1:r) { # successively reduce h for(i in 1:n) { x1.vct - x2.vct - x x1.vct[i] - x[i] + h[i] x2.vct[i] - x[i] - h[i] if(k == 1) a.mtr[k,i] - (func(x1.vct) - func(x2.vct))/(2*h[i]) else{ if(abs(a.mtr[(k-1),i])1e-20) # some functions are unstable near 0.0 a.mtr[k,i] - (func(x1.vct)-func(x2.vct))/(2*h[i]) else a.mtr[k, i] - 0 } } h - h/v # Reduced h by 1/v. } if(show) { cat(\n,first order approximations, \n) print(a.mtr, 12) } for(m in 1:(r - 1)) { for(i in 1:(r - m)) b.mtr[i,]- (a.mtr[(i+1),]*(4^m)-a.mtr[i,])/(4^m-1) if(show m!=(r-1) ) { cat(\n,Richarson improvement group No. , m, \n) print(a.mtr[1:(r-m),], 12) } } a.mtr[length(a.mtr)]}) } ## try it out richardson.grad(function(x){x^3},2) #works fine... should return 12. # now try integrating something simple integrate(function(i) richardson.grad(function(x) x^2,i),0,1) #also works fine, but instead try this: CDFLHP -function(x,D,B) pnorm((sqrt(1-B^2)*qnorm(x)-D)/B) integrate(function(i) richardson.grad(function(x) CDFLHP(x,-2,0.1),i),0,1) # fails, for some annoying reason, even tho richardson.grad is vectorised... XX This is the error message: Error in if (abs(a.mtr[(k - 1), i]) 1e-20) a.mtr[k, i] - (func(x1.vct) - : missing value where TRUE/FALSE needed In addition: Warning message: NaNs produced in: qnorm(p, mean, sd, lower.tail, log.p) Peter Dalgaard wrote: Gray Calhoun [EMAIL PROTECTED] writes: Tolga, Look at numericDeriv. arbfun - function(x) x^2 x - 3 numericDeriv(quote(arbfun(x)), x) [1] 9 attr(,gradient) [,1] [1,]6 However, numericDeriv is not particularly intelligent. It is effectively doing what Tolga was trying not to. A more refined function could be a good idea, e.g. implementing higher order approximations, a tunable stepsize, box constraints... --Gray On 3/12/06, Tolga Uzuner [EMAIL PROTECTED] wrote: Hi, Suppose I have an arbitrary function: arbfun-function(x) {...} Is there a robust implementation of a numerical derivative routine in R which I can use to take it's derivative ? Something a bit more than simple division by delta of the difference of evaluating the function at x and x+delta... Perhaps there is a way to do this using D or deriv but I could not figure it out. Trying: eval(deriv(function(x) arbfun(x),x),1) does not seem to work. Thanks, Tolga __ 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 -- Gray Calhoun Economics Department UC San Diego __ 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] finding warning point in function
Hi everyone, I would like to find out when and where exactly I get the following warning in a piece of code I've written: Error in [-(`*tmp*`, iseq, value = numeric(0)) : nothing to replace with The code is a for () loop performing a somewhat trivial calculation, modulated by a number of logical if(){} else(){} conditions, involving the creation of a number of vectors that contain the elements that will be manipulated. The warning itself makes me suspicious that somewhere along the way a vector ends up having length 0 for some of the elements of my dataset... is there a way of finding out where the warning is generated that is less verbose than printing out every single step? Cheers, Federico -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Numerical Derivatives in R
Note that warning message. Its trying to evaluate qnorm outside of its allowable domain. On 3/12/06, Tolga Uzuner [EMAIL PROTECTED] wrote: Actually, I did implement this using richardson extrapolation, but am having trouble vectorising it. For some reason, it fails within integrate... Anyone willing to look over the below and let me know what I am doing wrong, helps much appreciated. You can cut paste the below into the console.. XX richardson.grad - function(func, x10, d=0.01, eps=1e-4, r=6, show=F){ sapply(x10,function(x){ v - 2 # reduction factor. n - length(x) # Integer, number of variables. a.mtr - matrix(1, r, n) b.mtr - matrix(1, (r - 1), n) h - abs(d*x)+eps*(x==0.0) for(k in 1:r) { # successively reduce h for(i in 1:n) { x1.vct - x2.vct - x x1.vct[i] - x[i] + h[i] x2.vct[i] - x[i] - h[i] if(k == 1) a.mtr[k,i] - (func(x1.vct) - func(x2.vct))/(2*h[i]) else{ if(abs(a.mtr[(k-1),i])1e-20) # some functions are unstable near 0.0 a.mtr[k,i] - (func(x1.vct)-func(x2.vct))/(2*h[i]) else a.mtr[k, i] - 0 } } h - h/v # Reduced h by 1/v. } if(show) { cat(\n,first order approximations, \n) print(a.mtr, 12) } for(m in 1:(r - 1)) { for(i in 1:(r - m)) b.mtr[i,]- (a.mtr[(i+1),]*(4^m)-a.mtr[i,])/(4^m-1) if(show m!=(r-1) ) { cat(\n,Richarson improvement group No. , m, \n) print(a.mtr[1:(r-m),], 12) } } a.mtr[length(a.mtr)]}) } ## try it out richardson.grad(function(x){x^3},2) #works fine... should return 12. # now try integrating something simple integrate(function(i) richardson.grad(function(x) x^2,i),0,1) #also works fine, but instead try this: CDFLHP -function(x,D,B) pnorm((sqrt(1-B^2)*qnorm(x)-D)/B) integrate(function(i) richardson.grad(function(x) CDFLHP(x,-2,0.1),i),0,1) # fails, for some annoying reason, even tho richardson.grad is vectorised... XX This is the error message: Error in if (abs(a.mtr[(k - 1), i]) 1e-20) a.mtr[k, i] - (func(x1.vct) - : missing value where TRUE/FALSE needed In addition: Warning message: NaNs produced in: qnorm(p, mean, sd, lower.tail, log.p) Peter Dalgaard wrote: Gray Calhoun [EMAIL PROTECTED] writes: Tolga, Look at numericDeriv. arbfun - function(x) x^2 x - 3 numericDeriv(quote(arbfun(x)), x) [1] 9 attr(,gradient) [,1] [1,]6 However, numericDeriv is not particularly intelligent. It is effectively doing what Tolga was trying not to. A more refined function could be a good idea, e.g. implementing higher order approximations, a tunable stepsize, box constraints... --Gray On 3/12/06, Tolga Uzuner [EMAIL PROTECTED] wrote: Hi, Suppose I have an arbitrary function: arbfun-function(x) {...} Is there a robust implementation of a numerical derivative routine in R which I can use to take it's derivative ? Something a bit more than simple division by delta of the difference of evaluating the function at x and x+delta... Perhaps there is a way to do this using D or deriv but I could not figure it out. Trying: eval(deriv(function(x) arbfun(x),x),1) does not seem to work. Thanks, Tolga __ 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 -- Gray Calhoun Economics Department UC San Diego __ 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-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] finding warning point in function
If your function is called f then options(warn = 2) debug(f) will cause the warning to be converted to an error and when the error stops the code just issue: traceback() On 3/12/06, Federico Calboli [EMAIL PROTECTED] wrote: Hi everyone, I would like to find out when and where exactly I get the following warning in a piece of code I've written: Error in [-(`*tmp*`, iseq, value = numeric(0)) : nothing to replace with The code is a for () loop performing a somewhat trivial calculation, modulated by a number of logical if(){} else(){} conditions, involving the creation of a number of vectors that contain the elements that will be manipulated. The warning itself makes me suspicious that somewhere along the way a vector ends up having length 0 for some of the elements of my dataset... is there a way of finding out where the warning is generated that is less verbose than printing out every single step? Cheers, Federico -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ 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] Numerical Derivatives in R
Ah, yes. I see your point. Apologies to all for the misinformation. --Gray On 12 Mar 2006 19:31:18 +0100, Peter Dalgaard [EMAIL PROTECTED] wrote: Gray Calhoun [EMAIL PROTECTED] writes: Tolga, Look at numericDeriv. arbfun - function(x) x^2 x - 3 numericDeriv(quote(arbfun(x)), x) [1] 9 attr(,gradient) [,1] [1,]6 However, numericDeriv is not particularly intelligent. It is effectively doing what Tolga was trying not to. A more refined function could be a good idea, e.g. implementing higher order approximations, a tunable stepsize, box constraints... --Gray On 3/12/06, Tolga Uzuner [EMAIL PROTECTED] wrote: Hi, Suppose I have an arbitrary function: arbfun-function(x) {...} Is there a robust implementation of a numerical derivative routine in R which I can use to take it's derivative ? Something a bit more than simple division by delta of the difference of evaluating the function at x and x+delta... Perhaps there is a way to do this using D or deriv but I could not figure it out. Trying: eval(deriv(function(x) arbfun(x),x),1) does not seem to work. Thanks, Tolga __ 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 -- Gray Calhoun Economics Department UC San Diego __ 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 -- Gray Calhoun Economics Department UC San Diego __ 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] Changing predictor order in lm()
Hi, I don't know why you want but to say the code you can try body(lm) or simply type lm The order in anova is important in nested design ! you can use the libre car and try another type of SS type. - [[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] exit codes for Rcmd.exe under Windows
Hello, I know i'm being lazy, but does anyone know what the exit codes mean for Rcmd.exe under windows? I'm getting 1's and 2's. thanks! -rich __ 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] Ordination of feature film data question
I am severely rusty re. multivariate / ordination analysis, having done my last work 40 years ago (in plant ecology). I am interested in exploring applications of multivariate analytic approaches to data from the history of motion picture films. I'd very much appreciate any pointers as to possibly appropriate proceedures. The individual samples may be individual films and the measurements may be the presence and absence of actors and production personel; for example two films with many actors and / or crew in common would be located close together in the resultant ordination, while films with few or no personel in common would be located far apart. May I express my appreciation in advance to any helpful recipients. cordially David Woods Dr. David Woods M.B.K.S. Holcus Ltd. 16 John Street Kingston Square Hull HU2 8DH East Yorkshire UK tel. 44 (0)1482 323421 cel (0781) 259 1772 [[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-pkgs] New package for calibration of biplot axes.
Hi, I recently uploaded a package called calibrate to CRAN. This package contains routines for the calibration of (oblique) axes in biplots and scatter plots. Documentation provides examples for ordinary scatter plots with additional axes, biplots from principal component analysis, correspondence analysis, canonical correlation analysis and redundancy analysis. Jan Graffelman -- |Jan Graffelman |tel: +34-93-4011739| |Dpt. of Statistics Operations Research|fax: +34-93-4016575| |Universitat Politecnica de Catalunya|email: [EMAIL PROTECTED]| |Av. Diagonal 647, 6th floor | | |08028 Barcelona, Spain | | ___ 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
[R] [R-pkgs] Spectrino 1.5 update
Dear R users, a new release (v1.5) of Spectrino package is on CRAN. For those of you not familiar with Spectrino: Spectrino is a spectra preparation utility for R. It has specialized organization and visualization features for spectra. Spectrino has visual interface - as Windows application with rich set of features to set a structure and manipulate visually spectra and it is accessible from R as a library with a set of commands for saving and selective extraction of spectral data. more info at http://www.spectrino.com For all Spectrino users: The new in version 1.5: - minor bugs fixed. - some visual interface improvements. - now, the pre-processing options are adjustable from within R - function spnPPOpt(opts) - the mean extraction is based on a specific group (not on the entire set) - more appropriate for discriminant analysis. Enjoy the new Spectrino ! Teodor Krastev --SpecLabs ___ 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] R-help Digest, Vol 37, Issue 12
Hi r-users, I would like to know if R have any solution to the Address standardization. The problem is to classify a database of addresses with the real addresses of a streets of Spain. Ideally, I would like to assign Postal code, census data and other geographic information. If this is not possible I would like to know solutions in R about text mining, text classification, distance within text data,... Any help will be appreciate Thanks in advance Ferran Carrascosa __ 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] exit codes for Rcmd.exe under Windows
On 3/10/2006 6:29 PM, Richard Evans wrote: Hello, I know i'm being lazy, but does anyone know what the exit codes mean for Rcmd.exe under windows? I'm getting 1's and 2's. See https://svn.r-project.org/R/trunk/src/gnuwin32/front-ends/rcmdfn.c. The exit code should be the return value from the rcmdfn() function. The return value 1 looks ambiguous; other values other than 0 appear to correspond to error messages that should have been printed. 0 means everything was fine. 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] Pakcage for fitting data into an arbitrary nonlinear function
Dear R lister Could any one tell me what R package I can use to fit data into an arbitrary nonlinear function and to test how good a resulting fit is? Thanks in advance. Young-Jin Lee __ 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] Want to fit random intercept in logistic regression (testing lmer and glmmML)
The problem you report is related to the fact that a variance component can NOT be estimated from individual binary observations. The data do not contain enough information. I don't know the minimum requirements, but you could get estimates if you had some 0's and some 1's for multiple levels of x for at least two levels for idnumber. Otherwise, the likelihood surface has no finite minimum: If you have all 0's or all 1's, the intercept wants to go to +/-Inf. If you have complete separation between the 0's and the 1's, the slope wants to go to +/-Inf. If you don't have complete separation and you have a random component with one binary outcome per group, you could use offset to fix the the slope at some large number and estimate the variance component of the group effect (I think; I haven't tried it). Currently, neither lme nor lmer contain good checks for overparameterization. I've gotten estimates for variance components that were not estimable. After I did it and tried to interpret the results, I realized the algoritm was too polite to tell me my model was stupid; it just tried to estimate it anyway -- often taking much longer to compute than if the model were actually estimable. (lme and lmer could, of course, be modified to include better checks for models that can't be estimated. However, I think Doug Bates' current development efforts are more important than these checks, and I don't have the time to develop code that checks for these issues.) Hope this helps, spencer graves Paul Johnson wrote: Greetings. Here is sample code, with some comments. It shows how I can simulate data and estimate glm with binomial family when there is no individual level random error, but when I add random error into the linear predictor, I have a difficult time getting reasonable estimates of the model parameters or the variance component. There are no clusters here, just individual level responses, so perhaps I am misunderstanding the translation from my simple mixed model to the syntax of glmmML and lmer. I get roughly the same (inaccurate) fixed effect parameter estimates from glmmML and lmer, but the information they give on the variance components is quite different. Thanks in advance. Now I paste in the example code ### Paul Johnson [EMAIL PROTECTED] ### 2006-03-08 N - 1000 A - -1 B - 0.3 x - 1 + 10 * rnorm(N) eta - A + B * x pi - exp(eta)/(1+exp(eta)) myunif - runif(N) y - ifelse(myunif pi, 1, 0) plot(x,y, main=bquote( eta[i] == .(A) + .(B) * x[i] )) text ( 0.5*max(x), 0.5, expression( Prob( y[i] == 1) == frac( 1 , 1 + exp(-eta[i] myglm1 - glm ( y ~ x, family=binomial(link=logit) ) summary(myglm1) ## Just for fun myglm2 - glm(y~x, family=quasibinomial) summary(myglm2) ### Mixed model: random intercept with large variance eta - A + B * x + 5 * rnorm(N) pi - exp(eta)/(1+exp(eta)) myunif - runif(N) y - ifelse(myunif pi, 1, 0) plot(x,y, main=bquote( eta[i] == .(A) + .(B) * x[i] + u[i])) text ( 0.5*max(x), 0.5, expression( Prob( y[i] == 1) == frac( 1 , 1 + exp(-eta[i] ### Parameter estimates go to hell, as expected myglm3 - glm ( y ~ x, family=binomial(link=logit) ) summary(myglm3) ### Why doesn't quasibinomial show more evidence of the random intercept? myglm4 - glm(y~x, family=quasibinomial) summary(myglm4) # Can I estimate with lmer? library(lme4) ### With no repeated observations, what does lmer want? ### Clusters of size 1 ? ### In lme, I'd need random= ~ 1 idnumber - 1: length(y) mylmer1 - lmer( y ~ x + ( 1 | idnumber ), family=binomial, method=Laplace ) summary(mylmer1) ### Glmm wants clusters, and I don't have any clusters with more than 1 observation ### library(glmmML) myglmm1 - glmmML(y~x, family=binomial, cluster = idnumber ) summary(myglmm1) -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas __ 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] Pakcage for fitting data into an arbitrary nonlinear func tion
Your question is too vague. Do you want to fit functions of one variable, or several variables? Do you need the function to have explicit form, or would you be happy with sort of `black box'? R itself has facilities to fit smooth functions of one variable (e.g., smooth.spline(), loess(), etc.) Many packages can fit smooth functions of several variables (e.g., mgcv, locfit, mda, gss, nnet [part of the VR bundle], rpart, tree, or even gbm and randomForest). Andy From: Young-Jin Lee Dear R lister Could any one tell me what R package I can use to fit data into an arbitrary nonlinear function and to test how good a resulting fit is? Thanks in advance. Young-Jin Lee __ 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-help Digest, Vol 37, Issue 12
From: Ferran Carrascosa Hi r-users, I would like to know if R have any solution to the Address standardization. The problem is to classify a database of addresses with the real addresses of a streets of Spain. Ideally, I would like to assign Postal code, census data and other geographic information. I have no idea about this one... If this is not possible I would like to know solutions in R about text mining, text classification, distance within text data,... RSiteSearch(text mining) produced hits that look relevant. Andy Any help will be appreciate Thanks in advance Ferran Carrascosa __ 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] boosting for multi-class classification
Simon Knapp sleepingwell at gmail.com writes: Hi List, I can't seem to find a package that implements boosting for multi-class classification. Does such a package exist? In an R session, try RSiteSearch( boosting, restrict=functions ) This gives 15 hits. Would the package 'caTools' satisfy your needs? __ 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] Pakcage for fitting data into an arbitrary nonlinear function
Not sure I understand what you want but look at ?nls and see if that answers it. On 3/12/06, Young-Jin Lee [EMAIL PROTECTED] wrote: Dear R lister Could any one tell me what R package I can use to fit data into an arbitrary nonlinear function and to test how good a resulting fit is? Thanks in advance. Young-Jin Lee __ 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] difference between 2 dates: IN MONTHS the way Motherscompute it
Thanks Gabor, that's what I understood but then why do I get these results? library(zoo) 12*as.numeric(as.yearmon(2006-03-07)-as.yearmon(2006-02-07)) [1] NA Warning messages: 1: NAs introduced by coercion 2: NAs introduced by coercion 12*as.numeric(as.yearmon(2006-03-07)-as.yearmon(2006-02-07)) [1] -12 12*as.numeric(as.yearmon(as.Date(2006-03-07))-as.yearmon(as.Date(2006-02-07))) [1] 1 version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R I am sure I am missing somehting, but what is it?? Thanks Francisco From: Gabor Grothendieck [EMAIL PROTECTED] To: Francisco J. Zagmutt [EMAIL PROTECTED] CC: [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject: Re: [R] difference between 2 dates: IN MONTHS the way Motherscompute it Date: Fri, 10 Mar 2006 21:01:55 -0500 as.yearmon has a character method so its not necessary to convert it to Date first: print(as.yearmon.character) function (x, ...) as.yearmon(as.Date(x, ...)) On 3/10/06, Francisco J. Zagmutt [EMAIL PROTECTED] wrote: Gabor, please correct me if I am wrong but shouldn't you use as.Date to change the date string to a Date class before you call as.yearmon? i.e. 12* as.numeric(as.yearmon(as.Date(2006-03-07))-as.yearmon(as.Date(2006-02-07))) That returns 1 in Windows XP Regards Francisco From: Gabor Grothendieck [EMAIL PROTECTED] To: Smith, Phil [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] difference between 2 dates: IN MONTHS the way Motherscompute it Date: Fri, 10 Mar 2006 13:38:12 -0500 zoo has the yearmon class which will convert a date to a year + 0/12 to 11/12 to represent the month, disregarding the day, so: library(zoo) 12 * as.numeric((as.yearmon(2006-03-07) - as.yearmon(2006-02-06))) # 1 On 3/10/06, Smith, Phil [EMAIL PROTECTED] wrote: Hi R-people: I need a function to compute the number of months between 2 dates, in the same way a mother would do it. For example, if a kid is born on February 6, the number of months between that date and March 7 is exactly 1 month, although it is only 29 days. Thank you! Phil Smith CDC [[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-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] difference between 2 dates: IN MONTHS the way Motherscompute it
Maybe you have an old version of zoo? When I run the first one I get 1. I am using R 2.2.1 under Windows XP and checking the Built: line of library(help = zoo) I am using the verson of zoo version built on Feb 6, 2006: 12*as.numeric(as.yearmon(2006-03-07)-as.yearmon(2006-02-07)) [1] 1 In the second example you are not giving it a date but are subtracting a bunch of numbers and giving that to as.yearmon. On 3/12/06, Francisco J. Zagmutt [EMAIL PROTECTED] wrote: Thanks Gabor, that's what I understood but then why do I get these results? library(zoo) 12*as.numeric(as.yearmon(2006-03-07)-as.yearmon(2006-02-07)) [1] NA Warning messages: 1: NAs introduced by coercion 2: NAs introduced by coercion 12*as.numeric(as.yearmon(2006-03-07)-as.yearmon(2006-02-07)) [1] -12 12*as.numeric(as.yearmon(as.Date(2006-03-07))-as.yearmon(as.Date(2006-02-07))) [1] 1 version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R I am sure I am missing somehting, but what is it?? Thanks Francisco From: Gabor Grothendieck [EMAIL PROTECTED] To: Francisco J. Zagmutt [EMAIL PROTECTED] CC: [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject: Re: [R] difference between 2 dates: IN MONTHS the way Motherscompute it Date: Fri, 10 Mar 2006 21:01:55 -0500 as.yearmon has a character method so its not necessary to convert it to Date first: print(as.yearmon.character) function (x, ...) as.yearmon(as.Date(x, ...)) On 3/10/06, Francisco J. Zagmutt [EMAIL PROTECTED] wrote: Gabor, please correct me if I am wrong but shouldn't you use as.Date to change the date string to a Date class before you call as.yearmon? i.e. 12* as.numeric(as.yearmon(as.Date(2006-03-07))-as.yearmon(as.Date(2006-02-07))) That returns 1 in Windows XP Regards Francisco From: Gabor Grothendieck [EMAIL PROTECTED] To: Smith, Phil [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] difference between 2 dates: IN MONTHS the way Motherscompute it Date: Fri, 10 Mar 2006 13:38:12 -0500 zoo has the yearmon class which will convert a date to a year + 0/12 to 11/12 to represent the month, disregarding the day, so: library(zoo) 12 * as.numeric((as.yearmon(2006-03-07) - as.yearmon(2006-02-06))) # 1 On 3/10/06, Smith, Phil [EMAIL PROTECTED] wrote: Hi R-people: I need a function to compute the number of months between 2 dates, in the same way a mother would do it. For example, if a kid is born on February 6, the number of months between that date and March 7 is exactly 1 month, although it is only 29 days. Thank you! Phil Smith CDC [[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-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] bihistogram plots
Does anyone have code to plot bihistograms in R? See http://www.itl.nist.gov/div898/handbook/eda/section3/bihistog.htm for a description of a bihistogram. -- Hal Varian voice: 510-643-4757 SIMS, 102 South Hall fax: 510-642-5814 University of California [EMAIL PROTECTED] Berkeley, CA 94720-4600http://www.sims.berkeley.edu/~hal __ 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] bihistogram plots
I believe the histbackback() function in the `Hmisc' package does what you want. Andy From: Hal Varian Does anyone have code to plot bihistograms in R? See http://www.itl.nist.gov/div898/handbook/eda/section3/bihistog.htm for a description of a bihistogram. -- Hal Varian voice: 510-643-4757 SIMS, 102 South Hall fax: 510-642-5814 University of California [EMAIL PROTECTED] Berkeley, CA 94720-4600http://www.sims.berkeley.edu/~hal __ 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] nls number of explantory variables
Hi.. is there a limit on the number of explanatory variables in nls ? i have a dataframe with the columns names x1,x2..,x300 when i run nls it gives the error: x181 not found thought it does run when i have x1,x2,...,x170 variables. Thanks Harsh - [[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] Mixed GLM methodology and execution question
Have you considered 'lmer' (split between the lme4 and Matrix packages)? To learn about this, I suggest you also consult the vignettes in the 'mlmRev' package. hope this helps, spencer graves p.s. If you are unfamiliar with vignettes, I suggest you consult (http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67006.html) Ben Ridenhour wrote: Hi all, I have a question regarding how to properly analyze a data set and then how to perform the analysis in R. First, I have data that I would like to analyze using a mixed GLM (I think this is the most appropriate method, but I am unsure). In a mixed model (y = X*beta+Z*gamma+epsilon), I would like to structure the variance matrices of gamma, G, and the error, R, to take advantage of all my information. The structure of the data is like this: Response Variable: y = continuous response variable Predictor Variables: x1 = nominal treatment x2 = nominal group Random Variables: z = nominal subgroup of x2, i.e. z is nested within x2 Other variables(?; I'm not sure what exactly these are) z1 = first continuous property of z z2 = second continuous property of z z3 = third continuous property of z Presumably all the traits z1-z3 could potentially affect y, though I'm primarily interested in the model y=x1+x2+x1*x2. My wish is to put z in as a random variable and z1-z3 in the error matrix R. A small data sample would be like x1x2 z z1 z2 z3 y L1 A1 S1 1.23 4.59 -1.02 100.45 L2 A1 S1 1.23 4.59 -1.02 113.09 L1 A1 S2 1.50 3.76-0.06 119.21 L2 A1 S2 1.50 3.76-0.06 150.44 L1 A2 S3 1.09 4.01-1.50 109.18 L2 A2 S3 1.09 4.01-1.50 170.23 L1 A2 S4 1.01 3.70-0.78 109.26 L2 A2 S4 1.01 3.70-0.78 99.44 What is correct way to put together my model/matrices for this situation? How do accomplish such a task in R? Thanks, Ben [[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] Use of step() with an unbalanced ANOVA model
This is not really answering your question... If the data really came from a designed experiment, I believe `model simplification' is likely inappropriate. Andy From: Christoph Scherber Dear all, Is it dangerous to use step() during model simplification when I have an ANOVA design that is unbalanced (i.e. there is order dependence when entering the terms into the full model)? Thanks very much for your help! Kind regards, Christoph __ 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] difference between 2 dates: IN MONTHS the way Motherscompute it
Right! I updated zoo and the example worked. I should have started by updating the library in the first place...I slept well and I had my cup of coffee this morning so I don't really have any excuse :-) Thanks Gabor! Francisco From: Gabor Grothendieck [EMAIL PROTECTED] To: Francisco J. Zagmutt [EMAIL PROTECTED] CC: [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject: Re: [R] difference between 2 dates: IN MONTHS the way Motherscompute it Date: Sun, 12 Mar 2006 21:13:50 -0500 Maybe you have an old version of zoo? When I run the first one I get 1. I am using R 2.2.1 under Windows XP and checking the Built: line of library(help = zoo) I am using the verson of zoo version built on Feb 6, 2006: 12*as.numeric(as.yearmon(2006-03-07)-as.yearmon(2006-02-07)) [1] 1 In the second example you are not giving it a date but are subtracting a bunch of numbers and giving that to as.yearmon. On 3/12/06, Francisco J. Zagmutt [EMAIL PROTECTED] wrote: Thanks Gabor, that's what I understood but then why do I get these results? library(zoo) 12*as.numeric(as.yearmon(2006-03-07)-as.yearmon(2006-02-07)) [1] NA Warning messages: 1: NAs introduced by coercion 2: NAs introduced by coercion 12*as.numeric(as.yearmon(2006-03-07)-as.yearmon(2006-02-07)) [1] -12 12*as.numeric(as.yearmon(as.Date(2006-03-07))-as.yearmon(as.Date(2006-02-07))) [1] 1 version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R I am sure I am missing somehting, but what is it?? Thanks Francisco From: Gabor Grothendieck [EMAIL PROTECTED] To: Francisco J. Zagmutt [EMAIL PROTECTED] CC: [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject: Re: [R] difference between 2 dates: IN MONTHS the way Motherscompute it Date: Fri, 10 Mar 2006 21:01:55 -0500 as.yearmon has a character method so its not necessary to convert it to Date first: print(as.yearmon.character) function (x, ...) as.yearmon(as.Date(x, ...)) On 3/10/06, Francisco J. Zagmutt [EMAIL PROTECTED] wrote: Gabor, please correct me if I am wrong but shouldn't you use as.Date to change the date string to a Date class before you call as.yearmon? i.e. 12* as.numeric(as.yearmon(as.Date(2006-03-07))-as.yearmon(as.Date(2006-02-07))) That returns 1 in Windows XP Regards Francisco From: Gabor Grothendieck [EMAIL PROTECTED] To: Smith, Phil [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] difference between 2 dates: IN MONTHS the way Motherscompute it Date: Fri, 10 Mar 2006 13:38:12 -0500 zoo has the yearmon class which will convert a date to a year + 0/12 to 11/12 to represent the month, disregarding the day, so: library(zoo) 12 * as.numeric((as.yearmon(2006-03-07) - as.yearmon(2006-02-06))) # 1 On 3/10/06, Smith, Phil [EMAIL PROTECTED] wrote: Hi R-people: I need a function to compute the number of months between 2 dates, in the same way a mother would do it. For example, if a kid is born on February 6, the number of months between that date and March 7 is exactly 1 month, although it is only 29 days. Thank you! Phil Smith CDC [[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-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] bihistogram plots
Also note that there is an example of that here: http://addictedtor.free.fr/graphiques/graphcode.php?graph=136 On 3/12/06, Liaw, Andy [EMAIL PROTECTED] wrote: I believe the histbackback() function in the `Hmisc' package does what you want. Andy From: Hal Varian Does anyone have code to plot bihistograms in R? See http://www.itl.nist.gov/div898/handbook/eda/section3/bihistog.htm for a description of a bihistogram. -- Hal Varian voice: 510-643-4757 SIMS, 102 South Hall fax: 510-642-5814 University of California [EMAIL PROTECTED] Berkeley, CA 94720-4600http://www.sims.berkeley.edu/~hal __ 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-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] Sharing of Libraries (S+ and R)
You might want to check out: http://www.omegahat.org/RinS/ Andy From: [EMAIL PROTECTED] Hi, Can anyone please advise if there is a neat way to 'share' libraries of (previously developed) S+ code with R? Specifically, within S+ I can use the attach(what = Chapter Directory, pos = 2) command, to retrieve previously developed functions and variables to position 2 in the search list. [Some may be intentionally masked by what's in the current working chapter]. Can I similarly directly retrieve these functions and variables within R at position 2 in the search list? I have been able to achieve limited success via data.dump (within S+) and subsequent data.restore functionality (within R). I have intentionally NOT restored objects beginning with . (via use of initial argument objects(pos, regexpr.pattern = ^[^.] within S+ data.dump command) because of issues with .Random.seed due to differing random number generation methodologies between S+ and R. I would wish to maintain this rationale of not including such . objects if possible. Also, I am not sure how to restore objects to (a new R object at) position 2 as opposed to my workspace (env argument defaulting to .GlobalEnv) via data.restore? With regard to the 'attach' functionality within R I have been able to retrieve previous functions developed within R and saved as an R data file. So maybe my issue boils down to 'converting' the S+ Chapter Directory into an R data file? I hope there is indeed such a simple solution. Any help or advice would be greatly appreciated. Thanks and kind regards Paul ** Irish Life Investment Managers Limited is authorised by the Financial Regulator under Section 10 of the Investment Intermediaries Act, 1995. While Irish Life Investment Managers uses reasonable efforts to ensure that the information contained in this email is current, accurate and complete at the date of publication, no representations or warranties are made (express or implied) as to the reliability, accuracy or completeness of such information. Irish Life Investment Managers therefore cannot be held liable for any loss arising directly or indirectly from the use of, or any action taken in reliance on, any information contained in this email. This material is for information only and does not constitute an offer or recommendation to buy or sell any investment, or subscribe to any investment management or advisory service. It is intended for the use of institutional and other professional investors. Past performance is not indicative of future results. The value of funds we manage may fall as well as rise. This email and any files transmitted with it are confidentia...{{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 __ 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] bihistogram plots
Just what I want, thanks! Gabor Grothendieck wrote: Also note that there is an example of that here: http://addictedtor.free.fr/graphiques/graphcode.php?graph=136 On 3/12/06, Liaw, Andy [EMAIL PROTECTED] wrote: I believe the histbackback() function in the `Hmisc' package does what you want. Andy From: Hal Varian Does anyone have code to plot bihistograms in R? See http://www.itl.nist.gov/div898/handbook/eda/section3/bihistog.htm for a description of a bihistogram. -- Hal Varian voice: 510-643-4757 SIMS, 102 South Hall fax: 510-642-5814 University of California [EMAIL PROTECTED] Berkeley, CA 94720-4600http://www.sims.berkeley.edu/~hal __ 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 -- Hal Varian voice: 510-643-4757 SIMS, 102 South Hall fax: 510-642-5814 University of California [EMAIL PROTECTED] Berkeley, CA 94720-4600http://www.sims.berkeley.edu/~hal __ 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] bihistogram plots
On 12 March 2006 at 20:12, Hal Varian wrote: | Just what I want, thanks! It would be nice to have a function akin to the NIST example you referred, i.e. rotated with the histograms 'on top of each other' rather than back to back. However, from a quick glance at Pat Burns' code in histbackback() it does not seem obvious how to make that a simple switch. Regards, Dirk | Gabor Grothendieck wrote: | Also note that there is an example of that here: | | http://addictedtor.free.fr/graphiques/graphcode.php?graph=136 | | On 3/12/06, Liaw, Andy [EMAIL PROTECTED] wrote: | | I believe the histbackback() function in the `Hmisc' package does what you | want. | | Andy | | From: Hal Varian | | Does anyone have code to plot bihistograms in R? | | See http://www.itl.nist.gov/div898/handbook/eda/section3/bihistog.htm | for a description of | a bihistogram. | | -- | Hal Varian voice: 510-643-4757 | SIMS, 102 South Hall fax: 510-642-5814 | University of California [EMAIL PROTECTED] | Berkeley, CA 94720-4600http://www.sims.berkeley.edu/~hal | | __ | 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 | | | | -- | Hal Varian voice: 510-643-4757 | SIMS, 102 South Hall fax: 510-642-5814 | University of California [EMAIL PROTECTED] | Berkeley, CA 94720-4600http://www.sims.berkeley.edu/~hal | | __ | 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 -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ 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] Density Estimation
Hallo I am trying to use the package LocFit to follow the example given in an Introductory note of C Loader concerning density estimation. It involves the geyser dataset (107 observations on durations, inlc in the package). I have tried the following (using the latest version of R): fit.of - locfit(~geyser,flim=c(1,6),alpha=c(0.15,0.9)) plot(fit.of,get.data=T,mpv=200) This produces a plot (after several warnings). My question is: how can I get the plot to cover the range: 1 - 6 ? for durations. The plot covers the observed data range only. It appears there is a problem with flim=c(1,6) flim is not actually correct, and consequently c(1,6) is not used correctly. I have also tried to use xlim=c(1,6), but without success. I need some help on this please. Thanks Jacob Jacob L van Wyk Department of Statistics University of Johannesburg APK P O Box 524 Auckland Park 2006 South Africa Tel: +27-11-489-3080 Fax: +27-11-489-2832 __ 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] RFC: default background on lattice plots
JohnF == John Fox [EMAIL PROTECTED] on Sat, 11 Mar 2006 13:29:34 -0500 writes: JohnF Dear Deepayan, As you say, it's currently very easy JohnF to change settings (which is what I do routinely), JohnF but since you asked, I much prefer the settings in JohnF canonical.theme(pdf) and therefore would prefer JohnF that the windows() device use these settings as a JohnF default (independent of the printing issue). JohnF Regards, and thanks for the lattice package, indeed, thanks a lot, Deepayan! I think it would make much sense to use the *same* canonical.theme for all interactive default devices. This may be important in teaching, packages, user-written functions which often are all meant to be used interactively; I think it would be painful if students in my class looked at quite differently colored pictures depending on if they are using MacOS X, Linux or Windows. Hence, if you change the setting for windows(), I think you should also do so for x11() and quartz(). Martin Maechler, ETH Zurich __ 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] Ordination of feature film data question
`Ordination' is ecologists' terminology for multidimensional scaling. You will find worked examples in MASS (the book, see the R FAQ), and the two most commonly used functions, isoMDS and sammon, in MASS the package. In your example, the main issue is going to be to choose an appropriate dissimilarity measure, and dist() (in stats) and daisy() in package cluster will give you a good start. On Sat, 11 Mar 2006, David Woods wrote: I am severely rusty re. multivariate / ordination analysis, having done my last work 40 years ago (in plant ecology). I am interested in exploring applications of multivariate analytic approaches to data from the history of motion picture films. I'd very much appreciate any pointers as to possibly appropriate proceedures. The individual samples may be individual films and the measurements may be the presence and absence of actors and production personel; for example two films with many actors and / or crew in common would be located close together in the resultant ordination, while films with few or no personel in common would be located far apart. May I express my appreciation in advance to any helpful recipients. cordially David Woods Dr. David Woods M.B.K.S. Holcus Ltd. 16 John Street Kingston Square Hull HU2 8DH East Yorkshire UK tel. 44 (0)1482 323421 cel (0781) 259 1772 [[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