[R] correlation between two 2D point patterns?
Suppose I have two sets of (x,y) points like this: x1-runif(n=10) y1-runif(n=10) A-cbind(x1,y1) x2-runif(n=10) y2-runif(n=10) B-cbind(x2,y2) I would like to measure how similar the two sets of points are. Something like a correlation coefficient, where 0 means the two patterns are unrelated, and 1 means they are identical. And in addition I'd like to be able to assign a p-value to the calculated statistic. cor(x1,x2) cor(y1,y2) gives two numbers instead of one. cor(A,B) gives a correlation matrix I have looked a little at spatial statistics. I have seen methods that, for each point, search in some neighbourhood around it and then compute the correlation as a function of search radius. That is not what I am looking for. I would like a single number that summarises the strength of the relationship between the two patterns. I will do procrustes on the two point sets first, so that if A is just a rotated, translated, scaled, reflected version of B the two patterns will superimpose and the statistic I'm looking for will say there is perfect correspondence. Thanks very much for any help in finding such a statistic and calculating it using R. Bill __ R-help@r-project.org 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] Stochastic (transition) matrices: how to determine distributions and variance?
(apologies for the cross-posting, and for this being a more general stats question rather than a specific-to-R one. I assure you I will be doing the actual analysis in R :) I am trying to determine the distribution and variance for a classic stochastic (transition) matrix problem such that: let x(t) be an initial state vector consisting of counts of classes A, B and C: x(t) = [A(t),B(t),C(t)] T is the stochastic (transition) matrix for these classes consisting of the transition probabilities between each combination of A,B and C: pAA pBA pCA T= pAB pBB pCB pAC pBC pCC By doing matrix multiplication of Tx(t) we can determine the *mean* counts of these classes at t+1 such that: x mean (t+1) = Tx(t) = [A mean (t+1),B mean (t+1),C mean (t+1)] What I want to know is what is a) what is the *distribution* of A(t+1),B(t+1) and C(t+1), and what is the variance around these mean values? Since pXY are stochastic probabilities, it seems that the distribution and variance should be calculable. Thanks! --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial Technologies and Remote Sensing (CSTARS) University of California, Davis One Shields Avenue The Barn, Room 250N Davis, CA 95616 Cell: 415-794-5043 AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307 __ R-help@r-project.org 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 help regarding NaN in sets package
Hi List! I had enquired about the above few days back and did not get an answer. So I am asking again. Thanks. I have built a program for fuzzy inference using the sets package. Though there are no errors after defuzzifying using gset_defuzzify() command, the output after using the centroid option is a NaN. What may be going wrong here? P.S: There are just 10 dependent factors and just five rules. All the membership function are Gaussian. Any help is appreciated. Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Please help regarding NaN in sets package
MSP Stat wrote: Hi List! I had enquired about the above few days back and did not get an answer. So I am asking again. Thanks. Perhaps you should read the posting guide at first (and each R-help message contains the footer): PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. It is also a good idea to sign messages with a name, we are quite reluctant to answer to robots. I have built a program for fuzzy inference using the sets package. Though there are no errors after defuzzifying using gset_defuzzify() command, the output after using the centroid option is a NaN. What may be going wrong here? If you had given reproducible code, I suspect some people would be volunteering to look at it, perhaps including the authors of those functions and the package maintainer who could also be asked (including the aforementioned relevant details, of course). Best, Uwe Ligges P.S: There are just 10 dependent factors and just five rules. All the membership function are Gaussian. Any help is appreciated. Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] POSIX time conversion doesn't display digit
R_help Help wrote: Hi, I have the following string that I converted to a POSIXct: a - 2009-08-24 10:00:00.213 a.p - strptime(a,%Y-%m-%d %H:%M:%OS) as.double(as.POSIXct(a.p)) [1] 1251122400 I can't seem to get the decimal fraction of .213 out by casting to double or numeric. Is there anyway to make sure that POSIXct spits that out? Thank you. It is in the object, just rounded when printed to the console, see: format(as.double(as.POSIXct(a.p)), digits=22) Best, Uwe Ligges adschai __ R-help@r-project.org 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@r-project.org 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] correlation between two 2D point patterns?
On Sun, 2009-08-30 at 07:51 +0100, William Simpson wrote: Suppose I have two sets of (x,y) points like this: x1-runif(n=10) y1-runif(n=10) A-cbind(x1,y1) x2-runif(n=10) y2-runif(n=10) B-cbind(x2,y2) I would like to measure how similar the two sets of points are. Something like a correlation coefficient, where 0 means the two patterns are unrelated, and 1 means they are identical. And in addition I'd like to be able to assign a p-value to the calculated statistic. cor(x1,x2) cor(y1,y2) gives two numbers instead of one. cor(A,B) gives a correlation matrix I have looked a little at spatial statistics. I have seen methods that, for each point, search in some neighbourhood around it and then compute the correlation as a function of search radius. That is not what I am looking for. I would like a single number that summarises the strength of the relationship between the two patterns. I will do procrustes on the two point sets first, so that if A is just a rotated, translated, scaled, reflected version of B the two patterns will superimpose and the statistic I'm looking for will say there is perfect correspondence. Thanks very much for any help in finding such a statistic and calculating it using R. Bill Hi Bill, If your 2 points set is similar I expect your Euclidean distance is 0, so I suggest this script: dist-sqrt((x1-x2)^2+(y1-y2)^2) # Euclidean distance t.test(dist) # test for mean equal 0 -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil __ R-help@r-project.org 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] Best R text editors?
Hi Jonathan, contributing to your poll: Also Emacs+ESS on Linux. Uli __ R-help@r-project.org 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] Best R text editors?
Hello, On 8/30/09, Uli Kleinwechter ulikleinwech...@yahoo.com.mx wrote: contributing to your poll: Also Emacs+ESS on Linux. Could someone give a brief and subjective overview of ESS. I notice that many people use it, and many describe it as the tool for the power user. As far as I'm concerned, I've once again looked at Emacs (after couple of years) and I still don't feel like using it for my editing purposes. Thank you Liviu __ R-help@r-project.org 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] need technique for speeding up R dataframe individual element insertion (no deletion though)
Bill, Jim One word. Thanks tons! :-) 2009/8/13 bill.venab...@csiro.au: Why do you need an explicit loop at all? (Also, your loop goes over i in 1:length(cam$end_date) but your code refers to cam$end_date[i+1] --||--!!) Here is a suggestion. You want to identify places where the date increases but the volume does not change. OK, where? ind - with(cam, { dx - as.numeric(diff(strptime(end_date, %d/%m/%Y))) dt - diff(vol) which(dx 0 dt == 0) }) Now adjust the new data frame cap - within(cam, { levels[ind] - 1 levels[ind+1] - 1 }) Of course this is untested code, so caveat emptor! Bill Venables. From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Ishwor [ishwor.gur...@gmail.com] Sent: 13 August 2009 22:07 To: r-help@r-project.org Subject: [R] need technique for speeding up R dataframe individual element insertion (no deletion though) Hi fellas, I am working on a dataframe cam and it involves comparison within the 2 columns - t1 and t2 on about 20K rows and 14 columns. ### cap = cam; # this doesn't take long. ~1 secs. for( i in 1:length(cam$end_date)) { x1=strptime(cam$end_date[i], %d/%m/%Y); x2=strptime(cam$end_date[i+1], %d/%m/%Y); t1= cam$vol[i]; t2= cam$vol[i+1]; if(!is.na(x2) !is.na(x1) !is.na(t1) !is.na(t2)) { if( (x2=x1) (t1==t2) ) # date and vol { cap$levels[i]=1; #make change to specific dataframe cell cap$levels[i+1]=1; } } } ### Having coded that, i ran a timing profile on this section and each 1000'th row comparison is taking ~1.1 minutes on a 2.8Ghz dual-core box (which is a test box we use). This obviously computes to ~21 minutes for 20k which is definitely not where we want it headed. I believe, optimisation(or even different way to address indexing inside dataframe) can be had inside the innermost `if' and specifically in `cap$levels[i]=1;' but I am a bit at a loss having scoured the documentation failing to find anything of value. So, my question remains are there any general/specific changes I can do to speed up the code execution dramatically? Thanks folks. -- Regards, Ishwor Gurung __ R-help@r-project.org 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. -- Regards, Ishwor Gurung __ R-help@r-project.org 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] POSIX time conversion doesn't display digit
Try this: options(digits = 20) as.double(as.POSIXct(a.p)) [1] 1251122400.213 On Sat, Aug 29, 2009 at 11:37 PM, R_help Helprhelp...@gmail.com wrote: Hi, I have the following string that I converted to a POSIXct: a - 2009-08-24 10:00:00.213 a.p - strptime(a,%Y-%m-%d %H:%M:%OS) as.double(as.POSIXct(a.p)) [1] 1251122400 I can't seem to get the decimal fraction of .213 out by casting to double or numeric. Is there anyway to make sure that POSIXct spits that out? Thank you. adschai __ R-help@r-project.org 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@r-project.org 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] Google's R Style Guide
hadley wickham wrote: Perhaps most of you have already seen this? http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html Comments/Critiques? I made my own version that reflects my personal biases: http://had.co.nz/stat405/resources/r-style-guide.html thanks for sharing, I'll check it out. Cheers, Esmail __ R-help@r-project.org 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] correlation between two 2D point patterns?
On Sun, Aug 30, 2009 at 10:46 AM, Bernardo Rangel Turat...@centroin.com.br wrote: On Sun, 2009-08-30 at 07:51 +0100, William Simpson wrote: Suppose I have two sets of (x,y) points like this: x1-runif(n=10) y1-runif(n=10) A-cbind(x1,y1) x2-runif(n=10) y2-runif(n=10) B-cbind(x2,y2) I would like to measure how similar the two sets of points are. Something like a correlation coefficient, where 0 means the two patterns are unrelated, and 1 means they are identical. And in addition I'd like to be able to assign a p-value to the calculated statistic. cor(x1,x2) cor(y1,y2) gives two numbers instead of one. cor(A,B) gives a correlation matrix I have looked a little at spatial statistics. I have seen methods that, for each point, search in some neighbourhood around it and then compute the correlation as a function of search radius. That is not what I am looking for. I would like a single number that summarises the strength of the relationship between the two patterns. I will do procrustes on the two point sets first, so that if A is just a rotated, translated, scaled, reflected version of B the two patterns will superimpose and the statistic I'm looking for will say there is perfect correspondence. Thanks very much for any help in finding such a statistic and calculating it using R. Bill Hi Bill, If your 2 points set is similar I expect your Euclidean distance is 0, so I suggest this script: dist-sqrt((x1-x2)^2+(y1-y2)^2) # Euclidean distance t.test(dist) # test for mean equal 0 I'm not sure what you'd do for two sets of points - compute the sum of all the distances from points in set 1 to the nearest point in set 2? That'll be zero for identical patterns, but also zero if you have superimposed points in set1 but not in set 2. If rotation and scale and translation are of interest to you then what you are doing is shape analysis. There's a package for that[1]. http://www.maths.nott.ac.uk/personal/ild/shapes/ Barry [1] Not quite as catchy as 'there's an app for that' __ R-help@r-project.org 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] Meaning of data set variables
Hi all, Does anybody know the meaning of the values 0 - 1, for each variable from data sex2 avaible from the package logistf? Thanks in advance. Best, Caio [[alternative HTML version deleted]] __ R-help@r-project.org 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] Meaning of data set variables
No need to repost the question. We read it. Have you looked at ?sex2 ? If that is not sufficient, have you looked into the cited reference? If that is also not sufficient, please ask the package maintainer. Uwe Ligges Caio Azevedo wrote: Hi all, Does anybody know the meaning of the values 0 - 1, for each variable from data sex2 avaible from the package logistf? Thanks in advance. Best, Caio [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] Bootstrap inference for the sample median?
Folks, I have this code fragment: set.seed(1001) x - c(0.79211363702017, 0.940536712079832, 0.859757602692931, 0.82529998629531, 0.973451006822, 0.92378802164835, 0.996679563355802, 0.943347739494445, 0.992873542980045, 0.870624707845108, 0.935917364493788) range(x) # from 0.79 to 0.996 e - function(x,d) { median(x[d]) } b - boot(x, e, R=1000) boot.ci(b) The 95% confidence interval, as seen with `Normal' and `Basic' calculations, has an upper bound of 1.0028 and 1.0121. How is this possible? If I sample with replacement from values which are all lower than 1, then any sample median of these bootstrap samples should be lower than 1. The upper cutoff of the 95% confidence interval should also be below 1. Is this a bug in the boot package? Or should I be using `Percentile' or `BCa' in this situation? -- Ajay Shah http://www.mayin.org/ajayshah ajays...@mayin.org http://ajayshahblog.blogspot.com *(:-? - wizard who doesn't know the answer. __ R-help@r-project.org 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] lrm in Design
Thank you for your reply, it helped. That thread is about glm, I take it that lrm behaves in the same way?!? See: https://stat.ethz.ch/pipermail/r-help/2009-July/204192.html and also other posts in that thread. -- View this message in context: http://www.nabble.com/lrm-in-Design-tp25206737p25209958.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Best R text editors?
Hello, I'm using PLD Linux and in my opinion, if you looking for very easy editor - Geany!!! It'll be fantastic ;) -- View this message in context: http://www.nabble.com/Best-R-text-editors--tp25178744p25210782.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] about isoMDS method
Hi, For example: I built a half matrix w using a daisy(x, metric = c(euclidean)) http://www.nabble.com/file/p25211016/1.jpg And next I transformed this matrix w using isoMDS function, for example isoMDS(w, k=2) and as result I got: http://www.nabble.com/file/p25211016/2.jpg And now I have a question: 1. If number in matrix w[2, 1] (= 0.41538462) match two points (below) in matrix created by isoMDS ? http://www.nabble.com/file/p25211016/3.jpg Is this the same point? -- View this message in context: http://www.nabble.com/about-isoMDS-method-tp25211016p25211016.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Best R text editors?
Uli Kleinwechter wrote: Hi Jonathan, contributing to your poll: Also Emacs+ESS on Linux. same here J __ R-help@r-project.org 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] version 1.5-1 of Rcmdr package released
Dear R users, There is a new version (1.5-1) of the Rcmdr package. Here, from the CHANGES files, are changes since the last minor version (1.4-0) was released a year ago: --- Version 1.4-1 o The following updated translations have been added: Catalan (thanks to Manel Salamero), French (thanks to Philippe Grojean), Japanese (thanks to Takaharu Araki), Romanian (thanks to Adrian Dusa), and Slovenian (thanks to Jaro.Lajovic). Version 1.4-2 o For cases where translated help files of the form Commander-xx.Rd won't compile (where xx is the language code), translators can now provide a PDF file named Commander-xx.pdf to be substituted when users select Menu - Commander help. (Thanks to Alexey Shipunov for helping me with this problem.) o Dialogs that reset the active data set no longer do so if an error occurs; previously, resetting the active data set caused error messages to scroll off out of sight in the Messages window (problem reported by Peter Dalgaard). o Improved error checking and protection in distributions dialogs. Version 1.4-3 o Fixed a bug in the scroll-bar for the RHS of model formulas (reported by Ulrich Halekoh). o Fixed problem with some legends in plotMeans() (reported by Rich Heiberger). o Updated Spanish translation (courtesy Rcmdr Spanish translation team). Version 1.4-4 o Small changes to Hist() to make it more flexible (suggested by Gilles Marcou). Version 1.4-5 o Change to Message(), which posts messages to the Message window, to prevent the window from freezing in (some) Windows systems under R 2.8.0 (problem reported by Rich Heiberger). o Updated Indonesian translation (thanks to I. Made Tirta). Version 1.4-6 o Added polr and multinom models to effect-plots, consistent with latest version of effects package. o ttkentry() redefined to trim leading and trailing blanks (to avoid potential problems when user introduces a leading or trailing blank in a text field, as reported by Rich Heiberger). o An attempt is made to break commands at blanks and commas to fit them in the script and output windows. o Improvements to the one-way and multi-way ANOVA dialogs, including saving the models that are produced (suggested by Rich Heiberger). o Improvements and bug fixes to handling of plug-in menu installation. o New function MacOSXP() to test for Mac OS X; used to suppress Data - New data set menu, since the Mac data editor causes R to hang when called with an empty data frame (reported by Rob Goedman and Tracy Lightcap). o When character values are entered in the data editor after Data - New data set, the corresponding variable is converted to a factor. o When console.output is TRUE, messages as well as output now go to the R Console and the Commander Messages window (as well as the Output window) is suppressed (with code contributed by Richard Heiberger). o Small changes. Version 1.4-7 o Improved Brazilian Portuguese translation, contributed by Adriano Azevedo-Filho and Marilia Sa Carvalho. o Added function sortVarNames(), which sorts variable names including numerals into a more natural order than does sort(); used in variable lists when the Rcmdr option sort.names is TRUE, which is the default. o Small changes. Version 1.4-8 o Export data set now allows an arbitrary field separator (suggested by Marilia Sa Carvalho). o Menus can now use translation files supplied by plug-ins. o Path names with apostrophes should no longer produce an unbalanced parentheses error. o Added files for Debian Linux (from Pietro Battiston and Dirk Eddelbuettel). o Small changes. Version 1.4-9 o Upated Russian translation (courtesy of Alexey Shipunov). o Fixed bug in BreuschPaganTest() that prevented dialog from functioning (reported by Michel Pouchain). Version 1.4-10 o Corrected problem in paste in Command window in non-Windows systems (reported by Liviu Andronic). o Fixed handling of X11 warnings which was disrupted by showData(), and added check for Warning in structure (problems reported by Liviu Andronic). o Prefixes used when output is directed to the R console are no longer hard-coded, but can be set by the prefixes Rcmdr option (to satisfy a request by Liviu Andronic). Version 1.4-11 o Correction to .mo file for Brazilian Portuguese translation (supplied by Adriano Azevedo-Filho following report by Donald Pianto). o Added summary() output to principal components (suggested by Liviu Andronic). Version 1.5-0 o Added model-selection dialogs, stepwise and subset (several requests). o Modifications to model-definition dialogs (suggested by Ulrike Gromping): If you select several variables in the variable-list box, clicking on the +, *, or : button will enter them
Re: [R] Best R text editors?
On 8/30/09, Grzes gregori...@gmail.com wrote: I'm using PLD Linux and in my opinion, if you looking for very easy editor - Geany!!! It'll be fantastic ;) Yeah, Geany is very simple and comfortable. But there is no direct link to R, and not being able to evaluate code on the fly is a show-stopper for me. Liviu __ R-help@r-project.org 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] Change the Order of a Cluster Topology
Hi list, recently, for didactic reasons, I had the need to change a cluster topology (just the order of my groups, defined in an height of choice), not the results, obviously. Well Im looking at hclust or agnes (cluster package) objects for something that defines the line breakings of the graphics, so I could try something to change this plot ordering. But, Im unable to figure that out. Is there a way to do so? Here is an example code: Spp-matrix(rnorm(1:750,mean=10,sd=2),ncol=15,nrow=50,list(c(paste('Spp',1:5 0,sep='')),c(paste('C',1:15,sep=''))),byrow=T) Ward-hclust(dist(Spp),method='ward') plot(Ward) Lets suppose I want to change the order of the groups formed at the height of 20 (Obviously, only where its possible, without altering the greater groups composition). Is it possible? - MSc. mailto:r.alui...@gmail.com Rodrigo Aluizio Centro de Estudos do Mar/UFPR Laboratório de Micropaleontologia Avenida Beira Mar s/n - CEP 83255-000 Pontal do Paraná - PR - Brasil [[alternative HTML version deleted]] __ R-help@r-project.org 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] Best R text editors?
Well, on Linux = Emacs+ Ess On Windows = Tinn-R - MSc. Rodrigo Aluizio Centro de Estudos do Mar/UFPR Laboratório de Micropaleontologia __ R-help@r-project.org 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] RConsole processing crashes Rgui.exe
Using R 2.9.2 on Windows XP SP3. 1. Edit ~/Rconsole, and set font = TT Bitstream Vera Sans Mono 2. Start Rgui.exe 3. Go to Edit, GUI Preferfences 4. Rgui.exe crashes Rgui.exe does not crash if I do not access GUI Preferences (i.e., if I just use R), and it does correctly use Bitstream Vera Sans Mono as my font. Nor does it crash if I edit RConsole to set the font back to Lucida Console and then try to access GUI Preferences. __ R-help@r-project.org 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] correlation between two 2D point patterns?
Bill, prod( cancor( A,B )$cor ) perhaps? Note that this accounts for linear transformations. HTH, Chuck On Sun, 30 Aug 2009, William Simpson wrote: Suppose I have two sets of (x,y) points like this: x1-runif(n=10) y1-runif(n=10) A-cbind(x1,y1) x2-runif(n=10) y2-runif(n=10) B-cbind(x2,y2) I would like to measure how similar the two sets of points are. Something like a correlation coefficient, where 0 means the two patterns are unrelated, and 1 means they are identical. And in addition I'd like to be able to assign a p-value to the calculated statistic. cor(x1,x2) cor(y1,y2) gives two numbers instead of one. cor(A,B) gives a correlation matrix I have looked a little at spatial statistics. I have seen methods that, for each point, search in some neighbourhood around it and then compute the correlation as a function of search radius. That is not what I am looking for. I would like a single number that summarises the strength of the relationship between the two patterns. I will do procrustes on the two point sets first, so that if A is just a rotated, translated, scaled, reflected version of B the two patterns will superimpose and the statistic I'm looking for will say there is perfect correspondence. Thanks very much for any help in finding such a statistic and calculating it using R. Bill __ R-help@r-project.org 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. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-help@r-project.org 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] RFE: vectorize URLdecode
Gabor Grothendieck ggrothendieck at gmail.com writes: URLdecode.vec - Vectorize(URLdecode) On Sat, Aug 29, 2009 at 10:31 AM, Jack Tannerihok at hotmail.com wrote: Could URLdecode be modified to actually process all elements of the vector, not just the first? Sure, that's a fine workaround. But is this a legitimate RFE? Should I file a bug? It seems like the warning itself is coming from charToRaw(), but the rest of URLdecode() might need an upgrade to deal with a charToRaw that processes all the elements in the vector. __ R-help@r-project.org 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] about isoMDS method
Are you using euclidean distances? On Sun, Aug 30, 2009 at 7:33 AM, Grzesgregori...@gmail.com wrote: Hi, For example: I built a half matrix w using a daisy(x, metric = c(euclidean)) http://www.nabble.com/file/p25211016/1.jpg And next I transformed this matrix w using isoMDS function, for example isoMDS(w, k=2) and as result I got: http://www.nabble.com/file/p25211016/2.jpg And now I have two questions: 1. If number in matrix w[2, 1] (= 0.41538462) match two points (below) in matrix created by isoMDS [1,1:2] and [2,1:2] ? http://www.nabble.com/file/p25211016/3.jpg Is this the same point? 2. If it's true why I can't check my euclidean distance by using this equation: d- ((0.511396296-(-0.129372871))^2+((-0.0171714934)-(-0.2759703494))^2)^(1/2) I thought that d should be 0.41538462 but unfortunately I get d=0.6910586. Why? -- View this message in context: http://www.nabble.com/about-isoMDS-method-tp25211016p25211016.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ R-help@r-project.org 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] abline does not show on plot if slope differs from 0
Hi, Does anybody have a hint why this does not work? plot(c(1991,2000), c(-1,10))abline(a=6, b=-1, col=dark grey, lty=dashed) It does not generate an error message, but the line does not turn up. If b=0 it works fine. If I change the axes of the plot to plot(c(1,10), c(-1,10)) it does work fine as well. Thanks, Gabor -- Pozsgai Gábor www.coleoptera.hu www.photogabor.com __ R-help@r-project.org 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] lrm in Design
Presumably the same idea would apply to lrm if appropriately adapted. On Sun, Aug 30, 2009 at 5:19 AM, loch1l...@gmx.li wrote: Thank you for your reply, it helped. That thread is about glm, I take it that lrm behaves in the same way?!? See: https://stat.ethz.ch/pipermail/r-help/2009-July/204192.html and also other posts in that thread. -- View this message in context: http://www.nabble.com/lrm-in-Design-tp25206737p25209958.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] abline does not show on plot if slope differs from 0
Very simple, look at the x-axis you are plotting with. If you want the line, then use: abline(a=1996, b=-1, col=dark grey, lty=dashed) On Sun, Aug 30, 2009 at 12:25 PM, Gábor Pozsgaipozsg...@gmail.com wrote: Hi, Does anybody have a hint why this does not work? plot(c(1991,2000), c(-1,10))abline(a=6, b=-1, col=dark grey, lty=dashed) It does not generate an error message, but the line does not turn up. If b=0 it works fine. If I change the axes of the plot to plot(c(1,10), c(-1,10)) it does work fine as well. Thanks, Gabor -- Pozsgai Gábor www.coleoptera.hu www.photogabor.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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] abline does not show on plot if slope differs from 0
The intercept, a, is the value when x = 0. Thus if you want y = 6 when x = 1991 then the line is y = 6 - (x-1991) = 1997 - x so a = 1997: abline(a=1997, b=-1, col=dark grey, lty=dashed) On Sun, Aug 30, 2009 at 12:25 PM, Gábor Pozsgaipozsg...@gmail.com wrote: Hi, Does anybody have a hint why this does not work? plot(c(1991,2000), c(-1,10))abline(a=6, b=-1, col=dark grey, lty=dashed) It does not generate an error message, but the line does not turn up. If b=0 it works fine. If I change the axes of the plot to plot(c(1,10), c(-1,10)) it does work fine as well. Thanks, Gabor -- Pozsgai Gábor www.coleoptera.hu www.photogabor.com __ R-help@r-project.org 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@r-project.org 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] RConsole processing crashes Rgui.exe
On 30/08/2009 11:40 AM, Jack Tanner wrote: Using R 2.9.2 on Windows XP SP3. 1. Edit ~/Rconsole, and set font = TT Bitstream Vera Sans Mono 2. Start Rgui.exe 3. Go to Edit, GUI Preferfences 4. Rgui.exe crashes Rgui.exe does not crash if I do not access GUI Preferences (i.e., if I just use R), and it does correctly use Bitstream Vera Sans Mono as my font. Nor does it crash if I edit RConsole to set the font back to Lucida Console and then try to access GUI Preferences. Thanks for the report. I can reproduce that; I'll see if I can figure out what's going wrong. Duncan Murdoch __ R-help@r-project.org 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] standard error associated with correlation coefficient
Here are some options for confidence intervals. #by hand sample_r - .5 n_sample - 100 df - n_sample-1 fisher_z - 0.5*(log(1+sample_r)-log(1-sample_r)) se_z - 1/sqrt(n_sample-3) t_crit - qt(.975,df ,lower.tail=TRUE) z_lci - fisher_z - (t_crit * se_z) z_uci - fisher_z + (t_crit * se_z) (r_lci - tanh(z_lci)) (r_uci - tanh(z_uci)) # Compare to the CIr function in psychometric library #that uses standard normal instead of t library(psychometric) CIr(sample_r,n_sample) And see http://www.stat.umn.edu/geyer/5601/examp/bse.html for bootstrap options. On Thu, Aug 27, 2009 at 3:03 PM, Donald Braman dbra...@law.gwu.edu wrote: I want the standard error associated with a correlation. I can calculate using cor var, but am wondering if there are libraries that already provide this function. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Best R text editors?
emacs + ess in windows is just as powerful as in linux. emacs is the only programming editor i would ever need. On Sun, Aug 30, 2009 at 11:37 AM, Rodrigo Aluizio r.alui...@gmail.comwrote: Well, on Linux = Emacs+ Ess On Windows = Tinn-R - MSc. Rodrigo Aluizio Centro de Estudos do Mar/UFPR Laboratório de Micropaleontologia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- == WenSui Liu Blog : statcompute.spaces.live.com Tough Times Never Last. But Tough People Do. - Robert Schuller == [[alternative HTML version deleted]] __ R-help@r-project.org 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] Re moving the numbers of the X/Y axis
Hi all, Suppose I have some data that I plot using the histogram command - ie. hist(x) Is there an option that will allow me to remove the numbers that appear along the X and Y axis as I'm just interested in the overall distribution of the data and not the actual values? Anyways, any help is greatly appreciated! -- View this message in context: http://www.nabble.com/Removing-the-numbers-of-the-X-Y-axis-tp25214292p25214292.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Re moving the numbers of the X/Y axis
Hi njhuang86, Something like this? x - rnorm(100) hist(x, axes = FALSE) HTH, Jorge On Sun, Aug 30, 2009 at 2:30 PM, njhuang86 njhuan...@yahoo.com wrote: Hi all, Suppose I have some data that I plot using the histogram command - ie. hist(x) Is there an option that will allow me to remove the numbers that appear along the X and Y axis as I'm just interested in the overall distribution of the data and not the actual values? Anyways, any help is greatly appreciated! -- View this message in context: http://www.nabble.com/Removing-the-numbers-of-the-X-Y-axis-tp25214292p25214292.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] Complexity parameter in rpart
Hi all, I'm currently using the 'rpart' function to run some regression analysis and I am at the point where I wish to prune my overfitted trees. Having read the documentation I understand that to do this requires the use of the complexity parameter. My question is how to go about choosing the correct complexity parameter for my tree? In some places (http://www.statmethods.net/advstats/cart.html) I have read that it is best to select the complexity parameter which minimises the cross-validated (x) error of the model, but elsewhere I have read that the optimum cp is the first value on the left above the '1+SE' line of the complexity paramter plot. I was hoping someone might be able to clarify this minor issue for me. Many thanks, Andy _ Save time by using Hotmail to access your other email accounts. [[alternative HTML version deleted]] __ R-help@r-project.org 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] about isoMDS method
Yes, I'm using euclidean distances -- View this message in context: http://www.nabble.com/about-isoMDS-method-tp25211016p25213217.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Bootstrap inference for the sample median?
Le dimanche 30 août 2009 à 18:43 +0530, Ajay Shah a écrit : Folks, I have this code fragment: set.seed(1001) x - c(0.79211363702017, 0.940536712079832, 0.859757602692931, 0.82529998629531, 0.973451006822, 0.92378802164835, 0.996679563355802, 0.943347739494445, 0.992873542980045, 0.870624707845108, 0.935917364493788) range(x) # from 0.79 to 0.996 e - function(x,d) { median(x[d]) } b - boot(x, e, R=1000) boot.ci(b) The 95% confidence interval, as seen with `Normal' and `Basic' calculations, has an upper bound of 1.0028 and 1.0121. How is this possible? If I sample with replacement from values which are all lower than 1, then any sample median of these bootstrap samples should be lower than 1. The upper cutoff of the 95% confidence interval should also be below 1. Nope. Normal and Basic try to adjust (some form of) normal distribution to the sample of your statistic. But the median of such a small sample is quite far from a normal (hint : it is a discrete distribution with only very few possible values, at most as many value as the sample. Exercise : derive the distribution of median(x)...). To convince yourself, look at the histogram of the bootstrap distribution of median(x). Contrast with the bootstrap distribution of mean(x). Meditate. Conclude... HTH, Emmanuel Charpentier __ R-help@r-project.org 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] Computer Modern Fonts in R graphic
Hello all, I am trying to use computer modern fonts in my r grahics. I tried to do, as described here: http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html but unfortunately, it does not work. First of all I downloaded the cm-lgc package and the AFM and PFB-files from the page and put them in my R working directory, so far, so good. Then I tried to run the following code: sn - seq(1,7,length=100) sm - seq(0,4,length=100) f - function(x,y) {5.64080973 + 0.12271038*x - 0.27725481 * y + 0.29281216*x*y} z - outer(sn,sm,f) nrz - nrow(z) ncz - ncol(z) jet.colors - colorRampPalette( c(yellow, red) ) nbcol - 100 color - jet.colors(nbcol) zfacet - z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz] facetcol - cut(zfacet, nbcol) CM - Type1Font(CM, c(cm-lgc/fonts/afm/public/cm-lgc/fcmr8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmb8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmri8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmbi8a.afm, cmsyase.afm)) postscriptFonts(CM=CM) pdf(snxsm.pdf) par(family=CM) persp(sn,sm,z,xlab=SN, ylab=SM,zlab=VI,theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol]) dev.off() It works fine, until the persp() function, there I get: persp(sn,sm,z,xlab=SN, ylab=SM,zlab=VI,theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol]) Error in persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : Invalid font type In addition: Warning messages: 1: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 2: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 3: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 4: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 5: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database Any help is appreciated! Also a hint/link how to install the CM fonts under R for general use, so that I don't have to have it in my wd all the time. Thank you very much! Greetings, Friedericksen __ R-help@r-project.org 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] Computer Modern Fonts in R graphic
Hi Friedericksen Hope wrote: Hello all, I am trying to use computer modern fonts in my r grahics. I tried to do, as described here: http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html but unfortunately, it does not work. First of all I downloaded the cm-lgc package and the AFM and PFB-files from the page and put them in my R working directory, so far, so good. Then I tried to run the following code: sn - seq(1,7,length=100) sm - seq(0,4,length=100) f - function(x,y) {5.64080973 + 0.12271038*x - 0.27725481 * y + 0.29281216*x*y} z - outer(sn,sm,f) nrz - nrow(z) ncz - ncol(z) jet.colors - colorRampPalette( c(yellow, red) ) nbcol - 100 color - jet.colors(nbcol) zfacet - z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz] facetcol - cut(zfacet, nbcol) CM - Type1Font(CM, c(cm-lgc/fonts/afm/public/cm-lgc/fcmr8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmb8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmri8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmbi8a.afm, cmsyase.afm)) postscriptFonts(CM=CM) pdf(snxsm.pdf) par(family=CM) persp(sn,sm,z,xlab=SN, ylab=SM,zlab=VI,theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol]) dev.off() It works fine, until the persp() function, there I get: persp(sn,sm,z,xlab=SN, ylab=SM,zlab=VI,theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol]) Error in persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : Invalid font type In addition: Warning messages: 1: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 2: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 3: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 4: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 5: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database Looks like you are trying to produce PDF output, but you've set up the fonts in the PostScript font database. Try using pdfFonts() instead. Any help is appreciated! Also a hint/link how to install the CM fonts under R for general use, so that I don't have to have it in my wd all the time. The cm-lgc package should have instructions for installing the fonts on your system (e.g., http://www.ctan.org/tex-archive/fonts/ps-type1/cm-lgc/INSTALL) but you would then need to adjust the paths that you specify in the call to Type1Font(). You could then add the calls to Type1Font() and pdfFonts() to your .Rprofile so that this font is defined every time you start an R session (see ?Startup). Paul Thank you very much! Greetings, Friedericksen __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 p...@stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/ __ R-help@r-project.org 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] error with summary(vector)??
Hello, I get summary(E) level nodesave_nodestime Min. : 1 Min. :1.00 Min. : 10.71 Min. : 0. 1st Qu.: 237414 1st Qu.:2.00 1st Qu.: 19.70 1st Qu.: 0.0100 Median : 749229 Median :3.00 Median : 27.01 Median : 0.0100 Mean : 767902 Mean : 49.85 Mean : 98.89 Mean : 0.2296 3rd Qu.:288 3rd Qu.:7.00 3rd Qu.: 80.38 3rd Qu.: 0.0300 Max. :2097152 Max. :70632.00 Max. :4451.67 Max. :338.9200 ave_time singlesautarkies depthave_reductions Min. : 0.0490 Min. :0 Min. :0 Min. :33 Min. : 0.20 1st Qu.: 0.0910 1st Qu.:0 1st Qu.:0 1st Qu.:52 1st Qu.: 7.50 Median : 0.1270 Median :0 Median :0 Median :52 Median : 9.92 Mean : 0.4636 Mean :0 Mean :0 Mean :52 Mean :11.76 3rd Qu.: 0.3860 3rd Qu.:0 3rd Qu.:0 3rd Qu.:52 3rd Qu.:13.46 Max. :16.2720 Max. :0 Max. :0 Max. :52 Max. :70.00 summary(E$nodes) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.00 2.00 3.0049.85 7.00 70630.00 The max-value for E$nodes is incorrect --- it it 70632, as computed by summary(E) ?? Oliver __ R-help@r-project.org 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] test for bimodalityIn-Reply-To=
Has a test for bimodality been implemented in R? Thanks, John NIWA is the trading name of the National Institute of Water Atmospheric Research Ltd. __ R-help@r-project.org 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 with summary(vector)??
On 30/08/2009 5:39 PM, Oliver Kullmann wrote: Hello, I get summary(E) level nodesave_nodestime Min. : 1 Min. :1.00 Min. : 10.71 Min. : 0. 1st Qu.: 237414 1st Qu.:2.00 1st Qu.: 19.70 1st Qu.: 0.0100 Median : 749229 Median :3.00 Median : 27.01 Median : 0.0100 Mean : 767902 Mean : 49.85 Mean : 98.89 Mean : 0.2296 3rd Qu.:288 3rd Qu.:7.00 3rd Qu.: 80.38 3rd Qu.: 0.0300 Max. :2097152 Max. :70632.00 Max. :4451.67 Max. :338.9200 ave_time singlesautarkies depthave_reductions Min. : 0.0490 Min. :0 Min. :0 Min. :33 Min. : 0.20 1st Qu.: 0.0910 1st Qu.:0 1st Qu.:0 1st Qu.:52 1st Qu.: 7.50 Median : 0.1270 Median :0 Median :0 Median :52 Median : 9.92 Mean : 0.4636 Mean :0 Mean :0 Mean :52 Mean :11.76 3rd Qu.: 0.3860 3rd Qu.:0 3rd Qu.:0 3rd Qu.:52 3rd Qu.:13.46 Max. :16.2720 Max. :0 Max. :0 Max. :52 Max. :70.00 summary(E$nodes) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.00 2.00 3.0049.85 7.00 70630.00 The max-value for E$nodes is incorrect --- it it 70632, as computed by summary(E) ?? Read ?summary. The digits parameter is handled differently in your two cases: format(c(49.85, 70632), digits=4) [1]49.85 70632.00 signif(c(49.85, 70632), digits=4) [1]49.85 70630.00 Duncan Murdoch __ R-help@r-project.org 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] RConsole processing crashes Rgui.exe
On 30/08/2009 11:40 AM, Jack Tanner wrote: Using R 2.9.2 on Windows XP SP3. 1. Edit ~/Rconsole, and set font = TT Bitstream Vera Sans Mono 2. Start Rgui.exe 3. Go to Edit, GUI Preferfences 4. Rgui.exe crashes Rgui.exe does not crash if I do not access GUI Preferences (i.e., if I just use R), and it does correctly use Bitstream Vera Sans Mono as my font. Nor does it crash if I edit RConsole to set the font back to Lucida Console and then try to access GUI Preferences. I've found the bug, and a partial fix will appear in R-devel and R-patched shortly. The problem is that the dialog assumed you're using one of the fonts in its list, and the Bitstream font isn't there. If you'd like to edit the code to allow a more general font selection (any fixed width font on your system would make sense) I'd consider a patch, but I don't have time to do that. All I've done is allow you to type in any valid font name, or put it into Rconsole, which is more or less equivalent. A problem with my partial fix is that the sample text doesn't get updated after you change fonts: because of limitations in the ancient GUI toolkit we use, there are no notifications sent when you select a font other than by choosing from the predefined list. The whole thing needs rewriting (and has for years), but that's certainly not something I'm planning to take on. Duncan Murdoch __ R-help@r-project.org 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] Sapply
Hi, I need a bit of guidance with the sapply function. I've read the help page, but am still a bit unsure how to use it. I have a large data frame with about 100 columns and 30,000 rows. One of the columns is group of which there are about 2,000 distinct groups. I want to normalize (sum to 1) one of my variables per-group. Normally, I would just write a huge for each loop, but have read that is hugely inefficient with R. The old way would be (just an example, syntax might not be perfect): for (group in data$group){ for (score in data[data$group == group]){ new_score - score / sum(data$score[data$group==group]) } } How would I simplify this with sapply? Thanks! -- Noah __ R-help@r-project.org 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] SVM coefficients
Hello, I'm using the svm function from the e1071 package. It works well and gives me nice results. I'm very curious to see the actual coefficients calculated for each input variable. (Other packages, like RapidMiner, show you this automatically.) I've tried looking at attributes for the model and do see a coefficients item, but printing it returns an NULL result. Can someone point me in the right direction? Thanks -- Noah __ R-help@r-project.org 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] test for bimodality
On 31/08/2009, at 9:40 AM, John Sansom wrote: Has a test for bimodality been implemented in R? Doing RSiteSearch(test for bimodality) yields one hit, which points to http://finzi.psych.upenn.edu/Rhelp08/2008-September/173308.html It looks like it might be *some* help to you. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org 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] about isoMDS method
On Sun, 2009-08-30 at 09:40 -0700, Grzes wrote: Yes, I'm using euclidean distances Sorry I deleted the original. Here a some responses; First, to be concrete, here is a reproducible example... set.seed(123) D - data.frame(matrix(rnorm(100), ncol = 10)) Dij - dist(D) require(MASS) Dnmds - isoMDS(Dij, k = 2) Now look at structure of Dnmds: str(Dnmds) List of 2 $ points: num [1:10, 1:2] -0.356 1.058 -2.114 -0.177 0.575 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : NULL $ stress: num 12.2 The second matrix you talk about is component $points of the object returned by isoMDS. 1) The rows of $points pertain to your n samples. In the example I give, there are 10 rows as we have ten samples. Row 1 is the location of sample 1 in the 2d nMDS solution. Likewise for Row 2. 2) Why do you think that? nMDS aims to preserve the rank correlation of dissimilarities, not of the actual dissimilarities. You are also working with a 2D solution of the nMDS fit to your full dissimilarity matrix. There will be some level of approximation going on. You can look at how the well dissimilarities in the nMDS solution reflect the original distances using function Shepard: ## continuing from the above S - Shepard(Dij, Dnmds$points) plot(S) lines(yf ~ x, data = S, type = S, col = blue, lwd = 2) You can also compute some measures to help understand how well the nMDS distances reflect the original distances. ## Note, these are taken from function stressplot in the vegan package ## written by Jari Oksanen, which uses isoMDS from package MASS ## internally. ## you might want to look at metaMDSiter() in that package to do random ## starts to check you haven't converged to a sub-optimal local solution (stress - sum((S$y - S$yf)^2) / sum(S$y^2)) ## intermediate calc (rstress - 1 - stress) ## non-metric fit, R^2 (ralscal - cor(S$y, S$yf)^2) ## Linear fit, R2 (stress - sqrt(stress) * 100) ## compare with Dnmds$stress ## statistic minimised in nMDS algorithm In this example, the stress is quite low, hence quite a good fit. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@r-project.org 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] Combining: R + Condor in 2009 ? (+foreach maybe?)
Hello dear R-help group (and David Smith from REvolution), I would like to perform parallel computing using R with Condor (hopefully using foreach or other recommended solutions, if available) for some Embarrassingly parallel problem. I will start by listing what I found so far, and then go on asking for help. So far I found the a manual by Xianhong Xie from Rnews_2005-2 (see page 13) Talking about R and condor: http://cran.r-project.org/doc/Rnews/Rnews_2005-2.pdf I also found several references for R and condor in the task views of High Performance Computinghttp://cran.r-project.org/web/views/HighPerformanceComputing.html : http://cran.r-project.org/web/views/HighPerformanceComputing.html Stating that: The GridRhttp://cran.r-project.org/web/packages/GridR/index.html package by Wegener et al. can be used in a grid computing environment via a web service, via ssh or via Condor or Globus. I then found a 2008 lecture slides on the subject here: http://www.statistik.uni-dortmund.de/useR-2008/tutorials/GridR.pdf And an articles showing it was already done: http://www.ecmlpkdd2008.org/files/pdf/workshops/ubiqkd/3.pdf (But without code examples to my dismay) What I wish from you is some guidance. Is there a more updated (formal) material on condor and R then Xianhong Xie article from 2005? Is GridR a good way of making the connection? Is using the foreach package relevant or useful here? I am not a UNIX person. I never ran R in batch, and any step by step instructions (either by referring to links or explaining here) would be of great help. Thanks in advance, Tal -- My contact information: Tal Galili Phone number: 972-50-3373767 FaceBook: Tal Galili My Blogs: http://www.r-statistics.com/ http://www.talgalili.com http://www.biostatistics.co.il [[alternative HTML version deleted]] __ R-help@r-project.org 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] Sapply
Try this: data$score - ave(data$score, data$group, FUN = prop.table) On Sun, Aug 30, 2009 at 6:08 PM, Noah Silvermann...@smartmediacorp.com wrote: Hi, I need a bit of guidance with the sapply function. I've read the help page, but am still a bit unsure how to use it. I have a large data frame with about 100 columns and 30,000 rows. One of the columns is group of which there are about 2,000 distinct groups. I want to normalize (sum to 1) one of my variables per-group. Normally, I would just write a huge for each loop, but have read that is hugely inefficient with R. The old way would be (just an example, syntax might not be perfect): for (group in data$group){ for (score in data[data$group == group]){ new_score - score / sum(data$score[data$group==group]) } } How would I simplify this with sapply? Thanks! -- Noah __ R-help@r-project.org 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@r-project.org 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] Sapply
On 30/08/2009 6:08 PM, Noah Silverman wrote: Hi, I need a bit of guidance with the sapply function. I've read the help page, but am still a bit unsure how to use it. I have a large data frame with about 100 columns and 30,000 rows. One of the columns is group of which there are about 2,000 distinct groups. I want to normalize (sum to 1) one of my variables per-group. Normally, I would just write a huge for each loop, but have read that is hugely inefficient with R. Don't believe what you read, try it. If the for loop takes 100 times longer than the fastest method, but it still only takes 10 seconds, is it worth optimizing? Duncan Murdoch The old way would be (just an example, syntax might not be perfect): for (group in data$group){ for (score in data[data$group == group]){ new_score - score / sum(data$score[data$group==group]) } } How would I simplify this with sapply? Thanks! -- Noah __ R-help@r-project.org 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@r-project.org 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] Trying to rename spatial pts data frame slot that isn't a slot()
Dear List, I am analyzing the home range area of fish and seem to have lost the individuals ID names during my manipulations, and can't find out how to rename them. I calculated the MCP of the fish using mcp() in Adehabitat. MCP's were converted to spatial points data frame and exported to qGIS for manipulations. At this point the ID names were lost. I brought the manipulated shapefiles back into qGIS, but can't figure out how to rename the individuals. #Calculate MCP and save as a shapefile my.mcp-mcp(xy, id=id, percent=100) spol-area2spol(my.mcp) spdf - SpatialPolygonsDataFrame(spol, data=data.frame +(getSpPPolygonsLabptSlots(spol), +row.names=getSpPPolygonsIDSlots(spol)), match.ID = TRUE) writeOGR(spdf,dsn=mcp.dir,layer=All Mantas MCP, driver=ESRI +Shapefile) #Read shapefile manipulated in qGIS mymcp-readOGR(dsn=mcp.dir,layer=All mantas MCP land differenc) My spatial points data frame has a number of Slots, including one that contained the original names called Slot ID. However, I can not access this slot using slot() or slotNames(). slotNames(mymcp) [1] datapolygonsplotOrder bbox proj4string What am I missing here? Is Slot ID not a slot? Can I export the ID's with the shapefiles to qGIS? Can I rename the ID's when I bring them back into R? When is a slot not a slot()? Thanks, TIm Tim Clark Department of Zoology University of Hawaii __ R-help@r-project.org 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] test for bimodality
Dear John, you may check dip in package diptest, which tests unimodality vs. multimuodality (you'll need qDiptab for that, too). Apologies if this misses the point; I only saw the last responses but not the original question so this may not be what you are after, or already mentioned, but I decided that I risk making a fool of myself for a small chance that it helps you. Cheers, Christian On Mon, 31 Aug 2009, Rolf Turner wrote: On 31/08/2009, at 9:40 AM, John Sansom wrote: Has a test for bimodality been implemented in R? Doing RSiteSearch(test for bimodality) yields one hit, which points to http://finzi.psych.upenn.edu/Rhelp08/2008-September/173308.html It looks like it might be *some* help to you. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org 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. *** --- *** Christian Hennig University College London, Department of Statistical Science Gower St., London WC1E 6BT, phone +44 207 679 1698 chr...@stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche __ R-help@r-project.org 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] CRAN (and crantastic) updates this week
CRAN (and crantastic) updates this week New packages Updated packages New reviews --- This email provided as a service for the R community by http://crantastic.org. Like it? Hate it? Please let us know: crana...@gmail.com. __ R-help@r-project.org 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] Sapply
On Sun, Aug 30, 2009 at 5:08 PM, Noah Silvermann...@smartmediacorp.com wrote: Hi, I need a bit of guidance with the sapply function. I've read the help page, but am still a bit unsure how to use it. I have a large data frame with about 100 columns and 30,000 rows. One of the columns is group of which there are about 2,000 distinct groups. I want to normalize (sum to 1) one of my variables per-group. Normally, I would just write a huge for each loop, but have read that is hugely inefficient with R. The old way would be (just an example, syntax might not be perfect): for (group in data$group){ for (score in data[data$group == group]){ new_score - score / sum(data$score[data$group==group]) } } It might be easier to use ddply from the plyr package. The command you want would be: data - ddply(data, group, transform, score = score / sum(score)) More information at http://had.co.nz/plyr. Hadley -- http://had.co.nz/ __ R-help@r-project.org 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] Aggregating irregular time series
Hi, I have a couple of aggregation operations that I don't know how to accomplish. Let me give an example. I have the following irregular time series time x 10:00:00.021 20 10:00:00.224 20 10:00:01.002 19 10:00:02:948 20 1) For each entry time, I'd like to get sum of x for the next 2 seconds (excluding itself). Using the above example, the output should be time sumx 10:00:00.021 39 10:00:00.224 19 10:00:01.442 20 10:00:02:948 0 2) For each i-th of x in the series, what's the first passage time to x[i]-1. I.e. the output should be time firstPassgeTime 10:00:00.021 0.981 10:00:00.224 0.778 10:00:01.442 NA 10:00:02:948 NA Is there any shortcut function that allows me to do the above? Thank you. adschai __ R-help@r-project.org 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] SVM coefficients
Hi, On Sun, Aug 30, 2009 at 6:10 PM, Noah Silvermann...@smartmediacorp.com wrote: Hello, I'm using the svm function from the e1071 package. It works well and gives me nice results. I'm very curious to see the actual coefficients calculated for each input variable. (Other packages, like RapidMiner, show you this automatically.) I've tried looking at attributes for the model and do see a coefficients item, but printing it returns an NULL result. Hmm .. I don't see a coefficients attribute, but rather a coefs attribute, which I guess is what you're looking for (?) Run example(svm) to its end and type: R m$coefs [,1] [1,] 1.00884130 [2,] 1.27446460 [3,] 2. [4,] -1. [5,] -0.35480340 [6,] -0.74043692 [7,] -0.87635311 [8,] -0.04857869 [9,] -0.03721980 [10,] -0.64696793 [11,] -0.57894605 HTH, -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [R-SIG-Finance] Aggregating irregular time series
Try this for the first question: neighborapply - function(z, width, FUN) { out - z ix - seq_along(z) jx - findInterval(time(z) + width, time(z)) out[] - mapply(function(i, j) FUN(c(0, z[seq(i+1, length = j-i)])), ix, jx) out } # test - corrected :948 in last line library(zoo) library(chron) Lines - Time x 10:00:00.02120 10:00:00.22420 10:00:01.00219 10:00:02.94820 z - read.zoo(textConnection(Lines), header = TRUE, FUN = times) neighborapply(z, times(00:00:02), sum) # and here is an alternative neighborapply # using loops. The non-loop solution does # have the disadvantage that it does as # readily extend to other situations which # is why we add this second solution to # the first question. neighborapply - function(z, width, FUN) { out - z tt - time(z) for(i in seq_along(tt)) { for(j in seq_along(tt)) { if (tt[j] - tt[i] width) break } if (j == length(tt) tt[j] - tt[i] = width) j - j+1 out[i] - FUN(c(0, z[seq(i+1, length = j-i-1)])) } out } The second question can be answered along the lines of the first by modifying neighborapply in the loop solution appropriately. On Sun, Aug 30, 2009 at 9:38 PM, R_help Helprhelp...@gmail.com wrote: Hi, I have a couple of aggregation operations that I don't know how to accomplish. Let me give an example. I have the following irregular time series time x 10:00:00.021 20 10:00:00.224 20 10:00:01.002 19 10:00:02:948 20 1) For each entry time, I'd like to get sum of x for the next 2 seconds (excluding itself). Using the above example, the output should be time sumx 10:00:00.021 39 10:00:00.224 19 10:00:01.442 20 10:00:02:948 0 2) For each i-th of x in the series, what's the first passage time to x[i]-1. I.e. the output should be time firstPassgeTime 10:00:00.021 0.981 10:00:00.224 0.778 10:00:01.442 NA 10:00:02:948 NA Is there any shortcut function that allows me to do the above? Thank you. adschai ___ r-sig-fina...@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. -- If you want to post, subscribe first. __ R-help@r-project.org 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] RE xcel - two problems - Running RExcel Working Directory error
Hi, I am using RExcel both at work and at home and am facing a couple of challenges. The one at home is that when using RExcel and trying to run any code that involves changing the working directory, I get the following error. Error in command: setwd(C:\\Raoul\\R\\R Maps_UK Maps_Test\\NUTS_03M_2006_SH\\shape\\data)\n cannot change working directory The one at office is more complicated, I have had R,RExcel the DCOM package installed and re-installed numerous times but still get the error there is no R server connected to Excel and when I try to set the server it does not work. Could someone please help me out with these problems? Thanks in advance, Raoul -- View this message in context: http://www.nabble.com/RExcel---two-problems---Running-RExcel---Working-Directory-error-tp25217926p25217926.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Quadratcount image plot colors
Hi, I have two quadratcounts of two different sets of spatial locations in the UK. I then take the difference of these to produce a final quadratcount. In this final quadratcount some values can be negative (if there where more in the first count) or positive (if there where more in the second). Basically I want to plot this using the image.plot function, but I want all values under 0 to be 1 gradient of color, and all values above 0 to be another gradient (color ramp) of color. Is there a way to specify this in R. Phil -- View this message in context: http://www.nabble.com/Quadratcount-image-plot-colors-tp25216951p25216951.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Re : Re: Best R text editors?
There's also a page on the R-Wiki devoted to the colection of editors :You'll find it in the section Windows GUI + other editorshttp://wiki.r-project.org/rwiki/doku.php?id=getting-started:system-setup:system-setups=editorWolfgang- Message d'origine -De: Liviu Andronic landronim...@gmail.comDate: Dimanche, 30 Août 2009, 17:01Objet: Re: [R] Best R text editors?À: Grzes gregori...@gmail.comCc: r-help@r-project.org On 8/30/09, Grzes gregori...@gmail.com wrote: I'm using PLD Linux and in my opinion, if you looking for very easy editor - Geany!!! It'll be fantastic ;) Yeah, Geany is very simple and comfortable. But there is no direct link to R, and not being able to evaluate code on the fly is a show-stopper for me. Liviu __ R-help@r-project.org 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@r-project.org 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] clarificatin on validate.ols method='cross'
Hi, I was hoping to clarify the exact behavior associated with this incantation: validate(fit.ols, method='cross', B=50) Output: index.orig trainingtest optimism index.corrected n R-square 0.5612 0.5613 0.5171 0.0442 0.5170 50 MSE 1.3090 1.3086 1.3547 -0.0462 1.3552 50 Intercept 0. 0. -0.0040 0.0040 -0.0040 50 Slope 1. 1. 0.9899 0.0101 0.9899 50 Questions: 1. Does this perform 50 replicate, 10-fold CV operations? 2. What do the slope and intercept terms refer to? 3. How can I interpret the 'test R2' ? Thanks in advance! Cheers, Dylan __ R-help@r-project.org 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] RE xcel - two problems - Running RExcel Working Directory error
1. The embedded blanks often cause problems. Try the 8.3 version of the filepath. To find the 8.3 name, open an MSDOS cmd window and enter dir /x 'C:\\Raoul\\R There will be a line something like RMAPS_~1 R Maps_UK Maps_Test Use the value that appears in the RMAPS_~1 position. 2. try loading rcom at the R prompt before starting RExcel from the Excel window. require(rcom) If that works you will need to modify your Rprofile to make that happen automatically. Further questions on RExcel should be sent to the rcom mailing list rco...@mailman.csd.univie.ac.at If you need further help, please include the information from RExcel: In Excel, click on RExcel About RExcel Copy to Clipboard OK Then move to your email and paste that information. Rich __ R-help@r-project.org 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] Computer Modern Fonts in R graphic
If you are trying to use Computer Modern fonts because the R graphics will be included in a LaTeX report, you could try the TikZ Device Cameron Bracken and I wrote: http://r-forge.r-project.org/projects/tikzdevice The tikzDevice translates R graphics instructions into a LaTeX-friendly format that can be included directly into documents where the font used in the figure will match that used in the rest of the text. http://r-forge.r-project.org/projects/tikzdeviceIt can be installed from R with the following command: install.packages( 'tikzDevice', repos='http://r-forge.r-project.org') The package is still in beta but we have had very good results so far- tests we have run with the persp function look great. For your case, you would replace the call to pdf() with: pdf(snxsm.tex) And inside your tex document the figure code stored in snxsm.tex is included using the \input{} command: \documentclass{whatever} ... \usepackage{tikz} ... \begin{document} \begin{figure} \input{snxsm} \end{figure} ... \end{document} Note you will need the TikZ package installed in your LaTeX distribution. Installation of LaTeX packages is covered in Part 2 of the tikzDevice vignette: vignette( 'tikzDevice' ) Hope this helps! -Charlie On Sun, Aug 30, 2009 at 1:14 PM, Friedericksen Hope friedericksen.h...@gmail.com wrote: Hello all, I am trying to use computer modern fonts in my r grahics. I tried to do, as described here: http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html but unfortunately, it does not work. First of all I downloaded the cm-lgc package and the AFM and PFB-files from the page and put them in my R working directory, so far, so good. Then I tried to run the following code: sn - seq(1,7,length=100) sm - seq(0,4,length=100) f - function(x,y) {5.64080973 + 0.12271038*x - 0.27725481 * y + 0.29281216*x*y} z - outer(sn,sm,f) nrz - nrow(z) ncz - ncol(z) jet.colors - colorRampPalette( c(yellow, red) ) nbcol - 100 color - jet.colors(nbcol) zfacet - z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz] facetcol - cut(zfacet, nbcol) CM - Type1Font(CM, c(cm-lgc/fonts/afm/public/cm-lgc/fcmr8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmb8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmri8a.afm, cm-lgc/fonts/afm/public/cm-lgc/fcmbi8a.afm, cmsyase.afm)) postscriptFonts(CM=CM) pdf(snxsm.pdf) par(family=CM) persp(sn,sm,z,xlab=SN, ylab=SM,zlab=VI,theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol]) dev.off() It works fine, until the persp() function, there I get: persp(sn,sm,z,xlab=SN, ylab=SM,zlab=VI,theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol]) Error in persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : Invalid font type In addition: Warning messages: 1: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 2: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 3: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 4: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database 5: In persp.default(sn, sm, z, xlab = SN, ylab = SM, zlab = VI, : font family not found in PostScript font database Any help is appreciated! Also a hint/link how to install the CM fonts under R for general use, so that I don't have to have it in my wd all the time. Thank you very much! Greetings, Friedericksen __ R-help@r-project.org 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@r-project.org 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 with summary(vector)??
Ah, thank you! (A bit strange.) Now looking more closer to it, I wonder whether I could achieve the following output formatting: fivenum(E$nodes,1) [1] 1 2 3 7 70632 round(mean(E$nodes),2) [1] 49.85 That's a reasonable way of showing the numbers involved, since E$nodes is declared as integer data. Now could I get summary to show me the numbers in this way, i.e. Min. 1st Qu. Median Mean 3rd Qu. Max. 1 2 3 49.85 7 70630 ?? I guess not. Perhaps it would be helpful to see how summary achieves its result here --- how to display the code of this function? (Spent some time with the documentation and on the Internet, but can't find the right combination of key words, and a nice section List everything related to functions doesn't seem to be available.) Thanks for your help. Oliver On Sun, Aug 30, 2009 at 10:39:48PM +0100, Oliver Kullmann wrote: Hello, I get summary(E) level nodesave_nodestime Min. : 1 Min. :1.00 Min. : 10.71 Min. : 0. 1st Qu.: 237414 1st Qu.:2.00 1st Qu.: 19.70 1st Qu.: 0.0100 Median : 749229 Median :3.00 Median : 27.01 Median : 0.0100 Mean : 767902 Mean : 49.85 Mean : 98.89 Mean : 0.2296 3rd Qu.:288 3rd Qu.:7.00 3rd Qu.: 80.38 3rd Qu.: 0.0300 Max. :2097152 Max. :70632.00 Max. :4451.67 Max. :338.9200 ave_time singlesautarkies depthave_reductions Min. : 0.0490 Min. :0 Min. :0 Min. :33 Min. : 0.20 1st Qu.: 0.0910 1st Qu.:0 1st Qu.:0 1st Qu.:52 1st Qu.: 7.50 Median : 0.1270 Median :0 Median :0 Median :52 Median : 9.92 Mean : 0.4636 Mean :0 Mean :0 Mean :52 Mean :11.76 3rd Qu.: 0.3860 3rd Qu.:0 3rd Qu.:0 3rd Qu.:52 3rd Qu.:13.46 Max. :16.2720 Max. :0 Max. :0 Max. :52 Max. :70.00 summary(E$nodes) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.00 2.00 3.0049.85 7.00 70630.00 The max-value for E$nodes is incorrect --- it it 70632, as computed by summary(E) ?? Oliver __ R-help@r-project.org 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@r-project.org 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] online classes or online eduction in statistics? esp. time series analysis and cointegration?
Hi all, I am looking for low cost online education in statistics. I am thinking of taking online classes on time series analysis and cointegration, etc. Of course, if there are free video lectures, that would be great. However I couldn't find any free video lectures at upper-undergraduate and graduate level which formally going through the whole timeseries education... That's why I would like to enroll in some sort of online degree classes. However, I don't want to earn the certificate or the degree; I just want to audit the online class specifically in time series analysis and cointegration. Could anybody recommend such online education in statistics esp. in time series and cointegration, at low cost? Hopefully it's not going to be like a few thousand dollars for one class. Thanks a lot for your pointers in advance! [[alternative HTML version deleted]] __ R-help@r-project.org 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 extract the theta values from coxph frailty models
Hello, I am working on the frailty model using coxph function. I am running some simulations and want to store the variance of frailty (theta) values from each simulation result. Can anyone help me how to extract the theta values from the results. I appreciate any help. Thanks Shankar Viswanathan __ R-help@r-project.org 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.