Re: [R] how to run ANCOVA?
But how is that different from just a 3-way ANOVA with age, diagnosis, and gender as the the three effects? Isn't ANCOVA a fundamentally different model? Thanks, Sasha ANCOVA is a linear model with both factors and continuous variables on the right-hand side of the model formula. In pre-computer texts, the commonly used algorithm hid that fact. 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 and provide commented, minimal, self-contained, reproducible code.
[R] Search for best ARIMA model
Hello, I have a several time series, which I would like to check for their best fitted Arima model (I am checking for the lowest aic value). Which lets me raise two questions: 1) is there are more efficient way, than using 6 for-loops? 2) sometimes the system cannot calculate with given parameters - is there a more efficient solution than I found? I hope, you can help me to make this calculation quicker since I have to run this function 450 times... Thank you very much in advance, Markus arima.estim - function(TS) { best.model - arima(TS, order = c(1, 0, 0), seasonal = list(order = c(0, 0, 0), period = frequency(TS)) ) # Start value # I continue with brute force- p, q, r, s are nested from 0 to 3 and i and j are nested from 0 to 2. p and q are not both allowed to be 0. for (p in 0:3){ for( q in 0:3){ if(p==0 q==0) {} else { for(r in 0:3) { for(s in 0:3) { for (j in 0:2) { for(i in 0:2) { # test, if series works if(inherits(try(arima(TS, order = c(p, i, q), seasonal = list(order = c(r, j, s), period = frequency(TS)) ), TRUE), 'try-error')){ print(c(p,i,q))} #shows, which parameters didn't work - will be removed by else{ tmp - arima(TS, order = c(p, i, q), seasonal = list(order = c(r, j, s), period = frequency(TS))) # calculate again :( if(best.model$aic tmp$aic) { best.model - tmp } } } } } } } } } best.model} [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Authoring a book
Jack B. Arnold wrote: Dear Tom, Looking forward to your book. Psychologists and students clearly need all the encouragement to use R that they can get. I have been using it for a couple of years now, and find, that for most purposes, it is just a little harder to get into than the expensive commercial packages. That said, as an old timer, I can't pass up the opportunity to discourage younger colleagues from using constructions like Me and some colleagues ... Some colleagues and I is a lot more polite and it is also grammatically correct. Thank you. English is my second (or third, perhaps fourth) language and my mastering of it is (naturally) less than perfect. Tom The best and good luck. Jack Jack B. Arnold Professor of Psychology, Retired Saint Mary's College of California Tom Backer Johnsen wrote: Me and some colleagues are planning to write a textbook together (Statistics using R) where the target audience for the book is psychologists and students of psychology. We thought that it might be a good idea to use a Wiki when writing the text. Is that a good idea? Does anybody have any experience in that direction? What alternatives are there? The tool (Wiki) would have to be able to handle tables and mathematical formulas in some manner, and of course, some mechanism to export the contents to a word processor in the final stages. I have my own server, Windows, based on Apache, PhP, and MySQL. Tom __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fixed effects transformation
plm function in plm package are for panel data model. library(plm) ?plm 2006/8/24, Eduardo Leoni [EMAIL PROTECTED]: Hi - I am doing an analysis using panel data methods, particularly what economists call fixed effects. It can easily be done in R through the inclusion of factors in an lm formula. However, when the number of groups is excessive (in my case 2000+) it is much more efficient to demean the data by panel. I created this function following Farnsworth (http://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf) demean - function(x,index) { for (i in unique(index)) { for (j in 1:ncol(x)) { x.now - x[index==i,j] x[index==i,j] - x.now-mean(x.now,na.rm=TRUE) } } x } it is obvious that there must be a much much more efficient way to do this, though. Any recommendations? thanks, -eduardo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 黄荣贵 Department 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] error message from lm.ridge() in MASS ***package***
jz7 == jz7 [EMAIL PROTECTED] on Tue, 22 Aug 2006 17:10:42 -0400 (EDT) writes: jz7 Dear all, jz7 I got a wierd problem when using lm.ridge() in MASS library. there is MASS the book and MASS the package, and there is even a MASS library (namely the file MASS.so or MASS.dll depending on your platform) but you are really talking about the MASS *package* ! jz7 When my X matrix has few columns, there is no jz7 problem. But when my X matrix gets larger (over 1000 jz7 columns), I got the following error: and where is the selfcontained reproducible code which we ask you for, explicitly in the posting guide and at the footer of every R-help message ??? jz7 Error in Xs$v %*% a : non-conformable arguments jz7 In addition: Warning messages: jz7 1: longer object length jz7 is not a multiple of shorter object length in: d^2 + rep(lambda, jz7 rep(p, k)) jz7 2: longer object length jz7 is not a multiple of shorter object length in: drop(d * rhs)/div jz7 The R code I use for the calculation is lm.ridge( y ~ x,lambda=seq(1,15,1)). jz7 Please advice. jz7 Thanks a lot! jz7 Jeny __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Waring message in mvBEKK.est
Deal all R users, I am getting a warning message negative inverted hessian matrix element in: mvBEKK.est(weekly.return.all, order = c(2, 1)) while I am using mvBEKK.estlibrary to estimate time varying Covariance matrix using Bivariate Garch. Can anyone please tell me in details why I am getting this message and what is the remedy for that? Sincerely yours, Arun [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Omegahat-site down?
Dear R-list subscriber, is it possible that the omegahat-site is down? I was looking for package 'RDCOMClient', but could not establish a connection. In case somebody has the latest binary zip-file for Windows, would she/he mind to send it directly to my emaim adress stated in the signature? Many thanks, and sorry for bothering/misusing R-help in this instance. Best, Bernhard Dr. Bernhard Pfaff Global Structured Products Group (Europe) Invesco Asset Management Deutschland GmbH Bleichstrasse 60-62 D-60313 Frankfurt am Main Tel: +49(0)69 29807 230 Fax: +49(0)69 29807 178 Email: [EMAIL PROTECTED] * Confidentiality Note: The information contained in this mess...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Lost command area in R-SciViews
Dear all I am writing with a question regarding SciViews for R. It's probably a slightly stupid question but I cannot find a solution to a very elementary problem. I am using SciViews 0.8.9 on with R 2.3.1pat on a Windows XP Home machine. R is set to SDI mode, I start R, enter library(svGUI), SciViews starts properly, I can access the docks and everything, but (i) the command area at the bottom cannot be found (ii) the regular R window cannot be minimized/maximized anymore. I don't know what to do to get the command area back. I have checked the web and the mailing list (with the search words sciviews and command) but all I could come up with (http://tolstoy.newcastle.edu.au/R/help/05/12/16841.html) is the recommendation to click on Misc: Toolbars: Command. But I did that and it's still not visible. Am I making some kind of stupid mistake? I have uploaded a screenshot to my website at http://www.linguistics.ucsb.edu/faculty/stgries/other/sciviews.png to show you what's happening. I have even un- and reinstalled R and SciViews but to no avail. Any ideas would be greatly appreciated. I am currently teaching a course on R and would like to show the participants how to work with R, Tinn-R, and SciViews, but with the present problem, this is not going to work; I wrote to Philippe Grosjean but have not received a reply. Thanks a lot, STG -- Stefan Th. Gries --- University of California, Santa Barbara http://www.linguistics.ucsb.edu/faculty/stgries __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Omegahat-site down?
Pfaff, Bernhard Dr. [EMAIL PROTECTED] writes: Dear R-list subscriber, is it possible that the omegahat-site is down? I was looking for package 'RDCOMClient', but could not establish a connection. In case somebody has the latest binary zip-file for Windows, would she/he mind to send it directly to my emaim adress stated in the signature? Many thanks, and sorry for bothering/misusing R-help in this instance. Best, Bernhard It's a UC Davis machine (eeyore.ucdavis.edu), so I suppose Duncan Temple Lang should know. Incidentally, www.omegahat.com (not .org) turns out to be a strange site with links to Omega watches and various kinds of hats (including Fedoras!), but also statistics and data mining... -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to compare rows of two matrices
Dear all, I have a dataset train - cbind(c(0,2,2,1,0), c(8,9,4,0,2), 6:10, c(-1, 1, 1, -1, 1)) test - cbind(1:5, c(0,1,5,1,3), c(1,1,2,0,3) ,c(1, 1, -1, 1, 1)) I want to find which rows of train and test it different in its last column (column 4). The solution must be something like train [,1] [,2] [,3] [,4] [1,]086 -1 [3,]2481 [4,]109 -1 test [,1] [,2] [,3] [,4] [1,]1011 [3,]352 -1 [4,]4101 I have tried with matrix(train %in% test, dim(train)) apply(train, 1, paste, collapse=) %in% apply(test, 1, paste, collapse=) It doesn't work. How can I do. Thanks for any help. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] syntax for pdDiag (nlme)
At the top of page 283 of Pinheiro and Bates, a covariance structure for the indomethicin example is specified as random = pdDiag(A1 + lrc1 + A2 + lrc2 ~ 1) The argument to pdDiag() looks like a two-sided formula, and I'm struggling to reconcile this with the syntax described in Ch4 of the book and online. Further down page 283 the formula is translated into list(A1 ~ 1, lrc1 ~ 1, A2 ~ 1, lrc2 ~ 1) which I find just as puzzling. Can anyone help? -- *I.White * *University of Edinburgh * *Ashworth Laboratories, West Mains Road* *Edinburgh EH9 3JT * *Fax: 0131 650 6564 Tel: 0131 650 5490 * *E-mail: [EMAIL PROTECTED] * __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to compare rows of two matrices
Does this work for you? dd - mapply(==,train,test) dim(dd) - dim(train) dd [,1] [,2] [,3] [,4] [1,] FALSE FALSE FALSE FALSE [2,] TRUE FALSE FALSE TRUE [3,] FALSE FALSE FALSE FALSE [4,] FALSE FALSE FALSE FALSE [5,] FALSE FALSE FALSE TRUE HTH steve Muhammad Subianto wrote: Dear all, I have a dataset train - cbind(c(0,2,2,1,0), c(8,9,4,0,2), 6:10, c(-1, 1, 1, -1, 1)) test - cbind(1:5, c(0,1,5,1,3), c(1,1,2,0,3) ,c(1, 1, -1, 1, 1)) I want to find which rows of train and test it different in its last column (column 4). The solution must be something like train [,1] [,2] [,3] [,4] [1,]086 -1 [3,]2481 [4,]109 -1 test [,1] [,2] [,3] [,4] [1,]1011 [3,]352 -1 [4,]4101 I have tried with matrix(train %in% test, dim(train)) apply(train, 1, paste, collapse=) %in% apply(test, 1, paste, collapse=) It doesn't work. How can I do. Thanks for any help. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to compare rows of two matrices
Hi maybe simple math can do it. different (train[,4]-test[,4])!=0 same (train[,4]-test[,4])==0 if you are sure the numbers are integers HTH Petr On 24 Aug 2006 at 12:03, Muhammad Subianto wrote: Date sent: Thu, 24 Aug 2006 12:03:31 +0200 From: Muhammad Subianto [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] How to compare rows of two matrices Dear all, I have a dataset train - cbind(c(0,2,2,1,0), c(8,9,4,0,2), 6:10, c(-1, 1, 1, -1, 1)) test - cbind(1:5, c(0,1,5,1,3), c(1,1,2,0,3) ,c(1, 1, -1, 1, 1)) I want to find which rows of train and test it different in its last column (column 4). The solution must be something like train [,1] [,2] [,3] [,4] [1,]086 -1 [3,]2481 [4,]109 -1 test [,1] [,2] [,3] [,4] [1,]1011 [3,]352 -1 [4,]4101 I have tried with matrix(train %in% test, dim(train)) apply(train, 1, paste, collapse=) %in% apply(test, 1, paste, collapse=) It doesn't work. How can I do. Thanks for any help. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] my error with augPred
Dear all I try to refine my nlme models and with partial success. The model is refined and fitted (using Pinheiro/Bates book as a tutorial) but when I try to plot plot(augPred(fit4)) I obtain Error in predict.nlme(object, value[1:(nrow(value)/nL), , drop = FALSE], : Levels (0,3.5],(3.5,5],(5,7],(7,Inf] not allowed for vykon.fac Is it due to the fact that I have unbalanced design with not all levels of vykon.fac present in all levels of other explanatory factor variable? I try to repeat 8.19 fig which is OK until I try: fit4 - update(fit2, fixed = list(A+B~1,xmid~vykon.fac, scal~1), start = c(57, 100, 700, rep(0,3), 13)) I know I should provide an example but maybe somebody will be clever enough to point me to an explanation without it. nlme version 3.1-75 SSfpl model R 2.4.0dev (but is the same in 2.3.1), W2000. Thank you Best regards. Petr PikalPetr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Intro to Programming R Book
I am new to R and am looking for a book that can help in learning to program in R. I have looked at the R website suggested books but I am still not sure which book best suite my needs. I am interesting in programming, data manipulation not statistics. Any suggestions? Raphael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Authoring a book
Mark Orr wrote: Tom, i'm a psychologist with much interest in training future psychologists (and others) to use R/S+. So, if you need anyone to review or give feedback on draft versions of your work, I'd be happy to review. Thank you! That is a very generous offer. The project is so far very much in its infancy, but I may accept the offer when we have something to review. Tom ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Intro to Programming R Book
I recently invested in two books: Venables and Ripley Modern Applied Statistics in S, and Everitt and Rabe Heskith's Analyzing Medical Data in S-Plus I think either one is a good self-teaching tool. On 8/24/06, Raphael Fraser [EMAIL PROTECTED] wrote: I am new to R and am looking for a book that can help in learning to program in R. I have looked at the R website suggested books but I am still not sure which book best suite my needs. I am interesting in programming, data manipulation not statistics. Any suggestions? Raphael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- I can answer any question. I don't know is an answer. I don't know yet is a better answer. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Intro to Programming R Book
--- Raphael Fraser [EMAIL PROTECTED] wrote: I am new to R and am looking for a book that can help in learning to program in R. I have looked at the R website suggested books but I am still not sure which book best suite my needs. I am interesting in programming, data manipulation not statistics. Any suggestions? Raphael I have not been able to get my hands on much since someone has raided the local library and grabbed all the R books on long-term loan but I have found that there is some very useful material on the CRAN site under Other I have found An Introduction to S and the Hmisc and Design Libraries by Carlos Alzola and Frank E. Harrell very useful as is Simple R by John Verzani. There are also some other intro tutorials on line that might be helpful. One I found useful is http://www.math.ilstu.edu/dhkim/Rstuff/Rtutor.html I just recently got my hands on John Fox's book An R and S-Plus Companion to Applied Regression and it has some very useful discussions of data handling. Ch.2 and Ch.7 (on graphs) is useful. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Intro to Programming R Book
Hi Raphael: You mention being interested in programming, which covers many various topics itself. I wholeheartedly recommend: S Programming (2000) by Venables and Ripley . Don't let the date of the book nor the fact that R is not mentioned in the title dissuade you. Much like MASS by Venables and Ripley, I find there is always something useful to learn (or re-learn), particularly if you work through the exercises. The authors have excellent complementary materials to both books as well at the books' web sites: see the links for [5] and [4] at http://www.r-project.org/doc/bib/R-books.html. Hope that helps, Bill Centocor, Inc. Nonclinical Statistics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Raphael Fraser Sent: Thursday, August 24, 2006 8:09 AM To: r-help@stat.math.ethz.ch Subject: [R] Intro to Programming R Book I am new to R and am looking for a book that can help in learning to program in R. I have looked at the R website suggested books but I am still not sure which book best suite my needs. I am interesting in programming, data manipulation not statistics. Any suggestions? Raphael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Optim question
This is a very basic question, but I am a bit confused with optim. I want to get the MLEs using optim which could replace the newton-raphson code I have below which also gives the MLEs. The function takes as input a vector x denoting whether a respondent answered an item correctly (x=1) or not (x=0). It also takes as input a vector b_vector, and these are parameters of test items (Rasch estimates in this case) For example, here is how my current function operates. rasch.max(c(1,1,0,0), c(-1,.5,0,1)) theta is about 0.14 , se 1.063972 I'm not quite sure how to accomplish the same thing using optim. Can anyone offer a suggestion? rasch.max - function(x, b_vector){ p - numeric(length(b_vector)) theta - log(sum(x)/(length(x)/sum(x))) # This is a starting value for theta rasch - function(theta,b) 1/ (1 + exp(b-theta)) old - 0 updated - 5 while(abs(old-updated) .001){ old - updated for(k in seq(along=b_vector)) p[k] - rasch(theta,b_vector[k]) first_deriv - sum(x) - sum(p) second_deriv - sum((1-p)*-p) change - (first_deriv/second_deriv) theta- theta - change # This is the updated theta updated - change } cat('theta is about', round(theta,2), ', se', 1/sqrt(-second_deriv), '\n') } Harold version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 3.0 year 2006 month 04 day24 svn rev37909 language R version.string Version 2.3.0 (2006-04-24) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R and time series
Hi, I'm new here. I need to use R to analyze a particular time serie. I have to estimate the pubblication of a news of an online newspaper, for example in the CNN site. I have many text files and every file correspond to a day. In every file I have two columns: 1) in the first column there is the pubblication time of the news 2) in the second column there is the distance, expressed in seconds, of this news from the previous I think I can use the Holt-Winters method, but I have some doubt. Do I need both columns or is sufficient just the first? Do you have any helpful suggestion? Sorry if my problem sounds strange. Thanks, bye. Carlo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Please Ignore This is only a test mail
Hi All, I regret for sending my question many times as there was some problem at my end. Further, I am just sending this post to confirm whether my post is reaching or not. Sayonara With Smile With Warm Regards :-) G a u r a v Y a d a v Senior Executive Officer, Economic Research Surveillance Department, Clearing Corporation Of India Limited. Address: 5th, 6th, 7th Floor, Trade Wing 'C', Kamala City, S.B. Marg, Mumbai - 400 013 Telephone(Office): - +91 022 6663 9398 , Mobile(Personal) (0)9821286118 Email(Office) :- [EMAIL PROTECTED] , Email(Personal) :- [EMAIL PROTECTED] DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] Authoring a book
Peter Dalgaard wrote: Tom Backer Johnsen [EMAIL PROTECTED] writes: Me and some colleagues are planning to write a textbook together (Statistics using R) where the target audience for the book is psychologists and students of psychology. We thought that it might be a good idea to use a Wiki when writing the text. Is that a good idea? Does anybody have any experience in that direction? What alternatives are there? The tool (Wiki) would have to be able to handle tables and mathematical formulas in some manner, and of course, some mechanism to export the contents to a word processor in the final stages. I have my own server, Windows, based on Apache, PhP, and MySQL. SVN and LaTeX would be my tools of choice. A very different approach. SVN is not something I am aquainted with, but should be worth looking into. As to LaTex, the closest I have worked with is Lyx. The problem is, there are two other authors I have to persuade to learn new tools. So, it might be too complex. Tom -- ++ | Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology | | University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY | | Tel : +47-5558-9185Fax : +47-5558-9879 | | Email : [EMAIL PROTECTED]URL : http://www.galton.uib.no/ | ++ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help: trouble using lines()
Hi not sure but are there some NA values in your data? what length(mtf) and length(fitted(f2)) tells you? And you need not to use assignment graph1 - plot() to output a plot on screen. HTH Petr On 24 Aug 2006 at 13:43, Simon Pickett wrote: Date sent: Thu, 24 Aug 2006 13:43:18 +0100 (BST) From: Simon Pickett [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject:[R] help: trouble using lines() Hi R experts, I have been using ReML as follows... model-lmer(late.growth~mtf+year+treat+hatch.day+hatch.day:year+hatch. day:treat+ mtf:treat+ treat:year+ year:treat:mtf+(1|fybrood), data = A) then I wanted to plot the results of the three way interaction using lines() as follows... tmp-as.vector(fixef(model)) graph1-plot(mtf,fitted(f2), xlab=list(Brood Size), ylab=list(Early growth rate), pch=16, col=darkgrey, bg=yellow) lines(y,exp(tmp[1]+tmp[2])) but no matter what I try I always get the error message Error in xy.coords(x, y) : 'x' and 'y' lengths differ Can anyone shed some light please? I am basically copying the methods of the pdf entitled Linear mixed models in R by Sřren Feodor Nielsen 20003. http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed-mod els.pdf#search=%22Linear%20mixed%20models%20in%20R%22 Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Intro to Programming R Book
There is some online material at: http://zoonek2.free.fr/UNIX/48_R/all.html http://pj.freefaculty.org/R/statsRus.html On 8/24/06, Raphael Fraser [EMAIL PROTECTED] wrote: I am new to R and am looking for a book that can help in learning to program in R. I have looked at the R website suggested books but I am still not sure which book best suite my needs. I am interesting in programming, data manipulation not statistics. Any suggestions? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help: trouble using lines()
Hi, thanks for replying. No, there arent any NA's in the original data set I think I must be mis-interpreting the use of lines()? in the example what exactly is y? lines(y,exp(tmp[1]+tmp[2])) In my case tmp[1] and tmp[2] are coeficients from the model so just one number (not a vector) and I havent specified y Thanks everyone, Simon Hi not sure but are there some NA values in your data? what length(mtf) and length(fitted(f2)) tells you? And you need not to use assignment graph1 - plot() to output a plot on screen. HTH Petr On 24 Aug 2006 at 13:43, Simon Pickett wrote: Date sent:Thu, 24 Aug 2006 13:43:18 +0100 (BST) From: Simon Pickett [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject: [R] help: trouble using lines() Hi R experts, I have been using ReML as follows... model-lmer(late.growth~mtf+year+treat+hatch.day+hatch.day:year+hatch. day:treat+ mtf:treat+ treat:year+ year:treat:mtf+(1|fybrood), data A) then I wanted to plot the results of the three way interaction using lines() as follows... tmp-as.vector(fixef(model)) graph1-plot(mtf,fitted(f2), xlab=list(Brood Size), ylab=list(Early growth rate), pch=16, col=darkgrey, bg=yellow) lines(y,exp(tmp[1]+tmp[2])) but no matter what I try I always get the error message Error in xy.coords(x, y) : 'x' and 'y' lengths differ Can anyone shed some light please? I am basically copying the methods of the pdf entitled Linear mixed models in R by Søren Feodor Nielsen 20003. http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed-mod els.pdf#search=%22Linear%20mixed%20models%20in%20R%22 Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Authoring a book
I think Peter Dalgaard is right. Since you are able to use R I believe you will be very fast in learning LaTeX. I think it needs less then a week to learn the most common LaTeX commands. And setting up a wiki and trying then to convert this into a printable document format plus learning the wiki syntax is probably more time consuming. Beside this R is able to work perfectly together with LaTeX, it creates LaTeX output and is doing excellent graphics in the EPS/PS format. The best introduction for LaTeX is the not so short introduction: http://people.ee.ethz.ch/~oetiker/lshort/lshort.pdf If you still are not convinced have a look at UniWakkaWiki: http://uniwakka.sourceforge.net/HomePage It is a Wiki for Science and University purposes and claims to be able to export to Openoffice as well as to LaTeX. Stefan Grosse I have my own server, Windows, based on Apache, PhP, and MySQL. SVN and LaTeX would be my tools of choice. A very different approach. SVN is not something I am aquainted with, but should be worth looking into. As to LaTex, the closest I have worked with is Lyx. The problem is, there are two other authors I have to persuade to learn new tools. So, it might be too complex. Tom __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lmer(): specifying i.i.d random slopes for multiple covariates
Dear readers, Is it possible to specify a model y=X %*% beta + Z %*% b ; b=(b_1,..,b_k) and b_i~N(0,v^2) for i=1,..,k that is, a model where the random slopes for different covariates are i.i.d., in lmer() and how? In lme() one needs a constant grouping factor (e.g.: all=rep(1,n)) and would then specify: lme(fixed= y~X, random= list(all=pdIdent(~Z-1)) ) , that´s how it's done in the lmeSplines- documentation. Any hints would be greatly appreciated- I'm trying to write a suite of functions that will transform additive models into their mixed-effects representation like lmeSplines but using lmer() instead of lme(). Thank you for your time, Fabian Scheipl -- Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help: trouble using lines()
Hi from lines help page x, y coordinate vectors of points to join. and lines or points simply adds lines or points to existing plot. What do you want to plot with lines? HTH Petr On 24 Aug 2006 at 14:52, Simon Pickett wrote: Date sent: Thu, 24 Aug 2006 14:52:09 +0100 (BST) From: Simon Pickett [EMAIL PROTECTED] To: Petr Pikal [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch, Simon Pickett [EMAIL PROTECTED] Subject:Re: [R] help: trouble using lines() Hi, thanks for replying. No, there arent any NA's in the original data set I think I must be mis-interpreting the use of lines()? in the example what exactly is y? lines(y,exp(tmp[1]+tmp[2])) In my case tmp[1] and tmp[2] are coeficients from the model so just one number (not a vector) and I havent specified y Thanks everyone, Simon Hi not sure but are there some NA values in your data? what length(mtf) and length(fitted(f2)) tells you? And you need not to use assignment graph1 - plot() to output a plot on screen. HTH Petr On 24 Aug 2006 at 13:43, Simon Pickett wrote: Date sent: Thu, 24 Aug 2006 13:43:18 +0100 (BST) From: Simon Pickett [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject:[R] help: trouble using lines() Hi R experts, I have been using ReML as follows... model-lmer(late.growth~mtf+year+treat+hatch.day+hatch.day:year+hat ch. day:treat+ mtf:treat+ treat:year+ year:treat:mtf+(1|fybrood), data A) then I wanted to plot the results of the three way interaction using lines() as follows... tmp-as.vector(fixef(model)) graph1-plot(mtf,fitted(f2), xlab=list(Brood Size), ylab=list(Early growth rate), pch=16, col=darkgrey, bg=yellow) lines(y,exp(tmp[1]+tmp[2])) but no matter what I try I always get the error message Error in xy.coords(x, y) : 'x' and 'y' lengths differ Can anyone shed some light please? I am basically copying the methods of the pdf entitled Linear mixed models in R by Sřren Feodor Nielsen 20003. http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed- mod els.pdf#search=%22Linear%20mixed%20models%20in%20R%22 Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Optim question
Hi Harold, you're probably looking for something like: rasch.max2 - function(x, betas){ opt - function(theta){ -sum(dbinom(x, 1, plogis(theta - betas), log = TRUE)) } out - optim(log(sum(x)/(length(x)/sum(x))), opt, method = BFGS, hessian = TRUE) cat('theta is about', round(out$par, 2), ', se', 1/sqrt(out$hes),'\n') } rasch.max(c(1, 1, 0, 0), c(-1, .5, 0, 1)) rasch.max2(c(1, 1, 0, 0), c(-1, .5, 0, 1)) rasch.max(c(1, 0, 1, 1), c(-1, .5, 0, 1)) rasch.max2(c(1, 0, 1, 1), c(-1, .5, 0, 1)) 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://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Doran, Harold [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, August 24, 2006 2:54 PM Subject: [R] Optim question This is a very basic question, but I am a bit confused with optim. I want to get the MLEs using optim which could replace the newton-raphson code I have below which also gives the MLEs. The function takes as input a vector x denoting whether a respondent answered an item correctly (x=1) or not (x=0). It also takes as input a vector b_vector, and these are parameters of test items (Rasch estimates in this case) For example, here is how my current function operates. rasch.max(c(1,1,0,0), c(-1,.5,0,1)) theta is about 0.14 , se 1.063972 I'm not quite sure how to accomplish the same thing using optim. Can anyone offer a suggestion? rasch.max - function(x, b_vector){ p - numeric(length(b_vector)) theta - log(sum(x)/(length(x)/sum(x))) # This is a starting value for theta rasch - function(theta,b) 1/ (1 + exp(b-theta)) old - 0 updated - 5 while(abs(old-updated) .001){ old - updated for(k in seq(along=b_vector)) p[k] - rasch(theta,b_vector[k]) first_deriv - sum(x) - sum(p) second_deriv - sum((1-p)*-p) change - (first_deriv/second_deriv) theta- theta - change # This is the updated theta updated - change } cat('theta is about', round(theta,2), ', se', 1/sqrt(-second_deriv), '\n') } Harold version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 3.0 year 2006 month 04 day24 svn rev37909 language R version.string Version 2.3.0 (2006-04-24) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. 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 and provide commented, minimal, self-contained, reproducible code.
[R] installing the x86_64 R Binary on Fedora Core 5
I am looking for help install the x86_64 R Binary onto my FC5 machine. At the risk of subjecting myself to tons of criticism, I must confess that I don't know anything about Linux and I have never compiled R from source. Therefore, I choose FC5 because I see that a 64-bit binary is already available. Here is what I tried: I installed FC5 with all options (productivity, software development, and web server). FC5 boots up fine. I downloaded all the R binary files in that FC5 directory to my USB drive and copied them onto my linux machine (where I don't yet have internet access). I created a folder in my rbos's Home directory and copied the files there. I clicked on the R-2.3.1-1.fc5.x86_64.rpm and right-clicked to choose 'open with install software' It asked me for my root password. I put in the same root password I choose when I installed FC5. I get a installing packages screen that shows the R filename and I click Apply. It then give me an Error: Unable to retrieve software information. Can anyone tell me what steps I am missing? The R install guide states that binary installs are platform specific so it only considers building from the sources. I look forward to learning a lot about Linux and using more than just the GUI, but to get started, I just want to learn how to install a binary of R. Thanks so much, Roger [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fixed effects transformation
On Wed, 23 Aug 2006, Eduardo Leoni wrote: I created this function following Farnsworth (http://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf) demean - function(x,index) { for (i in unique(index)) { for (j in 1:ncol(x)) { x.now - x[index==i,j] x[index==i,j] - x.now-mean(x.now,na.rm=TRUE) } } x } it is obvious that there must be a much much more efficient way to do this, though. Any recommendations? I think you want ave(). -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Why are lagged correlations typically negative?
Recently, I was working with some lagged designs where a vector of observations at one time was used to predict a vector of observations at another time using a lag 1 design. In the work, I noticed a lot of negative correlations, so I ran a simple simulation with 2 matched points. The crude simulation example below shows that the correlation can be -1 or +1, but interestingly if you do this basic simulation thousands of times, you get negative correlations 66 to 67% of the time. If you simulate three matched observations instead of three you get negative correlations about 74% of the time and then as you simulate 4 and more observations the number of negative correlations asymptotically approaches an equal 50% for negative versus positive correlations (though then with 100 observations one has 54% negative correlations). Creating T1 and T2 so they are related (and not correlated 1 as in the crude simulation) attenuates the effect. A more advanced simulation is provided below for those interested. Can anyone explain why this occurs in a way a non-mathematician is likely to understand? Thanks, Paul # # Crude simulation # (T1-rnorm(3)) [1] -0.1594703 -1.3340677 0.2924988 (T2-c(T1[2:3],NA)) [1] -1.3340677 0.2924988 NA cor(T1,T2, use=complete) [1] -1 (T1-rnorm(3)) [1] -0.84258593 -0.49161602 0.03805543 (T2-c(T1[2:3],NA)) [1] -0.49161602 0.03805543 NA cor(T1,T2, use=complete) [1] 1 ### # More advanced simulation example ### lags function(nobs,nreps,rho=1){ OUT-data.frame(NEG=rep(NA,nreps),COR=rep(NA,nreps)) nran-nobs+1 #need to generate 1 more random number than there are observations for(i in 1:nreps){ V1-rnorm(nran) V2-sqrt(1-rho^2)*rnorm(nran)+rho*V1 #print(cor(V1,V2)) V1-V1[1:nran-1] V2-V2[2:nran] OUT[i,1]-ifelse(cor(V1,V2)=0,1,0) OUT[i,2]-cor(V1,V2) } return(OUT) #out is a 1 if the corr is negative or 0; 0 if positive } LAGS.2-lags(2,1) #Number of observations matched = 2 mean(LAGS.2) NEG COR 0.6682 -0.3364 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Rd] reshape scaling with large numbers of times/rows
On 8/24/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Here is one more solution . It uses the reshape package. Its faster than using reshape but not as fast as xtabs; however, it is quite simple -- just one line and if that matters it might be useful: library(reshape) system.time(w4 - cast(melt(DF, id = 1:2), Y ~ X, head, n = 1)) On 8/24/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 8/24/06, Mitch Skinner [EMAIL PROTECTED] wrote: On Thu, 2006-08-24 at 08:57 -0400, Gabor Grothendieck wrote: If your Z in reality is not naturally numeric try representing it as a factor and using the numeric levels as your numbers and then put the level labels back on: m - n - 5 DF - data.frame(X = gl(m*n, 1), Y = gl(m, n), Z = letters[1:25]) Zn - as.numeric(DF$Z) system.time(w1 - reshape(DF, timevar = X, idvar = Y, dir = wide)) system.time({Zn - as.numeric(DF$Z) w2 - xtabs(Zn ~ Y + X, DF) w2[w2 0] - levels(DF$Z)[w2] w2[w2 == 0] - NA }) This is pretty slick, thanks. It looks like it works for me. For the archives, this is how I got back to a data frame (as.data.frame(w2) gives me a long version again): m - 4500 n - 70 DF - data.frame(X = gl(m, n), Y = 1:n, Z = letters[1:25]) system.time({Zn - as.numeric(DF$Z) +w2 - xtabs(Zn ~ Y + X, DF) +w2[w2 0] - levels(DF$Z)[w2] +w2[w2 == 0] - NA +WDF - data.frame(Y=dimnames(w2)$Y) +for (col in dimnames(w2)$X) { WDF[col]=w2[,col] } + }) [1] 131.888 1.240 135.945 0.000 0.000 dim(WDF) [1] 70 4501 I'll have to look; maybe I can just use w2 as is. Next time I guess I'll try R-help first. Thanks again, Mitch Also try na.omit(as.data.frame(w2)) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rgl: exporting to pdf or png does not work
Hej, On Wed, 23 Aug 2006, Duncan Murdoch wrote: On 8/23/2006 5:15 PM, Gaspard Lequeux wrote: When exporting a image from rgl, the following error is encountered: rgl.postscript('testing.pdf', fmt=pdf) RGL: ERROR: can't bind glx context to window RGL: ERROR: can't bind glx context to window Warning messages: 1: X11 protocol error: GLXBadContextState 2: X11 protocol error: GLXBadContextState The pdf file is created and is readable, but all the labels are gone. Taking a snapshot (to png) gives 'failed' and no file is created. Version of rgl used: 0.67-2 (2006-07-11) Version of R used: R 2.3.1; i486-pc-linux-gnu; 2006-07-13 01:31:16; Running Debian GNU/Linux testing (Etch). That looks like an X11 error to me, not something that I'm very likely to be able to fix. If you can debug the error, it would be helpful. Actually after upgrading everything (debian testing (etch)) and restarting X, I didn't get that error anymore. It was worse: R crashed: library(rgl);triangles3d(c(1,,2,3),c(1,2,4),c(1,3,5));rgl.postscript('testing.pdf','pdf') X Error of failed request: GLXBadContextState Major opcode of failed request: 142 (GLX) Minor opcode of failed request: 5 (X_GLXMakeCurrent) Serial number of failed request: 85 Current serial number in output stream: 85 [EMAIL PROTECTED]:~/seqanal$ I downloaded the source package (debian testing (etch), rgl-0.67-2). In rgl-0.67-2/src/ I changed the following files: rglview.cpp, around line 587. Commenting the function call gl2psBeginPage removed the crash (but also no pdf output...) I enabled this function again and went to gl2ps.c, to the function gl2psBeginPage. At the end of that function, around line 4426, commenting out the line glRenderMode(GL_FEEDBACK); removes the R crash, but of course still no pdf output (well, only the background). GL_FEEDBACK is defined in /usr/include/GL/gl.h as: /* Render Mode */ #define GL_FEEDBACK 0x1C01 #define GL_RENDER 0x1C00 #define GL_SELECT 0x1C02 Trying glRenderMode(GL_RENDER) removed the crash, but still only the background in the pdf. If someone has some suggestions about what to do next... /Gaspard __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing the x86_64 R Binary on Fedora Core 5
On Thu, 2006-08-24 at 10:53 -0400, roger bos wrote: I am looking for help install the x86_64 R Binary onto my FC5 machine. At the risk of subjecting myself to tons of criticism, I must confess that I don't know anything about Linux and I have never compiled R from source. Therefore, I choose FC5 because I see that a 64-bit binary is already available. Here is what I tried: I installed FC5 with all options (productivity, software development, and web server). FC5 boots up fine. I downloaded all the R binary files in that FC5 directory to my USB drive and copied them onto my linux machine (where I don't yet have internet access). I created a folder in my rbos's Home directory and copied the files there. I clicked on the R-2.3.1-1.fc5.x86_64.rpm and right-clicked to choose 'open with install software' It asked me for my root password. I put in the same root password I choose when I installed FC5. I get a installing packages screen that shows the R filename and I click Apply. It then give me an Error: Unable to retrieve software information. Can anyone tell me what steps I am missing? The R install guide states that binary installs are platform specific so it only considers building from the sources. I look forward to learning a lot about Linux and using more than just the GUI, but to get started, I just want to learn how to install a binary of R. Thanks so much, Roger Roger, I don't know if the GUI version of the RPM interface (Red Hat/Fedora's Package Manager) is sufficiently robust these days. In the past, there were notable problems trying to use it to install software binaries. I would open a console and change into the folder where you copied the files. If you are running GNOME and do not have a Terminal launcher (icon) on any of your panels, you can go to the menus and select: Applications - Accessories - Terminal This will open a console on your desktop, just like the Windows command line console. Then change to the appropriate folder: cd /Path/To/FolderName Note that unlike Windows, the slashes are '/', not '\'. Then in that folder, type: su You will be prompted for the root password. If successful, you will note that the prompt prefix changes from a '$' to a '#'. Then, type: rpm -ivh R-2.3.1-1.fc5.x86_64.rpm This will begin the R installation process. If you get back to the prompt without any error messages, you should be good to go. Then type: exit at the console, which will exit root status and bring you back to your regular user ID (prompt prefix back to '$'). Needless to say, that while you have root privileges in the console, be careful in what you might type. You have total access to screw up the system... :-) If you get any error messages, post them back here and we can help debug the process. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing the x86_64 R Binary on Fedora Core 5
Hi Roger, I dunno what exactly might be the source of that mistake but I would strongly recommend to install R while you are online. Often other packages must be installed for dependencies. (And then I recommend using the smart package manager ( http://labix.org/smart ) which is a great tool and handling dependencies better.) You could use rpm at the command line level. open a shell, type su and give your password, change to the folder where the rpm is downloaded to, type rpm -ivh R-2.3.1-1.fc5.x86_64.rpm will try to install and give you information on whats missing... Stefan Grosse roger bos schrieb: I am looking for help install the x86_64 R Binary onto my FC5 machine. At the risk of subjecting myself to tons of criticism, I must confess that I don't know anything about Linux and I have never compiled R from source. Therefore, I choose FC5 because I see that a 64-bit binary is already available. Here is what I tried: I installed FC5 with all options (productivity, software development, and web server). FC5 boots up fine. I downloaded all the R binary files in that FC5 directory to my USB drive and copied them onto my linux machine (where I don't yet have internet access). I created a folder in my rbos's Home directory and copied the files there. I clicked on the R-2.3.1-1.fc5.x86_64.rpm and right-clicked to choose 'open with install software' It asked me for my root password. I put in the same root password I choose when I installed FC5. I get a installing packages screen that shows the R filename and I click Apply. It then give me an Error: Unable to retrieve software information. Can anyone tell me what steps I am missing? The R install guide states that binary installs are platform specific so it only considers building from the sources. I look forward to learning a lot about Linux and using more than just the GUI, but to get started, I just want to learn how to install a binary of R. Thanks so much, Roger [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] problem in install on ubuntu
Hi, the problem is: /usr/bin/ld: cannot find -lblas-3 collect2: ld returned 1 exit status make: ** [ape.so] Erro 1 ERROR: compilation failed for package 'ape' ** Removing '/usr/local/lib/R/site-library/ape' Any help would be appreciated. Thanks, Bruno G. M. Churata __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why are lagged correlations typically negative?
On Thu, 24 Aug 2006, Bliese, Paul D LTC USAMH wrote: Recently, I was working with some lagged designs where a vector of observations at one time was used to predict a vector of observations at another time using a lag 1 design. In the work, I noticed a lot of negative correlations, so I ran a simple simulation with 2 matched points. The crude simulation example below shows that the correlation can be -1 or +1, but interestingly if you do this basic simulation thousands of times, you get negative correlations 66 to 67% of the time. If you simulate three matched observations instead of three you get negative correlations about 74% of the time and then as you simulate 4 and more observations the number of negative correlations asymptotically approaches an equal 50% for negative versus positive correlations (though then with 100 observations one has 54% negative correlations). Creating T1 and T2 so they are related (and not correlated 1 as in the crude simulation) attenuates the effect. A more advanced simulation is provided below for those interested. Can anyone explain why this occurs in a way a non-mathematician is likely to understand? Consider the two points out of three case from the viewpoint of the middle point. The correlation is positive if the previous point is lower and the following point is higher, or vice versa. It is negative if the previous and following points are both higher or both lower. Now, if the middle point is higher than the first point it is probably higher than average, and so it has a more than 50% chance of also being higher than the third point. Similarly, if it is lower than the first point it is likely to be lower than the third point. So negative correlation is more likely than positive. Working out the covariance may be useful even for non-mathematicians. Call the three points X,Y,Z cov(X-Y, Y-Z) = cov(X,Y)-cov(Y,Y)-cov(X,Z)+cov(Y,Z) =0- var(Y) -0 -0 -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Intro to Programming R Book
Raphael Fraser wrote: I am new to R and am looking for a book that can help in learning to program in R. I have looked at the R website suggested books but I am still not sure which book best suite my needs. I am interesting in programming, data manipulation not statistics. Any suggestions? Raphael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. S Programming by Venables and Ripley (Springer) seems the only(?) one around targeting the language, not it's applications. luckily, it's very good. for the rest (things specific to R, e.g. package development, namespaces etc.) I think one can only resort to the R manuals . __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem in install on ubuntu
Hi Bruno, Your missing the Basic Linear Algebra Subroutines 3.0 package. apt-get install refblas3 should fix the problem. (At least in Debian, should be the same for Ubuntu) Ryan Bruno Grimaldo Martinho Churatae wrote: Hi, the problem is: /usr/bin/ld: cannot find -lblas-3 collect2: ld returned 1 exit status make: ** [ape.so] Erro 1 ERROR: compilation failed for package 'ape' ** Removing '/usr/local/lib/R/site-library/ape' Any help would be appreciated. Thanks, Bruno G. M. Churata __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem in install on ubuntu
Sorry, that should be: apt-get install refblas3-dev apt-get install refblas3 should fix the problem. (At least in Debian, should be the same for Ubuntu) Ryan Bruno Grimaldo Martinho Churatae wrote: Hi, the problem is: /usr/bin/ld: cannot find -lblas-3 collect2: ld returned 1 exit status make: ** [ape.so] Erro 1 ERROR: compilation failed for package 'ape' ** Removing '/usr/local/lib/R/site-library/ape' Any help would be appreciated. Thanks, Bruno G. M. Churata __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing the x86_64 R Binary on Fedora Core 5
Thanks so much Marc Stefan! The GUI wasn't telling me what I was missing. The terminal told me I was missing tk-8.4.12-1.2.x86_64.rpm so I went and got that and it installed without errors. Then I could't figure out how to launch R through the GUI so I went back to the terminal and typed R and it launched. I have a lot to learn but I want to thank you so much for getting me started. Another question: As I said, I don't have internet access on the linux machine, so is there any way to copy the library folder from my windows machine to the linux box and install the packages from there? Roger On 8/24/06, Stefan Grosse [EMAIL PROTECTED] wrote: Hi Roger, I dunno what exactly might be the source of that mistake but I would strongly recommend to install R while you are online. Often other packages must be installed for dependencies. (And then I recommend using the smart package manager ( http://labix.org/smart ) which is a great tool and handling dependencies better.) You could use rpm at the command line level. open a shell, type su and give your password, change to the folder where the rpm is downloaded to, type rpm -ivh R-2.3.1-1.fc5.x86_64.rpm will try to install and give you information on whats missing... Stefan Grosse roger bos schrieb: I am looking for help install the x86_64 R Binary onto my FC5 machine. At the risk of subjecting myself to tons of criticism, I must confess that I don't know anything about Linux and I have never compiled R from source. Therefore, I choose FC5 because I see that a 64-bit binary is already available. Here is what I tried: I installed FC5 with all options (productivity, software development, and web server). FC5 boots up fine. I downloaded all the R binary files in that FC5 directory to my USB drive and copied them onto my linux machine (where I don't yet have internet access). I created a folder in my rbos's Home directory and copied the files there. I clicked on the R-2.3.1-1.fc5.x86_64.rpm and right-clicked to choose 'open with install software' It asked me for my root password. I put in the same root password I choose when I installed FC5. I get a installing packages screen that shows the R filename and I click Apply. It then give me an Error: Unable to retrieve software information. Can anyone tell me what steps I am missing? The R install guide states that binary installs are platform specific so it only considers building from the sources. I look forward to learning a lot about Linux and using more than just the GUI, but to get started, I just want to learn how to install a binary of R. Thanks so much, Roger [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help: trouble using lines()
Hi I have no experience with lmer and its plotting method. However If it uses plain (not grid) graphics you maybe shall consult abline and/or segments. If it uses grid, you shall consult panel.abline from lattice package. BTW. Better to copy your answer every time to the list as somebody from BigBoys can definitely be able to answer questions with more intuition than myself. HTH Petr On 24 Aug 2006 at 16:34, Simon Pickett wrote: Date sent: Thu, 24 Aug 2006 16:34:57 +0100 (BST) Subject:Re: [R] help: trouble using lines() From: Simon Pickett [EMAIL PROTECTED] To: Petr Pikal [EMAIL PROTECTED] Hi, I have a model with a three way interaction f2- lmer(late.growth ~ mtf+year+treat+hatch.day+ hatch.day:year+ hatch.day:treat+ mtf:treat+ treat:year+ year:treat:mtf+(1|fybrood), data = A) (one continuous and two factors) and so I wanted to plot the fitted values of the model for each of the two factor levels. Copying the technique of the pdf I mentioned Linear mixed models in R by Sřren Feodor Nielsen 20003. http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mixed-mod els.pdf#search=%22Linear%20mixed%20models%20in%20R%22. I plotted the fitted values against the continuous variable. Now I plan to put lines on the existing plot for each of the combinations of the factors I have. where tmp[1] and tmp[2] are coefficients from the model... I was under the impression that lines(y,exp(tmp[1]+tmp[2])) would give me a line, but it doesnt work... thanks again Hi from lines help page x, y coordinate vectors of points to join. and lines or points simply adds lines or points to existing plot. What do you want to plot with lines? HTH Petr On 24 Aug 2006 at 14:52, Simon Pickett wrote: Date sent: Thu, 24 Aug 2006 14:52:09 +0100 (BST) From: Simon Pickett [EMAIL PROTECTED] To: Petr Pikal [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch, Simon Pickett [EMAIL PROTECTED] Subject:Re: [R] help: trouble using lines() Hi, thanks for replying. No, there arent any NA's in the original data set I think I must be mis-interpreting the use of lines()? in the example what exactly is y? lines(y,exp(tmp[1]+tmp[2])) In my case tmp[1] and tmp[2] are coeficients from the model so just one number (not a vector) and I havent specified y Thanks everyone, Simon Hi not sure but are there some NA values in your data? what length(mtf) and length(fitted(f2)) tells you? And you need not to use assignment graph1 - plot() to output a plot on screen. HTH Petr On 24 Aug 2006 at 13:43, Simon Pickett wrote: Date sent: Thu, 24 Aug 2006 13:43:18 +0100 (BST) From:Simon Pickett [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject: [R] help: trouble using lines() Hi R experts, I have been using ReML as follows... model-lmer(late.growth~mtf+year+treat+hatch.day+hatch.day:year+ hat ch. day:treat+ mtf:treat+ treat:year+ year:treat:mtf+(1|fybrood), data A) then I wanted to plot the results of the three way interaction using lines() as follows... tmp-as.vector(fixef(model)) graph1-plot(mtf,fitted(f2), xlab=list(Brood Size), ylab=list(Early growth rate), pch=16, col=darkgrey, bg=yellow) lines(y,exp(tmp[1]+tmp[2])) but no matter what I try I always get the error message Error in xy.coords(x, y) : 'x' and 'y' lengths differ Can anyone shed some light please? I am basically copying the methods of the pdf entitled Linear mixed models in R by Sřren Feodor Nielsen 20003. http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-mix ed- mod els.pdf#search=%22Linear%20mixed%20models%20in%20R%22 Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus
Re: [R] metaplot and meta.summaries
On Thu, 24 Aug 2006, Anne Katrin Heinrichs wrote: metaplot: - Can I change the label size? I've got 126 values and the intersection of the labels makes it impossible to read them. Yes. metaplot() accepts the cex graphics parameter. This doesn't alter the size of the summary text, so you might want to have no summlabel= and add it on later. Why do I have to give sumse (Standard Error) and sumnn (Precision) of the summary estimate? I can calculate one from the other, right? Just to make sure I'm not misunderstanding something. It's an oversight by the designer. metaplot() was basically designed to be called from the plot methods for the meta. objects. You might also want to look at forestplot(), which is more flexible. I don't know how it copes with large numbers of intervals, but if it doesn't it would be worth fixing. metaplot(CoeffVector, StdErrorVector, nn=NULL, labels=Name, conf.level=0.95, xlab=paste(CoeffNames[j], CoefficientName[i]), ylab=Countries, xlim=NULL, summn=PostCoeffs[1,j], sumse=sqrt(PostVars[1,j]), sumnn=1/(PostVars[1,j]), summlabel=Summary, lwd=2, boxsize=1) meta.summaries -- What does it mean, when I get the warning message that NaNs were produced in pchisq(q, df, lower.tail, log.p)? Is there something wrong with my data (there are no NAs in the data)? MetaAnalyse - meta.summaries(CoeffVector, StdErrorVector, method = random) It means that NaNs were produced. You should be able to see where from the output. It's hard to say more without more information. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] xyplot tick marks and line thickness
Hello, A made a xyplot using the lattice library in R (latest version). The publisher of our paper has requested: 1. all tick marks should point inwards instead of outwards. 2. All lines should be thicker (lines, axes, boxes, etc. Everything). Lines is easy...I used: lwd=1.5 but what about the lines of the axes, and the lines that build up the plot itself?? Any suggestions? Kind regards, Piet Bell - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why are lagged correlations typically negative?
The covariance has the same sign as the correlation so lets calculate the sample covariance of the vector T1 = (X,Y) with T2 = (Y,Z) where we ignored the third component in each case due to use=complete. cov(T1, T2) = XY + YZ - (X+Y)/2 * (Y+Z)/2 X, Y and Z are random variables so we take the expectation to get the overall average over many runs. Expectation is linear and all the random variables are uncorrelated so: EXY + EYZ - E[(X+Y)/2 * (Y+Z)/2] = EXY + EYZ - EXY/4 - EXZ/4 - EYY/4 - EYZ/4 = -EYY/4 0 where the third line is due to the fact that all terms in the second line except the surviving term are zero. On 8/24/06, Bliese, Paul D LTC USAMH [EMAIL PROTECTED] wrote: Recently, I was working with some lagged designs where a vector of observations at one time was used to predict a vector of observations at another time using a lag 1 design. In the work, I noticed a lot of negative correlations, so I ran a simple simulation with 2 matched points. The crude simulation example below shows that the correlation can be -1 or +1, but interestingly if you do this basic simulation thousands of times, you get negative correlations 66 to 67% of the time. If you simulate three matched observations instead of three you get negative correlations about 74% of the time and then as you simulate 4 and more observations the number of negative correlations asymptotically approaches an equal 50% for negative versus positive correlations (though then with 100 observations one has 54% negative correlations). Creating T1 and T2 so they are related (and not correlated 1 as in the crude simulation) attenuates the effect. A more advanced simulation is provided below for those interested. Can anyone explain why this occurs in a way a non-mathematician is likely to understand? Thanks, Paul # # Crude simulation # (T1-rnorm(3)) [1] -0.1594703 -1.3340677 0.2924988 (T2-c(T1[2:3],NA)) [1] -1.3340677 0.2924988 NA cor(T1,T2, use=complete) [1] -1 (T1-rnorm(3)) [1] -0.84258593 -0.49161602 0.03805543 (T2-c(T1[2:3],NA)) [1] -0.49161602 0.03805543 NA cor(T1,T2, use=complete) [1] 1 ### # More advanced simulation example ### lags function(nobs,nreps,rho=1){ OUT-data.frame(NEG=rep(NA,nreps),COR=rep(NA,nreps)) nran-nobs+1 #need to generate 1 more random number than there are observations for(i in 1:nreps){ V1-rnorm(nran) V2-sqrt(1-rho^2)*rnorm(nran)+rho*V1 #print(cor(V1,V2)) V1-V1[1:nran-1] V2-V2[2:nran] OUT[i,1]-ifelse(cor(V1,V2)=0,1,0) OUT[i,2]-cor(V1,V2) } return(OUT) #out is a 1 if the corr is negative or 0; 0 if positive } LAGS.2-lags(2,1) #Number of observations matched = 2 mean(LAGS.2) NEG COR 0.6682 -0.3364 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] metaplot and meta.summaries
Thanks! Sorry, I forgot to add the output of meta.summaries: Random-effects meta-analysis Call: meta.summaries(d = CoeffVector, se = StdErrorVector, method = random, logscale = FALSE) Summary effect=NaN 95% CI (NaN, NaN) If anyone has further hints, what the problem is, that would be great. I've found out by now that STATA gives me a result for my data, if that's any help. Best regards, Katrin meta.summaries -- What does it mean, when I get the warning message that NaNs were produced in pchisq(q, df, lower.tail, log.p)? Is there something wrong with my data (there are no NAs in the data)? MetaAnalyse - meta.summaries(CoeffVector, StdErrorVector, method = random) It means that NaNs were produced. You should be able to see where from the output. It's hard to say more without more information. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rgl: exporting to pdf or png does not work
On 8/24/2006 11:19 AM, Gaspard Lequeux wrote: Hej, On Wed, 23 Aug 2006, Duncan Murdoch wrote: On 8/23/2006 5:15 PM, Gaspard Lequeux wrote: When exporting a image from rgl, the following error is encountered: rgl.postscript('testing.pdf', fmt=pdf) RGL: ERROR: can't bind glx context to window RGL: ERROR: can't bind glx context to window Warning messages: 1: X11 protocol error: GLXBadContextState 2: X11 protocol error: GLXBadContextState The pdf file is created and is readable, but all the labels are gone. Taking a snapshot (to png) gives 'failed' and no file is created. Version of rgl used: 0.67-2 (2006-07-11) Version of R used: R 2.3.1; i486-pc-linux-gnu; 2006-07-13 01:31:16; Running Debian GNU/Linux testing (Etch). That looks like an X11 error to me, not something that I'm very likely to be able to fix. If you can debug the error, it would be helpful. Actually after upgrading everything (debian testing (etch)) and restarting X, I didn't get that error anymore. It was worse: R crashed: library(rgl);triangles3d(c(1,,2,3),c(1,2,4),c(1,3,5));rgl.postscript('testing.pdf','pdf') X Error of failed request: GLXBadContextState Major opcode of failed request: 142 (GLX) Minor opcode of failed request: 5 (X_GLXMakeCurrent) Serial number of failed request: 85 Current serial number in output stream: 85 [EMAIL PROTECTED]:~/seqanal$ I downloaded the source package (debian testing (etch), rgl-0.67-2). In rgl-0.67-2/src/ I changed the following files: rglview.cpp, around line 587. Commenting the function call gl2psBeginPage removed the crash (but also no pdf output...) I enabled this function again and went to gl2ps.c, to the function gl2psBeginPage. At the end of that function, around line 4426, commenting out the line glRenderMode(GL_FEEDBACK); removes the R crash, but of course still no pdf output (well, only the background). GL_FEEDBACK is defined in /usr/include/GL/gl.h as: /* Render Mode */ #define GL_FEEDBACK 0x1C01 #define GL_RENDER 0x1C00 #define GL_SELECT 0x1C02 Trying glRenderMode(GL_RENDER) removed the crash, but still only the background in the pdf. If someone has some suggestions about what to do next... gl2ps is a separate project, whose source has been included into rgl. You can see the gl2ps project page at http://www.geuz.org/gl2ps/. We're using version 1.2.2, which is a couple of years old. The current stable release of gl2ps is 1.3.1. It might fix your problem. I don't know if we modified gl2ps.c or gl2ps.h when they were included, but they haven't been modified since. (Daniel put them in, based on a patch from Albrecht Gebhardt, according to the log.) It would be helpful to know: 1. Is the rgl source identical to 1.2.2? 2. Does rgl work if 1.3.1 is dropped in instead? 3. Does 1.3.1 fix the bug you're seeing? I'll look into these at some point, but probably not this week. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Lattice symbol size and legend margins
Hi: I am using the following command: xyplot(dat6$CO3*1e6 ~ dat6$irradiance, data=dat6, group=ref, xlab=list(label=expression(paste(Irradiance (, mu, mol photons, m^-2, , s^-1, ))), cex=1.3), ylab=list(label=expression(paste(Carbonate concentration (x , 10^6, , kg^-1, ))) , cex=1.3), scales = list(x = list(cex=1.1), y = list(cex=1.1)), type=p, trellis.par.set(plot.symbol = list(cex=2)), layout=c(1, 1), aspect=1, auto.key = list(cex=1.2, between=4, space=right, border=T) ) And get the following error: Error in multiple !outer : invalid 'x' type in 'x y' I know it comes from the trellis.par.set command: I am unable to find the right syntax. A second question: I am adjusting the left and right margins between the text of the legend and the border using between. How can I control the top and bottom margins? Thanks, Jean-Pierre Gattuso __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing the x86_64 R Binary on Fedora Core 5
Roger, The Windows packages will not run on Linux. You will need to install them using the Linux versions (.tar.gz files) of the CRAN packages. You can copy them from a CRAN mirror to your USB drive and then install them locally using R CMD INSTALL PackageName.tar.gz This will again need to be done as root using 'su' from the console. Note that depending upon the nature of the package (ie. does it uses C and/or FORTRAN code or require third party libraries), you may get errors during the installation process if you are missing required code/applications/header files. HTH, Marc On Thu, 2006-08-24 at 11:50 -0400, roger bos wrote: Thanks so much Marc Stefan! The GUI wasn't telling me what I was missing. The terminal told me I was missing tk-8.4.12-1.2.x86_64.rpm so I went and got that and it installed without errors. Then I could't figure out how to launch R through the GUI so I went back to the terminal and typed R and it launched. I have a lot to learn but I want to thank you so much for getting me started. Another question: As I said, I don't have internet access on the linux machine, so is there any way to copy the library folder from my windows machine to the linux box and install the packages from there? Roger On 8/24/06, Stefan Grosse [EMAIL PROTECTED] wrote: Hi Roger, I dunno what exactly might be the source of that mistake but I would strongly recommend to install R while you are online. Often other packages must be installed for dependencies. (And then I recommend using the smart package manager ( http://labix.org/smart ) which is a great tool and handling dependencies better.) You could use rpm at the command line level. open a shell, type su and give your password, change to the folder where the rpm is downloaded to, type rpm -ivh R-2.3.1-1.fc5.x86_64.rpm will try to install and give you information on whats missing... Stefan Grosse roger bos schrieb: I am looking for help install the x86_64 R Binary onto my FC5 machine. At the risk of subjecting myself to tons of criticism, I must confess that I don't know anything about Linux and I have never compiled R from source. Therefore, I choose FC5 because I see that a 64-bit binary is already available. Here is what I tried: I installed FC5 with all options (productivity, software development, and web server). FC5 boots up fine. I downloaded all the R binary files in that FC5 directory to my USB drive and copied them onto my linux machine (where I don't yet have internet access). I created a folder in my rbos's Home directory and copied the files there. I clicked on the R-2.3.1-1.fc5.x86_64.rpm and right-clicked to choose 'open with install software' It asked me for my root password. I put in the same root password I choose when I installed FC5. I get a installing packages screen that shows the R filename and I click Apply. It then give me an Error: Unable to retrieve software information. Can anyone tell me what steps I am missing? The R install guide states that binary installs are platform specific so it only considers building from the sources. I look forward to learning a lot about Linux and using more than just the GUI, but to get started, I just want to learn how to install a binary of R. Thanks so much, Roger [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to compare rows of two matrices
Dear Stephen C. Upton Petr Pikal Thank you both very much for the suggestions! Best wishes, Muhammad Subianto On this day 24/08/2006 12:03, Muhammad Subianto wrote: Dear all, I have a dataset train - cbind(c(0,2,2,1,0), c(8,9,4,0,2), 6:10, c(-1, 1, 1, -1, 1)) test - cbind(1:5, c(0,1,5,1,3), c(1,1,2,0,3) ,c(1, 1, -1, 1, 1)) I want to find which rows of train and test it different in its last column (column 4). The solution must be something like train [,1] [,2] [,3] [,4] [1,]086 -1 [3,]2481 [4,]109 -1 test [,1] [,2] [,3] [,4] [1,]1011 [3,]352 -1 [4,]4101 I have tried with matrix(train %in% test, dim(train)) apply(train, 1, paste, collapse=) %in% apply(test, 1, paste, collapse=) It doesn't work. How can I do. Thanks for any help. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Intro to Programming R Book
On Thu, 24 Aug 2006, Joerg van den Hoff wrote: Raphael Fraser wrote: I am new to R and am looking for a book that can help in learning to program in R. I have looked at the R website suggested books but I am still not sure which book best suite my needs. I am interesting in programming, data manipulation not statistics. Any suggestions? If you know German, then Uwe Ligges' 2005 book Programmieren mit R may be what you are looking for. Some German-speakers I was teaching found it very useful. http://www.springeronline.com/sgw/cda/frontpage/0,,1-40109-22-26682866-0,00.html Raphael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. S Programming by Venables and Ripley (Springer) seems the only(?) one around targeting the language, not it's applications. luckily, it's very good. for the rest (things specific to R, e.g. package development, namespaces etc.) I think one can only resort to the R manuals . __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing the x86_64 R Binary on Fedora Core 5
On Thu, 24 Aug 2006, roger bos wrote: Thanks so much Marc Stefan! The GUI wasn't telling me what I was missing. The terminal told me I was missing tk-8.4.12-1.2.x86_64.rpm so I went and got that and it installed without errors. Then I could't figure out how to launch R through the GUI so I went back to the terminal and typed R and it launched. I have a lot to learn but I want to thank you so much for getting me started. Another question: As I said, I don't have internet access on the linux machine, so is there any way to copy the library folder from my windows machine to the linux box and install the packages from there? No, but what you can do on Windows is use download.packages(..., type=source), and copy the folder into which you downloaded to your Linux box. To avoid continually needing root access, I would do cd ~ mkdir Rlibrary cat .Renviron ~/Rlibrary ^D cd folder-with-downloaded-sources foreach f (*.tar.gz) R CMD INSTALL -l ~/Rlibrary $f end The next time you start R the installed packages should be available to you. Roger On 8/24/06, Stefan Grosse [EMAIL PROTECTED] wrote: Hi Roger, I dunno what exactly might be the source of that mistake but I would strongly recommend to install R while you are online. Often other packages must be installed for dependencies. (And then I recommend using the smart package manager ( http://labix.org/smart ) which is a great tool and handling dependencies better.) You could use rpm at the command line level. open a shell, type su and give your password, change to the folder where the rpm is downloaded to, type rpm -ivh R-2.3.1-1.fc5.x86_64.rpm will try to install and give you information on whats missing... Stefan Grosse roger bos schrieb: I am looking for help install the x86_64 R Binary onto my FC5 machine. At the risk of subjecting myself to tons of criticism, I must confess that I don't know anything about Linux and I have never compiled R from source. Therefore, I choose FC5 because I see that a 64-bit binary is already available. Here is what I tried: I installed FC5 with all options (productivity, software development, and web server). FC5 boots up fine. I downloaded all the R binary files in that FC5 directory to my USB drive and copied them onto my linux machine (where I don't yet have internet access). I created a folder in my rbos's Home directory and copied the files there. I clicked on the R-2.3.1-1.fc5.x86_64.rpm and right-clicked to choose 'open with install software' It asked me for my root password. I put in the same root password I choose when I installed FC5. I get a installing packages screen that shows the R filename and I click Apply. It then give me an Error: Unable to retrieve software information. Can anyone tell me what steps I am missing? The R install guide states that binary installs are platform specific so it only considers building from the sources. I look forward to learning a lot about Linux and using more than just the GUI, but to get started, I just want to learn how to install a binary of R. Thanks so much, Roger [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Check values in colums matrix
Dear all, I apologize if my question is quite simple. I have a dataset (20 columns 1000 rows) which some of columns have the same value and the others have different values. Here are some piece of my dataset: obj - cbind(c(1,1,1,4,0,0,1,4,-1), c(0,1,1,4,1,0,1,4,-1), c(1,1,1,4,2,0,1,4,-1), c(1,1,1,4,3,0,1,4,-1), c(1,1,1,4,6,0,1,5,-1), c(1,1,1,4,6,0,1,6,-1), c(1,1,1,4,6,0,1,7,-1), c(1,1,1,4,6,0,1,8,-1)) obj.tr - t(obj) obj.tr obj.tr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,]11140014 -1 [2,]01141014 -1 [3,]11142014 -1 [4,]11143014 -1 [5,]11146015 -1 [6,]11146016 -1 [7,]11146017 -1 [8,]11146018 -1 How can I do to check columns 2,3,4,6,7 and 9 have the same value, and columns 1,5 and 8 have different values. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot tick marks and line thickness
Piet Bell wrote: Hello, A made a xyplot using the lattice library in R (latest version). The publisher of our paper has requested: 1. all tick marks should point inwards instead of outwards. 2. All lines should be thicker (lines, axes, boxes, etc. Everything). Lines is easy...I used: lwd=1.5 but what about the lines of the axes, and the lines that build up the plot itself?? Any suggestions? library(lattice) trellis.device() # to find all components with lwd setting # names(trellis.par.get()[grep(lwd, trellis.par.get())]) trellis.par.set( add.line = list(lwd=1.5), plot.polygon = list(lwd=1.5), box.rectangle = list(lwd=1.5), box.umbrella = list(lwd=1.5), dot.line = list(lwd=1.5), plot.line = list(lwd=1.5), reference.line = list(lwd=1.5), strip.border = list(lwd=1.5), superpose.line = list(lwd=1.5), superpose.polygon = list(lwd=1.5), axis.line = list(lwd=1.5), box.3d = list(lwd=1.5)) xyplot(rnorm(5) ~ 1:5, type = b, scales = list(x = list(tck = -1), y = list(tck = -1))) Kind regards, Piet Bell - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot tick marks and line thickness
Look through the output of trellis.par.get() for the right parameters or when all else fails use grid (which we use below for the box around the panel since I could not locate the parameter): library(lattice) library(grid) x - 1:12 g - gl(3,4) lwd - 3 xyplot(x ~ x | g, type = l, lwd = lwd, scales = list(tck = -1, lwd = lwd), par.settings = list(add.text = list(lwd = lwd), strip.border = list(lwd = lwd)), panel = function(...) { grid.rect(gp = gpar(lwd = lwd)) panel.xyplot(...) } ) On 8/24/06, Piet Bell [EMAIL PROTECTED] wrote: Hello, A made a xyplot using the lattice library in R (latest version). The publisher of our paper has requested: 1. all tick marks should point inwards instead of outwards. 2. All lines should be thicker (lines, axes, boxes, etc. Everything). Lines is easy...I used: lwd=1.5 but what about the lines of the axes, and the lines that build up the plot itself?? Any suggestions? Kind regards, Piet Bell - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice symbol size and legend margins
Try par.settings= You can find examples via: RSiteSearch(par.settings) . On 8/24/06, Gattuso, Jean-Pierre [EMAIL PROTECTED] wrote: Hi: I am using the following command: xyplot(dat6$CO3*1e6 ~ dat6$irradiance, data=dat6, group=ref, xlab=list(label=expression(paste(Irradiance (, mu, mol photons, m^-2, , s^-1, ))), cex=1.3), ylab=list(label=expression(paste(Carbonate concentration (x , 10^6, , kg^-1, ))) , cex=1.3), scales = list(x = list(cex=1.1), y = list(cex=1.1)), type=p, trellis.par.set(plot.symbol = list(cex=2)), layout=c(1, 1), aspect=1, auto.key = list(cex=1.2, between=4, space=right, border=T) ) And get the following error: Error in multiple !outer : invalid 'x' type in 'x y' I know it comes from the trellis.par.set command: I am unable to find the right syntax. A second question: I am adjusting the left and right margins between the text of the legend and the border using between. How can I control the top and bottom margins? Thanks, Jean-Pierre Gattuso __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Intro to Programming R Book
S Poetry may be of use to you. Some things are now out-of-date and some things are wrong for R, but mostly it's right. And the price is right. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Raphael Fraser wrote: I am new to R and am looking for a book that can help in learning to program in R. I have looked at the R website suggested books but I am still not sure which book best suite my needs. I am interesting in programming, data manipulation not statistics. Any suggestions? Raphael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot tick marks and line thickness
On 8/24/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Look through the output of trellis.par.get() for the right parameters or when all else fails use grid (which we use below for the box around the panel since I could not locate the parameter): library(lattice) library(grid) x - 1:12 g - gl(3,4) lwd - 3 xyplot(x ~ x | g, type = l, lwd = lwd, scales = list(tck = -1, lwd = lwd), par.settings = list(add.text = list(lwd = lwd), strip.border = list(lwd = lwd)), panel = function(...) { grid.rect(gp = gpar(lwd = lwd)) panel.xyplot(...) } ) Right. the grid call shouldn't be necessary, axis.line controls the panel borders. And tck can be a vector, to get rid of the ugly bumps on top: xyplot(x ~ x | g, type = l, lwd = lwd, scales = list(tck = c(-1, 0)), par.settings = list(axis.line = list(lwd = lwd), strip.border = list(lwd = lwd))) -Deepayan On 8/24/06, Piet Bell [EMAIL PROTECTED] wrote: Hello, A made a xyplot using the lattice library in R (latest version). The publisher of our paper has requested: 1. all tick marks should point inwards instead of outwards. 2. All lines should be thicker (lines, axes, boxes, etc. Everything). Lines is easy...I used: lwd=1.5 but what about the lines of the axes, and the lines that build up the plot itself?? Any suggestions? Kind regards, Piet Bell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] forum.LancashireClubbers.co.uk - LAUNCH
(Mailing list information, including unsubscription instructions, is located at the end of this message.) __ LancashireClubbers.co.uk Hi, LancashireClubbers.co.uk is pleased to announce the official launch of there forum - http://forum.lancashireclubbers.co.uk If you wanna chat to other Clubbers, get the latest gossip or news about clubbing in Lancashire, download DJ Mix cd's or even promote an event in Lancashire, then register with us today. Many changes will be made to the forum over the coming months, remember this is your community, let us know your thoughts and we will do our best to improve the facility. The forum is very much in the community testing phase, where we will listen to your feedback, and goto many lengths to please you :) We hope to see you soon, http://forum.lancashireclubbers.co.uk Many Thanks Lancashire Clubbers Administrators -- The following information is a reminder of your current mailing list subscription: You are subscribed to the following list: Clubbing-UnknownLocations using the following email: r-help@stat.math.ethz.ch You may automatically unsubscribe from this list at any time by visiting the following URL: http://www.lancashireclubbers.co.uk/cgi-bin/dada/mail.cgi/u/loc_unknown/ If the above URL is inoperable, make sure that you have copied the entire address. Some mail readers will wrap a long URL and thus break this automatic unsubscribe mechanism. You may also change your subscription by visiting this list's main screen: http://www.lancashireclubbers.co.uk/cgi-bin/dada/mail.cgi/list/loc_unknown If you're still having trouble, please contact the list owner at: mailto:[EMAIL PROTECTED] The following physical address is associated with this mailing list: 168 Sycamore Avenue, Burnley [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot tick marks and line thickness
Here is a way to automate finding the lwd= parameters. library(lattice) # test data x - 1:12 g - gl(3, 4) lwd - 3 # set parameters par - trellis.par.get() par - lapply(par, function(x) replace(x, names(x) == lwd, lwd)) xyplot(x ~ x | g, type = l, par.settings = par) On 8/24/06, Chuck Cleland [EMAIL PROTECTED] wrote: Piet Bell wrote: Hello, A made a xyplot using the lattice library in R (latest version). The publisher of our paper has requested: 1. all tick marks should point inwards instead of outwards. 2. All lines should be thicker (lines, axes, boxes, etc. Everything). Lines is easy...I used: lwd=1.5 but what about the lines of the axes, and the lines that build up the plot itself?? Any suggestions? library(lattice) trellis.device() # to find all components with lwd setting # names(trellis.par.get()[grep(lwd, trellis.par.get())]) trellis.par.set( add.line = list(lwd=1.5), plot.polygon = list(lwd=1.5), box.rectangle = list(lwd=1.5), box.umbrella = list(lwd=1.5), dot.line = list(lwd=1.5), plot.line = list(lwd=1.5), reference.line = list(lwd=1.5), strip.border = list(lwd=1.5), superpose.line = list(lwd=1.5), superpose.polygon = list(lwd=1.5), axis.line = list(lwd=1.5), box.3d = list(lwd=1.5)) xyplot(rnorm(5) ~ 1:5, type = b, scales = list(x = list(tck = -1), y = list(tck = -1))) Kind regards, Piet Bell - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot tick marks and line thickness
That should read finding and setting. Chuck already showed how to find them. On 8/24/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Here is a way to automate finding the lwd= parameters. library(lattice) # test data x - 1:12 g - gl(3, 4) lwd - 3 # set parameters par - trellis.par.get() par - lapply(par, function(x) replace(x, names(x) == lwd, lwd)) xyplot(x ~ x | g, type = l, par.settings = par) On 8/24/06, Chuck Cleland [EMAIL PROTECTED] wrote: Piet Bell wrote: Hello, A made a xyplot using the lattice library in R (latest version). The publisher of our paper has requested: 1. all tick marks should point inwards instead of outwards. 2. All lines should be thicker (lines, axes, boxes, etc. Everything). Lines is easy...I used: lwd=1.5 but what about the lines of the axes, and the lines that build up the plot itself?? Any suggestions? library(lattice) trellis.device() # to find all components with lwd setting # names(trellis.par.get()[grep(lwd, trellis.par.get())]) trellis.par.set( add.line = list(lwd=1.5), plot.polygon = list(lwd=1.5), box.rectangle = list(lwd=1.5), box.umbrella = list(lwd=1.5), dot.line = list(lwd=1.5), plot.line = list(lwd=1.5), reference.line = list(lwd=1.5), strip.border = list(lwd=1.5), superpose.line = list(lwd=1.5), superpose.polygon = list(lwd=1.5), axis.line = list(lwd=1.5), box.3d = list(lwd=1.5)) xyplot(rnorm(5) ~ 1:5, type = b, scales = list(x = list(tck = -1), y = list(tck = -1))) Kind regards, Piet Bell - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ca.po Pz test question
Hello, I have a few questions about Ouliaris Unit Root Test of type Pz 1) I noticed that critical values given in the article Asymptotic properties of residual... by Phillips and Ouliaris are different from those given by R. More presicely - they are swaped with each other. Could explain why? 2) that question is quite stupid. Can you explain what coefficients for test Pz mean? for Pu it is straight-forward - Var1~ Var2*k1 + intercept +u. and u is tested for having a unit root. for Pz there it looks like Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.010013 0.002409 4.156 3.40e-05 *** zrV10.971824 0.006092 159.536 2e-16 *** zrV20.108994 0.047737 2.283 0.0225 * is it an equation for first differences? like if zrV1 is the first differ for V1 and zrV2 is the first diff for zrV2 then k1*zrV1+k2*zrV2+intercept~0 ??? 3) and the last question - why for Pz there is an option to use demean=trend and there is no such an option for Pu? Kind regards, Victor [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Authoring a book
Stefan Grosse wrote: I think Peter Dalgaard is right. Since you are able to use R I believe you will be very fast in learning LaTeX. I think it needs less then a week to learn the most common LaTeX commands. And setting up a wiki and trying then to convert this into a printable document format plus learning the wiki syntax is probably more time consuming. Beside this R is able to work perfectly together with LaTeX, it creates LaTeX output and is doing excellent graphics in the EPS/PS format. The best introduction for LaTeX is the not so short introduction: http://people.ee.ethz.ch/~oetiker/lshort/lshort.pdf It really was a not too short intro. I'll have a look at it. If you still are not convinced have a look at UniWakkaWiki: http://uniwakka.sourceforge.net/HomePage It is a Wiki for Science and University purposes and claims to be able to export to Openoffice as well as to LaTeX. Looks interesting and I really like the concept, but how stable is it? It looks rather fresh from the web page, but I may be wrong. A bibliography function is really a big advantage, so ... perhaps. Tom __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to constrast with factorial experiment
Hello, R users, I have two factors (treat, section) anova design experiment where there are 3 replicates. The objective of the experiment is to test if there is significant difference of yield between top (section 9 to 11) and bottom (section 9 to 11) of the fruit tree under treatment. I found that there are interaction between two factors. I wonder if I can contrast means from levels of one factor (section) under another factor (treat)? if so, how to do it in R and how to interpret the output? Here is the data and commands I used to test the differece between section 1 to 8 and 9 to 11 under treatment. But I don't know if I was right, how to interpret the out and whether there are significant difference between section 1 to 8 and section 9 to 11 under treatment. yield replicate treat section 35.55 1 Ctl 1 53.70 1 Ctl 2 42.79 1 Ctl 3 434.81 1 Ctl 4 705.96 1 Ctl 5 25.91 1 Ctl 6 57.53 1 Ctl 7 41.45 1 Ctl 8 85.54 1 Ctl 9 51.23 1 Ctl 10 188.24 1 Ctl 11 35.71 2 Ctl 1 45.15 2 Ctl 2 40.10 2 Ctl 3 312.76 2 Ctl 4 804.05 2 Ctl 5 28.22 2 Ctl 6 68.51 2 Ctl 7 46.15 2 Ctl 8 123.14 2 Ctl 9 33.78 2 Ctl 10 121.28 2 Ctl 11 30.96 3 Ctl 1 36.10 3 Ctl 2 47.19 3 Ctl 3 345.80 3 Ctl 4 644.61 3 Ctl 5 27.73 3 Ctl 6 56.63 3 Ctl 7 42.63 3 Ctl 8 61.25 3 Ctl 9 59.43 3 Ctl 10 109.87 3 Ctl 11 143.50 1 Trt 1 82.76 1 Trt 2 125.03 1 Trt 3 493.76 1 Trt 4 868.48 1 Trt 5 45.09 1 Trt 6 249.43 1 Trt 7 167.28 1 Trt 8 274.72 1 Trt 9 176.40 1 Trt 10 393.10 1 Trt 11 93.75 2 Trt 1 63.83 2 Trt 2 117.50 2 Trt 3 362.68 2 Trt 4 659.40 2 Trt 5 62.10 2 Trt 6 218.24 2 Trt 7 210.98 2 Trt 8 291.48 2 Trt 9 209.36 2 Trt 10 454.68 2 Trt 11 119.62 3 Trt 1 66.50 3 Trt 2 87.37 3 Trt 3 414.01 3 Trt 4 707.70 3 Trt 5 44.40 3 Trt 6 142.59 3 Trt 7 137.37 3 Trt 8 181.03 3 Trt 9 131.65 3 Trt 10 310.18 3 Trt 11 dat1-read.delim(c:/testcontr.txt, header=T) dat1$treat-as.factor(dat1$treat) dat1$replicate-as.factor(dat1$replicate) dat1$section-as.factor(dat1$section) attach(dat1) obj-lm(log2(yield)~treat*section) anova(obj) Analysis of Variance Table Response: log2(yield) Df Sum Sq Mean Sq F valuePr(F) treat 1 24.608 24.608 297.8649 2.2e-16 *** section 10 99.761 9.976 120.7565 2.2e-16 *** treat:section 10 6.708 0.671 8.1197 2.972e-07 *** Residuals 44 3.635 0.083 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 contrasts(section)-c(3,3,3,3,3,3,3,3,-8,-8,-8) objnew-lm(log2(yield)~treat*section) summary(objnew) Call: lm(formula = log2(yield) ~ treat * section) Residuals: Min 1Q Median 3Q Max -0.49647 -0.14913 -0.01521 0.17471 0.51105 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 6.288403 0.050034 125.682 2e-16 *** treatTrt1.221219 0.070759 17.259 2e-16 *** section1 -0.008502 0.010213 -0.832 0.409675 section2 -0.491175 0.165945 -2.960 0.004942 ** section32.569427 0.165945 15.484 2e-16 *** section43.556067 0.165945 21.429 2e-16 *** section5 -1.157069 0.165945 -6.973 1.25e-08 *** section6 -0.003562 0.165945 -0.021 0.982971 section7 -0.487770 0.165945 -2.939 0.005223 ** section80.106181 0.165945 0.640 0.525585 section9 -0.776882 0.165945 -4.682 2.74e-05 *** section10 0.759168 0.165945 4.575 3.87e-05 *** treatTrt:section1 -0.049000 0.01 -3.392 0.001474 ** treatTrt:section2 0.160825 0.234682 0.685 0.496757 treatTrt:section3 -0.949101 0.234682 -4.044 0.000208 *** treatTrt:section4 -1.118870 0.234682 -4.768 2.07e-05 *** treatTrt:section5 -0.295937 0.234682 -1.261 0.213950 treatTrt:section6 0.538638 0.234682 2.295 0.026549 * treatTrt:section7 0.796518 0.234682 3.394 0.001468 ** treatTrt:section8 -0.548744 0.234682 -2.338 0.023984 * treatTrt:section9 -0.191029 0.234682 -0.814 0.420033 treatTrt:section10 -0.556642 0.234682 -2.372 0.022137 * --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.2874 on 44 degrees of freedom Multiple R-Squared: 0.973, Adjusted R-squared: 0.9601 F-statistic: 75.55 on 21 and 44
Re: [R] extremely slow recursion in R?
i'm sure someone else will explain the recursion issue but , as far as your program running a few days, you don't have to wait this long. if you are in windows and do a ctrl alt delete and then click on processes, if the memory usage being used by that R process is staying EXACTLY the same and not moving at all, this is a sign ( atleast i have found this to be true for my cases. i guess it may not always hold ) that nothing is happening and your job has gone into never never land or has somehow become frozen. - Original Message - From: Jason Liao [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, August 24, 2006 4:05 PM Subject: [R] extremely slow recursion in R? I recently coded a recursion algorithm in R and ir ran a few days without returning any result. So I decided to try a simple case of computing binomial coefficient using recusrive relationship choose(n,k) = choose(n-1, k)+choose(n-1,k-1) I implemented in R and Fortran 90 the same algorithm (code follows). The R code finishes 31 minutes and the Fortran 90 program finishes in 6 seconds. So the Fortran program is 310 times faster. I thus wondered if there is room for speeding up recursion in R. Thanks. Jason R code my.choose = function(n,k) { if(kn) value = 0. else if(k==0) value = 1. else if(k==n) value = 1. else value = my.choose(n-1,k) + my.choose(n-1, k-1) value } print(date()) my.choose(30,15) print(date()) Fortran code recursive function choose(n, k) result(value) implicit none integer n, k double precision value if(kn) then value = 0. elseif(k==0) then value = 1. else if(k==n) then value = 1. else value = choose(n-1, k) + choose(n-1, k-1) end if end function program main write(*,*) choose(30, 15) end program Jason Liao, http://www.geocities.com/jg_liao Department of Epidemiology and Biostatistics Drexel University School of Public Health 245 N. 15th Street, Mail Stop 660 Philadelphia, PA 19102-1192 phone 215-762-3934 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extremely slow recursion in R?
There was some discussion here: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/73646.html On 8/24/06, Jason Liao [EMAIL PROTECTED] wrote: I recently coded a recursion algorithm in R and ir ran a few days without returning any result. So I decided to try a simple case of computing binomial coefficient using recusrive relationship choose(n,k) = choose(n-1, k)+choose(n-1,k-1) I implemented in R and Fortran 90 the same algorithm (code follows). The R code finishes 31 minutes and the Fortran 90 program finishes in 6 seconds. So the Fortran program is 310 times faster. I thus wondered if there is room for speeding up recursion in R. Thanks. Jason R code my.choose = function(n,k) { if(kn) value = 0. else if(k==0) value = 1. else if(k==n) value = 1. else value = my.choose(n-1,k) + my.choose(n-1, k-1) value } print(date()) my.choose(30,15) print(date()) Fortran code recursive function choose(n, k) result(value) implicit none integer n, k double precision value if(kn) then value = 0. elseif(k==0) then value = 1. else if(k==n) then value = 1. else value = choose(n-1, k) + choose(n-1, k-1) end if end function program main write(*,*) choose(30, 15) end program Jason Liao, http://www.geocities.com/jg_liao Department of Epidemiology and Biostatistics Drexel University School of Public Health 245 N. 15th Street, Mail Stop 660 Philadelphia, PA 19102-1192 phone 215-762-3934 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to constrast with factorial experiment
On 24-Aug-06 [EMAIL PROTECTED] wrote: Hello, R users, I have two factors (treat, section) anova design experiment where there are 3 replicates. The objective of the experiment is to test if there is significant difference of yield between top (section 9 to 11) and bottom (section 9 to 11) [I think you mean sections 1 to 8] of the fruit tree under treatment. I found that there are interaction between two factors. I wonder if I can contrast means from levels of one factor (section) under another factor (treat)? if so, how to do it in R and how to interpret the output? I think you would be well advised to look at a plot of the data. For example, let Y stand for yield, R for replicate, T for treat and S for section. ix-(T==Trt);plot(S[ix],Y[ix],col=red,ylim=c(0,1000)) ix-(T==Ctl);points(S[ix],Y[ix],col=blue) From this it is clear that sections 4 and 5 are in a class of their own. Also, in sections 1-3 and 6-11 the Ctl yields are not only lower, but have smaller (in some cases hardly any) variance, compared with the Trt yields. The variances for sections 7,8,9,10,11 are greater than for 1,2,3,6 without great change in mean value. While there is an evident difference between Trt yields and Ctrl yields for sections 1-3 and 6-11, this is not so for sections 4 and 5. This sort of behaviour no doubt provides some reasons for the interaction you observed. You seem to have a quite complex phenomenon here! To some extent the problems with variance can be diminished by working with logarithms. Compare the previous plot with ix-(T==Trt);plot(S[ix],log10(Y[ix]),col=red,ylim=c(0,3)) ix-(T==Ctl);points(S[ix],log10(Y[ix]),col=blue) (you have used log2() in your commands). The above observations can be seen reflected in R if you look at the output of summary(obj) where in particular: treatTrt:section2 -1.116910.33189 -3.365 0.001595 ** treatTrt:section3 -0.456340.33189 -1.375 0.176099 treatTrt:section4 -1.566270.33189 -4.719 2.42e-05 *** treatTrt:section5 -1.736040.33189 -5.231 4.48e-06 *** treatTrt:section6 -0.913110.33189 -2.751 0.008588 ** treatTrt:section7 -0.078530.33189 -0.237 0.814055 treatTrt:section8 0.179350.33189 0.540 0.591654 treatTrt:section9 -0.288590.33189 -0.870 0.389277 treatTrt:section10 0.069130.33189 0.208 0.835972 treatTrt:section11 -0.296490.33189 -0.893 0.376543 which, precisely, contrasts means from levels of one factor (section) under another factor (treat), and shows that most of the interaction arises in sections 4 and 5. Since sections 4 and 5 (in the middle of sections 1 to 8) are so exceptional, they will have strong influence on your comparison between sections 1-8 and sections 9-11. You need to think about what to do with sections 4 and 5! Here is the data and commands I used to test the differece between section 1 to 8 and 9 to 11 under treatment. But I don't know if I was right, how to interpret the out and whether there are significant difference between section 1 to 8 and section 9 to 11 under treatment. yield replicate treat section 35.55 1 Ctl 1 53.70 1 Ctl 2 42.79 1 Ctl 3 434.811 Ctl 4 705.961 Ctl 5 25.91 1 Ctl 6 57.53 1 Ctl 7 41.45 1 Ctl 8 85.54 1 Ctl 9 51.23 1 Ctl 10 188.241 Ctl 11 35.71 2 Ctl 1 45.15 2 Ctl 2 40.10 2 Ctl 3 312.762 Ctl 4 804.052 Ctl 5 28.22 2 Ctl 6 68.51 2 Ctl 7 46.15 2 Ctl 8 123.142 Ctl 9 33.78 2 Ctl 10 121.282 Ctl 11 30.96 3 Ctl 1 36.10 3 Ctl 2 47.19 3 Ctl 3 345.803 Ctl 4 644.613 Ctl 5 27.73 3 Ctl 6 56.63 3 Ctl 7 42.63 3 Ctl 8 61.25 3 Ctl 9 59.43 3 Ctl 10 109.873 Ctl 11 143.501 Trt 1 82.76 1 Trt 2 125.031 Trt 3 493.761 Trt 4 868.481 Trt 5 45.09 1 Trt 6 249.431 Trt 7 167.281 Trt 8 274.721 Trt 9 176.401 Trt 10 393.101 Trt 11 93.75 2 Trt 1 63.83 2 Trt 2 117.502 Trt 3 362.682 Trt 4 659.402 Trt 5 62.10 2 Trt 6 218.242 Trt 7 210.982 Trt 8 291.482 Trt 9 209.362 Trt 10 454.682 Trt 11 119.623 Trt 1 66.50 3 Trt 2 87.37 3 Trt 3 414.013 Trt 4 707.703 Trt 5 44.40 3 Trt 6 142.593 Trt 7 137.373 Trt 8 181.03
[R] extremely slow recursion in R?
I recently coded a recursion algorithm in R and ir ran a few days without returning any result. So I decided to try a simple case of computing binomial coefficient using recusrive relationship choose(n,k) = choose(n-1, k)+choose(n-1,k-1) I implemented in R and Fortran 90 the same algorithm (code follows). The R code finishes 31 minutes and the Fortran 90 program finishes in 6 seconds. So the Fortran program is 310 times faster. I thus wondered if there is room for speeding up recursion in R. Thanks. Jason R code my.choose = function(n,k) { if(kn) value = 0. else if(k==0) value = 1. else if(k==n) value = 1. else value = my.choose(n-1,k) + my.choose(n-1, k-1) value } print(date()) my.choose(30,15) print(date()) Fortran code recursive function choose(n, k) result(value) implicit none integer n, k double precision value if(kn) then value = 0. elseif(k==0) then value = 1. else if(k==n) then value = 1. else value = choose(n-1, k) + choose(n-1, k-1) end if end function program main write(*,*) choose(30, 15) end program Jason Liao, http://www.geocities.com/jg_liao Department of Epidemiology and Biostatistics Drexel University School of Public Health 245 N. 15th Street, Mail Stop 660 Philadelphia, PA 19102-1192 phone 215-762-3934 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rgl: exporting to pdf or png does not work
Hej, On Thu, 24 Aug 2006, Duncan Murdoch wrote: On 8/24/2006 11:19 AM, Gaspard Lequeux wrote: On Wed, 23 Aug 2006, Duncan Murdoch wrote: On 8/23/2006 5:15 PM, Gaspard Lequeux wrote: When exporting a image from rgl, the following error is encountered: rgl.postscript('testing.pdf', fmt=pdf) RGL: ERROR: can't bind glx context to window RGL: ERROR: can't bind glx context to window Warning messages: 1: X11 protocol error: GLXBadContextState 2: X11 protocol error: GLXBadContextState The pdf file is created and is readable, but all the labels are gone. Taking a snapshot (to png) gives 'failed' and no file is created. Version of rgl used: 0.67-2 (2006-07-11) Version of R used: R 2.3.1; i486-pc-linux-gnu; 2006-07-13 01:31:16; Running Debian GNU/Linux testing (Etch). That looks like an X11 error to me, not something that I'm very likely to be able to fix. If you can debug the error, it would be helpful. Actually after upgrading everything (debian testing (etch)) and restarting X, I didn't get that error anymore. It was worse: R crashed: library(rgl);triangles3d(c(1,,2,3),c(1,2,4),c(1,3,5));rgl.postscript('testing.pdf','pdf') X Error of failed request: GLXBadContextState Major opcode of failed request: 142 (GLX) Minor opcode of failed request: 5 (X_GLXMakeCurrent) Serial number of failed request: 85 Current serial number in output stream: 85 [EMAIL PROTECTED]:~/seqanal$ I downloaded the source package (debian testing (etch), rgl-0.67-2). In rgl-0.67-2/src/ I changed the following files: rglview.cpp, around line 587. Commenting the function call gl2psBeginPage removed the crash (but also no pdf output...) I enabled this function again and went to gl2ps.c, to the function gl2psBeginPage. At the end of that function, around line 4426, commenting out the line glRenderMode(GL_FEEDBACK); removes the R crash, but of course still no pdf output (well, only the background). GL_FEEDBACK is defined in /usr/include/GL/gl.h as: /* Render Mode */ #define GL_FEEDBACK 0x1C01 #define GL_RENDER0x1C00 #define GL_SELECT0x1C02 Trying glRenderMode(GL_RENDER) removed the crash, but still only the background in the pdf. If someone has some suggestions about what to do next... gl2ps is a separate project, whose source has been included into rgl. You can see the gl2ps project page at http://www.geuz.org/gl2ps/. We're using version 1.2.2, which is a couple of years old. The current stable release of gl2ps is 1.3.1. It might fix your problem. I don't know if we modified gl2ps.c or gl2ps.h when they were included, but they haven't been modified since. (Daniel put them in, based on a patch from Albrecht Gebhardt, according to the log.) It would be helpful to know: 1. Is the rgl source identical to 1.2.2? Yes. The version of gl2ps in rgl is identical to gl2ps version 1.2.2. 2. Does rgl work if 1.3.1 is dropped in instead? No: In version 1.3.1: #define GL2PS_PS 0 #define GL2PS_EPS 1 #define GL2PS_TEX 2 #define GL2PS_PDF 3 #define GL2PS_SVG 4 #define GL2PS_PGF 5 while in version 1.2.2: #define GL2PS_PS 1 #define GL2PS_EPS 2 #define GL2PS_TEX 3 #define GL2PS_PDF 4 Thus rgl.postscript('probeer.pdf','tex') should be used to generate a pdf. The pdf has still no characters (axes annotations). In R/enum.R The last line (line 54) rgl.enum (postscripttype, ps=1, eps=2, tex=3, pdf=4) should be rgl.enum (postscripttype, ps=0, eps=1, tex=2, pdf=3) and mayebe add svg and pgf... 3. Does 1.3.1 fix the bug you're seeing? No. Same error. The error occurs also on ubuntu dapper. On that ubuntu machine, when installing the libgl1-mesa-swrast, the packages libgl1-mesa libgl1-mesa-dri and x-window-system-core are removed. rgl.postscript doesn't produce any errors anymore, the pdf is created but no text (axes decorations) is written to the pdf. On debian testing, libgl1-mesa-swx11 can be installed. This removes the follwing packages: freeglut3-dev libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglitz-glx1-dev libglitz1-dev libglu1-mesa-dev libglui-dev libglut3-dev x-window-system-core xlibmesa-gl-dev xorg but R doesn't crash anymore and the figure is written to file (still without axes annotations). Reinstal libgl1-mesa-glx removes libgl1-mesa-swx11 and the R crash returns. So it seems the bug is really triggered by libgl1-mesa. I filled in a bug report for the debian package libgl1-mesa-glx. I'll look into these at some point, but probably not this week. Thanks. No hurry however, as I can still use the classical screenshots. The figures will probable not have to be published, as the expected results are not attained. /Gaspard __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide
[R] generating an expression for a formula automatically
Hi! I would like to be able to create formulas automatically. For example, I want to be able to create a function that takes on two values: resp and x, and then creates the proper formula to regress resp on x. My code: fit.main - function(resp,x) { form - expression(paste(resp, ~ ,paste(x,sep=,collapse= + ),sep=)) z - lm(eval(form)) z } main - fit.main(y,c(x1,x2,x3,x4)) and I get this error: Error in terms.default(formula, data = data) : no terms component Any suggestions? Thanks, Maria __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Check values in colums matrix
On 8/24/06, Muhammad Subianto [EMAIL PROTECTED] wrote: I have a dataset (20 columns 1000 rows) which some of columns have the same value and the others have different values. Here are some piece of my dataset: obj - cbind(c(1,1,1,4,0,0,1,4,-1), c(0,1,1,4,1,0,1,4,-1), c(1,1,1,4,2,0,1,4,-1), c(1,1,1,4,3,0,1,4,-1), c(1,1,1,4,6,0,1,5,-1), c(1,1,1,4,6,0,1,6,-1), c(1,1,1,4,6,0,1,7,-1), c(1,1,1,4,6,0,1,8,-1)) obj.tr - t(obj) obj.tr obj.tr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,]11140014 -1 [2,]01141014 -1 [3,]11142014 -1 [4,]11143014 -1 [5,]11146015 -1 [6,]11146016 -1 [7,]11146017 -1 [8,]11146018 -1 How can I do to check columns 2,3,4,6,7 and 9 have the same value, and columns 1,5 and 8 have different values. Just try all(obj.tr[,2]==obj.tr[1,2]) and so on for the other columns. See ? all. Paul __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] generating an expression for a formula automatically
Use as.formula to convert the character string to an object of class formula and note that we want to set the formula's environment appropriately: fit.main - function(resp, x, env = parent.frame()) { fo - as.formula(paste(y, ~, paste(x, collapse = +))) environment(fo) - env fo } # test fit.main(y, letters[1:3]) On 8/24/06, Maria Montez [EMAIL PROTECTED] wrote: Hi! I would like to be able to create formulas automatically. For example, I want to be able to create a function that takes on two values: resp and x, and then creates the proper formula to regress resp on x. My code: fit.main - function(resp,x) { form - expression(paste(resp, ~ ,paste(x,sep=,collapse= + ),sep=)) z - lm(eval(form)) z } main - fit.main(y,c(x1,x2,x3,x4)) and I get this error: Error in terms.default(formula, data = data) : no terms component Any suggestions? Thanks, Maria __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem in library.dynam problems on Linux
We have R 2.2.1 installed on a Linux cluster that seems to have problems loading either of our shared object libraries for packages. This seems to be happening on both local and global versions of packages that we install. However, we have only noticed this problem in the past 3 months on this R installation, whereas some users had success before then. It could be that something on our system changed, but I am not an admin so I wouldn't know where to look. Can anyone help with this problem? ## A LOCAL INSTALLATION OF HAPLO.STATS APPEARS SUCCESSFUL [EMAIL PROTECTED] rpack]$ R CMD INSTALL -l /home/sinnwell/rdir/tmplib haplo.stats * Installing *source* package 'haplo.stats' ... ** libs make: `haplo.stats.so' is up to date. ** R ** data ** demo ** inst ** preparing package for lazy loading ** help Building/Updating help pages for package 'haplo.stats' Formats: text html latex example ** building package indices ... * DONE (haplo.stats) ## TRY AND LOAD THE LOCALLY INSTALLED LIBRARY, YET THE SYSTEM COMMAND SHOWS THE .so FILE IS THERE R library(haplo.stats, lib.loc=/home/sinnwell/rdir/tmplib/) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/home/sinnwell/rdir/tmplib/haplo.stats/libs/haplo.stats.so': /home/sinnwell/rdir/tmplib/haplo.stats/libs/haplo.stats.so: cannot open shared object file: No such file or directory Error in library(haplo.stats, lib.loc = /home/sinnwell/rdir/tmplib/) : .First.lib failed for 'haplo.stats' R system('ls -al /home/sinnwell/rdir/tmplib/haplo.stats/libs') total 88 drwxr-xr-x 2 sinnwell sinnwell 4096 Aug 24 15:14 . drwxr-xr-x 13 sinnwell sinnwell 4096 Aug 24 15:14 .. -rwxr-xr-x 1 sinnwell sinnwell 61566 Aug 24 15:14 haplo.stats.so R version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor2.1 year 2005 month12 day 20 svn rev 36812 language R Also, the .First.lib for haplo.stats looks like this: .First.lib - function(lib, pkg) { library.dynam(haplo.stats, pkg, lib) } Thanks for you suggestions, Jason Sinnwell Jason Sinnwell Mayo Clinic, Rochester Division of Biostatistics ph: 507.284.3270 fax: 507.284.9542 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Using a 'for' loop : there should be a better way in R
I need to apply a yearly inflation factor to some wages and supply some simple sums by work category. I have gone at it with a brute force for loop approach which seems okay as it is a small dataset. It looks a bit inelegant and given all the warnings in the Intro to R, etc, about using loops I wondered if anyone could suggest something a bit simpler or more efficent? Example: cat1 - c( 1,1,6,1,1,5) cat2 - c( 1,2,3,4,5,6) cat3 - c( 5,4,6,7,8,8) cat4 - c( 1,2,1,2,1,2) years - c( 'year1', 'year2', 'year3', 'year3', 'year1', 'year1') id - c('a','a','b','c','c','a') df1 - data.frame(id,years,cat1,cat2, cat3, cat4) nn - levels(df1$id)# levels for outer loop hh - levels(df1$years) # levels for inter loop mp - c(1, 5, 10) # inflation factor tt - data.frame(matrix(NA, length(nn), 2)) names(tt) - c(s1,s2) rownames(tt) - nn for (i in 1:length(nn)){ scat - data.frame(matrix(NA, length(hh),2)) dd1 - subset(df1, id==nn[i]) for (j in 1:length(hh)){ dd2 - subset(dd1, dd1$years==hh[j]) s1 - sum(dd2$cat1,dd2$cat2, na.rm=T) s2 - sum(dd2$cat3,dd2$cat4,na.rm=T) scat[j,] - c(s1,s2) *mp[j]# multiply by the inflation factor } crush - apply(scat, 2, sum) tt[i,] - crush } tt __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] generating an expression for a formula automatically
On Thu, 2006-08-24 at 14:01 -0700, Maria Montez wrote: Hi! I would like to be able to create formulas automatically. For example, I want to be able to create a function that takes on two values: resp and x, and then creates the proper formula to regress resp on x. My code: fit.main - function(resp,x) { form - expression(paste(resp, ~ ,paste(x,sep=,collapse= + ),sep=)) z - lm(eval(form)) z } main - fit.main(y,c(x1,x2,x3,x4)) and I get this error: Error in terms.default(formula, data = data) : no terms component Any suggestions? Thanks, Maria See the last example in ?as.formula: BTW, I would pay note to the ability to use subset()'s of data frames in model functions. For example, let's say that your data frame above is called DF and contains columns 'y' and then 'x1' through 'x50' in sequence. However, you only want to use the columns you have indicated in your code above. You can then do: lm(y ~ ., data = subset(DF, select = y:x4)) The use of the '.' on the RHS of the formula indicates to use all other columns besides the response column in the formula. In the subset() function, you can specify a sequential group of columns using the ':' operator. For a specific example, let's use the iris data set, which has columns: names(iris) [1] Sepal.Length Sepal.Width Petal.Length Petal.Width [5] Species We want to use 'Sepal.Length' as the response variable and then all columns, other than 'Species', as terms: lm(Sepal.Length ~ ., data = subset(iris, select = -Species)) Call: lm(formula = Sepal.Length ~ ., data = subset(iris, select = -Species)) Coefficients: (Intercept) Sepal.Width Petal.Length Petal.Width 1.85600.65080.7091 -0.5565 In this case, I excluded the Species columns by using the '-' before the column name. However, I could have easily used: lm(Sepal.Length ~ ., data = subset(iris, select = Sepal.Length:Petal.Width)) Call: lm(formula = Sepal.Length ~ ., data = subset(iris, select = Sepal.Length:Petal.Width)) Coefficients: (Intercept) Sepal.Width Petal.Length Petal.Width 1.85600.65080.7091 -0.5565 See ?subset for additional information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] generating an expression for a formula automatically
Maria Montez wrote: Hi! I would like to be able to create formulas automatically. For example, I want to be able to create a function that takes on two values: resp and x, and then creates the proper formula to regress resp on x. My code: fit.main - function(resp,x) { form - expression(paste(resp, ~ ,paste(x,sep=,collapse= + ),sep=)) z - lm(eval(form)) z } main - fit.main(y,c(x1,x2,x3,x4)) and I get this error: Error in terms.default(formula, data = data) : no terms component Any suggestions? Thanks, Maria __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hi, Maria, Try regr - paste(x, collapse = +) form - as.formula(sprintf(%s ~ %s, resp, regr)) HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Check values in colums matrix
--- Muhammad Subianto [EMAIL PROTECTED] wrote: Dear all, I apologize if my question is quite simple. I have a dataset (20 columns 1000 rows) which some of columns have the same value and the others have different values. Here are some piece of my dataset: obj - cbind(c(1,1,1,4,0,0,1,4,-1), c(0,1,1,4,1,0,1,4,-1), c(1,1,1,4,2,0,1,4,-1), c(1,1,1,4,3,0,1,4,-1), c(1,1,1,4,6,0,1,5,-1), c(1,1,1,4,6,0,1,6,-1), c(1,1,1,4,6,0,1,7,-1), c(1,1,1,4,6,0,1,8,-1)) obj.tr - t(obj) obj.tr obj.tr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,]11140014 -1 [2,]01141014 -1 [3,]11142014 -1 [4,]11143014 -1 [5,]11146015 -1 [6,]11146016 -1 [7,]11146017 -1 [8,]11146018 -1 How can I do to check columns 2,3,4,6,7 and 9 have the same value, and columns 1,5 and 8 have different values. Best, Muhammad Subianto There has to be a better way but this will let you check visually since you only have 20 columns for(i in 1:8) { tt -table(obj.tr[,i]) print( i) print (tt) } __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R News, volume 6, issue 3 is now available
Hi The August 2006 issue of R News is now available on CRAN under the Documentation/Newsletter link. Many thanks to Ron Wehrens, our guest editor for this special issue. Paul (on behalf of the R News EditorialBoard) -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ ___ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem in library.dynam problems on Linux
Sinnwell, Jason P. [EMAIL PROTECTED] writes: We have R 2.2.1 installed on a Linux cluster that seems to have problems loading either of our shared object libraries for packages. This seems to be happening on both local and global versions of packages that we install. However, we have only noticed this problem in the past 3 months on this R installation, whereas some users had success before then. It could be that something on our system changed, but I am not an admin so I wouldn't know where to look. Can anyone help with this problem? ## A LOCAL INSTALLATION OF HAPLO.STATS APPEARS SUCCESSFUL [EMAIL PROTECTED] rpack]$ R CMD INSTALL -l /home/sinnwell/rdir/tmplib haplo.stats * Installing *source* package 'haplo.stats' ... ** libs make: `haplo.stats.so' is up to date. ** R ** data ** demo ** inst ** preparing package for lazy loading ** help Building/Updating help pages for package 'haplo.stats' Formats: text html latex example ** building package indices ... * DONE (haplo.stats) ## TRY AND LOAD THE LOCALLY INSTALLED LIBRARY, YET THE SYSTEM COMMAND SHOWS THE .so FILE IS THERE R library(haplo.stats, lib.loc=/home/sinnwell/rdir/tmplib/) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/home/sinnwell/rdir/tmplib/haplo.stats/libs/haplo.stats.so': /home/sinnwell/rdir/tmplib/haplo.stats/libs/haplo.stats.so: cannot open shared object file: No such file or directory Error in library(haplo.stats, lib.loc = /home/sinnwell/rdir/tmplib/) : .First.lib failed for 'haplo.stats' R system('ls -al /home/sinnwell/rdir/tmplib/haplo.stats/libs') total 88 drwxr-xr-x 2 sinnwell sinnwell 4096 Aug 24 15:14 . drwxr-xr-x 13 sinnwell sinnwell 4096 Aug 24 15:14 .. -rwxr-xr-x 1 sinnwell sinnwell 61566 Aug 24 15:14 haplo.stats.so H.. Does mount -l show something interesting on the filesystem containing the .so file? (e.g., option noexec). -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Using a 'for' loop : there should be a better way in R
Use cbind to create a two column matrix, mat, and multiply that by the appropriate inflation factors. Then use rowsum to sum the rows according to the id grouping factor. inf.fac - list(year1 = 1, year2 = 5, year3 = 10) mat - cbind(s1 = df1$cat1 + df1$cat2, s2 = df1$cat3 + df1$cat4) rowsum(mat * unlist(inf.fac[df1$year]), df1$id) On 8/24/06, John Kane [EMAIL PROTECTED] wrote: I need to apply a yearly inflation factor to some wages and supply some simple sums by work category. I have gone at it with a brute force for loop approach which seems okay as it is a small dataset. It looks a bit inelegant and given all the warnings in the Intro to R, etc, about using loops I wondered if anyone could suggest something a bit simpler or more efficent? Example: cat1 - c( 1,1,6,1,1,5) cat2 - c( 1,2,3,4,5,6) cat3 - c( 5,4,6,7,8,8) cat4 - c( 1,2,1,2,1,2) years - c( 'year1', 'year2', 'year3', 'year3', 'year1', 'year1') id - c('a','a','b','c','c','a') df1 - data.frame(id,years,cat1,cat2, cat3, cat4) nn - levels(df1$id)# levels for outer loop hh - levels(df1$years) # levels for inter loop mp - c(1, 5, 10) # inflation factor tt - data.frame(matrix(NA, length(nn), 2)) names(tt) - c(s1,s2) rownames(tt) - nn for (i in 1:length(nn)){ scat - data.frame(matrix(NA, length(hh),2)) dd1 - subset(df1, id==nn[i]) for (j in 1:length(hh)){ dd2 - subset(dd1, dd1$years==hh[j]) s1 - sum(dd2$cat1,dd2$cat2, na.rm=T) s2 - sum(dd2$cat3,dd2$cat4,na.rm=T) scat[j,] - c(s1,s2) *mp[j]# multiply by the inflation factor } crush - apply(scat, 2, sum) tt[i,] - crush } tt __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extremely slow recursion in R?
On Thu, 24 Aug 2006, Jason Liao wrote: I recently coded a recursion algorithm in R and ir ran a few days without returning any result. So I decided to try a simple case of computing binomial coefficient using recusrive relationship choose(n,k) = choose(n-1, k)+choose(n-1,k-1) I implemented in R and Fortran 90 the same algorithm (code follows). The R code finishes 31 minutes and the Fortran 90 program finishes in 6 seconds. So the Fortran program is 310 times faster. I thus wondered if there is room for speeding up recursion in R. Thanks. Recursive code that computes the same case many times can often be sped up by memoization, eg memo-new.env(hash=TRUE) chewse-function(n,k) { if (n==k) return(1) if(k==1) return(n) if(exists(paste(n,k),memo,inherits=FALSE)) return(get(paste(n,k),memo)) rval-chewse(n-1,k)+chewse(n-1,k-1) assign(paste(n,k),rval,envir=memo) return(rval) } This idea was discussed in an early Programmers' Niche article by Bill Venables in R News. However, I'm surprised that you're surprised that compiled Fortran 90 is 310 times faster than interpreted R. That would be about what I would expect for code that isn't making use of vectorized functions in R. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Check values in colums matrix
Try sd(obj.tr) which will give a vector of standard deviations, one per column. A column's entry will be zero if and only if all values in the column are the same. On 8/24/06, Muhammad Subianto [EMAIL PROTECTED] wrote: Dear all, I apologize if my question is quite simple. I have a dataset (20 columns 1000 rows) which some of columns have the same value and the others have different values. Here are some piece of my dataset: obj - cbind(c(1,1,1,4,0,0,1,4,-1), c(0,1,1,4,1,0,1,4,-1), c(1,1,1,4,2,0,1,4,-1), c(1,1,1,4,3,0,1,4,-1), c(1,1,1,4,6,0,1,5,-1), c(1,1,1,4,6,0,1,6,-1), c(1,1,1,4,6,0,1,7,-1), c(1,1,1,4,6,0,1,8,-1)) obj.tr - t(obj) obj.tr obj.tr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,]11140014 -1 [2,]01141014 -1 [3,]11142014 -1 [4,]11143014 -1 [5,]11146015 -1 [6,]11146016 -1 [7,]11146017 -1 [8,]11146018 -1 How can I do to check columns 2,3,4,6,7 and 9 have the same value, and columns 1,5 and 8 have different values. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Need help with difficulty loading page www.bioconductor.org
The page is either too busy, or there is something seriously wrong with access to this page. Most of the time, trying to reach www.bioconductor.org results in failure. Only once in a blue moon, do I get through. In fact, thus far, I have not been able to install bioconductor, since the first source(...) command from the R command window -- following instruction on www.bioconductor.org page, that I did manage to reach, one time -- has failed, every time. Please help. Debashis Bhattacharya. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Check values in colums matrix
Absolutely. But do note that if the values in obj are the product of numerical computations then columns of equal values may turn out to be only **nearly** equal and so the sd may turn out to be **nearly** 0 and not exactly 0. This is a standard issue in numerical computation, of course, and has been commented on in this list at least dozens of times, but it's still a gotcha for the unwary (so now dozens +1). -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Thursday, August 24, 2006 4:28 PM To: Muhammad Subianto Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Check values in colums matrix Try sd(obj.tr) which will give a vector of standard deviations, one per column. A column's entry will be zero if and only if all values in the column are the same. On 8/24/06, Muhammad Subianto [EMAIL PROTECTED] wrote: Dear all, I apologize if my question is quite simple. I have a dataset (20 columns 1000 rows) which some of columns have the same value and the others have different values. Here are some piece of my dataset: obj - cbind(c(1,1,1,4,0,0,1,4,-1), c(0,1,1,4,1,0,1,4,-1), c(1,1,1,4,2,0,1,4,-1), c(1,1,1,4,3,0,1,4,-1), c(1,1,1,4,6,0,1,5,-1), c(1,1,1,4,6,0,1,6,-1), c(1,1,1,4,6,0,1,7,-1), c(1,1,1,4,6,0,1,8,-1)) obj.tr - t(obj) obj.tr obj.tr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,]11140014 -1 [2,]01141014 -1 [3,]11142014 -1 [4,]11143014 -1 [5,]11146015 -1 [6,]11146016 -1 [7,]11146017 -1 [8,]11146018 -1 How can I do to check columns 2,3,4,6,7 and 9 have the same value, and columns 1,5 and 8 have different values. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Check values in colums matrix
Fair enough although in the case of the example it does not appear to be a problem: sd(obj.tr) [1] 0.3535534 0.000 0.000 0.000 2.5495098 0.000 0.000 [8] 1.5811388 0.000 Further, if all entries in the matrix are integers, as in the example, then we know that: nr - nrow(obj.tr) round(nr * (nr-1) * sd(obj.tr)) [1] 20 0 0 0 143 0 0 89 0 is all integer too. On 8/24/06, Berton Gunter [EMAIL PROTECTED] wrote: Absolutely. But do note that if the values in obj are the product of numerical computations then columns of equal values may turn out to be only **nearly** equal and so the sd may turn out to be **nearly** 0 and not exactly 0. This is a standard issue in numerical computation, of course, and has been commented on in this list at least dozens of times, but it's still a gotcha for the unwary (so now dozens +1). -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Thursday, August 24, 2006 4:28 PM To: Muhammad Subianto Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Check values in colums matrix Try sd(obj.tr) which will give a vector of standard deviations, one per column. A column's entry will be zero if and only if all values in the column are the same. On 8/24/06, Muhammad Subianto [EMAIL PROTECTED] wrote: Dear all, I apologize if my question is quite simple. I have a dataset (20 columns 1000 rows) which some of columns have the same value and the others have different values. Here are some piece of my dataset: obj - cbind(c(1,1,1,4,0,0,1,4,-1), c(0,1,1,4,1,0,1,4,-1), c(1,1,1,4,2,0,1,4,-1), c(1,1,1,4,3,0,1,4,-1), c(1,1,1,4,6,0,1,5,-1), c(1,1,1,4,6,0,1,6,-1), c(1,1,1,4,6,0,1,7,-1), c(1,1,1,4,6,0,1,8,-1)) obj.tr - t(obj) obj.tr obj.tr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,]11140014 -1 [2,]01141014 -1 [3,]11142014 -1 [4,]11143014 -1 [5,]11146015 -1 [6,]11146016 -1 [7,]11146017 -1 [8,]11146018 -1 How can I do to check columns 2,3,4,6,7 and 9 have the same value, and columns 1,5 and 8 have different values. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] zoo: new version 1.2-0
Dear useRs, the new version 1.2-0 of the zoo package for dealing with regular and irregular time series data is available from the CRAN mirrors. This version includes two important changes/enhancements: - rapply() was re-named to rollapply() because from R 2.4.0 on, base R provides a function rapply() for recursive (not rolling) application of functions, which was already described in the Green Book. zoo::rapply() currently still exists for backward compatibility, however, it is flagged as deprecated and now dispatches to rollapply() methods. We recommend to change existing scripts from using rapply() to rollapply(). - xyplot() methods for zoo, ts, and its objects have been added for creating trellis time series graphs. The functions are still under development and suggestions for improvement are welcome. For general introductions to the package see: vignette(zoo, package = zoo) vignette(zoo-quickref, package = zoo) Best wishes, Z ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] sandwich: new version 2.0-0
Dear useRs, a new version 2.0-0 of the sandwich package for estimating sandwich covariance matrices is available from the CRAN mirrors. The tools for computing heteroskedasticity (and autocorrelation) consistent covariance matrix estimators (also called HC and HAC estimators, including the Eicker-Huber-White estimator) have been generalized over the last releases from linear regression to general parametric models. These new object-oriented features of the sandwich package are also described in paper published in the Journal of Statistical Software (JSS) that accompanies this release. See http://www.jstatsoft.org/ The new JSS paper and the previous one (accompanying version 1.0-0) are also available as package vignettes: vignette(sandwich, package = sandwich) vignette(sandwich-OOP, package = sandwich) Best wishes, Z ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] tcltk command to figure out which widget in active or in focus
Hi, I'm making an interface, where a Tcl/Tk window have few listbox widgets. I need to select separate parameters from separate listboxes. It is clear how to get cursor selection value, once you know which listbox widget you clicked. The problem is I can't figure out which one tcltk command to use to get an information which listbox widget I clicked. Thank you, Vlad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Check values in colums matrix
As a minor footnote to both of these, I would add that both assume that all the columns of the dataset are numeric. It doesn't cost much to generalize it to cover any matrix structure, of any mode: constantColmuns - function(Xmat) which(apply(Xmat, 2, function(z) length(unique(z)) == 1)) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Berton Gunter Sent: Friday, 25 August 2006 9:37 AM To: 'Gabor Grothendieck'; 'Muhammad Subianto' Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Check values in colums matrix Absolutely. But do note that if the values in obj are the product of numerical computations then columns of equal values may turn out to be only **nearly** equal and so the sd may turn out to be **nearly** 0 and not exactly 0. This is a standard issue in numerical computation, of course, and has been commented on in this list at least dozens of times, but it's still a gotcha for the unwary (so now dozens +1). -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Thursday, August 24, 2006 4:28 PM To: Muhammad Subianto Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Check values in colums matrix Try sd(obj.tr) which will give a vector of standard deviations, one per column. A column's entry will be zero if and only if all values in the column are the same. On 8/24/06, Muhammad Subianto [EMAIL PROTECTED] wrote: Dear all, I apologize if my question is quite simple. I have a dataset (20 columns 1000 rows) which some of columns have the same value and the others have different values. Here are some piece of my dataset: obj - cbind(c(1,1,1,4,0,0,1,4,-1), c(0,1,1,4,1,0,1,4,-1), c(1,1,1,4,2,0,1,4,-1), c(1,1,1,4,3,0,1,4,-1), c(1,1,1,4,6,0,1,5,-1), c(1,1,1,4,6,0,1,6,-1), c(1,1,1,4,6,0,1,7,-1), c(1,1,1,4,6,0,1,8,-1)) obj.tr - t(obj) obj.tr obj.tr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,]11140014 -1 [2,]01141014 -1 [3,]11142014 -1 [4,]11143014 -1 [5,]11146015 -1 [6,]11146016 -1 [7,]11146017 -1 [8,]11146018 -1 How can I do to check columns 2,3,4,6,7 and 9 have the same value, and columns 1,5 and 8 have different values. Best, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.