Re: [R] D(dnorm...)?
G'day Spencer, SG == Spencer Graves [EMAIL PROTECTED] writes: SG I'm not qualified to make this suggestion since I'm incapable SG of turning it into reality, [...] This statement applies to me too, nevertheless I would like to point out the following GPL library: http://www.gnu.org/software/libmatheval/ I am wondering since some time how hard it would be to incorporate that library into R and let it provide symbolic differentiation capabilities for R. Cheers, Berwin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] [R-SIG-Mac] Hist for different levels of a factor
Hi On 26 Jan 2006 at 8:36, stefano iacus wrote: From: stefano iacus [EMAIL PROTECTED] Date sent: Thu, 26 Jan 2006 08:36:49 +0100 To: Sylvain Charlat [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch, r-sig-mac r-sig-mac@stat.math.ethz.ch Subject:Re: [R] [R-SIG-Mac] Hist for different levels of a factor The list of your interest is R-help not R-sig-mac stefano Il giorno 26/gen/06, alle ore 01:20, Sylvain Charlat ha scritto: Hi, Is there any simple way to get histogram for different levels of factor? Say you have the following data set: Island Sp.diam Moorea 1.21 Moorea 1.27 Moorea 1.28 Moorea 1.22 Moorea 1.28 Rurutu 1.5 Rurutu 1.67 Rurutu 1.75 Rurutu 1.55 Rurutu 1.7 Rurutu 1.55 Rurutu 1.59 Rurutu 1.66 Rurutu 1.7 Is there anything better than: hist(Sp.diam[factor(Island)==Moorea],main=Island=Moorea) It depends on how you want histograms to be plotted. e.g. library(lattice) histogram(~Sp.diam|Island) is one possibility HTH Petr followed by hist(Sp.diam[factor(Island)==Rurutu],main=Island=Rurutu) Sorry for this very stupid and basic question... Thanks for any help, Sylvain. --- Sylvain Charlat [EMAIL PROTECTED] / [EMAIL PROTECTED] http://www.ucl.ac.uk/~ucbtghu/Sylvain.htm - Department of Biology, University College London 4 Stephenson Way, London, NW1 2HE, UK - Fieldwork address: Gump Station, University of California Berkeley BP 244 Maharepa, 98728 Moorea, French Polynesia - Phone (Moorea): (+689) 56 43 97 or 26 90 18 or 56 52 87 - Fax (Moorea): (+689) 56 32 72 - Phone / Fax (London): (+44)20 76795072 / +(44) 20 76795052 --- __ _ Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com ___ R-SIG-Mac mailing list R-SIG-Mac@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-mac __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] What's wrong with JGR?
Hi all, I downloaded and installed JGR. Then when I tried to load the package in R console, it generated the following error message: local({pkg - select.list(sort(.packages(all.available = TRUE))) + if(nchar(pkg)) library(pkg, character.only=TRUE)}) Loading required package: rJava using Java Runtime version 1.5.0 using JAVA_HOME = C:\Program Files\Java\jre1.5.0_01 Loading required package: JavaGD using Java Runtime version 1.5.0 using JAVA_HOME = C:\Program Files\Java\jre1.5.0_01 Error in .jcall(org/rosuda/JGR/JGR, V, setRHome, as.character(R.home())) : RcallStaticMethod: cannot find specified class Error in library(pkg, character.only = TRUE) : .First.lib failed for 'JGR' What's wrong? Thanks a lot! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] What's wrong with Rcmdr?
Hi all, I successfully installed Rcmdr. And I type library(Rcmdr), nothing happened; or if I select menu item load package and select Rcmdr, still nothing happened... Why didn't Rcmdr start? Very strangely, if I close the R console and restart R console, every first time I load Rcmdr, it starts! But not second, third time... What's wrong with it? Thanks a lot! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] What's wrong with Rcmdr?
Try using Commander() but, obviously, the first time. HIH, Ste On Thu, Jan 26, 2006 at 01:11:23AM -0800, Michael wrote: MichaelHi all, Michael MichaelI successfully installed Rcmdr. And I type library(Rcmdr), nothing Michaelhappened; Michael Michaelor if I select menu item load package and select Rcmdr, still nothing Michaelhappened... Michael MichaelWhy didn't Rcmdr start? Michael MichaelVery strangely, if I close the R console and restart R console, every first Michaeltime I load Rcmdr, it starts! But not second, third time... Michael MichaelWhat's wrong with it? Michael MichaelThanks a lot! Michael MichaelMichael. Michael Michael [[alternative HTML version deleted]] Michael Michael__ MichaelR-help@stat.math.ethz.ch mailing list Michaelhttps://stat.ethz.ch/mailman/listinfo/r-help MichaelPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] What's wrong with Rcmdr?
I am afraid that you must be a little bit more verbose on your problem. You do not provide enough information to spot your problem. Best, Philippe Grosjean Michael wrote: Hi all, I successfully installed Rcmdr. And I type library(Rcmdr), nothing happened; or if I select menu item load package and select Rcmdr, still nothing happened... Why didn't Rcmdr start? Very strangely, if I close the R console and restart R console, every first time I load Rcmdr, it starts! But not second, third time... What's wrong with it? Thanks a lot! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] What's wrong with Rcmdr?
Commander() Error: couldn't find function Commander On 1/26/06, Stefano Calza [EMAIL PROTECTED] wrote: Try using Commander() but, obviously, the first time. HIH, Ste On Thu, Jan 26, 2006 at 01:11:23AM -0800, Michael wrote: MichaelHi all, Michael MichaelI successfully installed Rcmdr. And I type library(Rcmdr), nothing Michaelhappened; Michael Michaelor if I select menu item load package and select Rcmdr, still nothing Michaelhappened... Michael MichaelWhy didn't Rcmdr start? Michael MichaelVery strangely, if I close the R console and restart R console, every first Michaeltime I load Rcmdr, it starts! But not second, third time... Michael MichaelWhat's wrong with it? Michael MichaelThanks a lot! Michael MichaelMichael. Michael Michael [[alternative HTML version deleted]] Michael Michael__ MichaelR-help@stat.math.ethz.ch mailing list Michaelhttps://stat.ethz.ch/mailman/listinfo/r-help MichaelPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: reducing learning curves?
Hi all, Are there any R addon/pluggins with the following feature: (1) command history? even stores the command history many days ago? Like Matlab does? (2) online help? for example, as I see it, the Rcmdr is a good companian for a newbie like me who just touched R for 1.5 days. I can use Rcmdr to guide me to learn the commands to use for data analysis. However, Rcmdr does not have online help reference for R commands. For example, I saw the command abline and I want to know how to use it, I have to copy/type it in R-console, and do ?abline things, so that I can obtain help. But this is troublesome, does any editor offer online-help for commands, so I just need to hover my mouse on abline and then press F1 key then a help window will open automatically? Thanks a lot! On 1/25/06, Michael [EMAIL PROTECTED] wrote: Hi all, I am really new to the R language. I am a long time Matlab and C++ user and I was forced to learn R because I am taking a statistics class. I am seeking to reduce the learning curve to as smooth as possible. Are there any addon/plug-in features that can reduce the learning curve, for example, the following features can be very helpful for new learners: 1. Matlab-like command line auto-completion: Matlab has huge amount of command and nobody is able to remember them off the head. So a nice feature of Matlab command line is that I just need to type the first a few letters and then I press TAB key, there will be a list of possible commands popping up so I just need to select one. This helps a lot in terms of learning for new comers. A more advanced command auto-completion is Visual C++-like, which is implemented in program editor. It helps a lot while doing programming; 2. A good IDE editor with embedded inline debugger: can be as good as VC++, but also can be as simple as Matlab's debugger, which can breakpoint and trace line-by-line... the editor can do syntax correction, syntax check, syntax highlighting, code formatting, etc. Could you please recommend some good addon/plugins that have the above features? Could you please also suggest some tips/tools/tricks that can help me reduce the learning curve? Thank you very much! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] What's wrong with Rcmdr?
Ok, let's see: 1) library(Rcmdr) - RCommander should start (you say it does) 2) Close R Commander but NOT R. 3) To restart RCommander use Commander() Is this what you are looking for? HIH, Ste On Thu, Jan 26, 2006 at 01:32:01AM -0800, Michael wrote: Michael Commander() MichaelError: couldn't find function Commander Michael Michael MichaelOn 1/26/06, Stefano Calza [EMAIL PROTECTED] wrote: Michael Michael Try using Michael Michael Commander() Michael Michael but, obviously, the first time. Michael Michael HIH, Michael Ste Michael Michael On Thu, Jan 26, 2006 at 01:11:23AM -0800, Michael wrote: Michael MichaelHi all, Michael Michael Michael MichaelI successfully installed Rcmdr. And I type library(Rcmdr), Michael nothing Michael Michaelhappened; Michael Michael Michael Michaelor if I select menu item load package and select Rcmdr, still Michael nothing Michael Michaelhappened... Michael Michael Michael MichaelWhy didn't Rcmdr start? Michael Michael Michael MichaelVery strangely, if I close the R console and restart R console, Michael every first Michael Michaeltime I load Rcmdr, it starts! But not second, third time... Michael Michael Michael MichaelWhat's wrong with it? Michael Michael Michael MichaelThanks a lot! Michael Michael Michael MichaelMichael. Michael Michael Michael Michael [[alternative HTML version deleted]] Michael Michael Michael Michael__ Michael MichaelR-help@stat.math.ethz.ch mailing list Michael Michaelhttps://stat.ethz.ch/mailman/listinfo/r-help Michael MichaelPLEASE do read the posting guide! Michael http://www.R-project.org/posting-guide.html Michael Michael __ Michael R-help@stat.math.ethz.ch mailing list Michael https://stat.ethz.ch/mailman/listinfo/r-help Michael PLEASE do read the posting guide! Michael http://www.R-project.org/posting-guide.html Michael Michael Michael [[alternative HTML version deleted]] Michael Michael__ MichaelR-help@stat.math.ethz.ch mailing list Michaelhttps://stat.ethz.ch/mailman/listinfo/r-help MichaelPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] gam
I'm new to both R and to this list and would like to get advice on how to build generalized additive models in R. Based on the description of gam, which I found on the R website, I specified the following model: model1-gam(ST~s(MOWST1),family=binomial,data=strikes.S), in which ST is my binary response variable and MOWST1 is a categorical independent variable. I get the following error message: Error in smooth.construct.tp.smooth.spec(object, data, knots) : NA/NaN/Inf in foreign function call (arg 1) - I guess this should maybe get trapped a bit earlier, so that you get a more informative warning. - The basic problem is that gams are based around sums of smooth functions of covariates. For the notion of smooth to be meaningful the covariates have to live in a space where you have at least a notion of distance between the covariates, since in some loose sense `smooth' means that f(x_1) must be close to f(x_2) if x_1 and x_2 are close. For factors you doen't generally have any notion of distance between the levels of a factor. (e.g. if a factor has levels brick, sky and purple, how far is it from brick to purple?) - Even if a factor is naturally ordered (e.g. small, medium, large), you would still have to decide on how to measure smoothness/wiggliness of a function of the factor. For this reason, I think that it is actually better to explicitly convert levels of an ordered factor into numeric values on a scale that you think is appropriate, before using the ordered factor as the covariate in a gam. In this way it's usually fairly easy to get one of the mgcv built in smoother classes to use the notion of smoothness that you think is appropriate: if not then it's not too hard to add a smoother class, following the template provided in ?p.spline (actually you could use this template to write a smoother class for ordered catagorical predictors). best, Simon __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] list entries file into a list
Hi all, I have a file of this kind: entry0001:AB0032,CF32134,DF34334 entry0002:AB0033 entry0003:AB0032,CF32134,DF34334,DD343434,DD34222 entry0004:AB0032,CF32134 And I would like to read it into something like a hash, so that I can then loop over it by keys and values. I wonder which would be the best way to do that in R? Thanks, Albert. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reducing learning curves?
Michael wrote: Hi all, Are there any R addon/pluggins with the following feature: (1) command history? even stores the command history many days ago? Like Matlab does? See ?history, and also, menu entries File - Load/Save history... in Rgui (you use R under windows, isn't it?). also, if you answer Yes at the question Save workspace image? when you quit R, the history of commands is saved and resored next time you start R from the same directory. (2) online help? for example, as I see it, the Rcmdr is a good companian for a newbie like me who just touched R for 1.5 days. I can use Rcmdr to guide me to learn the commands to use for data analysis. However, Rcmdr does not have online help reference for R commands. For example, I saw the command abline and I want to know how to use it, I have to copy/type it in R-console, and do ?abline things, so that I can obtain help. But this is troublesome, does any editor offer online-help for commands, so I just need to hover my mouse on abline and then press F1 key then a help window will open automatically? Well, it is not much work to type ?abline However, if you want a button that you can click to do so, then look at http://www.sciviews.org/Tinn-R. That editor is definitely for you! Best, Philippe Grosjean Thanks a lot! On 1/25/06, Michael [EMAIL PROTECTED] wrote: Hi all, I am really new to the R language. I am a long time Matlab and C++ user and I was forced to learn R because I am taking a statistics class. I am seeking to reduce the learning curve to as smooth as possible. Are there any addon/plug-in features that can reduce the learning curve, for example, the following features can be very helpful for new learners: 1. Matlab-like command line auto-completion: Matlab has huge amount of command and nobody is able to remember them off the head. So a nice feature of Matlab command line is that I just need to type the first a few letters and then I press TAB key, there will be a list of possible commands popping up so I just need to select one. This helps a lot in terms of learning for new comers. A more advanced command auto-completion is Visual C++-like, which is implemented in program editor. It helps a lot while doing programming; 2. A good IDE editor with embedded inline debugger: can be as good as VC++, but also can be as simple as Matlab's debugger, which can breakpoint and trace line-by-line... the editor can do syntax correction, syntax check, syntax highlighting, code formatting, etc. Could you please recommend some good addon/plugins that have the above features? Could you please also suggest some tips/tools/tricks that can help me reduce the learning curve? Thank you very much! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] What's wrong with JGR?
Which R version and which os is yours? For me it works fine. Lade nötiges Paket: grDevices using Java Runtime version 1.5.0 using JAVA_HOME = C:\develope\jre Lade nötiges Paket: rJava Lade nötiges Paket: methods using Java Runtime version 1.5.0 using JAVA_HOME = C:\develope\jre R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 2.1 $year [1] 2005 $month [1] 12 $day [1] 20 $svn rev [1] 36812 $language [1] R Hi all, I downloaded and installed JGR. Then when I tried to load the package in R console, it generated the following error message: local({pkg - select.list(sort(.packages(all.available = TRUE))) + if(nchar(pkg)) library(pkg, character.only=TRUE)}) Loading required package: rJava using Java Runtime version 1.5.0 using JAVA_HOME = C:\Program Files\Java\jre1.5.0_01 Loading required package: JavaGD using Java Runtime version 1.5.0 using JAVA_HOME = C:\Program Files\Java\jre1.5.0_01 Error in .jcall(org/rosuda/JGR/JGR, V, setRHome, as.character(R.home())) : RcallStaticMethod: cannot find specified class Error in library(pkg, character.only = TRUE) : .First.lib failed for 'JGR' What's wrong? Thanks a lot! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reducing learning curves?
On 1/25/06, Michael [EMAIL PROTECTED] wrote: Hi all, I am really new to the R language. I am a long time Matlab and C++ user and I was forced to learn R because I am taking a statistics class. I am seeking to reduce the learning curve to as smooth as possible. Are there any addon/plug-in features that can reduce the learning curve, for example, the following features can be very helpful for new learners: 1. Matlab-like command line auto-completion: Matlab has huge amount of command and nobody is able to remember them off the head. So a nice feature You can use command name auto-completion if you use emacs and the ess mode for running R. (I don't whether this was mentioned earlier (not following the thread closely), sorry if it was.) 2. A good IDE editor with embedded inline debugger: can be as good as VC++, but also can be as simple as Matlab's debugger, which can breakpoint and trace line-by-line... the editor can do syntax correction, syntax check, syntax highlighting, code formatting, etc. emacs and ess mode does that for you as well, i'm not sure about the debugger, but syntax highlight and indentation work great. For debugging try ?debug. Could you please recommend some good addon/plugins that have the above features? Could you please also suggest some tips/tools/tricks that can help me reduce the learning curve? Reading 'An Introduction to R' helps a lot. Not about editors though, and this is right i think. Personally i hate ide's with built in editors, because you have to learn all of them, and they behave just a bit differently to annoy you. Using a single editor for all your editing tasks (writing mail, html, R, C++ and matlab code) on the other hand can greatly increase productivity. Just my 2 cents. Gabor Thank you very much! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] persp() and character labels for axis
I upgraded and it still does not work. I want something like this for 3d-persp() plots: days=c(2006-01-23,2006-01-24,2006-01-25,2006-01-26,2006-01-27,2006-01-28) sq=(1:6)^2 plot(x=as.Date(days, format=%Y-%m-%d),y=sq, type=l, main=What I learn about R, sub=R.version.string) sq3d=matrix(nrow = 4, ncol = 6) for (i in 1:4) { sq3d[i,]=sq+i } persp(x=1:4,y=1:6,z=sq3d,theta = 30, phi = 30, expand = 0.5, col = lightblue) (but y=days) Thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to make two side-by side trellis plots same size
Dear Latticers, I want to position two trellis plots of different forms side-by-side. The plot types are slightly different, aspect=1 required, but panels should look the same in both plots. Current workaround uses a guessed factor. Any way to improve this? Dieter library(lattice) n1 = 20 # I cannot rbind df1 and df2, because the x-dimensions are # different and must be scaled individually df1 = data.frame(y=rnorm(4*n1),x=rep(1:n1,4), facA=rep(c(A,B),each=2*n1),facB=rep(c(C,D),each=n1)) # I add a dummy facB here, to make sure panels have same structure df2 = data.frame(y=rnorm(2*n1),z=rep(100*(1:n1),2), facA=rep(c(A,B),each=n1),facB=C) # Note: aspect = 1 is required p1 = xyplot(y~x|facA*facB,data=df1,main=Plot1,aspect=1, between=list(x=2)) p2 = xyplot(y~z|facA*facB,data=df2,main=Plot2,aspect=1,layout=c(1,2)) wi = 0.61 # this is trial-and-error print(p1,position=c(0,0,wi,1),more=T) print(p2,position=c(wi,0,1,1),more=F) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Automatic differentiation (was: Re: D(dnorm...)?)
On Thursday 26 January 2006 07:56, [EMAIL PROTECTED] wrote: While symbolic computation is handy, I actually think a more pressing addition to R is some kind of automatic differentiation facility, particularly 'reverse mode' AD, which can be spectacular. There are free tools available for it as well, though I don't know how well developed they are. See: http://www-unix.mcs.anl.gov/autodiff/AD_Tools/ I admit this is not quite the same thing, but for statistical computations this is, in my experience, the key thing you need. (Well, for frequentist estimation at any rate...) There are commercial systems that use this idea already, of course. Two that I know of are 'ADMB' (and its associated 'ADMB-RE' for random effects) estimation and of course the 'S-NUOPT' module for another system not unlike R. ADMB is, frankly, difficult to use but it performs so well and so quickly once you get it going nothing else seems to come close to it. I has become almost a de-facto standard at the higher end of the fishery stock assessment game, for example, where they are always fitting huge, highly complex and very non-linear models. Bill V. I think AD Model Builder is mainly used for fisheries assessment in North America and, it seems, also in Australia. In Europe, R is still the de-facto standard for fisheries assessment. However, I'd like to support Bill Venables' suggestion. I've been resisting to adopt AD model builder, or to start using again that other system not unlike R, mainly because of the licence price and because I really like R as a tool for almost everything. But an AD function would really make a huge difference for my work. There are free tools that can be used to perform AD on C or Fortran code (e.g. http://www.autodiff.org). One of the difficulties to use them with R is the need to translate the R code into C of Fortran code, but probably there are many other problems that I'm not able to see. Alberto -- Alberto G. Murta [EMAIL PROTECTED] National Institute of Agriculture and Fisheries Research Avenida de Brasilia 1449-006 Lisboa Portugal Tel: +351 213027120 | Fax: +351 213015948 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] construct a bundle, subdirs do not exist?
Notice the trailing commas. The Contains: field is space-delimited (see the example) and I surmise you used commas. You also seem to have a typo: 'cwhool' not 'cwhtool'. On Thu, 26 Jan 2006, Christian Hoffmann wrote: Hi, Sorry to bother, but I checked around and did not succed creating a bundle from six existing packages (which are checkable, installable, etc. individually). I carefully followed the procedure given in ch. 1.1.5 Package bundles. However, I am getting [EMAIL PROTECTED]:~/R/Sources R CMD check cwhmisc * checking for working latex ... OK * using log directory '/home/woodstock/hoffmann/R/Sources/cwhmisc.Rcheck' * using R version 2.2.1, 2005-12-20 * checking for file 'cwhmisc/DESCRIPTION' ... OK * this is package '' version '1.0.0' * checking if this is a source package ... OK /usr/local/lib/R/bin/INSTALL: /home/woodstock/hoffmann/R/Sources/cwhmisc/cwhmath,: does not exist /usr/local/lib/R/bin/INSTALL: /home/woodstock/hoffmann/R/Sources/cwhmisc/cwhstring,: does not exist /usr/local/lib/R/bin/INSTALL: /home/woodstock/hoffmann/R/Sources/cwhmisc/cwhstat,: does not exist /usr/local/lib/R/bin/INSTALL: /home/woodstock/hoffmann/R/Sources/cwhmisc/cwhplot,: does not exist /usr/local/lib/R/bin/INSTALL: /home/woodstock/hoffmann/R/Sources/cwhmisc/cwhprint,: does not exist /usr/local/lib/R/bin/INSTALL: /home/woodstock/hoffmann/R/Sources/cwhmisc/cwhool: does not exist /usr/local/lib/R/bin/INSTALL: null directory ERROR Installation failed. *But I have* [EMAIL PROTECTED]:~/R/Sources/cwhmisc ls -lFa total 144 drwxr-xr-x 8 hoffmann wsl 1024 Jan 26 07:51 ./ drwxrwxrwx 26 hoffmann wsl 3072 Jan 26 08:29 ../ -rwxr--r-- 1 hoffmann wsl 430 Jan 26 07:51 DESCRIPTION* drwxr-xr-x 4 hoffmann wsl 1024 Jan 26 07:03 cwhmath/ drwxr-xr-x 5 hoffmann wsl 1024 Jan 26 07:04 cwhplot/ drwxr-xr-x 4 hoffmann wsl 1024 Jan 26 07:04 cwhprint/ drwxr-xr-x 4 hoffmann wsl 1024 Jan 26 07:04 cwhstat/ drwxr-xr-x 4 hoffmann wsl 1024 Jan 26 07:04 cwhstring/ drwxr-xr-x 4 hoffmann wsl 1024 Jan 26 07:13 cwhtool/ i.e. the subdirectories are *present*! And the packages with their [EMAIL PROTECTED]:~/1Sources/cwhmisc/cwhmath ls -lFa total 96 drwxr-xr-x 4 hoffmann wsl 1024 Jan 26 07:03 ./ drwxr-xr-x 8 hoffmann wsl 1024 Jan 26 07:51 ../ -rwxr--r-- 1 hoffmann wsl 142 Jan 25 16:24 DESCRIPTION.in* -rwxr--r-- 1 hoffmann wsl 1121 Jan 20 14:58 INDEX* drwxr-xr-x 3 hoffmann wsl 1024 Jan 25 16:21 R/ drwxr-xr-x 2 hoffmann wsl 1024 Jan 25 16:21 man/ [EMAIL PROTECTED]:~/1Sources/cwhmisc/cwhmath cat DESCRIPTION.in Package: CWHmath Description: Miscellaneous mathematical functions for general use Title: Miscellaneous mathematical functions for general use are fully present. Is this information enough to find the flaw in my bundle construction? Thank for help Christian -- Dr. Christian W. Hoffmann, Swiss Federal Research Institute WSL Mathematics + Statistical Computing Zuercherstrasse 111 CH-8903 Birmensdorf, Switzerland Tel +41-44-7392-277 (office) -111(exchange) Fax +41-44-7392-215 (fax) [EMAIL PROTECTED] http://www.wsl.ch/staff/christian.hoffmann International Conference 5.-7.6.2006 Ekaterinburg Russia Climate changes and their impact on boreal and temperate forests http://ecoinf.uran.ru/conference/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] persp() and character labels for axis
persp(x=1:4,y=1:6,z=sq3d,theta = 30, phi = 30, expand = 0.5, col = lightblue) (but y=days) of course it should be something like persp(y=as.Date(days, format=%Y-%m-%d),x=1:4,z=sq3d, theta=30, phi=30, expand=0.5, ticktype=detailed, col=seagreen) But this does not what I expected (after my experience with plot above). ticktype=detailed is better, but by far not the solution. How do I add date-lables to the x-Axis of a persp() plot? Who can help? Thanks... Thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reducing learning curves?
Hi On 26 Jan 2006 at 11:15, Philippe Grosjean wrote: Date sent: Thu, 26 Jan 2006 11:15:08 +0100 From: Philippe Grosjean [EMAIL PROTECTED] Organization: SciViews UMH - EcoNum To: Michael [EMAIL PROTECTED] Copies to: R-help@stat.math.ethz.ch Subject:Re: [R] reducing learning curves? Michael wrote: Hi all, Are there any R addon/pluggins with the following feature: (1) command history? even stores the command history many days ago? Like Matlab does? See ?history, and also, menu entries File - Load/Save history... in Rgui (you use R under windows, isn't it?). also, if you answer Yes at the question Save workspace image? when you quit R, the history of commands is saved and resored next time you start R from the same directory. Beware that .Rhistory file has not unlimited number of commands, you can see only about 500 lines in default setting, however you can modify it. (2) online help? for example, as I see it, the Rcmdr is a good companian for a newbie like me who just touched R for 1.5 days. I can use Rcmdr to guide me to learn the commands to use for data analysis. However, Rcmdr does not have online help reference for R commands. For example, I saw the command abline and I want to know how to use it, I have to copy/type it in R-console, and do ?abline things, so that I can obtain help. But this is troublesome, does any editor offer online-help for commands, so I just need to hover my mouse on abline and then press F1 key then a help window will open automatically? Beware of mouse elbow when perusing mouse too much. If you want interactive help just open HTML help pages with your favourite browser. Cheers Petr PS. It is good to have a copy of Paul Johnson's Rtips somewhere near when you start. Basic stuff and howtodo's is covered there. Well, it is not much work to type ?abline However, if you want a button that you can click to do so, then look at http://www.sciviews.org/Tinn-R. That editor is definitely for you! Best, Philippe Grosjean Thanks a lot! On 1/25/06, Michael [EMAIL PROTECTED] wrote: Hi all, I am really new to the R language. I am a long time Matlab and C++ user and I was forced to learn R because I am taking a statistics class. I am seeking to reduce the learning curve to as smooth as possible. Are there any addon/plug-in features that can reduce the learning curve, for example, the following features can be very helpful for new learners: 1. Matlab-like command line auto-completion: Matlab has huge amount of command and nobody is able to remember them off the head. So a nice feature of Matlab command line is that I just need to type the first a few letters and then I press TAB key, there will be a list of possible commands popping up so I just need to select one. This helps a lot in terms of learning for new comers. A more advanced command auto-completion is Visual C++-like, which is implemented in program editor. It helps a lot while doing programming; 2. A good IDE editor with embedded inline debugger: can be as good as VC++, but also can be as simple as Matlab's debugger, which can breakpoint and trace line-by-line... the editor can do syntax correction, syntax check, syntax highlighting, code formatting, etc. Could you please recommend some good addon/plugins that have the above features? Could you please also suggest some tips/tools/tricks that can help me reduce the learning curve? Thank you very much! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] list entries file into a list
The following might be what you want (replace clipboard with your filename): mylist - strsplit(readLines(clipboard), :) nm - sapply(mylist, [, 1) mylist - lapply(mylist, [, -1) names(mylist) - nm mylist - lapply(mylist, function(s) strsplit(s, ,)[[1]]) mylist $entry0001 [1] AB0032 CF32134 DF34334 $entry0002 [1] AB0033 $entry0003 [1] AB0032 CF32134 DF34334 DD343434 DD34222 $entry0004 [1] AB0032 CF32134 Andy From: Albert Vilella Hi all, I have a file of this kind: entry0001:AB0032,CF32134,DF34334 entry0002:AB0033 entry0003:AB0032,CF32134,DF34334,DD343434,DD34222 entry0004:AB0032,CF32134 And I would like to read it into something like a hash, so that I can then loop over it by keys and values. I wonder which would be the best way to do that in R? Thanks, Albert. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] efficiency with %*%
Hi, x and y are (numeric) vectors. I wonder if one of the following is more efficient than the other: x%*%y or sum(x*y) ? Thanks, Dimitri Szerman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] efficiency with %*%
[EMAIL PROTECTED] wrote: Hi, x and y are (numeric) vectors. I wonder if one of the following is more efficient than the other: x%*%y or sum(x*y) ? I'd try x - rnorm(100) y - rnorm(100) system.time(x%*%y) system.time(sum(x*y)) and finally (hint, hint!): system.time(crossprod(x, y)) Uwe Ligges Thanks, Dimitri Szerman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] maximizing available memory under windows XP
I have always been using ebitbin to set the 3GB switch in the windows binary, but version 2.2.1 has this set as default (which I verified using dumpbin). However, when I generate junk data to fill up my memory and read the memory usage using gc(), it seems that I am not getting as good results with 2.2.1 patched as I was with 2.2.0 after I edited the header. Under R 2.2.0 I was able to use over 2GB and with R 2.2.1 patched I can access only 1GB. Anyone have any suggestions that I can try. My machine has 4GB and I have modified the Boot.ini file. Thanks, Roger Here is the gc() on 2.2.1 patched: gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 252021 6.8 467875 12.5379294 10.2 Vcells 71097226 542.5 140857919 1074.7 140597245 1072.7 Here is the gc() output on 2.2.0 after I edited the header: gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells174118 4.7 359.4359.4 Vcells 130065529 992.4 257820332 1967.1 257565551 1965.1 Here is the code that I used to fill my memory (nothing fancy): a - diag(1000) b -a for (i in 1:100) { a- diag(1000) b - rbind(b,a) } gc() [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] efficiency with %*%
Excellent, but... x - rnorm(100) y - rnorm(100) system.time(x%*%y) [1] 0.03 0.00 0.03 NA NA system.time(sum(x*y)) [1] 0.05 0.00 0.04 NA NA system.time(crossprod(x, y)) [1] 0 0 0 NA NA So, to paraphrase a well-known contributor on this mailing list: Excellent! So, what did you decided to do during the next 30 milliseconds you will save by using crossprod() instead of x%*%y? (joke) Best, Philippe Grosjean P.S.: Uwe, perhaps you should consider buying a faster computer, isn't it? :-() Uwe Ligges wrote: [EMAIL PROTECTED] wrote: Hi, x and y are (numeric) vectors. I wonder if one of the following is more efficient than the other: x%*%y or sum(x*y) ? I'd try x - rnorm(100) y - rnorm(100) system.time(x%*%y) system.time(sum(x*y)) and finally (hint, hint!): system.time(crossprod(x, y)) Uwe Ligges Thanks, Dimitri Szerman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] efficiency with %*%
Philippe Grosjean wrote: Excellent, but... x - rnorm(100) y - rnorm(100) system.time(x%*%y) [1] 0.03 0.00 0.03 NA NA system.time(sum(x*y)) [1] 0.05 0.00 0.04 NA NA system.time(crossprod(x, y)) [1] 0 0 0 NA NA So, to paraphrase a well-known contributor on this mailing list: Excellent! So, what did you decided to do during the next 30 milliseconds you will save by using crossprod() instead of x%*%y? (joke) Best, Philippe Grosjean P.S.: Uwe, perhaps you should consider buying a faster computer, isn't it? :-() Well, I use R, you know. It is even fast enough for my 5 year old laptop. For your super computer, please replace 1e6 by 1e8 in the example above. ;-) Uwe Uwe Ligges wrote: [EMAIL PROTECTED] wrote: Hi, x and y are (numeric) vectors. I wonder if one of the following is more efficient than the other: x%*%y or sum(x*y) ? I'd try x - rnorm(100) y - rnorm(100) system.time(x%*%y) system.time(sum(x*y)) and finally (hint, hint!): system.time(crossprod(x, y)) Uwe Ligges Thanks, Dimitri Szerman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to make two side-by side trellis plots same size
On 1/26/06, Dieter Menne [EMAIL PROTECTED] wrote: Dear Latticers, I want to position two trellis plots of different forms side-by-side. The plot types are slightly different, aspect=1 required, but panels should look the same in both plots. Current workaround uses a guessed factor. Any way to improve this? Dieter library(lattice) n1 = 20 # I cannot rbind df1 and df2, because the x-dimensions are # different and must be scaled individually If that's the only reason, I would suggest rbind-ing them and then use scales = list(x = free) If you want the first two columns to have the same x-limits, you can specify xlim = list(c(0,25), c(0,25), c(0, 2500)) etc. Otherwise, if you want the panels to have the same physical dimensions, look at the panel.width and panel.height arguments in ?print.trellis. I can't think of any other way of guaranteeing it. Deepayan df1 = data.frame(y=rnorm(4*n1),x=rep(1:n1,4), facA=rep(c(A,B),each=2*n1),facB=rep(c(C,D),each=n1)) # I add a dummy facB here, to make sure panels have same structure df2 = data.frame(y=rnorm(2*n1),z=rep(100*(1:n1),2), facA=rep(c(A,B),each=n1),facB=C) # Note: aspect = 1 is required p1 = xyplot(y~x|facA*facB,data=df1,main=Plot1,aspect=1, between=list(x=2)) p2 = xyplot(y~z|facA*facB,data=df2,main=Plot2,aspect=1,layout=c(1,2)) wi = 0.61 # this is trial-and-error print(p1,position=c(0,0,wi,1),more=T) print(p2,position=c(wi,0,1,1),more=F) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] What's wrong with Rcmdr?
Dear Michael, To elaborate slightly: You can't load the same package twice in an R session. As mentioned, used Commander() to restart the Rcmdr GUI. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefano Calza Sent: Thursday, January 26, 2006 4:23 AM To: r-help@stat.math.ethz.ch Subject: Re: [R] What's wrong with Rcmdr? Try using Commander() but, obviously, the first time. HIH, Ste On Thu, Jan 26, 2006 at 01:11:23AM -0800, Michael wrote: MichaelHi all, Michael MichaelI successfully installed Rcmdr. And I type library(Rcmdr), nothing Michaelhappened; Michael Michaelor if I select menu item load package and select Rcmdr, still nothing Michaelhappened... Michael MichaelWhy didn't Rcmdr start? Michael MichaelVery strangely, if I close the R console and restart R console, every first Michaeltime I load Rcmdr, it starts! But not second, third time... Michael MichaelWhat's wrong with it? Michael MichaelThanks a lot! Michael MichaelMichael. Michael Michael [[alternative HTML version deleted]] Michael Michael__ MichaelR-help@stat.math.ethz.ch mailing list Michaelhttps://stat.ethz.ch/mailman/listinfo/r-help MichaelPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] maximizing available memory under windows XP
The problem is your test. You are trying to re-allocate large objects, and memory fragmentation will take its toll, and be almost random in its effects. Using the CRAN binary of 2.2.1 and for(i in 1:1000) assign(paste(r, i, sep=.), rnorm(1e6)) gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells1704804.6 359.4359.4 Vcells 253062963 1930.8 253513169 1934.2 253063937 1930.8 memory.size(max=T) [1] 2037137408 I was able to get close to address space limit on my laptop (which does not have the /3GB switch set (*in boot.ini*, not in the binary)). And that binary is marked: [d:/R/R-2.2.1/bin]% dumpbin /HEADERS Rterm.exe Microsoft (R) COFF Binary File Dumper Version 6.00.8447 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. Dump of file Rterm.exe PE signature found File Type: EXECUTABLE IMAGE FILE HEADER VALUES 14C machine (i386) 6 number of sections 43A80482 time date stamp Tue Dec 20 13:17:54 2005 0 file pointer to symbol table 0 number of symbols E0 size of optional header 32F characteristics Relocations stripped Executable Line numbers stripped Symbols stripped Application can handle large (2GB) addresses 32 bit word machine Debug information stripped On Thu, 26 Jan 2006, roger bos wrote: I have always been using ebitbin to set the 3GB switch in the windows binary, but version 2.2.1 has this set as default (which I verified using dumpbin). However, when I generate junk data to fill up my memory and read the memory usage using gc(), it seems that I am not getting as good results with 2.2.1 patched as I was with 2.2.0 after I edited the header. Under R 2.2.0 I was able to use over 2GB and with R 2.2.1 patched I can access only 1GB. Anyone have any suggestions that I can try. My machine has 4GB and I have modified the Boot.ini file. Thanks, Roger Here is the gc() on 2.2.1 patched: gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 252021 6.8 467875 12.5379294 10.2 Vcells 71097226 542.5 140857919 1074.7 140597245 1072.7 Here is the gc() output on 2.2.0 after I edited the header: gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells174118 4.7 359.4359.4 Vcells 130065529 992.4 257820332 1967.1 257565551 1965.1 Here is the code that I used to fill my memory (nothing fancy): a - diag(1000) b -a for (i in 1:100) { a- diag(1000) b - rbind(b,a) } gc() [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to make two side-by side trellis plots same size
Thanks, Deepayan Deepayan Sarkar deepayan.sarkar at gmail.com writes: If that's the only reason, I would suggest rbind-ing them and then use scales = list(x = free) I probably will go for this. If you want the first two columns to have the same x-limits, you can specify xlim = list(c(0,25), c(0,25), c(0, 2500)) etc. Otherwise, if you want the panels to have the same physical dimensions, look at the panel.width and panel.height arguments in ?print.trellis. I can't think of any other way of guaranteeing it. Documentation said that using panel.width with non-standard aspect (which must be 1) leads to undefined effects. Dieter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Using special characters
Dear R users I'm having problems in putting special characters (like á, ã, ç ) in my plots, as much in titles, as in axis names, as in legend...when I save them as a pdf document. They don't appear... I don't know if it is because I'm using a linux platform... The script is the following: library(grDevices) jpeg(file=Fronteira/FronteiraNova.jpeg, bg=white, quality=100,width = 600, height = 480) grafico.fe-function(varFA,retFA,varC,retC,covRF,retRF,varD,retD) { minx-min(100*sqrt(varFA),100*varC,100*sqrt(covRF[1,1]),100*sqrt(covRF[2,2]),100*sqrt(covRF[3,3]),100*sqrt(covRF[4,4]),100*varD) maxx-max(100*sqrt(varFA),100*varC,100*sqrt(covRF[1,1]),100*sqrt(covRF[2,2]),100*sqrt(covRF[3,3]),100*sqrt(covRF[4,4]),100*varD) miny-min(100*retFA,retC,retRF,retD) maxy-max(100*retFA,retC,retRF,retD) plot(100*sqrt(varFA),100*retFA,type=l,lwd=2,col=2,xlab=Risco %, ylab=Retorno % (anualizado), xlim=c(minx-0.01,maxx), ylim=c(miny,maxy),main=Fronteira Eficiente) points(100*varC,retC,pch=16,cex=0.6, col=3) points(100*sqrt(covRF[1,1]),retRF[1],pch=16,cex=0.6,col=4) points(100*sqrt(covRF[2,2]),retRF[2],pch=16,cex=0.6,col=5) points(100*sqrt(covRF[3,3]),retRF[3],pch=16,cex=0.6,col=6) points(100*sqrt(covRF[4,4]),retRF[4],pch=16,cex=0.6,col=7! ) points(100*varD,retD,pch=16,cex=0.6,col=1) legend(c(0.91,1.11),c(17.97,18.156),c(Fronteira Eficiente),lwd=2,cex=0.6, col=2) legend(0.93,18.13,c(Consolidado,Brad,AB,It,Uni,Ot),pch=16, bty=n, cex=0.6, col=c(3,4,5,6,7,1), ncol=1) } grafico.fe(varFA,retFA,varC,retC,covRF,retRF,varD,retD) dev.off() Do someome have a problem like this? Thanks Alexandra Almeida Alexandra R. Mendes de Almeida - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Automatic differentiation (was: Re: D(dnorm...)?)
Dear Alberto, There are fisheries people also in Europe using AD Model Builder (Denmark and England for instance), but you are probably right that it is more widespread in North America. There is also effort going on where people try to make assessment models written in ADMB callable from R. best regards, hans think AD Model Builder is mainly used for fisheries assessment in North America and, it seems, also in Australia. In Europe, R is still the de-facto standard for fisheries assessment. However, I'd like to support Bill Venables' suggestion. I've been resisting to adopt AD model builder, or to start using again that other system not unlike R, mainly because of the licence price and because I really like R as a tool for almost everything. But an AD function would really make a huge difference for my work. There are free tools that can be used to perform AD on C or Fortran code (e.g. http://www.autodiff.org). One of the difficulties to use them with R is the need to translate the R code into C of Fortran code, but probably there are many other problems that I'm not able to see. Alberto -- _ Hans Julius Skaug Department of Mathematics University of Bergen Johannes Brunsgate 12 5008 Bergen Norway __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to test robustness of correlation
Hi, Berton: thanks for getting back to me. I played around cor.rob(). Yes, I can get a robust correlation coefficient matrix based on mcd or mve outlier detection methods. I have two further questions: 1) How do I get a p value of the robust r? 2) What I mean by resampling is leave one out procedure, to get a confidence interval of r. Do you know if there is any package in R to do it? I suppose I could code it myself, but it is nice if there is already one. thanks. Yang Berton Gunter [EMAIL PROTECTED] 25-Jan-2006 15:57 To [EMAIL PROTECTED], r-help@stat.math.ethz.ch cc Subject RE: [R] how to test robustness of correlation check out cov.rob() in MASS (among others, I'm sure). The procedure is far more sophisticated than outlier removal or resampling (??). References are given in the docs. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, January 25, 2006 12:37 PM To: r-help@stat.math.ethz.ch Subject: [R] how to test robustness of correlation Hi, there: As you all know, correlation is not a very robust procedure. Sometimes correlation could be driven by a few outliers. There are a few ways to improve the robustness of correlation (pearson correlation), either by outlier removal procedure, or resampling technique. I am wondering if there is any R package or R code that have incorporated outlier removal or resampling procedure in calculating correlation coefficient. Your help is greatly appreciated. Thanks. Yang Yang Qiu Integrated Data Analysis [EMAIL PROTECTED] GlaxoSmithKline [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] efficiency with %*%
Perhaps you guys should try to benchmark that test on an nVidia GPU? ;-) Best regards, Marc On Thu, 2006-01-26 at 15:55 +0100, Uwe Ligges wrote: Philippe Grosjean wrote: Excellent, but... x - rnorm(100) y - rnorm(100) system.time(x%*%y) [1] 0.03 0.00 0.03 NA NA system.time(sum(x*y)) [1] 0.05 0.00 0.04 NA NA system.time(crossprod(x, y)) [1] 0 0 0 NA NA So, to paraphrase a well-known contributor on this mailing list: Excellent! So, what did you decided to do during the next 30 milliseconds you will save by using crossprod() instead of x%*%y? (joke) Best, Philippe Grosjean P.S.: Uwe, perhaps you should consider buying a faster computer, isn't it? :-() Well, I use R, you know. It is even fast enough for my 5 year old laptop. For your super computer, please replace 1e6 by 1e8 in the example above. ;-) Uwe Uwe Ligges wrote: [EMAIL PROTECTED] wrote: Hi, x and y are (numeric) vectors. I wonder if one of the following is more efficient than the other: x%*%y or sum(x*y) ? I'd try x - rnorm(100) y - rnorm(100) system.time(x%*%y) system.time(sum(x*y)) and finally (hint, hint!): system.time(crossprod(x, y)) Uwe Ligges Thanks, Dimitri Szerman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to test robustness of correlation
Below Hi, Berton: thanks for getting back to me. I played around cor.rob(). Yes, I can get a robust correlation coefficient matrix based on mcd or mve outlier detection methods. I have two further questions: 1) How do I get a p value of the robust r? A p-value for what? That r==0 ? 2) What I mean by resampling is leave one out procedure, to get a confidence interval of r. Do you know if there is any package in R to do it? I suppose I could code it myself, but it is nice if there is already one. thanks. Yang **An** answer to both is the same -- bootstrap it. Leave one out is not resampling (/bootstrapping). It is usually referred to as jackknifing, but that uses more specific ways of doing things than the analogy implies. Efron's little SIAM book on The jackknife, bootstrap, etc. explains them and their relationships in detail. It is trivial to bootstrap cor.rob in base R using sample() (from the x,y **pairs** -- or n-tuples generally -- not the marginals separately ). If you insist on a package, boot is the obvious one -- why did you not attempt to find it yourself? Either way, expect it to take a while for a decent size resample (e.g. 1e4). -- Bert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to make two side-by side trellis plots same size
On 1/26/06, Dieter Menne [EMAIL PROTECTED] wrote: Thanks, Deepayan Deepayan Sarkar deepayan.sarkar at gmail.com writes: If that's the only reason, I would suggest rbind-ing them and then use scales = list(x = free) I probably will go for this. If you want the first two columns to have the same x-limits, you can specify xlim = list(c(0,25), c(0,25), c(0, 2500)) etc. Otherwise, if you want the panels to have the same physical dimensions, look at the panel.width and panel.height arguments in ?print.trellis. I can't think of any other way of guaranteeing it. Documentation said that using panel.width with non-standard aspect (which must be 1) leads to undefined effects. Yes, because panel.width and panel.height together define the aspect, and will override whatever the 'aspect' argument says. It's fine to have aspect=fill (the default), or even 1 probably, and then control the aspect using panel.width and panel.height. Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] maximizing available memory under windows XP
Thanks so much. The more I thought about it the more I suspected it was the test. With your test I was able to use almost 2.9GB. gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells2492256.7 467875 12.5359.4 Vcells 380096322 2900.0 380460887 2902.7 380097332 2900.0 Roger On 1/26/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: The problem is your test. You are trying to re-allocate large objects, and memory fragmentation will take its toll, and be almost random in its effects. Using the CRAN binary of 2.2.1 and for(i in 1:1000) assign(paste(r, i, sep=.), rnorm(1e6)) gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells1704804.6 359.4359.4 Vcells 253062963 1930.8 253513169 1934.2 253063937 1930.8 memory.size(max=T) [1] 2037137408 I was able to get close to address space limit on my laptop (which does not have the /3GB switch set (*in boot.ini*, not in the binary)). And that binary is marked: [d:/R/R-2.2.1/bin]% dumpbin /HEADERS Rterm.exe Microsoft (R) COFF Binary File Dumper Version 6.00.8447 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. Dump of file Rterm.exe PE signature found File Type: EXECUTABLE IMAGE FILE HEADER VALUES 14C machine (i386) 6 number of sections 43A80482 time date stamp Tue Dec 20 13:17:54 2005 0 file pointer to symbol table 0 number of symbols E0 size of optional header 32F characteristics Relocations stripped Executable Line numbers stripped Symbols stripped Application can handle large (2GB) addresses 32 bit word machine Debug information stripped On Thu, 26 Jan 2006, roger bos wrote: I have always been using ebitbin to set the 3GB switch in the windows binary, but version 2.2.1 has this set as default (which I verified using dumpbin). However, when I generate junk data to fill up my memory and read the memory usage using gc(), it seems that I am not getting as good results with 2.2.1 patched as I was with 2.2.0 after I edited the header. Under R 2.2.0 I was able to use over 2GB and with R 2.2.1 patched I can access only 1GB. Anyone have any suggestions that I can try. My machine has 4GB and I have modified the Boot.ini file. Thanks, Roger Here is the gc() on 2.2.1 patched: gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 252021 6.8 467875 12.5379294 10.2 Vcells 71097226 542.5 140857919 1074.7 140597245 1072.7 Here is the gc() output on 2.2.0 after I edited the header: gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells174118 4.7 359.4359.4 Vcells 130065529 992.4 257820332 1967.1 257565551 1965.1 Here is the code that I used to fill my memory (nothing fancy): a - diag(1000) b -a for (i in 1:100) { a- diag(1000) b - rbind(b,a) } gc() [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] XML Request in R: Pointers/examples needed
Hello R-helpers, I'm new to XML. I have been using an application for some time, but now I wish to automate my downloads with R. When I use the web interface of their XML application, I'm able to read the response in R with the XML package. My problem now is to send the requests directly from R. Here below are two XML request scripts that come from the applicaton help file. My questions are: 1- What type of scripts are those (first one is xml, but I'm not sure about the second one) 2- How do I get them to work in R? I'm a loss with the first one. As for the second one, I suspect I would have to use the rcom or R(D)COM packages but I do not understand what I should do once I have established the COM object. (example: library(rcom) comCreateObject(MSXML2.XMLHTTP.3.0) Any pointers/examples would be appreciated. Script #1 Logon Request# ?xml version=1.0? ds:Requests xmlns:ds=http://product.datastream.com/zappy/dsxml_1_0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://product.datastream.com/zappy/dsxml_1_0 http://product.datastream.com/zappy/dsxml_1_0.xsd; ds:Request xsi:type=ds:SessionRequest ds:UserNamemyusername/ds:UserName ds:Passwordmypassword/ds:Password /ds:Request /ds:Requests Script #2 Request in HTTP Header script !-- function Exec() { var objRequest = new ActiveXObject( MSXML2.XMLHTTP.3.0 ); var request = ?xml version=1.0?; requests += ds:Requests xmlns:ds=\http://product.datastream.com/zappy/dsxml_1_0\; xmlns:xsi=\http://www.w3.org/2001/XMLSchema-instance\; xsi:schemaLocation=\http://product.datastream.com/zappy/dsxml_1_0 http://product.datastream.com/zappy/dsxml_1_0.xsd\; ds:Request xsi:type=\ds:SessionRequest\ ds:UserNamemyusername/ds:UserName ds:Passwordmypassword/ds:Password /ds:Request /ds:Requests; objRequest.open(POST,http://product.datastream.com/zappy/acces spoint.asp, false); objRequest.setRequestHeader (DSXMLAPIREQUEST, request); objRequest.send(); //Get the response XML. divResponse.innerText = objRequest.responseText } -- /script # Thank you Pierre Lapointe * AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to test robustness of correlation
One more thing ... I played around cor.rob(). Yes, I can get a robust correlation coefficient matrix based on mcd or mve outlier detection methods. I have two further questions: You might call it semantics, but I prefer resistant estimation to outlier detection methods. I recognize that they are equivalent (any resistant estimator can be used to identify outliers; any outlier detection method leads to a resistant estimator on downweighting of outliers). However, I consider the distinction important. Outlier detection suggests: 1) That outlier is a statistically well-defined concept; it isn't. The implied dichotomy is a fiction (a dangerous one, IMO -- but many would disagree). 2) That some sort of hypothesis testing procedure is used to reject points. None is. Rather, mve() and mcd() try to characterize the behavior of the central mass of the distribution, using that characterization to weight the informativeness of points outside that mass. A 1-D equivalent is MAD for spread. This is a far cry from the bad old days of (sequential) outlier detection. These methods are crucially dependent on modern computer power of course. Cheers, Bert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Using special characters
You haven't told us much, for example not your R version nor your exact platform (nor if this is a binary or self-compiled version of R) nor your locale. And you (or something between you and me) have wrapped the R code onto just two lines. You talk about saving as pdf, and ran a jpeg device, unless I missed something in those messed-up lines. I am afraid there is just too much uncertainty here. For current R, with the pdf() device and a Latin-1 or UTF-8 locale, this should work. For a jpeg() device, it depends on the fonts you have installed in your X11 server, but it usually works. If you can explain whether you want pdf or jpeg and give the missing details (and any others you think might be relevant), people here may be able to help you further. On Thu, 26 Jan 2006, Alexandra R. M. de Almeida wrote: Dear R users I'm having problems in putting special characters (like á, ã, ç ) in my plots, as much in titles, as in axis names, as in legend...when I save them as a pdf document. They don't appear... I don't know if it is because I'm using a linux platform... The script is the following: library(grDevices) jpeg(file=Fronteira/FronteiraNova.jpeg, bg=white, quality=100,width = 600, height = 480) grafico.fe-function(varFA,retFA,varC,retC,covRF,retRF,varD,retD) { minx-min(100*sqrt(varFA),100*varC,100*sqrt(covRF[1,1]),100*sqrt(covRF[2,2]),100*sqrt(covRF[3,3]),100*sqrt(covRF[4,4]),100*varD) maxx-max(100*sqrt(varFA),100*varC,100*sqrt(covRF[1,1]),100*sqrt(covRF[2,2]),100*sqrt(covRF[3,3]),100*sqrt(covRF[4,4]),100*varD) miny-min(100*retFA,retC,retRF,retD)maxy-max(100*retFA,retC,retRF,retD) plot(100*sqrt(varFA),100*retFA,type=l,lwd=2,col=2,xlab=Risco %, ylab=Retorno % (anualizado), xlim=c(minx-0.01,maxx), ylim=c(miny,maxy),main=Fronteira Eficiente)points(100*varC,retC,pch=16,cex=0.6, col=3) points(100*sqrt(covRF[1,1]),retRF[1],pch=16,cex=0.6,col=4)points(100*sqrt(covRF[2,2]),retRF[2],pch=16,cex=0.6,col=5) points(100*sqrt(covRF[3,3]),retRF[3],pch=16,cex=0.6,col=6)points(100*sqrt(covRF[4,4]),retRF[4],pch=16,cex=0.6,col=7) points(100*varD,retD,pch=16,cex=0.6,col=1) legend(c(0.91,1.11),c(17.97,18.156),c(Fronteira Eficiente),lwd=2,cex=0.6, col=2) legend(0.93,18.13,c(Consolidado,Brad,AB,It,Uni,Ot),pch=16, bty=n, cex=0.6, col=c(3,4,5,6,7,1), ncol=1) } grafico.fe(varFA,retFA,varC,retC,covRF,retRF,varD,retD) dev.off() Do someome have a problem like this? Thanks Alexandra Almeida Alexandra R. Mendes de Almeida - [[alternative HTML version deleted]] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to compare glm parameter values
Hi list, I have trained a logistic regression model on three diverse features. Now I want to compare these values to get an idea of their influence on the result. For most features the summary function returns p-values that equal zero, which makes the p-values unusable. I have the intuition it is impossible to compare the relevance of the features based on their parameter values as their ranges are quite different. Is it possible to compare the relevance of features on their parameters, if their range differs? Regards, Joost __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to test robustness of correlation
The cor function can do spearman correlation using method = spearman . On 1/25/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, there: As you all know, correlation is not a very robust procedure. Sometimes correlation could be driven by a few outliers. There are a few ways to improve the robustness of correlation (pearson correlation), either by outlier removal procedure, or resampling technique. I am wondering if there is any R package or R code that have incorporated outlier removal or resampling procedure in calculating correlation coefficient. Your help is greatly appreciated. Thanks. Yang Yang Qiu Integrated Data Analysis [EMAIL PROTECTED] GlaxoSmithKline [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re-writing the problem of Using special characters
Dear R users I'm having problems in putting special characters (like á, ã, ç ) in my plots, as much in titles, as in axis names, as in legend...when I save them as a pdf OR JPEG document. They don't appear IN BOTH... I don't know if it is because I'm using a linux platform (MANDRIVA 2006)... MY R VERSION IS: R 2.0.0 (2004-10-04) The script is the following: library(grDevices) jpeg(file=Fronteira/FronteiraNova.jpeg, bg=white, quality=100,width = 600, height = 480) grafico.fe-function(varFA,retFA,varC,retC,covRF,retRF,varD,retD) { minx-min(100*sqrt(varFA),100*varC,100*sqrt(covRF[1,1]),100*sqrt(covRF[2,2]),100*sqrt(covRF[3,3]),100*sqrt(covRF[4,4]),100*varD) maxx-max(100*sqrt(varFA),100*varC,100*sqrt(covRF[1,1]),100*sqrt(covRF[2,2]),100*sqrt(covRF[3,3]),100*sqrt(covRF[4,4]),100*varD) miny-min(100*retFA,retC,retRF,retD) maxy-max(100*retFA,retC,retRF,retD) plot(100*sqrt(varFA),100*retFA,type=l,lwd=2,col=2,xlab=Risco %, ylab=Retorno % (anualizado), xlim=c(minx-0.01,maxx), ylim=c(miny,maxy),main=Fronteira Eficiente) points(100*varC,retC,pch=16,cex=0.6, col=3) points(100*sqrt(covRF[1,1]),retRF[1],pch=16,cex=0.6,col=4) points(100*sqrt(covRF[2,2]),retRF[2],pch=16,cex=0.6,col=5) points(100*sqrt(covRF[3,3]),retRF[3],pch=16,cex=0.6,col=6) points(100*sqrt(covRF[4,4]),retRF[4],pch=16,cex=0.6,col=7) points(100*varD,retD,pch=16,cex=0.6,col=1) legend(c(0.91,1.11),c(17.97,18.156),c(Fronteira Eficiente),lwd=2,cex=0.6, col=2) legend(0.93,18.13,c(Consolidado,Brad,AB,It,Uni,Ot),pch=16, bty=n, cex=0.6, col=c(3,4,5,6,7,1), ncol=1) } grafico.fe(varFA,retFA,varC,retC,covRF,retRF,varD,retD) dev.off() Do someome have a problem like this? Thanks Alexandra Almeida Alexandra R. Mendes de Almeida - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to test robustness of correlation
Gabor: Contrary to popular belief, rank-based procedures are **not** resistant. Example: x-c(1:10,100);y-c(1:10+rnorm(10,sd=.25),-100) cor(x,y) [1] -0.9816899 ## awful cor(x,y,method='spearman') [1] 0.5 ## better require(MASS) Loading required package: MASS [1] TRUE cov.rob(cbind(x,y),cor=TRUE) ## ... bunch of output omitted $cor x y x 1.000 0.9977734 ## best y 0.9977734 1.000 ## Look at the plot to see. -- Bert -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Thursday, January 26, 2006 9:05 AM To: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] how to test robustness of correlation The cor function can do spearman correlation using method = spearman . On 1/25/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, there: As you all know, correlation is not a very robust procedure. Sometimes correlation could be driven by a few outliers. There are a few ways to improve the robustness of correlation (pearson correlation), either by outlier removal procedure, or resampling technique. I am wondering if there is any R package or R code that have incorporated outlier removal or resampling procedure in calculating correlation coefficient. Your help is greatly appreciated. Thanks. Yang Yang Qiu Integrated Data Analysis [EMAIL PROTECTED] GlaxoSmithKline [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to make two side-by side trellis plots same size
Deepayan Sarkar deepayan.sarkar at gmail.com writes: Documentation said that using panel.width with non-standard aspect (which must be 1) leads to undefined effects. Yes, because panel.width and panel.height together define the aspect, and will override whatever the 'aspect' argument says. It's fine to have aspect=fill (the default), or even 1 probably, and then control the aspect using panel.width and panel.height. Thanks, Deepayan, I got it now: I have to set BOTH width and height, and aspect set before will effectively get overridden. I tried before to set panel.width only, assuming that panel.height would follow according to aspect. Here the working solution. library(lattice) n1 = 20 # I cannot rbind df1 and df2, because the x-dimensions are # different and must be scaled individually df1 = data.frame(y=rnorm(4*n1),x=rep(1:n1,4), facA=rep(c(A,B),each=2*n1),facB=rep(c(C,D),each=n1)) # I add a dummy facB here, to make sure panels have same structure df2 = data.frame(y=rnorm(2*n1),z=rep(100*(1:n1),2), facA=rep(c(A,B),each=n1),facB=C) # Note: aspect = 1 is required later, but settings aspect here # does not make sense when we work with panel.height later p1 = xyplot(y~x|facA*facB,data=df1,main=Plot1, between=list(x=2)) p2 = xyplot(y~z|facA*facB,data=df2,main=Plot2,layout=c(1,2)) pw = list(x=3,units=cm) print(p1,position=c(0,0,2/3,1),more=T,panel.width=pw,panel.height=pw) print(p2,position=c(2/3,0,1,1),more=F,panel.width=pw,panel.height=pw) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to compare glm parameter values
It's inappropriate to use the p-values associated with the coefficients for that purpose. They tell you how sure you can be, based on the data you have, that they are not equal to zero. Prof. Fox's `effects' package on CRAN would be a better place to look, I think. I believe there's an JSS article describing the package as well. Andy From: Joost van Evert Hi list, I have trained a logistic regression model on three diverse features. Now I want to compare these values to get an idea of their influence on the result. For most features the summary function returns p-values that equal zero, which makes the p-values unusable. I have the intuition it is impossible to compare the relevance of the features based on their parameter values as their ranges are quite different. Is it possible to compare the relevance of features on their parameters, if their range differs? Regards, Joost __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Clustering Question
Hi group, My case has N physicians with each seeing M patients. One physician could have seen a group of patients, or, a patient could have been seen by multiple number of physicians. In order words, there are overlaps. Now, I have the following NxM matrix Patient#1 Patient#2 Patient#3 ... Patient#m Physician#1 10 1 ... 0 Physician#2 11 1 ... 1 Physician#3 01 0 ... 1 . .. . ... . . .. . ... . Physician#n 11 0 ... 0 1 indicates previous encouter and 0 otherwise. My aim is to identify physician group practice based on the common patients they see. Any suggestion on which R package would best serve this purpose? Thank you so much! Regards, Kelvin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Data management problem: convert text string to matrix of 0's and 1's
I have a data management problem which exceeds my meager R programming skills and would greatly appreciate suggestions on how to proceed? The data consists of a series of observation periods. Specific behaviors are recorded for each time period in the order each is observed. Their are 8 possible behaviors, coded as i c s r v e p f. The data looks like: -- icsrvepf fpevrsci ics p f ic -- I would like to convert the about to a matrix of the form: i c s r v e p f 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 Thanks. Dale Dale Steele, MD Pediatric Emergency Medicine Brown Medical School __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] DOS command using system
HI R users I have one question for using DOS command through system I like to delete a file that is located at C:\Program Files\DOSPROGRAM\input.dat I can use a DOS command del on Dos prompt like this C:\Documents and Settings del C:\Program Files\DOSPROGRAM\input.dat to delete input.dat file. When I try to do the same thing on R using system command system('del C:\Program Files\DOSPROGRAM\input.dat') or system(del C:\Program Files\DOSPROGRAM\input.dat) or system(paste(del, \C:\\Program Files\\DOSPROGRAM\\input.dat\,sep= )) All the three system commands did work Could you help me to figure out ? Thanks in advance TM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] What's wrong with Rcmdr?
thanks everyone, another problem is I cannot load Rcmdr at all in SCIView... what might be the problem? On 1/26/06, John Fox [EMAIL PROTECTED] wrote: Dear Michael, To elaborate slightly: You can't load the same package twice in an R session. As mentioned, used Commander() to restart the Rcmdr GUI. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefano Calza Sent: Thursday, January 26, 2006 4:23 AM To: r-help@stat.math.ethz.ch Subject: Re: [R] What's wrong with Rcmdr? Try using Commander() but, obviously, the first time. HIH, Ste On Thu, Jan 26, 2006 at 01:11:23AM -0800, Michael wrote: MichaelHi all, Michael MichaelI successfully installed Rcmdr. And I type library(Rcmdr), nothing Michaelhappened; Michael Michaelor if I select menu item load package and select Rcmdr, still nothing Michaelhappened... Michael MichaelWhy didn't Rcmdr start? Michael MichaelVery strangely, if I close the R console and restart R console, every first Michaeltime I load Rcmdr, it starts! But not second, third time... Michael MichaelWhat's wrong with it? Michael MichaelThanks a lot! Michael MichaelMichael. Michael Michael [[alternative HTML version deleted]] Michael Michael__ MichaelR-help@stat.math.ethz.ch mailing list Michaelhttps://stat.ethz.ch/mailman/listinfo/r-help MichaelPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Data management problem: convert text string to matrix of 0's and 1's
On Thu, 26 Jan 2006, Dale Steele wrote: The data looks like: -- icsrvepf fpevrsci ics p f ic -- I would like to convert the about to a matrix of the form: i c s r v e p f 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 One possibility is to use grep() a [1] icsrvepf fpevrsci p fic grep(i,a) [1] 1 2 6 so results-matrix(0,nrow=length(a),ncol=length(behaviours)) colnames(results)-behaviours for(b in behaviours) results[grep(b,a),b]-1 results i c s r v e p f [1,] 1 1 1 1 1 1 1 1 [2,] 1 1 1 1 1 1 1 1 [3,] 0 0 0 0 0 0 1 0 [4,] 0 0 0 0 0 0 0 0 [5,] 0 0 0 0 0 0 0 1 [6,] 1 1 0 0 0 0 0 0 -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] What's wrong with JGR?
Mine. What might be wrong? R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 2.1 $year [1] 2005 $month [1] 12 $day [1] 20 $svn rev [1] 36812 $language [1] R On 1/26/06, Michael [EMAIL PROTECTED] wrote: Here is mine. What might be wrong? R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 2.1 $year [1] 2005 $month [1] 12 $day [1] 20 $svn rev [1] 36812 $language [1] R On 1/26/06, Christian Schulz [EMAIL PROTECTED] wrote: Which R version and which os is yours? For me it works fine. Lade nötiges Paket: grDevices using Java Runtime version 1.5.0 using JAVA_HOME = C:\develope\jre Lade nötiges Paket: rJava Lade nötiges Paket: methods using Java Runtime version 1.5.0 using JAVA_HOME = C:\develope\jre R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 2.1 $year [1] 2005 $month [1] 12 $day [1] 20 $svn rev [1] 36812 $language [1] R Hi all, I downloaded and installed JGR. Then when I tried to load the package in R console, it generated the following error message: local({pkg - select.list(sort(.packages(all.available = TRUE))) + if(nchar(pkg)) library(pkg, character.only=TRUE)}) Loading required package: rJava using Java Runtime version 1.5.0 using JAVA_HOME = C:\Program Files\Java\jre1.5.0_01 Loading required package: JavaGD using Java Runtime version 1.5.0 using JAVA_HOME = C:\Program Files\Java\jre1.5.0_01 Error in .jcall(org/rosuda/JGR/JGR, V, setRHome, as.character( R.home())) : RcallStaticMethod: cannot find specified class Error in library(pkg, character.only = TRUE) : .First.lib failed for 'JGR' What's wrong? Thanks a lot! Michael. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] understanding patterns in categorical vs. continuous data
Greetings, I have a set of bivariate data: one variable (vegetation type) which is categorical, and one (computed annual insolation) which is continuous. Plotting veg_type ~ insolation produces a nice overview of the patterns that I can see in the source data. However, due to the large number of samples (1,000), and the apparent spread in the distribution of a single vegetation type over a range of insolation values- I having a hard time quantitatively describing the relationship between the two variables. Here is a link to a sample graph: http://casoilresource.lawr.ucdavis.edu/drupal/node/162 Since the data along each vegetation type line is not a distribution in the traditional sense, I am having problems applying descriptive statistical methods. Conceptually, I would like to some how describe the variation with insolation, along each vegetation type line. Any guidance, or suggested reading material would be greatly appreciated. -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] (no subject)
I found that read.table() does not work well on lines that is longer than 236 bytes. Is this know problem? Is it under fixing? Regards, Jincai Jiang (Office) 212-761-3984 NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] understanding patterns in categorical vs. continuous data
UC Davis has a statistical department, I would suggest you get consulting help from them. Do they have a consulting service? -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dylan Beaudette Sent: Thursday, January 26, 2006 11:11 AM To: r-help@stat.math.ethz.ch Subject: [R] understanding patterns in categorical vs. continuous data Greetings, I have a set of bivariate data: one variable (vegetation type) which is categorical, and one (computed annual insolation) which is continuous. Plotting veg_type ~ insolation produces a nice overview of the patterns that I can see in the source data. However, due to the large number of samples (1,000), and the apparent spread in the distribution of a single vegetation type over a range of insolation values- I having a hard time quantitatively describing the relationship between the two variables. Here is a link to a sample graph: http://casoilresource.lawr.ucdavis.edu/drupal/node/162 Since the data along each vegetation type line is not a distribution in the traditional sense, I am having problems applying descriptive statistical methods. Conceptually, I would like to some how describe the variation with insolation, along each vegetation type line. Any guidance, or suggested reading material would be greatly appreciated. -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (no subject)
Jiang, Jincai (Institutional Securities Management) wrote: I found that read.table() does not work well on lines that is longer than 236 bytes. Is this know problem? Is it under fixing? Regards, Jincai Jiang (Office) 212-761-3984 Hi, Jincai, What does not work well mean? 236 bytes is only 236 characters and is by far a very short line of data. I routinely read files with 100-300 columns and never had a problem with read.table. Please supply a reproducible example. Also, test your assertion on other datasets to determine if something is wrong with the file you are reading. I suspect the data format is the issue and not read.table. Finally, read the posting guide. Comments such as does not work well usually do not go over well on this list. HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Automatic differentiation (was: Re: D(dnorm...)?)
I can confirm that AD Model Builder is used at the Danish Institute for Fisheries Research, and by fisheries people in and all around the Pacific. On a few occasions I have solved a likelihood optimization problem in AD Model Builder, and then wrapped the binary in an R-package, with data read in, graphics and such, for others to use, as the binaries can be freely distributed. I can recommend this approach to anyone with problems where 'optim' is struggling. I would love to see AD in R, but I think it would be difficult to combine many of the things that makes R so wonderful and flexible to work with, like logical indexing, with AD, but I could be wrong. Anders. On Thursday 26 January 2006 05:55 am, Hans Skaug wrote: Dear Alberto, There are fisheries people also in Europe using AD Model Builder (Denmark and England for instance), but you are probably right that it is more widespread in North America. There is also effort going on where people try to make assessment models written in ADMB callable from R. best regards, hans think AD Model Builder is mainly used for fisheries assessment in North America and, it seems, also in Australia. In Europe, R is still the de-facto standard for fisheries assessment. However, I'd like to support Bill Venables' suggestion. I've been resisting to adopt AD model builder, or to start using again that other system not unlike R, mainly because of the licence price and because I really like R as a tool for almost everything. But an AD function would really make a huge difference for my work. There are free tools that can be used to perform AD on C or Fortran code (e.g. http://www.autodiff.org). One of the difficulties to use them with R is the need to translate the R code into C of Fortran code, but probably there are many other problems that I'm not able to see. Alberto -- _ Hans Julius Skaug Department of Mathematics University of Bergen Johannes Brunsgate 12 5008 Bergen Norway __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Image Processing packages
Thomas Kaliwe wrote: Hi, I've been looking for Image Processing packages. Thresholding, Edge Filters, Dct, Segmentation, Restoration. I'm aware, that Octave, Matlab etc. would be a good address but then I'm missing the statistical power of R. Does anybody know of packages, projects etc. Comments on wether the use of R for such matters is useful are welcome. See also my package rtiff for reading tiff images. I routinely do image analysis in R. Yes, it is relatively slow compared to dedicated solutions, but I like the smooth integration with the associated statistical analysis and the ability to have a single script that performs the image analysis and multiple files and subsequent statistical analysis, and with modern computing equipment R is fast enough for my purposes. I have a variety of standard image processing functions written in R, but have yet to distribute them because most people choose not to perform image analysis in R for the previously stated reasons. So in general I would agree that R is sub-optimal for image processing (and this is certainly outside the realm of things R was intended to do if I read the early mailing list archives correctly). However, it can be done and it might be desirable to do so from a work-flow perspective. -Eric Greetings Thomas Kaliwe This email message, including any attachments, is for the so...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] cluster analysis: error in vector(do uble, length): given vector size is too bi g {Fehler in vector(double, length) : angegebene Vektorgröße ist zu groß}
Dear R Specialists, when trying to cluster a data.frame with about 80.000 rows and 25 columns I get the above error message. I tried hclust (using dist), agnes (entering the data.frame directly) and pam (entering the data.frame directly). What I actually do not want to do is generate a random sample from the data. The machine I run R on is a Windows 2000 Server (Pentium 4) with 2 GB of RAM. Does anybody know what to do? Sincerely ___ Markus Preisetanz Consultant Client Vela GmbH Albert-Roßhaupter-Str. 32 81369 München fon: +49 (0) 89 742 17-113 fax: +49 (0) 89 742 17-150 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged infor...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] boot boot.ci
Dear all, I've a problem with bootstarp package... I want to bootstrap correlation ratio of some data. my code is: f-function(d) cov(d$x,d$y)/sqrt(var(x)*var(y)) boot(d,f,R) As a result I got an error: Error in statistic(data, original, ...) : unused argument(s) (.. .) d is a data.frame containing two vectors with labels x and y. Also, another thing I have problem with is generating the confidence interval using boot.ci if I write: d.boot-boot(d,cor,R) boot.ci(d.boot,conf=0.95,type=bca) I get an error: Error in bca.ci(boot.out, conf, index[1], L = L, t = t.o, t0 = t0.o, h = h, : estimated adjustment 'a' is NA Last question is how to generate a studentized intervals for such data? Thanks, Kuba Kuba Cameron Diaz i Toni Collette w filmie SIOSTRY W kinach od 27 stycznia 2005 r. http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fsiostry.htmlsid=641 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] understanding patterns in categorical vs. continuous data
You might prefer boxplot(insolation~veg_type) as a graphic. That will give you quantiles. To get the actual numeric values you could for (i in levels(veg_type)) { print(i) quantile(insolation[veg_type==i]) } see ?quantile for more help. Dylan Beaudette wrote: Greetings, I have a set of bivariate data: one variable (vegetation type) which is categorical, and one (computed annual insolation) which is continuous. Plotting veg_type ~ insolation produces a nice overview of the patterns that I can see in the source data. However, due to the large number of samples (1,000), and the apparent spread in the distribution of a single vegetation type over a range of insolation values- I having a hard time quantitatively describing the relationship between the two variables. Here is a link to a sample graph: http://casoilresource.lawr.ucdavis.edu/drupal/node/162 Since the data along each vegetation type line is not a distribution in the traditional sense, I am having problems applying descriptive statistical methods. Conceptually, I would like to some how describe the variation with insolation, along each vegetation type line. Any guidance, or suggested reading material would be greatly appreciated. -- David W. Roberts office 406-994-4548 Professor and Head FAX 406-994-3190 Department of Ecology email [EMAIL PROTECTED] Montana State University Bozeman, MT 59717-3460 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] understanding patterns in categorical vs. continuous data
Would this do? boxplot(Sepal.Length ~ Species, iris, horizontal = TRUE) library(Hmisc) summary(Sepal.Length ~ Species, iris, fun = summary) On 1/26/06, Dylan Beaudette [EMAIL PROTECTED] wrote: Greetings, I have a set of bivariate data: one variable (vegetation type) which is categorical, and one (computed annual insolation) which is continuous. Plotting veg_type ~ insolation produces a nice overview of the patterns that I can see in the source data. However, due to the large number of samples (1,000), and the apparent spread in the distribution of a single vegetation type over a range of insolation values- I having a hard time quantitatively describing the relationship between the two variables. Here is a link to a sample graph: http://casoilresource.lawr.ucdavis.edu/drupal/node/162 Since the data along each vegetation type line is not a distribution in the traditional sense, I am having problems applying descriptive statistical methods. Conceptually, I would like to some how describe the variation with insolation, along each vegetation type line. Any guidance, or suggested reading material would be greatly appreciated. -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] DOS command using system
Why don't you use 'unlink': unlink('c:/Program Files/DOSPROGRAM/input.dat') If you really want to use 'del', then you have to invoke the command processor: system('cmd /c del c:\\Program Files\\DOSPROGRAM\\input.dat') On 1/26/06, Taka Matzmoto [EMAIL PROTECTED] wrote: HI R users I have one question for using DOS command through system I like to delete a file that is located at C:\Program Files\DOSPROGRAM\input.dat I can use a DOS command del on Dos prompt like this C:\Documents and Settings del C:\Program Files\DOSPROGRAM\input.dat to delete input.dat file. When I try to do the same thing on R using system command system('del C:\Program Files\DOSPROGRAM\input.dat') or system(del C:\Program Files\DOSPROGRAM\input.dat) or system(paste(del, \C:\\Program Files\\DOSPROGRAM\\input.dat\,sep= )) All the three system commands did work Could you help me to figure out ? Thanks in advance TM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jim Holtman Cincinnati, OH +1 513 247 0281 What the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Data management problem: convert text string to matrix of 0's and 1's
Here is another way: x - scan('/tempxx.txt', what='', sep='\n', blank.lines.skip=F) Read 7 items x [1] icsrvepf fpevrsci ics p f ic x - strsplit(x, '') # break into single characters template - c(i=0, c=0, s=0, r=0, v=0, e=0, p=0, f=0) mat - lapply(x, function(.l){ + .result - template # initialize the result + .result[.l] - 1 + .result + }) do.call('rbind', mat) i c s r v e p f [1,] 1 1 1 1 1 1 1 1 [2,] 1 1 1 1 1 1 1 1 [3,] 1 1 1 0 0 0 0 0 [4,] 0 0 0 0 0 0 1 0 [5,] 0 0 0 0 0 0 0 0 [6,] 0 0 0 0 0 0 0 1 [7,] 1 1 0 0 0 0 0 0 On 1/26/06, Thomas Lumley [EMAIL PROTECTED] wrote: On Thu, 26 Jan 2006, Dale Steele wrote: The data looks like: -- icsrvepf fpevrsci ics p f ic -- I would like to convert the about to a matrix of the form: i c s r v e p f 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 One possibility is to use grep() a [1] icsrvepf fpevrsci p fic grep(i,a) [1] 1 2 6 so results-matrix(0,nrow=length(a),ncol=length(behaviours)) colnames(results)-behaviours for(b in behaviours) results[grep(b,a),b]-1 results i c s r v e p f [1,] 1 1 1 1 1 1 1 1 [2,] 1 1 1 1 1 1 1 1 [3,] 0 0 0 0 0 0 1 0 [4,] 0 0 0 0 0 0 0 0 [5,] 0 0 0 0 0 0 0 1 [6,] 1 1 0 0 0 0 0 0 -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jim Holtman Cincinnati, OH +1 513 247 0281 What the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] DOS command using system
jim holtman wrote: Why don't you use 'unlink': unlink('c:/Program Files/DOSPROGRAM/input.dat') If you really want to use 'del', then you have to invoke the command processor: system('cmd /c del c:\\Program Files\\DOSPROGRAM\\input.dat') See also ?shell Uwe Ligges On 1/26/06, Taka Matzmoto [EMAIL PROTECTED] wrote: HI R users I have one question for using DOS command through system I like to delete a file that is located at C:\Program Files\DOSPROGRAM\input.dat I can use a DOS command del on Dos prompt like this C:\Documents and Settings del C:\Program Files\DOSPROGRAM\input.dat to delete input.dat file. When I try to do the same thing on R using system command system('del C:\Program Files\DOSPROGRAM\input.dat') or system(del C:\Program Files\DOSPROGRAM\input.dat) or system(paste(del, \C:\\Program Files\\DOSPROGRAM\\input.dat\,sep= )) All the three system commands did work Could you help me to figure out ? Thanks in advance TM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jim Holtman Cincinnati, OH +1 513 247 0281 What the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] can I do this with read.table??
Hi, I'm trying to figure out if there's an automated way to get read.table to read in my data and *not* convert the character columns into anything, just leave them alone. What I'm referring to as 'character columns' are columns in the data that are quoted. For columns of alphabetic strings (that aren't TRUE or FALSE) I can suppress conversion to factor with as.is=TRUE, but what I'd like to stop is the conversion of quoted numbers of the form 01,02,..., into numeric form. By an 'automated way', I mean one that does not involve me having to know which columns in the data are the ones I want kept as they are. This doesn't seem like an unreasonable thing to want to do. After all, say I've got the data.frame: A - data.frame(a=1:3, b=I(c(01,02,03))) I can export this to a text file with the simple command write.table(A, A.txt, sep=\t, row.names=FALSE, quote=TRUE) but I cannot find an equally simple mechanism for reading this data back in from A.txt that allows me to reconstruct my data.frame 'A'. Is this an unreasonable thing to expect? Thanks, Doug __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] degrees freedom in nlme
I'm having hard time understanding the computation of degrees of freedom when runing nlme () on the following model: formula(my data.gd) dLt ~ Lt | ID TasavB- function(Lt, Linf, K) (K*(Linf-Lt)) my model.nlme - nlme (dLt ~ TasavB(Lt, Linf, K), data = my data.gd, fixed = list(Linf ~ 1, K ~ 1), start = list(fixed = c(70, 0.4)), na.action= na.include, naPattern = ~!is.na(dLt)) summary(my model.nlme) Nonlinear mixed-effects model fit by maximum likelihood Model: dLt ~ TasavB(Lt, Linf, K) Data: my data.gd AIC BIClogLik 13015.63 13051.57 -6501.814 Random effects: Formula: list(Linf ~ 1 , K ~ 1 ) Level: ID Structure: General positive-definite StdDev Corr Linf 7.3625291 Linf K 0.0845886 -0.656 Residual 1.6967358 Fixed effects: list(Linf + K ~ 1) Value Std.Error DF t-value p-value Linf 69.32748 0.4187314 402 165.5655 .0001 K 0.31424 0.0047690 2549 65.8917 .0001 Standardized Within-Group Residuals: Min Q1 MedQ3 Max -3.98674 -0.5338083 -0.02783649 0.5261591 4.750609 Number of Observations: 2952 Number of Groups: 403 Why are the DF of Linf and K different? I would apreciate if you could point me to a reference. Lic. Gabriela Escati Peñaloza Biología y Manejo de Recursos Acuáticos Centro Nacional Patagónico(CENPAT). CONICET Bvd. Brown s/nº. (U9120ACV)Pto. Madryn Chubut Argentina Tel: 54-2965/451301/451024/451375/45401 (Int:277) Fax: 54-29657451543 - 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo Abrí tu cuenta aquí [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] can I do this with read.table??
On Thu, 26 Jan 2006, Douglas Grove wrote: Hi, I'm trying to figure out if there's an automated way to get read.table to read in my data and *not* convert the character columns into anything, just leave them alone. What I'm referring to as 'character columns' are columns in the data that are quoted. For columns of alphabetic strings (that aren't TRUE or FALSE) I can suppress conversion to factor with as.is=TRUE, but what I'd like to stop is the conversion of quoted numbers of the form 01,02,..., into numeric form. One approach is to use quote= to specify that the quote marks are considered part of the string. Depending on what you are using the data for, you may then need to strip the quotes off, eg with sub(). B-read.table(a.txt,sep=\t,as.is=TRUE,header=TRUE,quote=) B X.a. X.b. 11 01 22 02 33 03 sub(^\(.*)\$, \\1, B[[2]]) [1] 01 02 03 -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] can I do this with read.table??
Douglas Grove wrote: Hi, I'm trying to figure out if there's an automated way to get read.table to read in my data and *not* convert the character columns into anything, just leave them alone. What I'm referring ?Did you read the help page? What about argument as.is=TRUE? See also argument colClasses Kjetil to as 'character columns' are columns in the data that are quoted. For columns of alphabetic strings (that aren't TRUE or FALSE) I can suppress conversion to factor with as.is=TRUE, but what I'd like to stop is the conversion of quoted numbers of the form 01,02,..., into numeric form. By an 'automated way', I mean one that does not involve me having to know which columns in the data are the ones I want kept as they are. This doesn't seem like an unreasonable thing to want to do. After all, say I've got the data.frame: A - data.frame(a=1:3, b=I(c(01,02,03))) I can export this to a text file with the simple command write.table(A, A.txt, sep=\t, row.names=FALSE, quote=TRUE) but I cannot find an equally simple mechanism for reading this data back in from A.txt that allows me to reconstruct my data.frame 'A'. Is this an unreasonable thing to expect? Thanks, Doug __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] can I do this with read.table??
I did read the help page, very carefully. The colClasses argument can be used if I want to stop and look through every data set to see which column I need to protect. But that's what I said that I don't want to do. As for 'as.is', I wish it did what you suggest, but it doesn't. If one reads carefully, as.is protects a character vector from converstion to a *factor*, but not from conversion to numeric/logical. Doug On Sun, 26 Feb 2006, Kjetil Brinchmann Halvorsen wrote: Douglas Grove wrote: Hi, I'm trying to figure out if there's an automated way to get read.table to read in my data and *not* convert the character columns into anything, just leave them alone. What I'm referring ?Did you read the help page? What about argument as.is=TRUE? See also argument colClasses Kjetil to as 'character columns' are columns in the data that are quoted. For columns of alphabetic strings (that aren't TRUE or FALSE) I can suppress conversion to factor with as.is=TRUE, but what I'd like to stop is the conversion of quoted numbers of the form 01,02,..., into numeric form. By an 'automated way', I mean one that does not involve me having to know which columns in the data are the ones I want kept as they are. This doesn't seem like an unreasonable thing to want to do. After all, say I've got the data.frame: A - data.frame(a=1:3, b=I(c(01,02,03))) I can export this to a text file with the simple command write.table(A, A.txt, sep=\t, row.names=FALSE, quote=TRUE) but I cannot find an equally simple mechanism for reading this data back in from A.txt that allows me to reconstruct my data.frame 'A'. Is this an unreasonable thing to expect? Thanks, Doug __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How do you convert this from S Plus to R - any help appreciated . thanks
exportData(MU.Cost,paste(C:/RAUDSL/S,as.character(MU.Cost$Run.Id[1]), .,as.character(MU.Cost$MU.Id[1]),.MU.PRICE.OUTPUT.txt,sep=),append = FALSE,type=ASCII,quote=FALSE) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] footnote in postscript lattice
I would like to add a footnote to this graph but do not see a footnote command in the package:lattice documentation. I would like to note the span=.8 as the footnote. postscript(file= ”C:/Documents and Settings/dsonneborn/My Documents/Slovak/output/pcb_tables/smooth_PCB_lines_four.ps”, bg=”transparent”, onefile=FALSE, pointsize=20,paper=”letter”, horizontal=TRUE, family=”Helvetica”,font=”Helvetica”) xyplot(AWGT ~ lipid_adj_lpcb2_cent | malex*romanix, data=pcb_graph3, auto.key = list(lines = TRUE, points = TRUE), ylab=”Birth Weight”, xlab=”Lipid Adjusted PCB”, par.settings = list(superpose.symbol = list(col = colr, pch = plotchar), superpose.line = list(col = colr, pch = plotchar, lty = 1)), type=c(p, smooth), span=.8) dev.off() thanks -- Dean Sonneborn, MS Programmer Analyst Department of Public Health Sciences University of California, Davis (530) 754-9516 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How do you convert this from S Plus to R - any help appreciated . thanks
There is an `R Data Import/Export' manual to guide you on how to do data export in R. Please consult it. I only know vaguely what format exportData(type=ASCII) uses, and it is probably easier to work out what you want and tailor write.table() to give that. (I am not aware that the fine details of exportData are documented.) On Fri, 27 Jan 2006, Briggs, Meredith M wrote: exportData(MU.Cost,paste(C:/RAUDSL/S,as.character(MU.Cost$Run.Id[1]), .,as.character(MU.Cost$MU.Id[1]),.MU.PRICE.OUTPUT.txt,sep=),append = FALSE,type=ASCII,quote=FALSE) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] xyplot: making strip function aware of panel.number
In xyplot(), I'd like to supress the printing of the strip on certain panels. I thought I'd do this inside the strip function, but it seems that panel.number doesn't get passed to that. Any ideas? Thanks, Ben __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] footnote in postscript lattice
After you create your xyplot use library(grid) panel.text(grid.locator(),label=My label) Cheers Francisco PS: How is good ol' David these days? From: Dean Sonneborn [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] footnote in postscript lattice Date: Thu, 26 Jan 2006 15:46:28 -0800 I would like to add a footnote to this graph but do not see a footnote command in the package:lattice documentation. I would like to note the span=.8 as the footnote. postscript(file= C:/Documents and Settings/dsonneborn/My Documents/Slovak/output/pcb_tables/smooth_PCB_lines_four.ps, bg=transparent, onefile=FALSE, pointsize=20,paper=letter, horizontal=TRUE, family=Helvetica,font=Helvetica) xyplot(AWGT ~ lipid_adj_lpcb2_cent | malex*romanix, data=pcb_graph3, auto.key = list(lines = TRUE, points = TRUE), ylab=Birth Weight, xlab=Lipid Adjusted PCB, par.settings = list(superpose.symbol = list(col = colr, pch = plotchar), superpose.line = list(col = colr, pch = plotchar, lty = 1)), type=c(p, smooth), span=.8) dev.off() thanks -- Dean Sonneborn, MS Programmer Analyst Department of Public Health Sciences University of California, Davis (530) 754-9516 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] xyplot: making strip function aware of panel.number
On 1/26/06, Benjamin Tyner [EMAIL PROTECTED] wrote: In xyplot(), I'd like to supress the printing of the strip on certain panels. I thought I'd do this inside the strip function, but it seems that panel.number doesn't get passed to that. Any ideas? Well, strip has access to much more detailed conditioning information (which.given, which.panel), why are they not enough? The panel.number feature exists for exactly the opposite reason, namely that panel functions traditionally didn't have the information on conditioning variables that the strip function has. Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] footnote in postscript lattice
On 1/26/06, Francisco J. Zagmutt [EMAIL PROTECTED] wrote: After you create your xyplot use library(grid) panel.text(grid.locator(),label=My label) Also, look up the 'page' argument in ?xyplot. Deepayan Cheers Francisco PS: How is good ol' David these days? From: Dean Sonneborn [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] footnote in postscript lattice Date: Thu, 26 Jan 2006 15:46:28 -0800 I would like to add a footnote to this graph but do not see a footnote command in the package:lattice documentation. I would like to note the span=.8 as the footnote. postscript(file= C:/Documents and Settings/dsonneborn/My Documents/Slovak/output/pcb_tables/smooth_PCB_lines_four.ps, bg=transparent, onefile=FALSE, pointsize=20,paper=letter, horizontal=TRUE, family=Helvetica,font=Helvetica) xyplot(AWGT ~ lipid_adj_lpcb2_cent | malex*romanix, data=pcb_graph3, auto.key = list(lines = TRUE, points = TRUE), ylab=Birth Weight, xlab=Lipid Adjusted PCB, par.settings = list(superpose.symbol = list(col = colr, pch = plotchar), superpose.line = list(col = colr, pch = plotchar, lty = 1)), type=c(p, smooth), span=.8) dev.off() thanks -- Dean Sonneborn, MS Programmer Analyst Department of Public Health Sciences University of California, Davis (530) 754-9516 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Justification of dendrogram labels
Hi all, Can someone tell me how to justify (right or left) the labels on the branches of a dendrogram tree? I have produced a dendrogram via agnes and plotted it with pltree. The dendrogram terminal branch labels seem to be centre-justified by default and I was hoping to change this to left justification. Thanks, Duncan * Dr. Duncan Mackay School of Biological Sciences Flinders University GPO Box 2100 Adelaide S.A.5001 AUSTRALIA Ph (08) 8201 2627FAX (08) 8201 3015 http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] question about density estimation with monotonic constraints
Hi, I have a 1-d vector x of values but it is rather noisy. I know a priori that the density function should be monotonically decreasing, but my data doesnt have that. Is there a way to transform the data in such a way so that the resultant density be monotonically decreasing? Thanks Debayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] nlme in R v.2.2.1 and S-Plus v. 7.0
I see you got an error message from R. Did you have both either the lme4 or the Matrix packages in the search path at the same time you ran nlme to get the result you got below? If yes, please rerun with only nlme in the search path. (This may not be necessary, but I always quite R and restart whenever I want to switch between nlme and lme4.) If this is not the problem, I would encourage you to experient with smaller models and data sets to try to find the simplest toy example that still produces the error message you got from summary(nlme(...)), then submit that to this listserve. I routinely copy reproducible examples into R to see if I get the same error message. Whether I do or not, I think my comments are much more likely to be helpful than if I have to guess. And if I'm guessing about an error message I can't generate myself at will, my comments may not be very helpful. Regarding whether to use S-Plus 7 or R 2.2.1 for this problem, if R gives you an error message when S-Plus does not, doesn't that answer your question? Moreover, the S-Plus logLik is higher than for R, which suggests that it must get closer to the actual maximum of the likelihood function. If you'd like more help from this listserve, I suggest you PLEASE do read the posting guide! www.R-project.org/posting-guide.html. Doing so will on average tend to increase the speed and utility of comments you might receive, I believe. hope this helps, spencer graves Paolo Ghisletta wrote: Dear R-Users, I am comparing the nlme package in S-Plus (v. 7.0) and R (v. 2.2.1, nlme package version 3.1-68.1; the lattice, Matrix, and lme4 have also just been updated today, Jan. 23, 2006) on a PC (2.40 GHz Pentium 4 processor and 1 GHz RAM) operating on Windows XP. I am using a real data set with 1,191 units with at most 4 repeated measures per unit (data are incomplete, unbalanced). I use the same code with the same starting values for both programs and obtain slightly different results. I am aware that at this stage my model is far from being well specified for the given data. Nevertheless, I wonder whether one program is more suited than the other to pursue my modeling. Below I included the input + output code, first for S-Plus, than for R. Many thanks and best regards, Paolo Ghisletta #S-Plus #min=4, max=41 logistic4.a - nlme(jugs ~ 4 + 41 / (1 + xmid*exp( -scal*I(occ-1) + u)), fixed=scal+xmid~1, random= u~1 |id, start=c(scal=.2, xmid=155), data=jug, na.action=na.exclude, method=ML) summary(logistic4.a) Nonlinear mixed-effects model fit by maximum likelihood Model: jugs ~ 4 + 41/(1 + xmid * exp( - scal * I(occ - 1) + u)) Data: jug AIC BIClogLik 29595.62 29621.3 -14793.81 Random effects: Formula: u ~ 1 | id u Residual StdDev: 5.162391 3.718887 Fixed effects: scal + xmid ~ 1 Value Std.Error DF t-value p-value scal 4.96970.0823 3339 60.39508 .0001 xmid 683.5634 125.8509 3339 5.43153 .0001 Standardized Within-Group Residuals: Min Q1 MedQ3 Max -10.66576 -0.5039498 0.0002772166 0.1226745 5.453209 Number of Observations: 4531 Number of Groups: 1191 # R #min=4, max=41 logistic4.a - nlme(jugs ~ 4 + 41 / (1 + xmid*exp( -scal*I(occ-1)+ u)), data=jug, fixed=scal+xmid~1, random= u~1 |id, start=c(scal=.2, xmid=155), method=ML, na.action=na.exclude) summary(logistic4.a) Nonlinear mixed-effects model fit by maximum likelihood Model: jugs ~ 4 + 41/(1 + xmid * exp(-scal * I(occ - 1) + u)) Data: jug AIC BIClogLik 29678.11 29703.78 -14835.05 Random effects: Formula: u ~ 1 | id u Residual StdDev: 5.116542 3.767097 Fixed effects: scal + xmid ~ 1 Value Std.Error DF t-value p-value scal 4.9244 0.08121 3339 60.63763 0 xmid 633.6956 115.37512 3339 5.49248 0 Erreur dans dim(x) : aucun slot de nom Dim pour cet objet de la classe correlation [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] cluster analysis: error in v ector(double, length): given vector size is too big {Fehler in vector(double, length ) : angegebene Vektorgröße ist zu groß}
Let's do some simple calculation: The dist object from a data set with 8 cases would have 8 * (8 - 1) / 2 elements, each takes 8 bytes to be stored in double precision. That's over 24GB if my arithmetic isn't too flaky. You'd have a devil of a time trying to do this on a 64-bit machine with 32GB RAM, let alone what you are using. You'd have much better chance sticking with algorithms that do not require storage of the (dis)similarity matrix. Andy From: Markus Preisetanz Dear R Specialists, when trying to cluster a data.frame with about 80.000 rows and 25 columns I get the above error message. I tried hclust (using dist), agnes (entering the data.frame directly) and pam (entering the data.frame directly). What I actually do not want to do is generate a random sample from the data. The machine I run R on is a Windows 2000 Server (Pentium 4) with 2 GB of RAM. Does anybody know what to do? Sincerely ___ Markus Preisetanz Consultant Client Vela GmbH Albert-Roßhaupter-Str. 32 81369 München fon: +49 (0) 89 742 17-113 fax: +49 (0) 89 742 17-150 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged infor...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Nesting Functions
Dear list members, I'm looking for a way to write nested functions similar to the function Nest or NestList in Mathematica. E.g., f-function(x) x+2*x f(f(f(2))) might instead be written as nest(f, 2, 3) read as, nest function f 3 times with 2 as the initial value. Thanks! Manuel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] about lm restrictions...
Hello all R-users _question 1_ I need to make a statistical model and respective ANOVA table but I get distinct results for the T-test (in summary(lm.object) function) and the F-test (in anova(lm.object) ) shouldn't this two approach give me the same result, i.e to indicate the same significants terms in both tests??? obs. The system has two restrictions: 1) sum( x_i ) = 1 2) sum( z_j ) = 1 *output below* _question 2_ Has I to considerate a SST in ANOVA table with: 1) N-2 d.f. because of 2 restrictions? or 2) N-1 d.f. because of 1 global restriction: sum( x ) + sum( z ) = 2 ? I don't find any paper, book or another reference, if someone may to indicate references for this type model (with 2 restrictions), I would be very grateful. Thanks a lot. Regards Cleber N. Borges ### # OUTPUT ### Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(|t|) (Intercept) 15.5000 0.5270 29.409 2.97e-10 *** z1:x1-5. 0.7454 -6.708 8.77e-05 *** z1:x2 0.5000 0.7454 0.671 0.519177 z1:x3-3. 0.7454 -4.025 0.002996 ** z2:x1-6. 0.7454 -8.050 2.11e-05 *** z2:x2-5. 0.7454 -6.708 8.77e-05 *** z2:x3-4.5000 0.7454 -6.037 0.000193 *** z3:x1 1. 0.7454 1.342 0.212580 z3:x2 1.5000 0.7454 2.012 0.075029 . z3:x3 NA NA NA NA Analysis of Variance Table Response: y Df Sum Sq Mean Sq F valuePr(F) z1:x1 1 16.674 16.674 30.0125 0.0003910 *** z1:x2 1 13.580 13.580 24.4446 0.0007977 *** z1:x3 1 1.190 1.190 2.1429 0.1772677 z2:x1 1 35.267 35.267 63.4800 2.287e-05 *** z2:x2 1 32.400 32.400 58.3200 3.202e-05 *** z2:x3 1 42.667 42.667 76.8000 1.061e-05 *** z3:x1 1 0.083 0.083 0.1500 0.7075349 z3:x2 1 2.250 2.250 4.0500 0.0750295 . Residuals 9 5.000 0.556 --- ### # DATA ### z1 z2 z3 x1 x2 x3 y 1 0 0 1 0 0 10 1 0 0 0 1 0 15 1 0 0 0 0 1 12 0 1 0 1 0 0 10 0 1 0 0 1 0 11 0 1 0 0 0 1 11 0 0 1 1 0 0 16 0 0 1 0 1 0 17 0 0 1 0 0 1 15 1 0 0 1 0 0 11 1 0 0 0 1 0 17 1 0 0 0 0 1 13 0 1 0 1 0 0 9 0 1 0 0 1 0 10 0 1 0 0 0 1 11 0 0 1 1 0 0 17 0 0 1 0 1 0 17 0 0 1 0 0 1 16 ### # CODE ### x = read.table(file(clipboard),h=T) ## NOT a Scheffé Model: x.lm - lm( y ~ (z1+z2+z3):(x1+x2+x3), data=x) summary(x.lm) anova(x.lm) ## Scheffé Model: - IS CORRECT the analysis below? x.lm - lm( y ~ -1 + (z1+z2+z3):(x1+x2+x3), data=x) summary(x.lm) x.aov - aov( y ~ (z1+z2+z3):(x1+x2+x3), data=x) summary(x.aov) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Nesting Functions
On 1/26/2006 9:45 PM, Manuel Morales wrote: Dear list members, I'm looking for a way to write nested functions similar to the function Nest or NestList in Mathematica. E.g., f-function(x) x+2*x f(f(f(2))) might instead be written as nest(f, 2, 3) read as, nest function f 3 times with 2 as the initial value. It's easy enough using a for loop: nest - function(f, initial, reps) { result - initial for (i in seq(len=reps)) result - f(result) result } Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] understanding patterns in categorical vs. continuous data
From: Dave Roberts You might prefer boxplot(insolation~veg_type) as a graphic. That will give you quantiles. To get the actual numeric values you could for (i in levels(veg_type)) { print(i) quantile(insolation[veg_type==i]) } see ?quantile for more help. If you want the five-number summaries plotted in the boxplots, just look at the returned object of boxplot(): g - factor(rep(1:3, 10)) y - rnorm(30) res - boxplot(y ~ g) str(res) List of 6 $ stats: num [1:5, 1:3] -1.135 -0.757 -0.536 0.499 0.996 ... $ n: num [1:3] 10 10 10 $ conf : num [1:2, 1:3] -1.1639 0.0918 -0.5208 1.6546 -1.2487 ... $ out : num(0) $ group: num(0) $ names: chr [1:3] 1 2 3 If you just want to compute the summaries without the boxplots, use fivenum(): tapply(y, g, fivenum) $1 [1] -1.1352456 -0.7571895 -0.5360496 0.4994445 0.9956749 $2 [1] -1.1408493 -0.3751730 0.5668747 1.8018146 2.0019303 $3 [1] -2.2309983 -0.905 -0.3402786 0.8849042 0.9833057 ... and if you really want the quantiles, you can do that, too: tapply(y, g, quantile) $1 0%25%50%75% 100% -1.1352456 -0.7391977 -0.5360496 0.3378861 0.9956749 $2 0%25%50%75% 100% -1.1408493 -0.3039648 0.5668747 1.6669879 2.0019303 $3 0%25%50%75% 100% -2.2309983 -0.8389260 -0.3402786 0.6746950 0.9833057 ... but note how the quartiles and hinges are not necessarily the same. Andy Dylan Beaudette wrote: Greetings, I have a set of bivariate data: one variable (vegetation type) which is categorical, and one (computed annual insolation) which is continuous. Plotting veg_type ~ insolation produces a nice overview of the patterns that I can see in the source data. However, due to the large number of samples (1,000), and the apparent spread in the distribution of a single vegetation type over a range of insolation values- I having a hard time quantitatively describing the relationship between the two variables. Here is a link to a sample graph: http://casoilresource.lawr.ucdavis.edu/drupal/node/162 Since the data along each vegetation type line is not a distribution in the traditional sense, I am having problems applying descriptive statistical methods. Conceptually, I would like to some how describe the variation with insolation, along each vegetation type line. Any guidance, or suggested reading material would be greatly appreciated. -- ~~ ~~ David W. Roberts office 406-994-4548 Professor and Head FAX 406-994-3190 Department of Ecology email [EMAIL PROTECTED] Montana State University Bozeman, MT 59717-3460 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] about lm restrictions...
From: klebyn Hello all R-users _question 1_ I need to make a statistical model and respective ANOVA table but I get distinct results for the T-test (in summary(lm.object) function) and the F-test (in anova(lm.object) ) shouldn't this two approach give me the same result, i.e to indicate the same significants terms in both tests??? No, because they are not the same tests. The t-tests in summary.lm() test whether the coefficient is zero, when all other terms are present in the model. The F-tests in anova.lm() test the terms by sequentially adding them into the model. Here's an example: set.seed(1) d - data.frame(x1=runif(20), x2=runif(20), y=rnorm(20)) fm - lm(y ~ ., d) summary(fm)$coef Estimate Std. Errort value Pr(|t|) (Intercept) 1.0187254 0.5534310 1.8407452 0.08318123 x1 -1.6914784 0.6377065 -2.6524404 0.01675543 x2 -0.1817831 0.6618875 -0.2746435 0.78689983 anova(fm) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(F) x1 1 4.2341 4.2341 7.0936 0.01638 * x2 1 0.0450 0.0450 0.0754 0.78690 Residuals 17 10.1472 0.5969 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 anova(fm2 - lm(y ~ x2 + x1, d)) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(F) x2 1 0.0797 0.0797 0.1336 0.71928 x1 1 4.1994 4.1994 7.0354 0.01676 * Residuals 17 10.1472 0.5969 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Notice how the p-value for x1 in the last output matches that of the t-test: because both are testing if the coefficient for x1 is 0 given that x2 is already in the model. (It's the same reason that the p-value for x2 in the first anova() output matches that of the summary.lm(), but not the second anova() output.) I may be off, but I do not think the restrictions you mentioned have any bearing on the analysis. If x + z is restricted to something _for each case_ then you do have to worry, but not the way you have it. You can choose the independent variables to take on any value you like (as in designed experiments), so such restrictions should not matter. Andy obs. The system has two restrictions: 1) sum( x_i ) = 1 2) sum( z_j ) = 1 *output below* _question 2_ Has I to considerate a SST in ANOVA table with: 1) N-2 d.f. because of 2 restrictions? or 2) N-1 d.f. because of 1 global restriction: sum( x ) + sum( z ) = 2 ? I don't find any paper, book or another reference, if someone may to indicate references for this type model (with 2 restrictions), I would be very grateful. Thanks a lot. Regards Cleber N. Borges ### # OUTPUT ### Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(|t|) (Intercept) 15.5000 0.5270 29.409 2.97e-10 *** z1:x1-5. 0.7454 -6.708 8.77e-05 *** z1:x2 0.5000 0.7454 0.671 0.519177 z1:x3-3. 0.7454 -4.025 0.002996 ** z2:x1-6. 0.7454 -8.050 2.11e-05 *** z2:x2-5. 0.7454 -6.708 8.77e-05 *** z2:x3-4.5000 0.7454 -6.037 0.000193 *** z3:x1 1. 0.7454 1.342 0.212580 z3:x2 1.5000 0.7454 2.012 0.075029 . z3:x3 NA NA NA NA Analysis of Variance Table Response: y Df Sum Sq Mean Sq F valuePr(F) z1:x1 1 16.674 16.674 30.0125 0.0003910 *** z1:x2 1 13.580 13.580 24.4446 0.0007977 *** z1:x3 1 1.190 1.190 2.1429 0.1772677 z2:x1 1 35.267 35.267 63.4800 2.287e-05 *** z2:x2 1 32.400 32.400 58.3200 3.202e-05 *** z2:x3 1 42.667 42.667 76.8000 1.061e-05 *** z3:x1 1 0.083 0.083 0.1500 0.7075349 z3:x2 1 2.250 2.250 4.0500 0.0750295 . Residuals 9 5.000 0.556 --- ### # DATA ### z1 z2 z3 x1 x2 x3 y 1 0 0 1 0 0 10 1 0 0 0 1 0 15 1 0 0 0 0 1 12 0 1 0 1 0 0 10 0 1 0 0 1 0 11 0 1 0 0 0 1 11 0 0 1 1 0 0 16 0 0 1 0 1 0 17 0 0 1 0 0 1 15 1 0 0 1 0 0 11 1 0 0 0 1 0 17 1 0 0 0 0 1 13 0 1 0 1 0 0 9 0 1 0 0 1 0 10 0 1 0 0 0 1 11 0 0 1 1 0 0 17 0 0 1 0 1 0 17 0 0 1 0 0 1 16 ### # CODE ### x = read.table(file(clipboard),h=T) ## NOT a Scheffé Model: x.lm - lm( y ~ (z1+z2+z3):(x1+x2+x3), data=x) summary(x.lm) anova(x.lm) ## Scheffé Model: - IS CORRECT the analysis below? x.lm - lm( y ~ -1 + (z1+z2+z3):(x1+x2+x3), data=x) summary(x.lm) x.aov - aov( y ~
[R] R compile on AIX 5.2
Fellow R Enthusiasts.. I'm trying to compile R on AIX 5.2 32bit with gcc 3.3.2-5. I've tried both the development bundle R-devel_2006-01-25.tar.gz and the R-beta.tar.gz from about a month ago. In each instance, I'm using the following options prior to running ./configure --prefix=/usr/local/R: OBJECT_MODE=32 MAIN_LDFLAGS=-Wl,-brtl SHLIB_LDFLAGS=-Wl,-G F2C=/usr/local/bin/f2c The R-beta bundle successfully completes the configure stage but comes up with the following error during make: gcc -Wl,-G -Wl,-bM:SRE -Wl,-H512 -Wl,-T512 -Wl,-bnoentry -Wl,-bexpall -Wl,-bI:../../../etc/R.exp -L/usr/local/lib -o internet.so Rsock.lo internet.lo nanoftp.lo nanohttp.lo sock.lo sockconn.lo /home/mbeason/work/R-beta/src/modules/lapack making Lapack.d from Lapack.c /usr/local/bin/f2c dlamc.f c_dlamc.c dlamch: dlamc1: Error on line 296: p1_addr: unknown uname_tag '537090960' dlamc2: dlamc3: dlamc4: dlamc5: make: The error code from the last command is 1. Stop. make: The error code from the last command is 2. Stop. make: The error code from the last command is 1. Stop. make: The error code from the last command is 1. Stop. make: The error code from the last command is 1. Stop. Any thoughts, suggestions, or tips would be greatly appreciated. Matt [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] generating random numbers from the logit-normal distribution ?
Hi R users I like to generate random numbers from the logit-normal distribution. Are there available simple commands I can use? I used to generate using exp(rnorm(1000,0,1))/(1+exp(rnorm(1000,0,1))) I am looking for a simple command such as rnorm(). Thanks in advance TM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Trimming / Removing leading and following blanks using Windows version
Code: write.table(MU.Cost,paste(C:/RAU/R,as.character(MU.Cost$Run.Id[1]),. ,as.character(MU.Cost$MU.Id[1]),.MU.PRICE.OUTPUT.txt,sep=),append = FALSE,quote = FALSE,sep = ,,row.names=FALSE) Output: Run.Id,MU.Id,Class,Av,lower,upper,Count.WO,Count.Seq,Total.WO.Value,Note s 32,158, 1, 0.00, 0.00, 0.00, 0, 0, 0.0,notes 32,158, 2, 78.27, 0.00, 0.00, 8, 8, 1.1,notes 32,158, 3, 58.52, 53.96, 3.09, 5, 75,89.1,notes 32,158, 4, 0.00, 0.00, 0.00, 0, 0, 0.0,notes 32,158, 12, 23.27, 0.00, 0.00, 8, 8, 1.1,notes 32,158, 34, 58.52, 18.96, 63.09, 75, 75,89.1,notes 32,158, 123, 26.10, 33.13, 39.08,213,213,90.3,notes 32,158,1234,2001.10,2000.13,2111.08,213,213,10.3,notes Morten Wennerberg Business Analyst Commercial Frameworks This communication may contain CONFIDENTIAL or copyright information of Telstra Corporation Limited (ABN 33 051 775 556). If you are not an intended recipient, you MUST NOT keep, forward, copy, use, save or rely on this communication, and any such action is unauthorised and prohibited. If you have received this communication in error, please reply to this e-mail to notify the sender of its incorrect delivery, and then delete both it and your reply. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] why did not data.table work?
Hi all, I am wondering what's wrong with my following code? x=read.table('c:\\.txt'); Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'c:\.txt', reason 'No such file or directory' what's wrong? Thanks [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] why did not data.table work?
The error message seems pretty clear in this case. It can't find the file. Try this instead: x - read.table(file.choose()) and then use the resulting GUI to locate the file. On 1/27/06, Michael [EMAIL PROTECTED] wrote: Hi all, I am wondering what's wrong with my following code? x=read.table('c:\\.txt'); Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'c:\.txt', reason 'No such file or directory' what's wrong? Thanks [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [Q] extracting lower diagonal elements of a matrix
Hi R users I like to extract lower diagonal elements of a matrix in such a way like, data[1,2], data[1,3], , data[5,6] are extracted from a matrix called 'data' This short script below is what I have written so far. ## data - matrix(rnorm(36,0,1),nrow=6) temp-c() for (i in 1:(nrow(data)-1)) { for (j in (i+1):nrow(data)) { temp-append(temp,data[j,i]) } } ## Is there any function for this? or is there any elegant way to do this task? Thanks in advance. TM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] [Q] extracting lower diagonal elements of a matrix
try: as.vector(as.dist(data)) Taka Matzmoto a écrit : Hi R users I like to extract lower diagonal elements of a matrix in such a way like, data[1,2], data[1,3], , data[5,6] are extracted from a matrix called 'data' This short script below is what I have written so far. ## data - matrix(rnorm(36,0,1),nrow=6) temp-c() for (i in 1:(nrow(data)-1)) { for (j in (i+1):nrow(data)) { temp-append(temp,data[j,i]) } } ## Is there any function for this? or is there any elegant way to do this task? Thanks in advance. TM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] [Q] extracting lower diagonal elements of a matrix
Try s - matrix(rnorm(36,0,1),nrow=6) s[col(s)row(s)] Courtesy of VR. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Taka Matzmoto Sent: Friday, January 27, 2006 1:13 AM To: r-help@stat.math.ethz.ch Subject: [R] [Q] extracting lower diagonal elements of a matrix Hi R users I like to extract lower diagonal elements of a matrix in such a way like, data[1,2], data[1,3], , data[5,6] are extracted from a matrix called 'data' This short script below is what I have written so far. ## data - matrix(rnorm(36,0,1),nrow=6) temp-c() for (i in 1:(nrow(data)-1)) { for (j in (i+1):nrow(data)) { temp-append(temp,data[j,i]) } } ## Is there any function for this? or is there any elegant way to do this task? Thanks in advance. TM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] measuring computation time
Hi R users Is there any function or command for measureing computation time? For example, if I like to how long it takes to generate 10 random numbers from a normal distribution, Is there any command I can wrap up around rnorm(10,0,1) and returns time in a sec unit ? Thanks TM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] [Q] extracting lower diagonal elements of a matrix
?lower.tri hih __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] generating random numbers from the logit-normal distribution ?
Selon Taka Matzmoto [EMAIL PROTECTED]: Hi R users I like to generate random numbers from the logit-normal distribution. Are there available simple commands I can use? I used to generate using exp(rnorm(1000,0,1))/(1+exp(rnorm(1000,0,1))) I am looking for a simple command such as rnorm(). Thanks in advance TM Hi, Consider writing a function, you can even learn how to use ... rlogitnormal - function(...){ x - exp(rnorm(...)) x / (1+x) } then rlogitnormal(1000, 0, 1) Romain __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] measuring computation time
Selon Taka Matzmoto [EMAIL PROTECTED]: Hi R users Is there any function or command for measureing computation time? For example, if I like to how long it takes to generate 10 random numbers from a normal distribution, Is there any command I can wrap up around rnorm(10,0,1) and returns time in a sec unit ? Thanks TM Hint : PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html there is system.time(rnorm(10,0,1)) RSiteSearch(time) would have told you that Romain __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] generating random numbers from the logit-normal distribution ?
On Thu, 26 Jan 2006, Taka Matzmoto wrote: Hi R users I like to generate random numbers from the logit-normal distribution. which is not a standard distribution. I guess you mean a random variable whose logit is normal (but that is not the only meaning in use). Are there available simple commands I can use? I used to generate using exp(rnorm(1000,0,1))/(1+exp(rnorm(1000,0,1))) That would be incorrect. I think you mean xx - rnorm(1000, 0, 1) exp(xx)/(1+exp(xx)) I am looking for a simple command such as rnorm(). plogis(rnorm(1000)) And if that is not simple enough for you, you can write a function wrapper like rlgnorm - function(...) plogis(rnorm(...)) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] about xyplot in lattice
Hi all, I am using xyplot (lattice) to generate a figure like Figure 4.18 in MASS4, but I have the following two questions (1) how to change the font of x(y)lab? (2) how to plot the panels for each level of the conditional variable (a factor in my data set) in the order as occurred in the data.frame rather than in the order of the levels of the conditioning variable? Thanks Jin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html