Re: [R] Odd r-squared
On Mon, 3 Nov 2003, Simon Wotherspoon wrote: I would consider the calculation of r-squared in the following to be a bug, but then, I've been wrong before. It seems that R looks to see if the model contains an intercept term, and if it does not, computes r-squared in a way I don't understand. To my mind, the following are two alternative parametrizations of the same model, and should yield the same r-squared. But the minimal model contains a overall mean in the first case and not in the second. Your models are 1+g+x+g:x and 0+g+g:x. So whereas they are alternative parametrizations of the same full model, R^2 compares two models, not just one. You will find this explained on ?summary.lm (RTFM!) and several times in the archives. One solution is to ignore the R^2 lines (as I do and tell my students to do). But we might consider labelling the printed output as say Multiple R-Squared (no int): 0.8061, Adjusted R-squared: 0.6769 to remind people. Any insight much appreciated Simon. set.seed(10,kind=NULL) x - runif(10) g - gl(2,5) y - runif(10) summary(lm(y ~ g*x)) Call: lm(formula = y ~ g * x) Residuals: Min 1Q Median 3Q Max -0.35205 -0.14021 0.02486 0.13958 0.39671 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.3138 0.2749 1.1410.297 g2 -0.1568 0.4339 -0.3610.730 x 0.3556 0.6082 0.5850.580 g2:x 0.3018 1.0522 0.2870.784 Residual standard error: 0.276 on 6 degrees of freedom Multiple R-Squared: 0.1491, Adjusted R-squared: -0.2763 F-statistic: 0.3505 on 3 and 6 DF, p-value: 0.7907 summary(lm(y ~ g/x-1)) Call: lm(formula = y ~ g/x - 1) Residuals: Min 1Q Median 3Q Max -0.35205 -0.14021 0.02486 0.13958 0.39671 Coefficients: Estimate Std. Error t value Pr(|t|) g1 0.3138 0.2749 1.1410.297 g2 0.1570 0.3357 0.4680.657 g1:x 0.3556 0.6082 0.5850.580 g2:x 0.6574 0.8586 0.7660.473 Residual standard error: 0.276 on 6 degrees of freedom Multiple R-Squared: 0.8061, Adjusted R-squared: 0.6769 F-statistic: 6.237 on 4 and 6 DF, p-value: 0.02491 --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status = major = 1 minor = 8.0 year = 2003 month = 10 day = 08 language = R Windows ME 4.90 (build 3000) Search Path: .GlobalEnv, package:methods, package:ctest, package:mva, package:modreg, package:nls, package:ts, Autoloads, package:base --- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Problem with batch-file
Hi I have written a graphical user interface using tcltk. Now I would like to run it under rterm.exe with a batch file. I tried the following code written in a .bat file: d:\R\rw1071\bin\Rterm.exe --no-restore --no-save d:\RGui.r d:\RGui.out The problem is that rterm does open but the gui isn't running properly. After a few seconds rterm is closeing without doing anything more than print the first gui window. If I run the same r-code in the normal RGui.exe I don't have any problems. Does anyone know what I'm doing wrong, or is there a help file which explains the needed code? thanks Sascha Morach, a student from ZHW switzerland __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] calling R from Perl
Hi, I want to call R from Perl to generate plots to be displayed on a webpage. What I found out so far is that there is a package called RSPerl on www.omegahat.org which should do what I need. However in the description it says it has been tested with R 1.3.* the latest. I'm using R 1.8.0 right now so the package seems rather unmaintained. It is not easy for me to just install it and see if it works because I have to contact the sysadmin everytime and he is kind of reluctant on 'just trying things out'. Does anybody have experience with RSPerl or any other solution on how to do this? Any help is appreciated, Martin Keller-Ressel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problem with batch-file
That's exactly what a batch file should do. There is no GUI to run. Please tell us what you actually want to do! On Mon, 3 Nov 2003, Morach Sascha, moracsa1 wrote: Hi I have written a graphical user interface using tcltk. Now I would like to run it under rterm.exe with a batch file. I tried the following code written in a .bat file: d:\R\rw1071\bin\Rterm.exe --no-restore --no-save d:\RGui.r d:\RGui.out The problem is that rterm does open but the gui isn't running properly. After a few seconds rterm is closeing without doing anything more than print the first gui window. If I run the same r-code in the normal RGui.exe I don't have any problems. Does anyone know what I'm doing wrong, or is there a help file which explains the needed code? thanks Sascha Morach, a student from ZHW switzerland -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] calling R from Perl
On 11/03/03 10:37, [EMAIL PROTECTED] wrote: Hi, I want to call R from Perl to generate plots to be displayed on a webpage. What I found out so far is that there is a package called RSPerl on www.omegahat.org which should do what I need. However in the description it says it has been tested with R 1.3.* the latest. I'm using R 1.8.0 right now so the package seems rather unmaintained. It is not easy for me to just install it and see if it works because I have to contact the sysadmin everytime and he is kind of reluctant on 'just trying things out'. Does anybody have experience with RSPerl or any other solution on how to do this? Any help is appreciated, RWeb, at http://www.math.montana.edu/Rweb/ actually works, and it does what you are trying to do, although not necessarily exactly what you are trying to do. It isn't being maintained either, it seems. I wrote Jeff Banfield, the author, and received no reply. It is a very nice package, and I think it could serve as the foundation for a GUI that would be useful for students. (That was its intention.) You might also look at the CRAN package CGIwithR, which I have not tried. Jon -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page:http://www.sas.upenn.edu/~baron R page: http://finzi.psych.upenn.edu __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Questions in R
Hello, I have 4 questions in R and I am looking for 4 answers! the questions are the below: 1) is there a function in R for the Least Significant Difference method for multiple comparisons? 2) Is there a function in R that gives me the studentized deleted residuals and the leverage points? 3) is there a way that I could create a link in a program of mine, so as to select an option when my program is running? 4) Whis function gives me the opprotunity to give data to my program while it's running?That is, how can i give information, like cin in C++, to my program will it is running in R. Any answer would be useful.Thanks! - ÁðïêôÞóôå ôçí äùñåÜí [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Questions in R
At 11:40 AM 11/3/2003 +, =?iso-8859-7?q?vasilis=20pappas?= wrote: Hello, I have 4 questions in R and I am looking for 4 answers! the questions are the below: 1) is there a function in R for the Least Significant Difference method for multiple comparisons? There is a multcomp package that implements many methods for multiple comparisons, but I'm not sure whether it does LSD. 2) Is there a function in R that gives me the studentized deleted residuals and the leverage points? rstudent() and hatvalues(). 3) is there a way that I could create a link in a program of mine, so as to select an option when my program is running? It's not altogether clear to me what you want to do, but see ?menu. 4) Whis function gives me the opprotunity to give data to my program while it's running?That is, how can i give information, like cin in C++, to my program will it is running in R. See ?readline. I hope that this helps, John - John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: [EMAIL PROTECTED] phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Questions in R
On Mon, 3 Nov 2003, John Fox wrote: At 11:40 AM 11/3/2003 +, =?iso-8859-7?q?vasilis=20pappas?= wrote: Hello, I have 4 questions in R and I am looking for 4 answers! the questions are the below: 1) is there a function in R for the Least Significant Difference method for multiple comparisons? There is a multcomp package that implements many methods for multiple comparisons, but I'm not sure whether it does LSD. You don't need a special function. Fisher's protected LSD first does an overall F test, then uses the standard formulae as implemented by e.g. se.contrast. For balanced layouts the LSD is very simple indeed. 4) Whis function gives me the opprotunity to give data to my program while it's running?That is, how can i give information, like cin in C++, to my program will it is running in R. See ?readline. scan() would be a closer analog. You can use source, read.table, the data editor, -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Question about the high dimensional density estimation
From: Jason Turner [mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I found that the R package KernSmooth can deal with only 1D and 2D data. But now I have a collection of 4-dimensional data (x1,x2,x3,x4) and would like to estimate the mode of the underlying density. What can I do about it ? The gss package might do what you want here. Cheers Jason -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343- 545 [EMAIL PROTECTED] I believe the `locfit' package will do as well, using local polynomials. HTH, Andy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] second Y axis
please send me the manual abnout the [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Visualising Vectors
Hi Laura, you should find some useful information in the latest R news Volume 3/2, October 2003 http://cran.r-project.org/doc/Rnews/ refer page 8 where Paul's figure 2 shows some novel symbols showing China Sea Wind Speed, Direction and Temperature... plotted by lat.long. s. Laura Quinn wrote: I sent a mail last week asking for some advise in relation to displaying wind vectors on a contour map of a region. Whilst I have had some useful feedback relating to the second part of this question (namely how to animate a time series of still frames), I haven't recieved any advise on how I might create the still images of the spatially distributed wind vector data at any given time point. Firstly, is there a way in which I can input orographical information (x,y,z co ords) into R to create a map, secondly, is there a way in which i can superimpose a visual wind vector (i.e. arrow of certain length and certain orientation) onto such a map? thanks in advance, Laura __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Odd r-squared
On 3 Nov 2003 at 17:53, Simon Wotherspoon wrote: If you are really interested, you could write your own function to calculate r-squared, deciding from the model matrix if the range space of the model matrix contains a constant vector. If model is the model matrix with n rows, one way is to compare the $rank components of qr(model) and qr(cbind(rep(1,n), model)) Kjetil Halvorsen Hi, I would consider the calculation of r-squared in the following to be a bug, but then, I've been wrong before. It seems that R looks to see if the model contains an intercept term, and if it does not, computes r-squared in a way I don't understand. To my mind, the following are two alternative parametrizations of the same model, and should yield the same r-squared. Any insight much appreciated Simon. set.seed(10,kind=NULL) x - runif(10) g - gl(2,5) y - runif(10) summary(lm(y ~ g*x)) Call: lm(formula = y ~ g * x) Residuals: Min 1Q Median 3Q Max -0.35205 -0.14021 0.02486 0.13958 0.39671 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.3138 0.2749 1.1410.297 g2 -0.1568 0.4339 -0.3610.730 x 0.3556 0.6082 0.5850.580 g2:x 0.3018 1.0522 0.2870.784 Residual standard error: 0.276 on 6 degrees of freedom Multiple R-Squared: 0.1491, Adjusted R-squared: -0.2763 F-statistic: 0.3505 on 3 and 6 DF, p-value: 0.7907 summary(lm(y ~ g/x-1)) Call: lm(formula = y ~ g/x - 1) Residuals: Min 1Q Median 3Q Max -0.35205 -0.14021 0.02486 0.13958 0.39671 Coefficients: Estimate Std. Error t value Pr(|t|) g1 0.3138 0.2749 1.1410.297 g2 0.1570 0.3357 0.4680.657 g1:x 0.3556 0.6082 0.5850.580 g2:x 0.6574 0.8586 0.7660.473 Residual standard error: 0.276 on 6 degrees of freedom Multiple R-Squared: 0.8061, Adjusted R-squared: 0.6769 F-statistic: 6.237 on 4 and 6 DF, p-value: 0.02491 --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status = major = 1 minor = 8.0 year = 2003 month = 10 day = 08 language = R Windows ME 4.90 (build 3000) Search Path: .GlobalEnv, package:methods, package:ctest, package:mva, package:modreg, package:nls, package:ts, Autoloads, package:base --- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] lang2(...) with two and more arguments
Dear R-help, how could I create an R call in C code using lang2 with 2 and more arguments? I tried this code: SEXP f(SEXP fn, SEXP rho) { SEXP R_fcall, x, y; PROTECT(R_fcall = lang2(fn, R_NilValue)); PROTECT(x = allocVector(REALSXP, 1)); PROTECT(y = allocVector(REALSXP, 1)); REAL(x)[0] = 10; REAL(y)[0] = 20; SETCADR(R_fcall, x); SETCADR(R_fcall, y); UNPROTECT(3); return R_fcall; } .Call(f, c, new.env()) returns `.Primitive(c)(20)', but not `.Primitive(c)(10, 20)', as I expected. How can I recieve the disired result? Thank you very much. -- WBR, Timur. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Weird problem with median on a factor
Continuing to beat the greasy spot in the road where the dead horse used to be 1) I know that the people building r are working on bigger and better things than this silly question and I appreciate the existence of this complicated package that was dropped in my lap for free. 2) Tony Platt succinctly pointed out one of the underlying 'problems' (possibly in my understanding): #this is a perfectly reasonable r object some.weird.object-factor(c(a,b,c)) #this is an internal r function acting on an object typeof(some.weird.object) [1] integer #this is a primitive r function acting on an object is.numeric(some.weird.object) [1] FALSE Do these functions behave in a design consistent manor?? Can a single r object simultaneously be of type integer and NOT numeric?? If this is intentional can someone explain why? I don't think this has anything to do with taking the median of a factor (median calls mode that calls typeof). It just requires a sufficiently complex object, such as factor, before we start seeing this behavior. I wasn't clever enough to come up with examples of non-factor objects that produced this behavior so I am curious if this problem is internal to factor or to the functions themselves. Thanks Bob -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Sunday, November 02, 2003 9:40 AM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Weird problem with median on a factor On 02 Nov 2003 12:50:37 +0100, you wrote: (Arguably, sorting an unordered factor ought to Verboten as well, though!) No, arbitrarily assigning an ordering and using that to sort is a useful thing in many situations, e.g. searching. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Calling R from PHP on Win2K?
John, I am sorry for the delayed reply...since it sounds like you would need to gain some knowledge on how to integrate components like Apache, MySQL, PHP, and R, I highly recommend one or more of Paul Dubois' books: 1) MySQL 2) MySQL Cookbook 3) MYSQL and Perl for the Web While the primary focus of these is the MySQL database, the author is very thorough in explaining how to connect MySQL to other tools like Apache and PHP. Even the third book, while certainly Perl-centric, illustrates concepts that are applicable to other glue languages such as PHP and Python. Even some of the OS differences between Windows and Linux are included in his discussions. There is overlap amongst all three, but enough distinction to make all 3 a worthwhile investment if indeed you wish to come with a reliable practical solution. If you want to invest in only one, I would start with the MySQL book. Hope this helps. Bill Bill Pikounis, Ph.D. Biometrics Research Department Merck Research Laboratories PO Box 2000, MailDrop RY33-300 126 E. Lincoln Avenue Rahway, New Jersey 07065-0900 USA Phone: 732 594 3913 Fax: 732 594 1565 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] FDR in p.adjust
Hello, I've a question about the fdr method in p.adjust: What is the threshold of the FDR, and is it possible to change this threshold? As I understand the FDR (please correct) it adjusts the p-values so that for less than N% (say the cutoff is 25%) of the alternative hypothesis the Null is in fact true. thanks a lot for help, +regards, Arne __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] USA map
On 3 Nov 2003 at 9:46, Owen, Jason wrote: library(maps) # since two days available precompiled for windows map('usa') Kjetil Halvorsen R users, In S, there was a function called usa() that would draw the map of the United States, plus it had other options for graphics. I have looked but I can't find the equivalent in R. Is there one? Thanks, Jason __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] USA map
On Monday 03 November 2003 15:46, Owen, Jason wrote: R users, In S, there was a function called usa() that would draw the map of the United States, plus it had other options for graphics. I have looked but I can't find the equivalent in R. Is there one? Description I don't know the usa() function in S but usa() in R gives a map of the US that's the output of a usa search, perhaps that is what you are looking for: cheers Martin P.S.: www.freegis.org - GeoData is worth a look for more maps usa() {map} This database produces a map of the United States mainland generated from US Department of the Census data (see the reference). Usage data(usaMapEnv) Format The data file is merely an assignment to a character string which specifies the name of an environment variable which contains the base location of the binary files used by the map drawing functions. This environment variable (R_MAP_DATA_DIR for the datasets in the maps package) is set at package load time if it does not already exist. Hence setting the environment variable before loading the package can override the default location of the binary datasets. References Richard A. Becker, and Allan R. Wilks, Maps in S, ATT Bell Laboratories Statistics Research Report [93.2], 1993. Richard A. Becker, and Allan R. Wilks, Constructing a Geographical Database, ATT Bell Laboratories Statistics Research Report [95.2], 1995. US Department of Commerce, Census Bureau, County Boundary File, computer tape, available from Customer Services, Bureau of the Census, Washingdon DC 20233. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] lang2(...) with two and more arguments
You set the first argument to x and then to y. Why are you surprised? On Mon, 3 Nov 2003, [koi8-r] Timur Elzhov[koi8-r] wrote: Dear R-help, how could I create an R call in C code using lang2 with 2 and more arguments? I tried this code: SEXP f(SEXP fn, SEXP rho) { SEXP R_fcall, x, y; PROTECT(R_fcall = lang2(fn, R_NilValue)); PROTECT(x = allocVector(REALSXP, 1)); PROTECT(y = allocVector(REALSXP, 1)); REAL(x)[0] = 10; REAL(y)[0] = 20; SETCADR(R_fcall, x); SETCADR(R_fcall, y); UNPROTECT(3); return R_fcall; } .Call(f, c, new.env()) returns `.Primitive(c)(20)', but not `.Primitive(c)(10, 20)', as I expected. How can I recieve the disired result? Thank you very much. -- WBR, Timur. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Weird problem with median on a factor
On Mon, 3 Nov 2003 [EMAIL PROTECTED] wrote: Continuing to beat the greasy spot in the road where the dead horse used to be 1) I know that the people building r are working on bigger and better things than this silly question and I appreciate the existence of this complicated package that was dropped in my lap for free. 2) Tony Platt succinctly pointed out one of the underlying 'problems' (possibly in my understanding): #this is a perfectly reasonable r object some.weird.object-factor(c(a,b,c)) #this is an internal r function acting on an object typeof(some.weird.object) [1] integer #this is a primitive r function acting on an object is.numeric(some.weird.object) [1] FALSE Do these functions behave in a design consistent manor?? Can a single r object simultaneously be of type integer and NOT numeric?? If this is intentional can someone explain why? See the help for is.numeric: it *does* explain this. You should be careful not to confuse classes with representations. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] lang2(...) with two and more arguments
Timur Elzhov [EMAIL PROTECTED] writes: Dear R-help, how could I create an R call in C code using lang2 with 2 and more arguments? I tried this code: SEXP f(SEXP fn, SEXP rho) { SEXP R_fcall, x, y; PROTECT(R_fcall = lang2(fn, R_NilValue)); PROTECT(x = allocVector(REALSXP, 1)); PROTECT(y = allocVector(REALSXP, 1)); REAL(x)[0] = 10; REAL(y)[0] = 20; SETCADR(R_fcall, x); SETCADR(R_fcall, y); UNPROTECT(3); return R_fcall; } .Call(f, c, new.env()) returns `.Primitive(c)(20)', but not `.Primitive(c)(10, 20)', as I expected. How can I recieve the disired result? Thank you very much. Hmmm. This is definitely not right: SETCADR(R_fcall, x); SETCADR(R_fcall, y); sets the same location first to x, and then to y. I suspect you need SETCADDR(R_fcall, y); but no guarantees... -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] comparing characters
Hi all, I´m having some trouble when trying to compare character values (to check if they are alphabetically ordered). Is it possible to do it in any way? Thanks for your help. Cheers, Aurora __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] comparing characters
What sort of trouble are you having? I just got the following from R 1.8.0: ab [1] TRUE ab [1] FALSE aba [1] FALSE aba [1] TRUE hope this helps. spencer graves Aurora Torrente wrote: Hi all, I´m having some trouble when trying to compare character values (to check if they are alphabetically ordered). Is it possible to do it in any way? Thanks for your help. Cheers, Aurora __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] problem building MS-Windows package under linux
hi there, trying to follow the steps of Yan Rossini 2003, I have two problems : first when I 'make CrossCompileBuild', I get : ** make[1]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' make -f Makefile.docfiles make[2]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' makeinfo --no-split --html --no-headers --number-sections -o tmp.html tmp.texi tidy tmp.html tmp2.html 2 /dev/null make[2]: [fixed/html/rw-FAQ.html] Error 127 (ignored) *** tidy appears to be non-functional *** make[2]: *** [fixed/html/rw-FAQ.html] Error 111 make[2]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' make[1]: *** [docfiles] Error 2 make[1]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' ** and then, trying to go throught, as this didn't look like a big error, I 'make pkg-multidim_0.5-3' and ** ---multidim-- make[1]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' -- Making package multidim installing inst files adding build stamp to DESCRIPTION making DLL ... dataentry.c:27: config.h: No such file or directory make[4]: *** [dataentry.o] Error 1 make[3]: *** [libR] Error 2 make[2]: *** [srcDynlib] Error 2 make[1]: *** [pkg-multidim] Error 2 make[1]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' adding: multidim/ (stored 0%) adding: multidim/doc/ (stored 0%) adding: multidim/DESCRIPTION (deflated 31%) adding: multidim/doc/multidim.ps (deflated 77%) ** I don't understand where this 'config.h' should come from... any help appreciated, and many thanks to the authors for this comprehensive article. -- Mathieu Ros Ph. D. student - Canalizing selection using Bayesian models INRA - Fish Genetics Unit (Paris)/Cell Genetics Unit (Toulouse) tel : (+0033)1 3465 3414 (FGU) / (+0033)5 6128 5305 (CGU) mail : [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] hclust doesn't return merge details
Dear R-users, I tried to receive the merge details of a clustering by using the summary function of hclust. For illustration I use the Longley data as done by Prof Ripley (Wed 11 Apr 2001) d - dist(longley.y) d - d/max(d) hc - hclust(d, ave) But instead of getting a matrix for $merge I get: summary(hc) Length Class Mode merge 30 -none- numeric height 15 -none- numeric order 16 -none- numeric labels 0 -none- NULL method 1 -none- character call 3 -none- call dist.method 1 -none- character Am I missing something? Arne Neumann R.version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor7.1 year 2003 month06 day 16 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] comparing characters
On Mon, 2003-11-03 at 10:46, Aurora Torrente wrote: Hi all, Im having some trouble when trying to compare character values (to check if they are alphabetically ordered). Is it possible to do it in any way? Thanks for your help. Cheers, Aurora Depending upon what it is you are comparing, you may find differences from what you expect due to to your 'locale'. See ?Comparison for more information. HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Binaries for RORacle and V 1.8. needed
Hi, there is no Oracle Client on my machine (Redhat Linux 9.0/686i, R1.8.0). I read the readme.client file and did: I unziped the package ROracle and copied it into the R-library path. I get: library(ROracle) Error in testRversion(descfields) : This package has not been installed properly Who has a binary version of ROracle for my configuration? Thanks, Claus __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] mva Hclust, heatmap and plotting functions
Hi All Not sure if this a bioconductor question or general R mailing list so apologies if this has gone to the wrong one. When plotting dendrograms created by hclust you can identify clusters by clicking on the graphics and returning a list of what is contained in each cluster. However I'd like to be able to zoom in on specific clusters and plot them, is this possible at all ? Also I have a microarray experiment where I'd like to be able to plot A gene tree against a condition tree using the heatmap function. for genes according to treatments and viceversa I.e Treatments being DIF1, DIF2, DIF3 genes being 324c_F, 634_F etc. 393 genes x 3 treatments nameDIF1DIF2DIF3 324c_F 4.16E-012.65E-010.298602679 634_F 8.95E-016.67E-010.337895962 504c_F 4.54E-015.94E-011.185792741 1302_F -6.43E-01 -5.39E-01 0.073152009 233c_F 4.20E-014.27E-010.261216119 1274_F -5.00E-01 -3.53E-01 -0.161567509 1314_F 1.59E+001.08E+000.403198377 1791c_F 9.08E-014.11E-010.461046812 594c_F 6.43E-013.93E-01-0.142807556 854c_F -5.59E-01 -9.70E-01 -0.766361402 viseversa. 3 treatment x 393 genes name324c_F 634_F 504c_F 1302_F.. DIF14.16E-018.95E-014.54E-01-6.43E-01.. DIF22.65E-016.67E-015.94E-01-5.39E-01.. DIF30.298602679 0.337895962 1.185792741 0.073152009 etc. And would like to be able to plot one against the other. I've used as.dendrogram to create dendrograms from the output of hclust for each of the data sets mentioned above but.. I'm having problems with the rest of the functions Could someone advise me as to which numeric matrix I should be using specified as X in the example: heatmap(x, dendrogram1, dendrogram2 etc) I.e. is X coming from the results of dist, hclust or the original data ? If so do you then need to covert it into a numeric matrix ? I've thus far tried the data.matrix function on the output from all of the above only to get: `x' must be a numeric matrix heatmap(DIF123distmatrix, hclustfun=hclust) This command works nicely but obviously plots the same thing on both axes. I've tried something along the lines of: heatmap(DIF123datamat, DIF123clustFLIPasdendro, DIF123clustHCmcquittyasdendro, hclustfun=hclust) but this returns row dendrogram ordering gave index of wrong length which has come from the viseversa example above. thanks for any help and guidance Jason -- Jason Skelton Pathogen Microarrays Wellcome Trust Sanger Institute Hinxton Cambridge CB10 1SA Tel +44(0)1223 834244 Ext 7123 Fax +44(0)1223 494919 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] comparing characters
That´s what I needed. Thanks! Spencer Graves wrote: What sort of trouble are you having? I just got the following from R 1.8.0: ab [1] TRUE ab [1] FALSE aba [1] FALSE aba [1] TRUE hope this helps. spencer graves __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] comparing characters
You could do something like that: x - sample(LETTERS, 10) x [1] K N C F R E L J S Q all.equal(order(x), 1:length(x)) [1] Mean relative difference: 0.5090909 When x is a numeric vector, I usually use any(diff(x) 0) although I don't know whether it's more efficient. HTH, Giovanni Date: Mon, 03 Nov 2003 16:46:34 + From: Aurora Torrente [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Organization: EBI Precedence: list User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 Hi all, I´m having some trouble when trying to compare character values (to check if they are alphabetically ordered). Is it possible to do it in any way? Thanks for your help. Cheers, Aurora __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- __ [ ] [ Giovanni Petris [EMAIL PROTECTED] ] [ Department of Mathematical Sciences ] [ University of Arkansas - Fayetteville, AR 72701 ] [ Ph: (479) 575-6324, 575-8630 (fax) ] [ http://definetti.uark.edu/~gpetris/ ] [__] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] comparing characters
Aurora Torrente wrote: Hi all, I´m having some trouble when trying to compare character values (to check if they are alphabetically ordered). Is it possible to do it in any way? Thanks for your help. Cheers, a b should work. If that's not your question, you have to be more specific. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problem building MS-Windows package under linux
I had this same problem before: you need to install the program tidy in your linux machine There is a p[ackage for DEBIAN such that you can use apt-get install tidy don't know about other distros but it is probably available as well P.J. [EMAIL PROTECTED]:~$ apt-cache search tidy perltidy - A Perl script indenter and reformatter tidy - HTML syntax checker and reformatter tidy-doc - HTML syntax checker and reformatter documentation tidy-proxy - A small http proxy which tidies html On Mon, 3 Nov 2003, Mathieu Ros wrote: hi there, trying to follow the steps of Yan Rossini 2003, I have two problems : first when I 'make CrossCompileBuild', I get : ** make[1]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' make -f Makefile.docfiles make[2]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' makeinfo --no-split --html --no-headers --number-sections -o tmp.html tmp.texi tidy tmp.html tmp2.html 2 /dev/null make[2]: [fixed/html/rw-FAQ.html] Error 127 (ignored) *** tidy appears to be non-functional *** make[2]: *** [fixed/html/rw-FAQ.html] Error 111 make[2]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' make[1]: *** [docfiles] Error 2 make[1]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' ** and then, trying to go throught, as this didn't look like a big error, I 'make pkg-multidim_0.5-3' and ** ---multidim-- make[1]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' -- Making package multidim installing inst files adding build stamp to DESCRIPTION making DLL ... dataentry.c:27: config.h: No such file or directory make[4]: *** [dataentry.o] Error 1 make[3]: *** [libR] Error 2 make[2]: *** [srcDynlib] Error 2 make[1]: *** [pkg-multidim] Error 2 make[1]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' adding: multidim/ (stored 0%) adding: multidim/doc/ (stored 0%) adding: multidim/DESCRIPTION (deflated 31%) adding: multidim/doc/multidim.ps (deflated 77%) ** I don't understand where this 'config.h' should come from... any help appreciated, and many thanks to the authors for this comprehensive article. -- Mathieu Ros Ph. D. student - Canalizing selection using Bayesian models INRA - Fish Genetics Unit (Paris)/Cell Genetics Unit (Toulouse) tel : (+0033)1 3465 3414 (FGU) / (+0033)5 6128 5305 (CGU) mail : [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Paulo Justiniano Ribeiro Jr Departamento de Estatística Universidade Federal do Paraná Caixa Postal 19.081 CEP 81.531-990 Curitiba, PR - Brasil Tel: (+55) 41 361 3471 Fax: (+55) 41 361 3141 e-mail: [EMAIL PROTECTED] http://www.est.ufpr.br/~paulojus __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] hclust doesn't return merge details
From: Arne Neumann [mailto:[EMAIL PROTECTED] Dear R-users, I tried to receive the merge details of a clustering by using the summary function of hclust. For illustration I use the Longley data as done by Prof Ripley (Wed 11 Apr 2001) d - dist(longley.y) d - d/max(d) hc - hclust(d, ave) But instead of getting a matrix for $merge I get: summary(hc) Length Class Mode merge 30 -none- numeric height 15 -none- numeric order 16 -none- numeric labels 0 -none- NULL method 1 -none- character call 3 -none- call dist.method 1 -none- character Am I missing something? I believe so. str(hc) List of 7 $ merge : int [1:15, 1:2] -6 -13 -10 -1 -9 -3 -5 -16 -12 8 ... $ height : num [1:15] 20.1 23.6 27.2 29.2 41.4 ... $ order : int [1:16] 1 2 3 4 16 13 14 12 15 5 ... $ labels : chr [1:16] 1947 1948 1949 1950 ... $ method : chr average $ call : language hclust(d = dist(data.matrix(longley)), method = ave) $ dist.method: chr euclidean - attr(*, class)= chr hclust so the merge component is a n x 2 matrix, whose mode is numeric. Andy Arne Neumann R.version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor7.1 year 2003 month06 day 16 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] hclust doesn't return merge details
Arne - I have carried out exactly your example below, and I get hc$merge as a matrix with two columns and 15 rows. Do str(hc) to see a useful representation of the contents of the returned list. help(hclust) describes this list in the section Value:. help(Subscript) shows the various syntactic forms that will extract one element from a list, but doesn't say quite as explicitly as one might wish that hc[[merge]] or hc[[1]] is the way to return just element merge from the list. Brian Ripley may correct me if I am wrong, but I think there have never been 'extractor' functions for the return value from hclust() as there are for lm(). - tom blackwell - u michigan medical school - ann arbor - On Mon, 3 Nov 2003, Arne Neumann wrote: Dear R-users, I tried to receive the merge details of a clustering by using the summary function of hclust. For illustration I use the Longley data as done by Prof Ripley (Wed 11 Apr 2001) d - dist(longley.y) d - d/max(d) hc - hclust(d, ave) But instead of getting a matrix for $merge I get: summary(hc) Length Class Mode merge 30 -none- numeric height 15 -none- numeric order 16 -none- numeric labels 0 -none- NULL method 1 -none- character call 3 -none- call dist.method 1 -none- character Am I missing something? Arne Neumann R.version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor7.1 year 2003 month06 day 16 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] FDR in p.adjust
There is no threshold for fdr. The adjusted p-values give the expected proportion of false positives for all comparisons with similar p-values or smaller. In other words, if you choose a p-value of 0.05, you would expect that ~5% of the tests with a p-value of 0.05 or smaller are false positives. HTH, Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 [EMAIL PROTECTED] 11/03/03 10:33AM Hello, I've a question about the fdr method in p.adjust: What is the threshold of the FDR, and is it possible to change this threshold? As I understand the FDR (please correct) it adjusts the p-values so that for less than N% (say the cutoff is 25%) of the alternative hypothesis the Null is in fact true. thanks a lot for help, +regards, Arne __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R]A matrix is full rank is equal to having independent columns?
For any matrix, the following definitions hold: row rank: number of linearly independent rows column rank: number of linearly independent columns There is a theorem stating that these 2 numbers must be the same for any matrix, and (consequently) that number is defined as the 'rank' of the matrix. For a matrix which has less columns than rows (as in your example), to say it has 'full column rank' would mean that it's rank = number of columns, and so yes, by definition all it's columns are linearly independent. I don't know if the description 'full rank' has any concrete interpretation for such matrices, though. HTH. On Monday 03 November 2003 13:32, Feng Zhang wrote: Dear R listers, Just a simple question. If we say an nxm matrix (nm) is full rank of m, does this mean that this matrix has linearly independent columns? They are the same definition or needs some proof? Thanks for your answer. Fred [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problem building MS-Windows package under linux
You do need to build R before you build a package, when cross-building. `Small' errors stop make running: try make -k? On Mon, 3 Nov 2003, Mathieu Ros wrote: hi there, trying to follow the steps of Yan Rossini 2003, I have two problems : first when I 'make CrossCompileBuild', I get : ** make[1]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' make -f Makefile.docfiles make[2]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' makeinfo --no-split --html --no-headers --number-sections -o tmp.html tmp.texi tidy tmp.html tmp2.html 2 /dev/null make[2]: [fixed/html/rw-FAQ.html] Error 127 (ignored) *** tidy appears to be non-functional *** make[2]: *** [fixed/html/rw-FAQ.html] Error 111 make[2]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' make[1]: *** [docfiles] Error 2 make[1]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' ** and then, trying to go throught, as this didn't look like a big error, I 'make pkg-multidim_0.5-3' and ** ---multidim-- make[1]: Entering directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' -- Making package multidim installing inst files adding build stamp to DESCRIPTION making DLL ... dataentry.c:27: config.h: No such file or directory make[4]: *** [dataentry.o] Error 1 make[3]: *** [libR] Error 2 make[2]: *** [srcDynlib] Error 2 make[1]: *** [pkg-multidim] Error 2 make[1]: Leaving directory `/home/ros/RWORK/CROSSSOMP/WinR/R-1.8.0/src/gnuwin32' adding: multidim/ (stored 0%) adding: multidim/doc/ (stored 0%) adding: multidim/DESCRIPTION (deflated 31%) adding: multidim/doc/multidim.ps (deflated 77%) ** I don't understand where this 'config.h' should come from... any help appreciated, and many thanks to the authors for this comprehensive article. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R]A matrix is full rank is equal to having independent columns?
On 3 Nov 2003 at 13:32, Feng Zhang wrote: This are the same concept, no additional proof is needed. The rank of a matrix is the max number of li columns, or rows (which are the same). Kjetil Halvorsen Dear R listers, Just a simple question. If we say an nxm matrix (nm) is full rank of m, does this mean that this matrix has linearly independent columns? They are the same definition or needs some proof? Thanks for your answer. Fred [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] comparing characters
Giovanni == Giovanni Petris [EMAIL PROTECTED] on Mon, 3 Nov 2003 12:00:41 -0600 (CST) writes: Giovanni You could do something like that: x - sample(LETTERS, 10) x Giovanni [1] K N C F R E L J S Q all.equal(order(x), 1:length(x)) Giovanni [1] Mean relative difference: 0.5090909 Giovanni When x is a numeric vector, I usually use any(diff(x) 0) Giovanni although I don't know whether it's more efficient. There's a builtin R function that is definitely even faster (at least for largish vectors): is.unsorted() -- Regards, Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] svm in e1071 package: polynomial vs linear kernel
I am trying to understand what is the difference between linear and polynomial kernel: linear: u'*v polynomial: (gamma*u'*v + coef0)^degree It would seem that polynomial kernel with gamma = 1; coef0 = 0 and degree = 1 should be identical to linear kernel, however it gives me significantly different results for very simple data set, with linear kernel significantly outperforming polynomial kernel. *** mse, r2 = 0.5, 0.9 for linear *** mse, r2 = 1.8, 0.1 for polynomial What am I missing ? Ryszard P.S. Here are my results: # simple cross validation function cv.svm - function(formula, data, ntry = 3, kernel = linear, scale = FALSE, cross = 3, gamma = 1/(dim(data)-1), degree = 3) { mse - 0; r2 - 0 for (n in 1:ntry) { svm.model - svm(formula , data = data, scale = scale, kernel = kernel, cross = cross) mse - mse + svm.model$tot.MSE r2 - r2 + svm.model$scorrcoeff } mse - mse/ntry; r2 - r2/ntry; result - c(mse, r2) cat(sprintf(cv.svm mse, r2 = %5.3f %5.3f\n, mse, r2)) return (result) } # define data set x1 - rnorm(9); x2 - rnorm(9) df - data.frame(y = 2*x1 + x2, x1, x2) # invoke cv.svm() for linear and polynomial kernels few times r - cv.svm( y ~ ., df, kernel = polynomial, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 1.888 0.162 r - cv.svm( y ~ ., df, kernel = polynomial, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 1.867 0.146 r - cv.svm( y ~ ., df, kernel = polynomial, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 1.818 0.105 r - cv.svm( y ~ ., df, kernel = linear, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 0.525 0.912 r - cv.svm( y ~ ., df, kernel = linear, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 0.537 0.878 r - cv.svm( y ~ ., df, kernel = linear, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 0.528 0.913 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] USA map
On 3 Nov 2003 at 16:33, Martin Wegmann wrote: On Monday 03 November 2003 15:46, Owen, Jason wrote: R users, In S, there was a function called usa() that would draw the map of the United States, plus it had other options for graphics. I have looked but I can't find the equivalent in R. Is there one? Description I don't know the usa() function in S but usa() in R gives a map of the US Where did you find that function? In rw1080 on windows XP I get: usa() Error: couldn't find function usa (and help.search(usa) does'nt give anything usefull) Kjetil Halvorsen that's the output of a usa search, perhaps that is what you are looking for: cheers Martin P.S.: www.freegis.org - GeoData is worth a look for more maps usa() {map} This database produces a map of the United States mainland generated from US Department of the Census data (see the reference). Usage data(usaMapEnv) Format The data file is merely an assignment to a character string which specifies the name of an environment variable which contains the base location of the binary files used by the map drawing functions. This environment variable (R_MAP_DATA_DIR for the datasets in the maps package) is set at package load time if it does not already exist. Hence setting the environment variable before loading the package can override the default location of the binary datasets. References Richard A. Becker, and Allan R. Wilks, Maps in S, ATT Bell Laboratories Statistics Research Report [93.2], 1993. Richard A. Becker, and Allan R. Wilks, Constructing a Geographical Database, ATT Bell Laboratories Statistics Research Report [95.2], 1995. US Department of Commerce, Census Bureau, County Boundary File, computer tape, available from Customer Services, Bureau of the Census, Washingdon DC 20233. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] USA map
I don't know the usa() function in S but usa() in R gives a map of the US Where did you find that function? In rw1080 on windows XP I get: Some earlier versions of the maps package (which was then available for Unix only), did have individual functions for each country in the world database. In the current version, you need to type: library(maps) map(usa) #or: map(world2, USA) Ray Brownrigg __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] USA map
I believe in R you need library(maps) before using usa(). Of course, the library has to be installed first. Cheers, Andy __ Andy Jaworski Engineering Systems Technology Center 3M Center, 518-1-01 St. Paul, MN 55144-1000 - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 |-+ | | [EMAIL PROTECTED] | | | Sent by: | | | [EMAIL PROTECTED]| | | ath.ethz.ch | | || | || | | 11/03/2003 13:56 | | || |-+ -| | | | To: R-list [EMAIL PROTECTED] | |Martin Wegmann [EMAIL PROTECTED] | | cc: Owen, Jason [EMAIL PROTECTED] | | Subject: Re: [R] USA map | -| On 3 Nov 2003 at 16:33, Martin Wegmann wrote: On Monday 03 November 2003 15:46, Owen, Jason wrote: R users, In S, there was a function called usa() that would draw the map of the United States, plus it had other options for graphics. I have looked but I can't find the equivalent in R. Is there one? Description I don't know the usa() function in S but usa() in R gives a map of the US Where did you find that function? In rw1080 on windows XP I get: usa() Error: couldn't find function usa (and help.search(usa) does'nt give anything usefull) Kjetil Halvorsen that's the output of a usa search, perhaps that is what you are looking for: cheers Martin P.S.: www.freegis.org - GeoData is worth a look for more maps usa() {map} This database produces a map of the United States mainland generated from US Department of the Census data (see the reference). Usage data(usaMapEnv) Format The data file is merely an assignment to a character string which specifies the name of an environment variable which contains the base location of the binary files used by the map drawing functions. This environment variable (R_MAP_DATA_DIR for the datasets in the maps package) is set at package load time if it does not already exist. Hence setting the environment variable before loading the package can override the default location of the binary datasets. References Richard A. Becker, and Allan R. Wilks, Maps in S, ATT Bell Laboratories Statistics Research Report [93.2], 1993. Richard A. Becker, and Allan R. Wilks, Constructing a Geographical Database, ATT Bell Laboratories Statistics Research Report [95.2], 1995. US Department of Commerce, Census Bureau, County Boundary File, computer tape, available from Customer Services, Bureau of the Census, Washingdon DC 20233. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] svm in e1071 package: polynomial vs linear kernel
On Mon, 3 Nov 2003 [EMAIL PROTECTED] wrote: I am trying to understand what is the difference between linear and polynomial kernel: linear: u'*v polynomial: (gamma*u'*v + coef0)^degree It would seem that polynomial kernel with gamma = 1; coef0 = 0 and degree = 1 should be identical to linear kernel, however it gives me significantly different results for very simple data set, with linear kernel significantly outperforming polynomial kernel. *** mse, r2 = 0.5, 0.9 for linear *** mse, r2 = 1.8, 0.1 for polynomial What am I missing ? Well: perhaps, that you should pass *all* parameters from your cv.svm function to the call of svm()? g., -d Ryszard P.S. Here are my results: # simple cross validation function cv.svm - function(formula, data, ntry = 3, kernel = linear, scale = FALSE, cross = 3, gamma = 1/(dim(data)-1), degree = 3) { mse - 0; r2 - 0 for (n in 1:ntry) { svm.model - svm(formula , data = data, scale = scale, kernel = kernel, cross = cross) mse - mse + svm.model$tot.MSE r2 - r2 + svm.model$scorrcoeff } mse - mse/ntry; r2 - r2/ntry; result - c(mse, r2) cat(sprintf(cv.svm mse, r2 = %5.3f %5.3f\n, mse, r2)) return (result) } # define data set x1 - rnorm(9); x2 - rnorm(9) df - data.frame(y = 2*x1 + x2, x1, x2) # invoke cv.svm() for linear and polynomial kernels few times r - cv.svm( y ~ ., df, kernel = polynomial, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 1.888 0.162 r - cv.svm( y ~ ., df, kernel = polynomial, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 1.867 0.146 r - cv.svm( y ~ ., df, kernel = polynomial, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 1.818 0.105 r - cv.svm( y ~ ., df, kernel = linear, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 0.525 0.912 r - cv.svm( y ~ ., df, kernel = linear, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 0.537 0.878 r - cv.svm( y ~ ., df, kernel = linear, gamma = 1, degree = 1, ntry = 32) cv.svm mse, r2 = 0.528 0.913 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] ROC with GLM?
Hello R-List: Does anybody have code to optimize a logistic regression using ROC curves? I've seen S+ code that does it but never in R. Thanks. __ You Rock! Your E-mail should, too. Visit Rock.com! [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Generic Function
Hi, How to I write a generate function that is specific to the class of the argument itself ? For example, I created a data.frame that contains results of an analysis. I would like to write a special plot function with the following usage plot(data.frame) I have been looking through the documentation but have not found anything to show me how to do this. Any help would be greatly appreciated. Thanks in advance, Arend van der Veen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] write.dta and handling labels
Hello, I need to write out a data matrix as a STATA 7 file and this happens perfectly with write.dta(), except I cannot seem to export the labelnames to Stata. So far I have tried the following: # X is the data matrix that is to be exported attributes(X)$var.labels - c(apple, banana, cat) write(X, filename = text.dta, version = 7) When i open the file in stata instead of the label names all I get are the variable names, when i ask stata to describe the data. I am hoping someone can suggest ways in which i can export the label names more effectively! thanks. Arnab - Ph.D. Candidate RAND Graduate School Santa Monica __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] write.dta and handling labels
Have you considered write.table? hope this helps. spencer graves Arnab mukherji wrote: Hello, I need to write out a data matrix as a STATA 7 file and this happens perfectly with write.dta(), except I cannot seem to export the labelnames to Stata. So far I have tried the following: # X is the data matrix that is to be exported attributes(X)$var.labels - c(apple, banana, cat) write(X, filename = text.dta, version = 7) When i open the file in stata instead of the label names all I get are the variable names, when i ask stata to describe the data. I am hoping someone can suggest ways in which i can export the label names more effectively! thanks. Arnab - Ph.D. Candidate RAND Graduate School Santa Monica __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Generic Function
Here is a simple example using S3 classes. We define a generic function myday. It dispaches, i.e. calls, a function whose name is myday followed by a dot followed by the class of the first argument to myday. After defining myday, define two functions for it to dispatch: myday.POSIXct and myday.numeric. # generic function myday - function(x, ...) UseMethod(myday) # if first argument is of class POSIXct then UseMethod calls this: myday.POSIXct - function(dat) as.POSIXlt(dat)$mday # if first argument is of class numeric then UseMethod calls this: myday.numeric - function(x) x # Here is how it would be called: myday(20) # causes myday.numeric to be dispached. Returns 20. myday(Sys.time()) # myday.POSIXct dispatched. Returns 3 on Nov 3rd. # We can also query what methods are available: methods(myday) # returns vector c(myday.POSIXct,myday.numeric) --- Date: 03 Nov 2003 17:28:22 -0500 From: Arend P. van der Veen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R] Generic Function Hi, How to I write a generate function that is specific to the class of the argument itself ? For example, I created a data.frame that contains results of an analysis. I would like to write a special plot function with the following usage plot(data.frame) I have been looking through the documentation but have not found anything to show me how to do this. Any help would be greatly appreciated. Thanks in advance, Arend van der Veen ___ No banners. No pop-ups. No kidding. Introducing My Way - http://www.myway.com __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Using _ in names?
I work with data bases that routinely use the underscore, _, as part of names. I've seen discussion on this list of possibly allowing that in a future release of R. How far are we away from that? I got the following from R 1.8.0 under Windows 2000: A_1 Error: syntax error A_B - 1 Error: syntax error A_B - 1 DF - data.frame(A_B=1) Error: syntax error DF - data.frame(A_B=1) DF A.B 1 1 names(DF) - A_B DF A_B 1 1 lm(A_B~1, DF) Error in terms.formula(formula, data = data) : invalid term in model formula Thanks for your help, Spencer Graves __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] write.dta and handling labels
On Tue, 4 Nov 2003, Arnab mukherji wrote: Hello, I need to write out a data matrix as a STATA 7 file and this happens perfectly with write.dta(), except I cannot seem to export the labelnames to Stata. So far I have tried the following: # X is the data matrix that is to be exported attributes(X)$var.labels - c(apple, banana, cat) write(X, filename = text.dta, version = 7) It's not clear whether you want value labels or variable labels. Variable labels don't get exported to stata, but factor levels do get exported as value labels. Eg data(esoph) write.dta(esoph, file=esoph.dta,version=7) -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Using _ in names?
On Mon, 3 Nov 2003, Spencer Graves wrote: I work with data bases that routinely use the underscore, _, as part of names. I've seen discussion on this list of possibly allowing that in a future release of R. How far are we away from that? About five months. -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help