Re: [R] lme4: Extract fixed effects Val, SE, t, p
Zev Ross zev at zevross.com writes: Using glmmPQL you can extract the full table of estimates, SE, p-values etc using as an example: mymodel-glmmPQL(mymodel here) summary(mymodel)[[18]] How can I pull this table out of a lmer object in lme4? Looks like it is not so easy, the code that produces the table is rather hidden in Matrix\r\lmer.R, about line 400 setMethod(show, summary.lmer, function(object) { fcoef - [EMAIL PROTECTED] useScale - [EMAIL PROTECTED] You might be able to write your own code using the outline given there, but you could run into trouble with method getFixDF. 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
[R] Help with data.frame and lapply
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello: I'm having problems with this line of code: X.lm - lapply(names(d), function(x) lm(d[cls] ~ d[x], data=d)) d[x] is what is giving trouble here, but I don't know exactly how to solve it. What I'm trying to do is to create a linear model from each column of the data frame 'd' to apply ANOVA later. Thanks very much in advance. Regards: Juan Daniel López Serna - Instituto de Ingeniería del Conocimiento (http://www.iic.uam.es) Universidad Autónoma de Madrid -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFDonvRXHsVbn2qIYMRAqi8AJ0X6zOAevAGzMczQ+ahHlVJnUK4ZQCeIDi6 PPB3baK8JNOa3eoIgbmVCdM= =WKlt -END PGP SIGNATURE- __ R-help@stat.math.ethz.ch 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 with data.frame and lapply
you could use something like: d - data.frame(x1 = rnorm(100), x2 = rnorm(100), x3 = rnorm(100), cls = rnorm(100)) lapply(d[-match(cls, names(d))], function(x, y) lm(y ~ x), y = d$cls) 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: Juan Daniel López Serna [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, December 16, 2005 9:33 AM Subject: [R] Help with data.frame and lapply -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello: I'm having problems with this line of code: X.lm - lapply(names(d), function(x) lm(d[cls] ~ d[x], data=d)) d[x] is what is giving trouble here, but I don't know exactly how to solve it. What I'm trying to do is to create a linear model from each column of the data frame 'd' to apply ANOVA later. Thanks very much in advance. Regards: Juan Daniel López Serna - Instituto de Ingeniería del Conocimiento (http://www.iic.uam.es) Universidad Autónoma de Madrid -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFDonvRXHsVbn2qIYMRAqi8AJ0X6zOAevAGzMczQ+ahHlVJnUK4ZQCeIDi6 PPB3baK8JNOa3eoIgbmVCdM= =WKlt -END PGP SIGNATURE- __ R-help@stat.math.ethz.ch 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 with data.frame and lapply
Hello: I'm having problems with this line of code: X.lm - lapply(names(d), function(x) lm(d[cls] ~ d[x], data=d)) d[x] is what is giving trouble here, but I don't know exactly how to solve it. How does d look like? Probably d[,cls] and d[,x] instead of d[cls] and d[x] solves your problem. PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html and *give a reproducible example*. Best, Matthias What I'm trying to do is to create a linear model from each column of the data frame 'd' to apply ANOVA later. Thanks very much in advance. Regards: Juan Daniel López Serna - Instituto de Ingeniería del Conocimiento (http://www.iic.uam.es) Universidad Autónoma de Madrid -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFDonvRXHsVbn2qIYMRAqi8AJ0X6zOAevAGzMczQ+ahHlVJnUK4ZQCeIDi6 PPB3baK8JNOa3eoIgbmVCdM= =WKlt -END PGP SIGNATURE- __ R-help@stat.math.ethz.ch 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] Help with data.frame and lapply
d - data.frame(x1 = rnorm(100), x2 = rnorm(100), x3 = rnorm(100), cls = rnorm(100)) dd - subset(d, sel=-cls) lapply(paste(lm(cls ~, names(dd), ,data=d)), function(x) eval(parse(text=x))) Juan Daniel López Serna a écrit : -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello: I'm having problems with this line of code: X.lm - lapply(names(d), function(x) lm(d[cls] ~ d[x], data=d)) d[x] is what is giving trouble here, but I don't know exactly how to solve it. What I'm trying to do is to create a linear model from each column of the data frame 'd' to apply ANOVA later. Thanks very much in advance. Regards: Juan Daniel López Serna - Instituto de Ingeniería del Conocimiento (http://www.iic.uam.es) Universidad Autónoma de Madrid -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFDonvRXHsVbn2qIYMRAqi8AJ0X6zOAevAGzMczQ+ahHlVJnUK4ZQCeIDi6 PPB3baK8JNOa3eoIgbmVCdM= =WKlt -END PGP SIGNATURE- __ R-help@stat.math.ethz.ch 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] autocorrelation test
Hi all, I would like to test the relevance of a vector field (i.e. if the vectors are organized or not). To do so, I would like to use an autocorrelation test, so that I have two questions: - is the Watson test applicable to that perpuse ? - is the kuiper test applicable to that purpuse ? Regards Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 __ R-help@stat.math.ethz.ch 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] The fastest way to select and execute a few selected functions inside a function
- Original Message - From: Ales Ziberna [EMAIL PROTECTED] To: R-help r-help@stat.math.ethz.ch Sent: Wednesday, December 14, 2005 6:05 PM Subject: The fastest way to select and execute a few selected functions inside a function Dear useRs? I have the following problem! I have a function that calls one or more functions, depending on the input parameters. I am searching for the fastest way to select and execute the selected functions and return their results in a list. The number of possible functions is 10, however usually only 2 are selected (although sometimes more, even all). For examples, if I have function myf and the possible functions that I want to call are mean, max and sum. I have thought of one way (myf) to do that and am interested if there maybe exists a faster way (the speed is very important, since this can be repeated millions of times in my function). myf-function(FUN, x){ f-list(mean=mean, max=max, sum=sum) res- vector( mode=list) for(i in FUN){ res[[i]]-f[[i]](x) } return(res) } myf(FUN=c(mean,max),x=1:10) In this case, it would be faster if I would compute all functions, even if I need only one: myf.all-function(x){ list(mean=mean(x), max=max(x), sum=sum(x)) } gc();system.time(for(i in 1:1)myf.all(1:20)) used (Mb) gc trigger (Mb) max used (Mb) Ncells 165659 4.5 35 9.4 35 9.4 Vcells 61135 0.5 786432 6.0 283043 2.2 [1] 0.90 0.00 1.08 NA NA gc();system.time(for(i in 1:1)myf(FUN=mean,1:20)) used (Mb) gc trigger (Mb) max used (Mb) Ncells 165659 4.5 35 9.4 35 9.4 Vcells 61135 0.5 786432 6.0 283043 2.2 [1] 1.14 0.00 1.40 NA NA This does (usually) not happen in my case, since most of functions I consider are more complex. Thanks in advance for any suggestions! Best regards, Ales Ziberna __ R-help@stat.math.ethz.ch 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] lme4: Extract fixed effects Val, SE, t, p
There are certain functions which can easily extracts the various components, however. For instance, you can grab the fixed effects using fixef(), the variance components using VarCorr, and the standard errors of the fixed effects using vcov() -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dieter Menne Sent: Friday, December 16, 2005 3:28 AM To: r-help@stat.math.ethz.ch Subject: Re: [R] lme4: Extract fixed effects Val, SE, t, p Zev Ross zev at zevross.com writes: Using glmmPQL you can extract the full table of estimates, SE, p-values etc using as an example: mymodel-glmmPQL(mymodel here) summary(mymodel)[[18]] How can I pull this table out of a lmer object in lme4? Looks like it is not so easy, the code that produces the table is rather hidden in Matrix\r\lmer.R, about line 400 setMethod(show, summary.lmer, function(object) { fcoef - [EMAIL PROTECTED] useScale - [EMAIL PROTECTED] You might be able to write your own code using the outline given there, but you could run into trouble with method getFixDF. 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 __ R-help@stat.math.ethz.ch 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] Vector of matrix
Dear statisticians, I would like to save results for a for loop in a vector previously created. My result would be of class matrix. I tried the following script: Script: #Creation of a previous vector n.Tree-2 VectorX-rep(1,n.Tree) #loop for (i in 1:2) { Ti-MatOccurTree[Tree[i],1] #number of observation for Tree i Xi-matrix(data=1,nrow=Ti,ncol=2) Xi[,2]-treedata2$lnE[IdentTree==Tree[i]] VectorX[i]-Xi } Console: VectorX[i]-Xi Warning message: le nombre d'objets à remplacer n'est pas multiple de la taille du remplacement number of object to replace isn't a multiple of the length of the replacement Would you have any solution to create a vector of matrix VectorX ? Thanks for your help. Ghislain Vieilledent. [[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] Vector of matrix
It seems that Xi is a matrix; so it can't be included in a vector. You need to create a list for the result of your for loop. res - list() for ( i in ...) { res[[i]] - Xi } Vieilledent Ghislain a écrit : Dear statisticians, I would like to save results for a for loop in a vector previously created. My result would be of class matrix. I tried the following script: Script: #Creation of a previous vector n.Tree-2 VectorX-rep(1,n.Tree) #loop for (i in 1:2) { Ti-MatOccurTree[Tree[i],1] #number of observation for Tree i Xi-matrix(data=1,nrow=Ti,ncol=2) Xi[,2]-treedata2$lnE[IdentTree==Tree[i]] VectorX[i]-Xi } Console: VectorX[i]-Xi Warning message: le nombre d'objets à remplacer n'est pas multiple de la taille du remplacement number of object to replace isn't a multiple of the length of the replacement Would you have any solution to create a vector of matrix VectorX ? Thanks for your help. Ghislain Vieilledent. [[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] Hmisc latex function
Paul, I believe that the bug has been fixed in the CVS version of latex(), but it has not yet made its way to an updated version of Hmisc on CRAN from what I can see. You can get the updated version of latex() from: http://biostat.mc.vanderbilt.edu/cgi-bin/cvsweb.cgi/Hmisc/R/latex.s Click on the 'download' link for version 1.14 at the top of the page. You can save the updated code to a text file and then source() it into a R session for the time being. HTH, Marc Schwartz On Thu, 2005-12-15 at 15:53 -0600, Paul Johnson wrote: Does anybody suggest a work-around this problem? pj Marc Schwartz (via MN) wrote: On Wed, 2005-10-12 at 08:33 -0500, Charles Dupont wrote: Marc Schwartz (via MN) wrote: On Tue, 2005-10-11 at 10:01 -0400, Rick Bilonick wrote: I'm using R 2.2.0 on an up-to-date version of Fedora Core 4 with the latest version of Hmisc. When I run an example from the latex function I get the following: x - matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','enLine 2'))) x c d enLine 2 a 1 35 b 2 46 latex(x) # creates x.tex in working directory sh: line 0: cd: “/tmp/Rtmpl10983”: No such file or directory This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) entering extended mode ! I can't find file `“/tmp/Rtmpl10983/file643c9869”'. * “/tmp/Rtmpl10983/file643c9869” Please type another input file name: q (/usr/share/texmf/tex/latex/tools/q.tex LaTeX2e 2003/12/01 Babel v3.8d and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur kish, ukrainian, nohyphenation, loaded. File ignored xdvi-motif.bin: Fatal error: /tmp/Rtmpl10983/file643c9869.dvi: No such file. How can I fix this? Rick B. I get the same results, also on FC4 with R 2.2.0. I am cc:ing Frank here for his input, but a quick review of the code and created files suggests that there may be conflict between the locations of some of the resultant files during the latex system call. Some files appear in a temporary R directory, while others appear in the current R working directory. For example, if I enter the full filename: /tmp/RtmpC12100/file643c9869.tex at the latex prompt, I get: latex(x) sh: line 0: cd: “/tmp/RtmpC12100”: No such file or directory This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) entering extended mode ! I can't find file `“/tmp/RtmpC12100/file643c9869”'. * “/tmp/RtmpC12100/file643c9869” Please type another input file name: *** loading the extensions datasource /tmp/RtmpC12100/file643c9869.tex (/tmp/RtmpC12100/file643c9869.tex LaTeX2e 2003/12/01 Babel v3.8d and hyphenation patterns for american, french, german, ngerman, b ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur kish, ukrainian, nohyphenation, loaded. (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2004/02/16 v1.4f Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/geometry/geometry.sty (/usr/share/texmf/tex/latex/graphics/keyval.sty) (/usr/share/texmf/tex/latex/geometry/geometry.cfg)) No file file643c9869.aux. [1] (./file643c9869.aux) ) Output written on file643c9869.dvi (1 page, 368 bytes). Transcript written on file643c9869.log. xdvi-motif.bin: Fatal error: /tmp/RtmpC12100/file643c9869.dvi H, It works for me. Interesting. It almost looks like the temp dir is not being created, but thats not possible because R does that. It might be a Unicode issue with you system shell. Can you run this statement in R sys(paste('cd',dQuote(tempdir()),;, echo Hello BOB test.test, ;,cat test.test)) What version of Hmisc are you using? What local are you using? Charles Hmisc version 3.0-7, Dated 2005-09-15, which is the latest according to CRAN. sys(paste('cd',dQuote(tempdir()),;, + echo Hello BOB test.test, + ;,cat test.test)) sh: line 0: cd: “/tmp/RtmpGY5553”: No such file or directory [1] Hello BOB From a bash console: $ cd /tmp/RtmpGY5553 $ pwd /tmp/RtmpGY5553 $ locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_NUMERIC=en_US.UTF-8 LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 LC_ALL= On the creation of the sys() call, it looks like the backquotes are causing the problem:
[R] DUPLEX
Hi all, not to invent the wheel a second time I wonder if someone out there has programmend Snee's CADEX algorithm (Validation of regression models: Methods and examples, Technometrics 19, 415-428). Thank you in advance. D. Trenkler -- Dietrich Trenkler c/o Universitaet Osnabrueck Rolandstr. 8; D-49069 Osnabrueck, Germany email: [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
Re: [R] notification (PR#8400)
I don't care what you guys say -- that email was for me!! That money is MINE, baby!! __ R-help@stat.math.ethz.ch 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] multiple plots per page
R-help, I would like to place nine (3X3) plots per page. I am not properly implement mfrow(3,3) in the script below: jpeg(xyplot.jpg) #names output file my_args - commandArgs() #sets up to take args from dos batch command mfcol(3,3) #set page for 3X3 TEMPS - c(-15,25,85)#list of temps VBATS - c(3,3.6,4.7)#list of Bats BOARDS - c(YZ0DC,ZD0DC,0E0DC,2E0DC,3E0DC)#list of boards #load the xtal data into all with formatting for memory saving all - read.csv(my_args[3], colClasses=c('factor', rep('integer',3),'numeric', 'numeric', 'numeric', 'integer', 'integer', 'integer', 'numeric', 'factor', 'factor', rep('integer', 5), 'numeric', 'integer', 'numeric')) #get data by board and temp and voltage for( T in TEMPS) for(V in VBATS) for(B in BOARDS) { board - subset(all,(Temperature==T BoardNumber == B PS13==V)) plot((board$FineTuneDACStep * board$ArrayID),board$OutpFreq) } Can you help me? Regards, Bill Bill Hunsicker RF Micro Devices 7625 Thorndike Road Greensboro, NC 27409 336-678-5260 610-597-9985(m) __ R-help@stat.math.ethz.ch 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] millions of comparisons, speed wanted
I have not taken the time to look into this example, but daisy() from the (recommended, hence part of R) package 'cluster' is more flexible than dist(), particularly in the case of NAs and for (a mixture of continuous and) categorical variables. It uses a version of Gower's formula in order to deal with NAs and asymmetric binary variables. The example below look like very well matching to this problem. Regards, Martin Maechler, ETH Zurich Adrian == Adrian DUSA [EMAIL PROTECTED] on Thu, 15 Dec 2005 22:04:01 +0200 writes: Adrian Dear Andy, Adrian On Thursday 15 December 2005 20:57, Liaw, Andy wrote: Just some untested idea: If the data are all 0/1, you could use dist(input, method=manhattan), and then check which entry equals 1. This should be much faster than creating all pairs of rows and check position-by-position. Adrian Thanks for the idea, I played a little with it. At the beginning yes, the data Adrian are all 0/1, but during the minimizing iterations there are also x values; Adrian for example comparing: Adrian 0 1 0 1 1 Adrian 0 0 0 1 1 Adrian should return Adrian 0 x 0 1 1 Adrian whereas Adrian 0 x 0 1 1 Adrian 0 0 0 1 1 Adrian shouldn't even be compared (they have different number of figures). Adrian Replacing x with NA in dist is not yielding results either, as with Adrian NA 0 0 1 1 Adrian 0 0 0 1 1 Adrian dist returns 0. Adrian I even wanted to see if I could tweak the dist code, but it calls a C program Adrian and I gave up. Adrian Nice idea anyhow, maybe I'll find a way to use it further. Adrian Best, Adrian Adrian Adrian -- Adrian Adrian DUSA Adrian Romanian Social Data Archive Adrian 1, Schitu Magureanu Bd Adrian 050025 Bucharest sector 5 Adrian Romania Adrian Tel./Fax: +40 21 3126618 \ Adrian +40 21 3120210 / int.101 Adrian __ Adrian R-help@stat.math.ethz.ch mailing list Adrian https://stat.ethz.ch/mailman/listinfo/r-help Adrian 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] column name of a table
hy all, I wish to switch in a part in my code that use read.table to scan, actually i use this: tab-scan(data.dat,what=integer(),skip=1) dim(tab)-c(75,length(tab)/75) tab-t(tab) It gives me a new tab with 75 columns, but i when i was using read.table with headers then attach i could use the columns names to access the data values, now how can i attach the columns names that are on the first line of the file data.dat? Any help would be great! thks all guillaume. __ R-help@stat.math.ethz.ch 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] multiple plots per page
Bill Hunsicker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] R-help, I would like to place nine (3X3) plots per page. I am not properly implement mfrow(3,3) in the script below: Does this help? jpeg(3x3.jpg) oldpar - par( mfcol=c(3,3) ) plot(1) plot(2) plot(3) plot(4) plot(5) plot(6) plot(7) plot(8) plot(9) par(oldpar) dev.off() efg __ R-help@stat.math.ethz.ch 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] Need help for a statistical problem (See the posting guide)
In response to a thread where a statistical question unrelated to R was asked, Uwe Ligges wrote: PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Please ask a local statistical consultant for help. Uwe Ligges Perhaps Uwe's admonition to do read the posting guide was just a knee jerk reaction to an unrecognized poster's name. Of course, if the poster did read the posting guide, they would have learned that : Questions about statistics: The R mailing lists are primarily intended for questions and discussion about the R software. However, questions about statistical methodology are sometimes posted. If the question is well-asked and of interest to someone on the list, it may elicit an informative up-to-date answer. See also the Usenet groups sci.stat.consult (applied statistics and consulting) and sci.stat.math (mathematical stat and probability). The language here is so equivocal! OK, it is really for R, but statistical questions are asked and you might get an informative and up-to-date answer if you do it well. Sounds good to me! I might start using r-help for my statistical questions. Thanks for referring me to the posting guide Uwe (though I am not sure why it was relevant the the original post). My point: If r-help does not want statistical questions, and people who ask statistical questions are referred to the posting guide, shouldn't the posting guide *actually* say no statistical questions! Brett __ R-help@stat.math.ethz.ch 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 question
HI, Suppose I have the following data structure. LRT tp 1 1.50654010 522 2 0.51793929 522 3 0.90340299 522 4 1.20293325 522 5 1.05578774 523 6 0.01617942 523 7 0.68183543 523 8 0.43820244 523 9 1.14123995 524 10 0.05809550 524 11 0.93061597 524 12 1.39739700 524 13 1.05220953 525 14 0.03471461 525 15 0.63168798 525 16 1.40592603 525 17 1.41884492 526 18 0.23388479 526 19 0.21881064 526 20 0.99710830 526 21 2.02054187 527 22 1.99872887 527 23 1.04187450 527 24 1.31556807 527 25 2.5190 528 26 2.94778561 528 27 1.88800177 528 28 2.08249941 528 I have succesfully used a command line such as the one below to get maxima for each tp-category' data.out-data[tapply(LRT,tp, function(x) which(LRT==max(x))),] However, when I try it on the above data, it gives me the following error message: Error in [.data.frame(data, tapply(LRT, tp, function(x) which(LRT == : invalid subscript type I don't know what to do. Thanks for your help -- __ R-help@stat.math.ethz.ch 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 a sort of tapply() to data frames
Hi, On 12/15/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: You don't get them as a column but you get them as the component labels. by(df, df$Day, function(x) colMeans(x[,-1])) If you convert it to a data frame you get them as the rownames: do.call(rbind, by(df, df$Day, function(x) colMeans(x[,-1]))) Thanks! that helps a lot. But I still run into problems with this. Sorry for bothering you with newbie questions, if my problems are trivial, point me to a suitable guide (I did read the introductory materials on R). First: it works for colMeans, but it does not work for a function like this: do.call(rbind, by(df, df$Day, function(x) cor(df$val1, df$val2)) it says Error in do.call() : second argument must be a list. I do not understand this, as the second argument is b of the class by, as it was in the case of colMeans, so it did not change...? Second: in case of colMeans (where it works) it returns a matrix, and I have troubles getting it back to the data.frame, so I can access blah$Day. Instead, I have smth like that: do.call(rbind,b) V2 V3 V4 V5 V7 Tue 19 15 2 0 1.538462 Wed 5 3 6 1 1.285714 ...and I do not know how to acces, for example, values for Tue, except with [1,] -- which is somewhat problematic. For example, I would like to display the 3 days for which V7 is highest. How can I do that? I think you want class(df) which shows its a data frame. Ops. Sorry, I didn't guess it from the manual :-) aggregate(df[,-1], df[,1,drop = FALSE], mean) But why is df[,1,drop=FALSE] a list? I don't get it... aggregate(df[,-1], list(Day = df$Day), mean) Yeah, I figured out that one. Another alternative is to use summaryBy from the doBy package found at http://genetics.agrsci.dk/~sorenh/misc/ : library(doBy) summaryBy(cbind(var1, var2) ~ Day, data = df) I think I am not confident enough with the basic data types in R, I need to understand them before I go over to specialized packages :-) Again, thanks a lot, January -- January Weiner 3 -+--- Division of Bioinformatics, University of Muenster | Schloßplatz 4 (+49)(251)8321634 | D48149 Münster http://www.uni-muenster.de/Biologie.Botanik/ebb/| Germany __ R-help@stat.math.ethz.ch 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] column name of a table
I am not sure to understand what you want, but maybe colnames() is what you want. for example mat [,1] [,2] [,3] [1,]135 [2,]246 colnames(mat)-c(col1,col2,col3) mat col1 col2 col3 [1,]135 [2,]246 was it what you were looking for ? florence. On 12/16/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hy all, I wish to switch in a part in my code that use read.table to scan, actually i use this: tab-scan(data.dat,what=integer(),skip=1) dim(tab)-c(75,length(tab)/75) tab-t(tab) It gives me a new tab with 75 columns, but i when i was using read.tablewith headers then attach i could use the columns names to access the data values, now how can i attach the columns names that are on the first line of the file data.dat? Any help would be great! thks all guillaume. __ R-help@stat.math.ethz.ch 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] tapply question
Frank Johannes wrote: HI, Suppose I have the following data structure. LRT tp 1 1.50654010 522 2 0.51793929 522 3 0.90340299 522 4 1.20293325 522 5 1.05578774 523 6 0.01617942 523 7 0.68183543 523 8 0.43820244 523 9 1.14123995 524 10 0.05809550 524 11 0.93061597 524 12 1.39739700 524 13 1.05220953 525 14 0.03471461 525 15 0.63168798 525 16 1.40592603 525 17 1.41884492 526 18 0.23388479 526 19 0.21881064 526 20 0.99710830 526 21 2.02054187 527 22 1.99872887 527 23 1.04187450 527 24 1.31556807 527 25 2.5190 528 26 2.94778561 528 27 1.88800177 528 28 2.08249941 528 I have succesfully used a command line such as the one below to get maxima for each tp-category' data.out-data[tapply(LRT,tp, function(x) which(LRT==max(x))),] However, when I try it on the above data, it gives me the following error message: Error in [.data.frame(data, tapply(LRT, tp, function(x) which(LRT == : invalid subscript type Works for me. Look at your data structures and check whether your data frame is OK. Or much better easier: tapply(LRT, tp, max) Uwe Ligges I don't know what to do. Thanks for your help -- __ R-help@stat.math.ethz.ch 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] Butterworth low-pass filter
Has anybody implemented code to extract coefficients for a Butterworth low-pass filter? I know Matlab has it implemented in the signal toolbox. I want to make use of a 10 point Butterworth low-pass filter for smoothing. In Matlab the code would look like this: % Determine the filter coefficients [b,a]=butter(10,0.1) % Apply the filter to the input outdata = filter (b,a,indata); The archives contain similar questions but if somebody responded, they did it off-list. Thanks in advance, 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] dendrogram branches with different lty
Dear r-list, I am trying to visually seperate the two main clusters of a dendrogram. The idea is to use: 'edgePar=list(lty=3)' for 'dend1[[1]]' and 'edgePar=list(lty=1)' for 'dend1[[2]]' I have not found a way to solve this. Any suggestions? Patrick hc - hclust(dist(USArrests), ave) (dend1 - as.dendrogram(hc)) par(mfrow=c(2,2)) plot(dend1) plot(dend1[[1]],edgePar=list(lty=3)) plot(dend1[[2]],edgePar=list(lty=1)) -- Patrick Kuss PhD-student Institute of Botany University of Basel Schönbeinstr. 6 CH-4056 Basel +41 61 267 2976 __ R-help@stat.math.ethz.ch 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 a sort of tapply() to data frames
On 12/16/05, January Weiner [EMAIL PROTECTED] wrote: Hi, On 12/15/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: You don't get them as a column but you get them as the component labels. by(df, df$Day, function(x) colMeans(x[,-1])) If you convert it to a data frame you get them as the rownames: do.call(rbind, by(df, df$Day, function(x) colMeans(x[,-1]))) Thanks! that helps a lot. But I still run into problems with this. Sorry for bothering you with newbie questions, if my problems are trivial, point me to a suitable guide (I did read the introductory materials on R). First: it works for colMeans, but it does not work for a function like this: do.call(rbind, by(df, df$Day, function(x) cor(df$val1, df$val2)) There are a number of problems: 1. the function does not depend on x and therefore will return the same result for each day group. 2. although ?by says it returns a list, it apparently simplifies the result, contrary to the documentation, in certain cases. Try this: do.call(rbind, as.list(by(df, df$Day, function(x) cor(x$val1, x$val2 or this: do.call(rbind, by(df, df$Day, function(x) list(cor = cor(x$val1, x$val2 3. In your sample data val1 is constant for Wed so you won't be able to get a correlation. That's the source of the warning that you get when running the line in #2. it says Error in do.call() : second argument must be a list. I do not understand this, as the second argument is b of the class by, as it was in the case of colMeans, so it did not change...? Second: in case of colMeans (where it works) it returns a matrix, and I have troubles getting it back to the data.frame, so I can access blah$Day. Instead, I have smth like that: Try blah[,Day] which works with both matrices and data frames. do.call(rbind,b) V2 V3 V4 V5 V7 Tue 19 15 2 0 1.538462 Wed 5 3 6 1 1.285714 Another possibility is to coerce it to a data frame: as.data.frame(do.call(rbind, b)) or change your function to return a list. ...and I do not know how to acces, for example, values for Tue, except with [1,] -- which is somewhat problematic. For example, I would like to display the 3 days for which V7 is highest. How can I do that? I think you want class(df) which shows its a data frame. Ops. Sorry, I didn't guess it from the manual :-) aggregate(df[,-1], df[,1,drop = FALSE], mean) But why is df[,1,drop=FALSE] a list? I don't get it... Because df is a one column data frame and data frames are lists. Had we not specified drop, it would have automatically dropped it since it has only one dimension simplifying it to a non-list. We do not want that simplification here. aggregate(df[,-1], list(Day = df$Day), mean) Yeah, I figured out that one. Another alternative is to use summaryBy from the doBy package found at http://genetics.agrsci.dk/~sorenh/misc/ : library(doBy) summaryBy(cbind(var1, var2) ~ Day, data = df) I think I am not confident enough with the basic data types in R, I need to understand them before I go over to specialized packages :-) Again, thanks a lot, January -- January Weiner 3 -+--- Division of Bioinformatics, University of Muenster | Schloßplatz 4 (+49)(251)8321634 | D48149 Münster http://www.uni-muenster.de/Biologie.Botanik/ebb/| Germany __ R-help@stat.math.ethz.ch 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] Wilcoxon Mann-Whitney Rank Sum Test
Does anybody know what is relation between 'T' value calculated by 'wilcox_test' function (coin package) and more common 'W' value? Jarek Tuszynski library(coin) ### Tritiated Water Diffusion Across Human Chorioamnion ### Hollander Wolfe (1999), Table 4.1, page 110 water_transfer - data.frame( + pd = c(0.80, 0.83, 1.89, 1.04, 1.45, 1.38, 1.91, 1.64, 0.73, 1.46, +1.15, 0.88, 0.90, 0.74, 1.21), + age = factor(c(rep(At term, 10), rep(12-26 Weeks, 5 ### Wilcoxon-Mann-Whitney test, cf. Hollander Wolfe (1999), page 111 ### exact p-value and confidence interval for the difference in location ### (At term - 12-26 Weeks) wt - wilcox_test(pd ~ age, data = water_transfer, distribution = exact, conf.int = TRUE) print(wt) Exact Wilcoxon Mann-Whitney Rank Sum Test data: pd by groups 12-26 Weeks, At term T = -1.2247, p-value = 0.2544 alternative hypothesis: true mu is not equal to 0 95 percent confidence interval: -0.76 0.15 sample estimates: difference in location -0.305 [[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] Looking for a sort of tapply() to data frames
Gabor Grothendieck wrote: On 12/16/05, January Weiner [EMAIL PROTECTED] wrote: Hi, On 12/15/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: You don't get them as a column but you get them as the component labels. by(df, df$Day, function(x) colMeans(x[,-1])) If you convert it to a data frame you get them as the rownames: do.call(rbind, by(df, df$Day, function(x) colMeans(x[,-1]))) Thanks! that helps a lot. But I still run into problems with this. Sorry for bothering you with newbie questions, if my problems are trivial, point me to a suitable guide (I did read the introductory materials on R). First: it works for colMeans, but it does not work for a function like this: do.call(rbind, by(df, df$Day, function(x) cor(df$val1, df$val2)) There are a number of problems: 1. the function does not depend on x and therefore will return the same result for each day group. 2. although ?by says it returns a list, it apparently simplifies the result, contrary to the documentation, in certain cases. Try this: do.call(rbind, as.list(by(df, df$Day, function(x) cor(x$val1, x$val2 or this: do.call(rbind, by(df, df$Day, function(x) list(cor = cor(x$val1, x$val2 3. In your sample data val1 is constant for Wed so you won't be able to get a correlation. That's the source of the warning that you get when running the line in #2. it says Error in do.call() : second argument must be a list. I do not understand this, as the second argument is b of the class by, as it was in the case of colMeans, so it did not change...? Second: in case of colMeans (where it works) it returns a matrix, and I have troubles getting it back to the data.frame, so I can access blah$Day. Instead, I have smth like that: Try blah[,Day] which works with both matrices and data frames. do.call(rbind,b) V2 V3 V4 V5 V7 Tue 19 15 2 0 1.538462 Wed 5 3 6 1 1.285714 Another possibility is to coerce it to a data frame: as.data.frame(do.call(rbind, b)) or change your function to return a list. ...and I do not know how to acces, for example, values for Tue, except with [1,] -- which is somewhat problematic. For example, I would like to display the 3 days for which V7 is highest. How can I do that? I think you want class(df) which shows its a data frame. Ops. Sorry, I didn't guess it from the manual :-) aggregate(df[,-1], df[,1,drop = FALSE], mean) But why is df[,1,drop=FALSE] a list? I don't get it... Because df is a one column data frame and data frames are lists. Had we not specified drop, it would have automatically dropped it since it has only one dimension simplifying it to a non-list. We do not want that simplification here. aggregate(df[,-1], list(Day = df$Day), mean) Yeah, I figured out that one. Another alternative is to use summaryBy from the doBy package found at http://genetics.agrsci.dk/~sorenh/misc/ : library(doBy) summaryBy(cbind(var1, var2) ~ Day, data = df) I think I am not confident enough with the basic data types in R, I need to understand them before I go over to specialized packages :-) Again, thanks a lot, January You might want to look at the summarize function in the Hmisc package. Frank -- January Weiner 3 -+--- Division of Bioinformatics, University of Muenster | Schloßplatz 4 (+49)(251)8321634 | D48149 Münster http://www.uni-muenster.de/Biologie.Botanik/ebb/| Germany __ R-help@stat.math.ethz.ch 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 -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt 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] R Reference Card (especially useful for Newbies)
Newbies (and others!) may find useful the R Reference Card made available by Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf or through the Contributed link on CRAN (where some other reference cards are also linked). It categorizes and organizes a bunch of R's basic, most used functions so that they can be easily found. For example, paste() is under the Strings heading and expand.grid() is under Data Creation. For newbies struggling to find the right R function as well as veterans who can't quite remember the function name, it's very handy. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ R-help@stat.math.ethz.ch 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 compile on AIX 5.3
I'm trying to compile R on AIX 5.3. I've gotten configure to work but make generates the following errors: Target R is up to date. Target R is up to date. Target R is up to date. Target R is up to date. Target Makedeps is up to date. Target libbz2.a is up to date. Target Makedeps is up to date. Target libpcre.a is up to date. Target Makedeps is up to date. Target libz.a is up to date. Target R is up to date. Target Makedeps is up to date. Target libappl.a is up to date. Target Makedeps is up to date. Target libnmath.a is up to date. Target Makedeps is up to date. Target libunix.a is up to date. Target Makedeps is up to date. gcc -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -mno-fp-in-toc -g -O2 -c platform.c -o platform.o In file included from /usr/include/netdb.h:47, from platform.c:1365: /usr/include/netinet/in.h:793: error: parse error before inet6_rth_space /usr/include/netinet/in.h:794: error: parse error before socklen_t /usr/include/netinet/in.h:800: error: parse error before socklen_t /usr/include/netinet/in.h:801: error: parse error before socklen_t /usr/include/netinet/in.h:803: error: parse error before socklen_t /usr/include/netinet/in.h:804: error: parse error before socklen_t /usr/include/netinet/in.h:805: error: parse error before socklen_t /usr/include/netinet/in.h:807: error: parse error before socklen_t /usr/include/netinet/in.h:809: error: parse error before socklen_t In file included from platform.c:1366: /usr/include/sys/socket.h:374: error: parse error before socklen_t /usr/include/sys/socket.h:378: error: parse error before msg_controllen /usr/include/sys/socket.h:380: error: parse error before '}' token /usr/include/sys/socket.h:404: error: parse error before socklen_t /usr/include/sys/socket.h:408: error: parse error before '}' token /usr/include/sys/socket.h:475: error: parse error before socklen_t /usr/include/sys/socket.h:476: error: parse error before socklen_t /usr/include/sys/socket.h:477: error: parse error before socklen_t /usr/include/sys/socket.h:478: error: parse error before socklen_t /usr/include/sys/socket.h:484: error: parse error before socklen_t /usr/include/sys/socket.h:485: error: parse error before socklen_t /usr/include/sys/socket.h:486: error: parse error before socklen_t /usr/include/sys/socket.h:490: error: parse error before socklen_t /usr/include/sys/socket.h:491: error: parse error before socklen_t make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 2. Stop. make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 1. Any ideas on what may be preventing make from completing successfully? I can provide an additional information required. Thanks! Matt [[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] Looking for a sort of tapply() to data frames
One other point. The cor example could be done using tapply like this: tapply(rownames(df), df$Day, function(r) cor(df[r,val1], df[r, val2])) On 12/16/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 12/16/05, January Weiner [EMAIL PROTECTED] wrote: Hi, On 12/15/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: You don't get them as a column but you get them as the component labels. by(df, df$Day, function(x) colMeans(x[,-1])) If you convert it to a data frame you get them as the rownames: do.call(rbind, by(df, df$Day, function(x) colMeans(x[,-1]))) Thanks! that helps a lot. But I still run into problems with this. Sorry for bothering you with newbie questions, if my problems are trivial, point me to a suitable guide (I did read the introductory materials on R). First: it works for colMeans, but it does not work for a function like this: do.call(rbind, by(df, df$Day, function(x) cor(df$val1, df$val2)) There are a number of problems: 1. the function does not depend on x and therefore will return the same result for each day group. 2. although ?by says it returns a list, it apparently simplifies the result, contrary to the documentation, in certain cases. Try this: do.call(rbind, as.list(by(df, df$Day, function(x) cor(x$val1, x$val2 or this: do.call(rbind, by(df, df$Day, function(x) list(cor = cor(x$val1, x$val2 3. In your sample data val1 is constant for Wed so you won't be able to get a correlation. That's the source of the warning that you get when running the line in #2. it says Error in do.call() : second argument must be a list. I do not understand this, as the second argument is b of the class by, as it was in the case of colMeans, so it did not change...? Second: in case of colMeans (where it works) it returns a matrix, and I have troubles getting it back to the data.frame, so I can access blah$Day. Instead, I have smth like that: Try blah[,Day] which works with both matrices and data frames. do.call(rbind,b) V2 V3 V4 V5 V7 Tue 19 15 2 0 1.538462 Wed 5 3 6 1 1.285714 Another possibility is to coerce it to a data frame: as.data.frame(do.call(rbind, b)) or change your function to return a list. ...and I do not know how to acces, for example, values for Tue, except with [1,] -- which is somewhat problematic. For example, I would like to display the 3 days for which V7 is highest. How can I do that? I think you want class(df) which shows its a data frame. Ops. Sorry, I didn't guess it from the manual :-) aggregate(df[,-1], df[,1,drop = FALSE], mean) But why is df[,1,drop=FALSE] a list? I don't get it... Because df is a one column data frame and data frames are lists. Had we not specified drop, it would have automatically dropped it since it has only one dimension simplifying it to a non-list. We do not want that simplification here. aggregate(df[,-1], list(Day = df$Day), mean) Yeah, I figured out that one. Another alternative is to use summaryBy from the doBy package found at http://genetics.agrsci.dk/~sorenh/misc/ : library(doBy) summaryBy(cbind(var1, var2) ~ Day, data = df) I think I am not confident enough with the basic data types in R, I need to understand them before I go over to specialized packages :-) Again, thanks a lot, January -- January Weiner 3 -+--- Division of Bioinformatics, University of Muenster | Schloßplatz 4 (+49)(251)8321634 | D48149 Münster http://www.uni-muenster.de/Biologie.Botanik/ebb/| Germany __ R-help@stat.math.ethz.ch 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 compile on AIX 5.3
1) What version of R is this? If not 2.2.1 beta, please do try that as there have been some recent AIX-related patches. 2) What is on lines 793 794 of /usr/include/netinet/in.h? It looks like some other header file needs to be included first. We only have reports of recent successful builds of R on AIX 5.2, no reports from 5.3. On Fri, 16 Dec 2005, Matthew Beason wrote: I'm trying to compile R on AIX 5.3. I've gotten configure to work but make generates the following errors: Target R is up to date. Target R is up to date. Target R is up to date. Target R is up to date. Target Makedeps is up to date. Target libbz2.a is up to date. Target Makedeps is up to date. Target libpcre.a is up to date. Target Makedeps is up to date. Target libz.a is up to date. Target R is up to date. Target Makedeps is up to date. Target libappl.a is up to date. Target Makedeps is up to date. Target libnmath.a is up to date. Target Makedeps is up to date. Target libunix.a is up to date. Target Makedeps is up to date. gcc -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -mno-fp-in-toc -g -O2 -c platform.c -o platform.o In file included from /usr/include/netdb.h:47, from platform.c:1365: /usr/include/netinet/in.h:793: error: parse error before inet6_rth_space /usr/include/netinet/in.h:794: error: parse error before socklen_t /usr/include/netinet/in.h:800: error: parse error before socklen_t /usr/include/netinet/in.h:801: error: parse error before socklen_t /usr/include/netinet/in.h:803: error: parse error before socklen_t /usr/include/netinet/in.h:804: error: parse error before socklen_t /usr/include/netinet/in.h:805: error: parse error before socklen_t /usr/include/netinet/in.h:807: error: parse error before socklen_t /usr/include/netinet/in.h:809: error: parse error before socklen_t In file included from platform.c:1366: /usr/include/sys/socket.h:374: error: parse error before socklen_t /usr/include/sys/socket.h:378: error: parse error before msg_controllen /usr/include/sys/socket.h:380: error: parse error before '}' token /usr/include/sys/socket.h:404: error: parse error before socklen_t /usr/include/sys/socket.h:408: error: parse error before '}' token /usr/include/sys/socket.h:475: error: parse error before socklen_t /usr/include/sys/socket.h:476: error: parse error before socklen_t /usr/include/sys/socket.h:477: error: parse error before socklen_t /usr/include/sys/socket.h:478: error: parse error before socklen_t /usr/include/sys/socket.h:484: error: parse error before socklen_t /usr/include/sys/socket.h:485: error: parse error before socklen_t /usr/include/sys/socket.h:486: error: parse error before socklen_t /usr/include/sys/socket.h:490: error: parse error before socklen_t /usr/include/sys/socket.h:491: error: parse error before socklen_t make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 2. Stop. make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 1. Any ideas on what may be preventing make from completing successfully? I can provide an additional information required. Thanks! Matt [[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] dendrogram branches with different lty
Hi Patrick, You may want to try out my (highly experimental, so not on CRAN) package A2R. http://addictedtor.free.fr/packages/A2R/A2R_0.0-3.tar.gz 2 dendro's are displayed on RGG, check http://addictedtor.free.fr/graphiques/search.php?q=dendrogram You might also be interrested in Appendix B of Paul Murrel's book : http://www.stat.auckland.ac.nz/~paul/RGraphics/rgraphics.html Romain Le 16.12.2005 17:40, Patrick Kuss a écrit : Dear r-list, I am trying to visually seperate the two main clusters of a dendrogram. The idea is to use: 'edgePar=list(lty=3)' for 'dend1[[1]]' and 'edgePar=list(lty=1)' for 'dend1[[2]]' I have not found a way to solve this. Any suggestions? Patrick hc - hclust(dist(USArrests), ave) (dend1 - as.dendrogram(hc)) par(mfrow=c(2,2)) plot(dend1) plot(dend1[[1]],edgePar=list(lty=3)) plot(dend1[[2]],edgePar=list(lty=1)) -- Patrick Kuss PhD-student Institute of Botany University of Basel Schönbeinstr. 6 CH-4056 Basel +41 61 267 2976 -- 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
Re: [R] R compile on AIX 5.3
Professor, It is version 2.2.0 of R. I'll download 2.2.1 straight away and see if that makes a difference. On lines 793 794 of /usr/include/netinet/in.h, I found the following: socklen_t inet6_rth_space(int, int); void*inet6_rth_init(void *, socklen_t, int, int); I have one other question for you if you don't mind. Do I need a library such as ATLAS to get the most use out of R? Is there a difference with R if you don't use something like ATLAS? I'm glad to be blazing new trails as far as compiling R on AIX 5.3. I think this is a useful exercise. Thanks again! Matthew Beason Unix Systems Engineer - Unix Engineering Harrah's Entertainment, Inc. One Harrah's Court, Las Vegas, NV 89119-4312 Office: 702-494-4097 Mobile: 702-622-6902 [EMAIL PROTECTED] The information contained in this email may be legally privileged and confidential. It is intended to be read only by the person to whom it is addressed. If you have received this in error or are not the intended recipient, please immediately notify the sender and delete all copies of this message. Thank you. -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Friday, December 16, 2005 11:14 AM To: Matthew Beason Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R compile on AIX 5.3 1) What version of R is this? If not 2.2.1 beta, please do try that as there have been some recent AIX-related patches. 2) What is on lines 793 794 of /usr/include/netinet/in.h? It looks like some other header file needs to be included first. We only have reports of recent successful builds of R on AIX 5.2, no reports from 5.3. On Fri, 16 Dec 2005, Matthew Beason wrote: I'm trying to compile R on AIX 5.3. I've gotten configure to work but make generates the following errors: Target R is up to date. Target R is up to date. Target R is up to date. Target R is up to date. Target Makedeps is up to date. Target libbz2.a is up to date. Target Makedeps is up to date. Target libpcre.a is up to date. Target Makedeps is up to date. Target libz.a is up to date. Target R is up to date. Target Makedeps is up to date. Target libappl.a is up to date. Target Makedeps is up to date. Target libnmath.a is up to date. Target Makedeps is up to date. Target libunix.a is up to date. Target Makedeps is up to date. gcc -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -mno-fp-in-toc -g -O2 -c platform.c -o platform.o In file included from /usr/include/netdb.h:47, from platform.c:1365: /usr/include/netinet/in.h:793: error: parse error before inet6_rth_space /usr/include/netinet/in.h:794: error: parse error before socklen_t /usr/include/netinet/in.h:800: error: parse error before socklen_t /usr/include/netinet/in.h:801: error: parse error before socklen_t /usr/include/netinet/in.h:803: error: parse error before socklen_t /usr/include/netinet/in.h:804: error: parse error before socklen_t /usr/include/netinet/in.h:805: error: parse error before socklen_t /usr/include/netinet/in.h:807: error: parse error before socklen_t /usr/include/netinet/in.h:809: error: parse error before socklen_t In file included from platform.c:1366: /usr/include/sys/socket.h:374: error: parse error before socklen_t /usr/include/sys/socket.h:378: error: parse error before msg_controllen /usr/include/sys/socket.h:380: error: parse error before '}' token /usr/include/sys/socket.h:404: error: parse error before socklen_t /usr/include/sys/socket.h:408: error: parse error before '}' token /usr/include/sys/socket.h:475: error: parse error before socklen_t /usr/include/sys/socket.h:476: error: parse error before socklen_t /usr/include/sys/socket.h:477: error: parse error before socklen_t /usr/include/sys/socket.h:478: error: parse error before socklen_t /usr/include/sys/socket.h:484: error: parse error before socklen_t /usr/include/sys/socket.h:485: error: parse error before socklen_t /usr/include/sys/socket.h:486: error: parse error before socklen_t /usr/include/sys/socket.h:490: error: parse error before socklen_t /usr/include/sys/socket.h:491: error: parse error before socklen_t make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 2. Stop. make: 1254-004 The error code from the last command is 1. Stop. make: 1254-004 The error code from the last command is 1. Any ideas on what may be preventing make from completing successfully? I can provide an additional information required. Thanks! Matt [[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.
[R] Multiple plots per page
R-help, I am trying to run a number of plots and want to generate 45 plots with 9 pages per plot. I sent an email about four hours ago, but my email has been funky, I apologize in advance if this message is duplicate. Regards, Bill Bill Hunsicker RF Micro Devices 7625 Thorndike Road Greensboro, NC 27409-9421 [EMAIL PROTECTED] 336-678-5260(w) 610-597-9985(m) 336-678-5088(lab) [[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] partially linear models
Hey, I am estiamting a partially linear model y=X\beta+f(\theta) where the f(\theta) is estiamted using wavelets. Has anyone heard of methods to test if the betas are significant or to address model fit? Thanks for any thoughts or comments. Elizabeth Lawson __ [[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] basis and penalty matrices for natural cubic splines
Hi, I am trying to get the basis matrix and penalty matrix for natural cubic splines. I found R function ns can generate the B-spline basis matrix for a natural cubic spline; and bsplinepen can compute the penalty matrix for functions expressed in terms of a B-spline basis. However, these two functions seem not compatible. I could not get the penalty matrix by bsplinepen using the basis matrix generated from ns. Anyone knows any compatible functions to give the basis matrix and penalty matrix for natural cubic splines? Thanks a lot! Wei __ R-help@stat.math.ethz.ch 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] selecting matrix cels by two factors
Hi, I have a (numeric) matrix X of the type X - matrix(c(1:9),ncol=3,nrow=3) colnames(X) - c(A,B,C) rownames(X) - c(D,E,F) Also, a have a data frame Y like Y - as.data.frame(cbind(c(D,E,F,D,E,F), + c(A,C,A,B,B,C) ) ) I want a matrix like 1 4 X[D,A] X[D,B] 8 5 or, equivalentely, X[E,C] X[E,B] 3 9 X[F,A] X[F,C] Any suggestions? Thanks in advanced, Dimitri __ R-help@stat.math.ethz.ch 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] selecting matrix cels by two factors
You can subscript any arbitrary array (of any dim) with an appropriately dimensioned matrix of integer indices. So all you have to do is convert the dimnames into indices. One simple way to do this is: X[cbind(match(c(D,E,F,D,E,F),rownames(X)), match(c(A,C,A,B,B,C),colnames(X)))] This gives a vector, which you can dimension however you like. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dimitri Joe Sent: Friday, December 16, 2005 3:02 PM To: R-Help Subject: [R] selecting matrix cels by two factors Hi, I have a (numeric) matrix X of the type X - matrix(c(1:9),ncol=3,nrow=3) colnames(X) - c(A,B,C) rownames(X) - c(D,E,F) Also, a have a data frame Y like Y - as.data.frame(cbind( c(D,E,F,D,E,F), + c(A,C,A,B,B,C) ) ) I want a matrix like 1 4X[D,A] X[D,B] 8 5 or, equivalentely, X[E,C] X[E,B] 3 9X[F,A] X[F,C] Any suggestions? Thanks in advanced, Dimitri __ R-help@stat.math.ethz.ch 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] help with multivariate analysis
Dear Dr. Vidali: 1. I would first plot the data a number of different ways. Maybe you've already done plenty of this, but I have had a tendancy to rush to the model I thought was the best without adequate data integrity checks. I typically want to start with normal probability (using qqnorm). Outliers, the need for transformations, mixtures, etc., will jump off the page when I do this. Sometimes, I find that I didn't get the data read properly. Also, I may consider log(heart.frequency) and 1/heart.frequency as well as heart.frequency. In most cases, I will base the subsequent analysis on whichever looks most nearly normally distributed. 2. I will also want to make scatterplots of the two variables as well as plotting each vs. time (with one line for each patient and separate plots for the two groups, but on the same scale). This can tell me how much correlation to expect as well as what kinds of effects I want to model. 3. Have you consulted Pinheiro and Bates (2000) Mixed-Effects Models in S and S-Plus (Springer)? The first half of that book describes how to analyze data sets like you describe when effects are linear and additive. The latter half describes what to do with nonlinear effects. 4. If you still would like further assistance from this group, please submit another post, but PLEASE do read the posting guide! www.R-project.org/posting-guide.html. Anecdotal evidence suggests that posts more consistent with that guide tend to get more useful replies quicker. hope this helps. spencer graves Matteo Vidali wrote: dear R users, I need some help for multivariate analysis. I have 2 anaesthetic treatment groups (20 patients/group) where I register heart frequency and pressure for 60 min (repeated measures every 5 minutes). I would like to perform a test to check if treatments are different in controlling freq and pressures during the anaesthesia, but i would like to have also an overall measure and not only multiple p for different time intervals. I also think I should choose a test in which time is meaningful since the measures are not simple repeated measurements but measurements taken at specific time points. 1 million dollar question how to do in R? thanks in advance Dr Matteo Vidali Dep. of Medical Sciences University of East Piedmont A. Avogadro ITALY -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch 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 does this warnings mean? and what should I do?
You actually received two different warning messages. The first 8 warnings read, optim or nlminb returned message false convergence (8), and the other 3 say, ... returned message singular convergence. The function lmer uses a nonlinear optimizer (either optim or nlminb) to minimize an objective function. The first message says that the nonlinear optimizer was still reducing the objective function when it reached an iteration limit. If this were the only problem, you might consider increasing the iteration limits, maxIter, msMaxIter, niterEM and PQLmaxIt. However, the singular convergence message says that the estimated variance-covariance matrix of the observations became singular. Looking now at your output, I notice that Corr between (Intercept) and trust.cz1 for the Random Effects commid is 1.000. This says that the structure of your data are not adequate to allow you to distinguish between random effects for (Intercept) and trust.cz1 for commid, while simultaneously estimating all the fixed effects you have in the model. If I were you, I'd start be deleting all the terms from the model that don't have a Signif. code beside it in the table of Fixed effects and then refit the smaller model, preferably also using 'method=AGQ'. If I still get the same message from trying to fit the reduced model, I would conclude that the data are not adequate to distinguish between (Intercept) and trust.cz1 for commid. I would then delete trust.cz1 from the model and go from there. hope this helps. spencer graves ronggui wrote: I use lmer to fit a mixed effect model.It give some warnings.what does this warnings mean? and what should I do? (fm2.mlm - lmer(qd ~ edu + jiankang + peixun +hunyin + cadcj + age + age2 + sex + dangyuan + Comp.1 + Comp.2+trust.cz1 + (trust.cz1|commid), data = individual,na.action = na.exclude,family=quasibinomial)) Generalized linear mixed model fit using PQL Formula: qd ~ edu + jiankang + peixun + hunyin + cadcj + age + age2 + sex + dangyuan + Comp.1 + Comp.2 + trust.cz1 + (trust.cz1 | commid) Data: individual Family: quasibinomial(logit link) AIC BIClogLik deviance 736.7059 821.8267 -349.3529 698.7059 Random effects: Groups NameVariance Std.Dev. Corr commid (Intercept) 1.56413 1.25065 trust.cz1 0.17922 0.42334 1.000 Residual 0.89728 0.94725 # of obs: 652, groups: commid, 39 Fixed effects: Estimate Std. Error DF t value Pr(|t|) (Intercept)-1.6115e-01 6.7997e-01 637 -0.2370 0.81274 edu-5.2585e-02 4.1048e-02 637 -1.2810 0.20064 jiankang -9.8243e-01 4.4645e-01 637 -2.2005 0.02813 * peixun -4.6307e-01 2.6397e-01 637 -1.7542 0.07988 . hunyin -1.2255e-02 2.8151e-01 637 -0.0435 0.96529 hunyin -2.7726e-01 1.3846e+00 637 -0.2002 0.84136 hunyin -2.9759e-01 8.7180e-01 637 -0.3414 0.73295 cadcj 2.2366e-01 7.6467e-01 637 0.2925 0.77000 age 9.3626e-02 4.0390e-02 637 2.3180 0.02076 * age2 -1.3095e-03 5.5104e-04 637 -2.3763 0.01778 * sex 3.9188e-01 1.9759e-01 637 1.9833 0.04776 * dangyuan -5.2558e-01 5.9091e-01 637 -0.8894 0.37410 Comp.1 5.2463e-02 1.0309e-01 637 0.5089 0.61100 Comp.2 -1.5048e-01 1.1435e-01 637 -1.3160 0.18863 trust.cz1 -8.0709e-01 4.4632e-01 637 -1.8083 0.07103 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 There were 11 warnings (use warnings() to see them) warnings() Warning messages: 1: optim or nlminb returned message false convergence (8) in: LMEopt(x = mer, value = cv) 2: optim or nlminb returned message false convergence (8) in: LMEopt(x = mer, value = cv) 3: optim or nlminb returned message false convergence (8) in: LMEopt(x = mer, value = cv) 4: optim or nlminb returned message false convergence (8) in: LMEopt(x = mer, value = cv) 5: optim or nlminb returned message false convergence (8) in: LMEopt(x = mer, value = cv) 6: optim or nlminb returned message false convergence (8) in: LMEopt(x = mer, value = cv) 7: optim or nlminb returned message false convergence (8) in: LMEopt(x = mer, value = cv) 8: optim or nlminb returned message false convergence (8) in: LMEopt(x = mer, value = cv) 9: optim or nlminb returned message singular convergence (7) in: LMEopt(x = mer, value = cv) 10: optim or nlminb returned message singular convergence (7) in: LMEopt(x = mer, value = cv) 11: optim or nlminb returned message singular convergence (7) in: LMEopt(x = mer, value = cv) version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.0 year 2005