RE: [R] A suggestion regarding multiple replies
As with most of the replies so far, I enjoy the way the list works. A couple of observations however are that it is evident that off list replies already happen and imho more importantly is the fact that initially quite straightforward queries can turn into something much more interesting. I find this type of query to be among the most helpful. Partly because they tend to deal with issues that I think I have already got covered. An example of this was the use of asp=1 in a plot to keep the aspect ratio correct. One might argue that having to go to plot.default to find this reference rather than in plot was the problem, but what it did to me was to ensure that I follow through deeper and deeper into the workings of R. There are times when it is only after you have found the answer that you realise why the answer had to be where it was (as with plot.default) and that's when the real learning begins. I use the list as a way of exploring different aspects of R (often those that I have no direct need of at the time.) Tom Mulholland Senior Policy Officer WA Country Health Service Tel: (08) 9222 4062 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, 15 November 2003 6:02 AM To: [EMAIL PROTECTED] Subject: [R] A suggestion regarding multiple replies Please don't take this the wrong way. There are a lot of extremely helpful people who subscribe to r-help. I was wondering if it is time to adopt a strategy a-la Splus help whereby people reply to the author and the author summarizes all the replies? Just a thought and have a good weekend. Partha __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help The contents of this e-mail transmission are confidential an...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] ?for
I have always been intrigued by why ?for (or ?if,?while,etc) leave R wanting for more: ?for + I know the help for these is in ?Control, but I sometimes make the mistake of typing ?for instead. What is R expecting me to say to finish the statement? Thanks, Angel [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ?for
You have typed a syntactically incomplete statement: this is explained in ?help. Hint: ?for and help(for) work. On Sun, 16 Nov 2003, Angel wrote: I have always been intrigued by why ?for (or ?if,?while,etc) leave R wanting for more: ?for + I know the help for these is in ?Control, but I sometimes make the mistake of typing ?for instead. What is R expecting me to say to finish the statement? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] CLARA
I need informations about the clara routine. The on-line doc say that the argument stand is a logical, indicating if the measurements in x are standardized before calculating the dissimilarities. Measurements are standardized for each variable (column), by subtracting the variable's mean value and dividing by the variable's mean absolute deviation. If we note STAND = TRUE, I suppose that the data will not be standardized before clustering. On the contrary, STAND = FALSE means that the data will be standardized before clustering. Each sub-dataset is partitioned into k clusters using the same algorithm as in pam. But the pam routine argument stand is a logical; if true, the measurements in x are standardized before calculating the dissimilarities. Measurements are standardized for each variable (column), by subtracting the variable's mean value and dividing by the variable's mean absolute deviation. If x is already a dissimilarity matrix, then this argument will be ignored. If we note STAND = TRUE, I suppose that the data will be standardized. There is a big difference as clara and pam use nearly the same algorithm. I need to use clara because I have a large dataset. Could help me about the argument stand ? May I have to standardize my datas with excel before ? If yes, what I have to write : STAND = ?? ? Best regards, Cordialement, Régis CHARIGNON Service Optimisation Direct Line: +33 (0)1 47 23 21 44 _ Lagardère Active Publicité 28, rue François 1er, 75008 Paris http://www.lagardere-active-pub.com ** Attention : le present message et toutes les pieces jointes (le message) sont confidentiels et etablis a l'attention exclusive du ou des destinataire(s) indique(s). Toute autre diffusion ou utilisation non autorisee est interdite. Si vous recevez ce message par erreur, veuillez immediatement en avertir l'expediteur par e-mail en retour, detruire le message et vous abstenir de toute reference aux informations qui y figurent afin d'eviter les sanctions attachees a la divulgation et a l'utilisation d'informations confidentielles. Les messages electroniques sont susceptibles d'alteration. Lagardere SCA et ses filiales declinent toute responsabilite en cas d'alteration ou de falsification du present message. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Symbolic math?
Hi Folks, I am using Windows 2000 and was wondering what (Open Source) software R users use or might recommend for symbolic computations (aside from the ol' noggin, e.g., Maxima, Mathomatic) . Thanks, Hank Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ?for
Prof Brian Ripley [EMAIL PROTECTED] writes: You have typed a syntactically incomplete statement: this is explained in ?help. Hint: ?for and help(for) work. Further hint: ? is an operator, syntactically similar to + and -. You can apply operators to the result of a for loop. Consider for example x - 1; - for (i in 1:10) x - x * i (? has special semantics, but that is not noticed at parse time). -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] function identify()
How can I control the size of the characters when using the function identify() ? Many thanks in advance. alain GUERREAUCNRS-Paris [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Symbolic math?
Hi, I sometimes use MuPAD (www.mupad.com). Unfortunately, it is not Open Source, but most versions are free of charge for non-commercial use (see http:// www.sciface.com/personal.shtml). Arne On Monday 17 November 2003 11:37, Hank Stevens wrote: Hi Folks, I am using Windows 2000 and was wondering what (Open Source) software R users use or might recommend for symbolic computations (aside from the ol' noggin, e.g., Maxima, Mathomatic) . Thanks, Hank Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 [EMAIL PROTECTED] http://www.uni-kiel.de/agrarpol/ahenningsen/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Initial size of graphics window
Paul == Paul Murrell [EMAIL PROTECTED] on Mon, 17 Nov 2003 09:07:29 +1300 writes: Paul Hi Paul Remington, Richard wrote: Wolfgang Zocher wrote: Hi, using par() a window is opened which is too large for my monitor. Is there any chance to change the size of this window? par(din=c(?,?)) Alternatively, if you don't need to use par() and are using Microsoft Windows, see ?win.graph Example, 4 x 4 inch window win.graph(width = 4, height = 4) Paul The first time you use a graphics command, R Paul automatically opens a graphics device (what sort of Paul device you get is controlled by options(device=?)). Paul This device will open with default size settings. Hence, if you really want the default window opened {by par() or plot() or ...} to become smaller, you could do something like myWin - function() win.graph(width = 4, height = 4) options(device = myWin) and even put this into an approriate Rprofile file, see ?Startup. Martin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Rweb: how to use source()
I cannot discover how to set or find the working directory in Rweb, so that I can source() a file from the server. The file I source() must refer to a data file in its directory. setwd() does not do anything, and getwd() says that the working directory is in /var/www/cgi-bin/ (on Linux). (I have a student who installed R on her own computer and analyzed half of her data, and then her computer died. Rweb could let her finish, if I could just take what she's done so far, which I have, and put it on my server.) -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page:http://www.sas.upenn.edu/~baron __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] confint: which method attached?
the function confint uses the profiling method of the function of the package MASS confint.glm even after the package has been detached! 1: might this be the intenden behavior? 2. How does the function remember its 'MASS' functionality after detaching the package? R: 1.8.0; Windows 2000 Here is a sample program set.seed(7882) x-rep(c(0,1),c(20,20)) p-plogis(2+0.1*x) y-cbind(event,50-rbinom(length(p),50,p)) xf-factor(x) g-glm(y~xf,family=binomial) # conficence intervals according base package: print(confint(g)) 2.5 %97.5 % (Intercept) 1.65425534 2.0266122 xf1 0.06324695 0.6282106 library(MASS) print(confint(g)) Waiting for profiling to be done... 2.5 %97.5 % (Intercept) 1.66398057 2.0247678 xf1 0.07341592 0.6210034 detach(package:MASS) print(search()) [1] .GlobalEnv package:methods package:ctest package:mva [5] package:modreg package:nls package:ts Autoloads [9] package:base print(confint(g)) Waiting for profiling to be done... 2.5 %97.5 % (Intercept) 1.66398057 2.0247678 xf1 0.07341592 0.6210034 Ulrich Halekoh, PhD Institute of Agricultural Sciences, Biometry Group 8830 Tjele, Denmark, [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] function identify()
On Mon, 17 Nov 2003, guerreau wrote: How can I control the size of the characters when using the function identify() ? You cannot and found the bug mentioned in PR#660. Uwe Ligges Many thanks in advance. alain GUERREAUCNRS-Paris [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] ISOdate() and strptime()
I think I do understand how difficult dates are. All I'm saying is that by adopting a standard that is OS dependent (and hence, almost by definition, OS varying) you make R behave differently on different OSs - and that is NOT making R portable across multiple OSs. This is a theoretical whinge. I'm not going to program it ! Please don't let me make too much of this anyway. For one thing, although it is not guaranteed, it seems that many OSs DO in fact behave identically. Also, it is only incomplete or erroneous dates that might be handled differently - and in most applications, one needs to pre-process incomplete date-times in R, rather than leave them to any default interpretation (even if that default was strictly fixed). -Original Message- From: Jason Turner [mailto:[EMAIL PROTECTED] Sent: 15 November 2003 06:17 To: Simon Fear Cc: [EMAIL PROTECTED] Subject: Re: [R] ISOdate() and strptime() Security Warning: If you are not sure an attachment is safe to open please contact Andy on x234. There are 0 attachments with this message. Thomas Lumley wrote: On Fri, 14 Nov 2003, Simon Fear wrote: Is the behaviour of ISOtime() and strptime() determined by ISO or POSIX standard? Seems not to fit R's no nannying policy at all. It's determined by your operating system, so you're complaining to the wrong people. And since R is written to be portable across multiple OSs, you might get an idea how tricky this becomes. Hence the iron fist approach to date handling. Believe me, I've programmed date handling - it's always a terrible, nasty, messy business when international locales and different operating systems clash. I'm stunned it's as good as it is, subtle traps and all. Cheers Jason Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 69 Fax: +44 (0) 1379 65 email: [EMAIL PROTECTED] web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] confint: which method attached?
On Mon, 17 Nov 2003, Ulrich Halekoh wrote: the function confint uses the profiling method of the function of the package MASS confint.glm even after the package has been detached! Why the exclamation mark? Note profile.glm is not actually in package:MASS (sic). Try looking for it: getAnywhere(profile.glm) A single object matching 'profile.glm' was found It was found in the following places registered S3 method for profile from namespace MASS namespace:MASS with value ... 1: might this be the intenden behavior? The accurate description is the intended behaviour. 2. How does the function remember its 'MASS' functionality after detaching the package? It isn't in the package There is currently no way to remove registered S3 methods like confint.glm in an R session. Nor is there likely to be in the near future, General comment: R has changed quite a lot recently, and older preconceptions do need to be checked against current information. The article `Name Space Management for R' in R-news 2003/1 may help (although it may tell you mor ethan you want to know). -- 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 272860 (secr) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rweb: how to use source()
It seem a user-permission problem. May be some mistake at Rweb configuration level (look at the RwebConfig file)? First you have to try R standalone. A.S. Alessandro Semeria Models and Simulations Laboratory Montecatini Environmental Research Center (Edison Group), Via Ciro Menotti 48, 48023 Marina di Ravenna (RA), Italy Tel. +39 544 536811 Fax. +39 544 538663 E-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Generalized linear model
Hi all! I am fitting a Poisson model, using the following command: fit2-glm(canc~id1+year1+time+lnpa,family=poisson) where 'id1', 'year1' and 'time' are factors. I defined them with: id1-C(factor(id1), treatment) and 'lnpa' is a continuous variable. The 'summary' function gives me all the effects estimates, that is, for id1, I end up with estimates for id12, id13 and id14, the id11 is the reference level. That is fine, but when I try to fit the model without the point 18, using the command line: fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset(dat, order!=18)) The 'summary' function stop to giving me the levels effect, and gives only one effect for id1, one for year1, one for time and one for lnpa. I want to have the parameters estimates for each level of each factor, as it was in the first fit. Also, I noticed the degree of freedom of deviance and the deviance itself has increased, so I cont't compare both models in terms of their deviance. What should I do to have each factor level effect as I had in the first case? Thanks Marcos __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ISOdate() and strptime()
I have followed with interest the discussion on date handling. I am no expert in these things; all I want to do is convert a character vector that has been read into R (and which may contain some erroneous dates) to a date format, and then do some work with it [e.g., use it in a plot]. Classes POSIXlt and POSIXct seem fine to me - for example, they have very nice and useful seq and plot methods. So now I have two more questions: 1. Is it only incomplete or erroneous dates that might be handled differently by ISOdate() or strptime()? Do correct specifications of year, month and day always give the same results, no matter where or who I am? 2. Can someone point me to a reference that helps me understand why R's (or the Operating systems?) best guess at what I intended turns out to be the results in the examples I posted in my earlier mail? Regards, Heinrich. -Ursprüngliche Nachricht- Von: RINNER Heinrich [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 14. November 2003 11:13 An: '[EMAIL PROTECTED]' Betreff: [R] ISOdate() and strptime() Dear R-people! I am using R 1.8.0, under Windows XP. While using ISOdate() and strptime(), I noticed the following behaviour when wrong arguments (e.g., months12) are given to these functions: ISOdate(year=2003,month=2,day=20) #ok [1] 2003-02-20 13:00:00 Westeuropäische Normalzeit ISOdate(year=2003,month=2,day=30) #wrong day, but returns a value [1] 2003-03-02 13:00:00 Westeuropäische Normalzeit ISOdate(year=2003,month=2,day=35) #wrong day, and returns NA [1] NA ISOdate(year=2003,month=2,day=40) #wrong day, but returns a value [1] 2003-02-04 01:12:00 Westeuropäische Normalzeit ISOdate(year=2003,month=22,day=20) #wrong month, but returns a value [1] 2003-02-02 21:12:00 Westeuropäische Normalzeit And almost the same with strptime(): strptime(2003-02-20, format=%Y-%m-%d) [1] 2003-02-20 strptime(2003-02-30, format=%Y-%m-%d) [1] 2003-03-02 strptime(2003-02-35, format=%Y-%m-%d) [1] NA strptime(2003-02-40, format=%Y-%m-%d) [1] 2003-02-04 strptime(2003-22-20, format=%Y-%m-%d) [1] NA Is this considered to be a user error (If you put garbage in, expect to get garbage out), or would it be safer to generally return Nas, as in ISOdate(year=2003,month=2,day=35)? -Heinrich. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Generalized linear model
The second fit appeared to use a dataframe and the first did not. Try fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset=-18) On Mon, 17 Nov 2003, Marcos Sanches wrote: Hi all! I am fitting a Poisson model, using the following command: fit2-glm(canc~id1+year1+time+lnpa,family=poisson) where 'id1', 'year1' and 'time' are factors. I defined them with: id1-C(factor(id1), treatment) and 'lnpa' is a continuous variable. The 'summary' function gives me all the effects estimates, that is, for id1, I end up with estimates for id12, id13 and id14, the id11 is the reference level. That is fine, but when I try to fit the model without the point 18, using the command line: fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset(dat, order!=18)) The 'summary' function stop to giving me the levels effect, and gives only one effect for id1, one for year1, one for time and one for lnpa. I want to have the parameters estimates for each level of each factor, as it was in the first fit. Also, I noticed the degree of freedom of deviance and the deviance itself has increased, so I cont't compare both models in terms of their deviance. What should I do to have each factor level effect as I had in the first case? Thanks Marcos __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Generalized linear model
Ok, it worked!!! But what would be the command if I want to eliminate another point? I mean, two points at the same time. Thanks, Marcos -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 1:02 PM To: Marcos Sanches Cc: R-Help Subject: Re: [R] Generalized linear model The second fit appeared to use a dataframe and the first did not. Try fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset=-18) On Mon, 17 Nov 2003, Marcos Sanches wrote: Hi all! I am fitting a Poisson model, using the following command: fit2-glm(canc~id1+year1+time+lnpa,family=poisson) where 'id1', 'year1' and 'time' are factors. I defined them with: id1-C(factor(id1), treatment) and 'lnpa' is a continuous variable. The 'summary' function gives me all the effects estimates, that is, for id1, I end up with estimates for id12, id13 and id14, the id11 is the reference level. That is fine, but when I try to fit the model without the point 18, using the command line: fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset(dat, order!=18)) The 'summary' function stop to giving me the levels effect, and gives only one effect for id1, one for year1, one for time and one for lnpa. I want to have the parameters estimates for each level of each factor, as it was in the first fit. Also, I noticed the degree of freedom of deviance and the deviance itself has increased, so I cont't compare both models in terms of their deviance. What should I do to have each factor level effect as I had in the first case? Thanks Marcos __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] S Programming
Dear all, I am thinking of writing my own functions in s-plus (or in R). I just know how to work with S-plus / R built-in functions. Therefore, I'm a beginner in S programming. I am looking for some on-line documentation that is well written about Programming in S language where control stuctures / loops / vectorization and necessery sequences of S programming are presented in an organized form. Any comment / suggestion / idea / web-link / replies will be gladly accepted. Thanks for your time. ___ Mohammad Ehsanul Karim [EMAIL PROTECTED] Institute of Statistical Research and Training University of Dhaka, Dhaka- 1000, Bangladesh __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Generalized linear model
On Mon, 17 Nov 2003, Marcos Sanches wrote: Ok, it worked!!! But what would be the command if I want to eliminate another point? I mean, two points at the same time. subset=-c(18,27) Thanks, Marcos -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 1:02 PM To: Marcos Sanches Cc: R-Help Subject: Re: [R] Generalized linear model The second fit appeared to use a dataframe and the first did not. Try fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset=-18) On Mon, 17 Nov 2003, Marcos Sanches wrote: Hi all! I am fitting a Poisson model, using the following command: fit2-glm(canc~id1+year1+time+lnpa,family=poisson) where 'id1', 'year1' and 'time' are factors. I defined them with: id1-C(factor(id1), treatment) and 'lnpa' is a continuous variable. The 'summary' function gives me all the effects estimates, that is, for id1, I end up with estimates for id12, id13 and id14, the id11 is the reference level. That is fine, but when I try to fit the model without the point 18, using the command line: fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset(dat, order!=18)) The 'summary' function stop to giving me the levels effect, and gives only one effect for id1, one for year1, one for time and one for lnpa. I want to have the parameters estimates for each level of each factor, as it was in the first fit. Also, I noticed the degree of freedom of deviance and the deviance itself has increased, so I cont't compare both models in terms of their deviance. What should I do to have each factor level effect as I had in the first case? Thanks Marcos __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] gradient option in nlm function
Dear list members, I am trying to use nlm function to maximize a mixture likelihood of beta densities. There are five unknown parameters in the likelihood. Since I can get the analytic gradient, I attach the gradient attribute in my target likehood function. The code is as the following target - function(x) { resp - grad - rep(0,5)## I have 5 paramters grad[1] - ...; grad[2] - ...; grad[3] - ...; grad[4] - ...; grad[5] - ... attr(resp, gradient) - grad resp } nlm(targ, c(1,2,3,4,5)) The R gave me this error message Error in nlm(targ, c(1,2,3,4,5)) : probable coding error in analytic gradient I ran my code for defining gradient separately, and there seemed to be no coding error. I provided other options for nlm() function and it gave me the same error message. I removed the gradient part and let nlm() do the numerical derivative, it ran but the algorithm was not converging. I want to know if nlm can handle multiple parameters problems, and if yes, was there any error in my code? How do I properly provide the gradient for my function? Thanks a lot, Yuan Ji, Ph.D. Assistant Professor Department of Bistatistics The University of Texas M.D. Anderson Cancer Center 1515 Holcombe Blvd. - Unit 447 Houston, TX 77030-4009 (713)794-4153 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] S Programming
Look at http://cran.r-project.org/other-docs.html A.S. Alessandro Semeria Models and Simulations Laboratory Montecatini Environmental Research Center (Edison Group), Via Ciro Menotti 48, 48023 Marina di Ravenna (RA), Italy Tel. +39 544 536811 Fax. +39 544 538663 E-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Generalized linear model
From ?glm, I find the following: subset: an optional vector specifying a subset of observations to be used in the fitting process. Thus, to delete observations 16 and 18, I can use the following: fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset=-c(16,18)) hope this helps. spencer graves Marcos Sanches wrote: Ok, it worked!!! But what would be the command if I want to eliminate another point? I mean, two points at the same time. Thanks, Marcos -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 1:02 PM To: Marcos Sanches Cc: R-Help Subject: Re: [R] Generalized linear model The second fit appeared to use a dataframe and the first did not. Try fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset=-18) On Mon, 17 Nov 2003, Marcos Sanches wrote: Hi all! I am fitting a Poisson model, using the following command: fit2-glm(canc~id1+year1+time+lnpa,family=poisson) where 'id1', 'year1' and 'time' are factors. I defined them with: id1-C(factor(id1), treatment) and 'lnpa' is a continuous variable. The 'summary' function gives me all the effects estimates, that is, for id1, I end up with estimates for id12, id13 and id14, the id11 is the reference level. That is fine, but when I try to fit the model without the point 18, using the command line: fit2-glm(canc~id1+year1+time+lnpa,family=poisson, subset(dat, order!=18)) The 'summary' function stop to giving me the levels effect, and gives only one effect for id1, one for year1, one for time and one for lnpa. I want to have the parameters estimates for each level of each factor, as it was in the first fit. Also, I noticed the degree of freedom of deviance and the deviance itself has increased, so I cont't compare both models in terms of their deviance. What should I do to have each factor level effect as I had in the first case? Thanks Marcos __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Accents in R
Hi, How can I include accents and signs like 'ñ' 'à' in the plots generated by R? I try, but R automatically transforms the name ex: countries - c(México, España) countries [1] M\216éxico Espa\216ña I've seen in some Spanish texts about R how is it normal to include labels of the plots and other names with accents, but I can't. I'm using R 1.8.0 in a Mandrake 9.0 Thanks, Xavier __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] gradient option in nlm function
On Mon, 17 Nov 2003 [EMAIL PROTECTED] wrote: Dear list members, I am trying to use nlm function to maximize a mixture likelihood of beta densities. There are five unknown parameters in the likelihood. Since I can get the analytic gradient, I attach the gradient attribute in my target likehood function. The code is as the following target - function(x) { resp - grad - rep(0,5)## I have 5 paramters grad[1] - ...; grad[2] - ...; grad[3] - ...; grad[4] - ...; grad[5] - ... attr(resp, gradient) - grad resp } nlm(targ, c(1,2,3,4,5)) It would probably help if you passed the function target() to nlm(), rather than passing targ(). The R gave me this error message Error in nlm(targ, c(1,2,3,4,5)) : probable coding error in analytic gradient I ran my code for defining gradient separately, and there seemed to be no coding error. I provided other options for nlm() function and it gave me the same error message. I removed the gradient part and let nlm() do the numerical derivative, it ran but the algorithm was not converging. I want to know if nlm can handle multiple parameters problems, and if yes, was there any error in my code? How do I properly provide the gradient for my function? Thanks a lot, Yuan Ji, Ph.D. Assistant Professor Department of Bistatistics The University of Texas M.D. Anderson Cancer Center 1515 Holcombe Blvd. - Unit 447 Houston, TX 77030-4009 (713)794-4153 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] gradient option in nlm function
Oh, that's a typo. I passed the function target. Seems to me R requires some kind of specific syntex. Yuan Ji, Ph.D. Assistant Professor Department of Bistatistics The University of Texas M.D. Anderson Cancer Center 1515 Holcombe Blvd. - Unit 447 Houston, TX 77030-4009 (713)794-4153 |-+-- | | | | | | | |Thomas W Blackwell| | | [EMAIL PROTECTED]| | | | | | 11/17/03 10:18 AM| | | | |-+-- -| | | | | | | |To: | | [EMAIL PROTECTED] | |cc: | | [EMAIL PROTECTED] | |Subject: | | Re: [R] gradient option in nlm function | | | -| On Mon, 17 Nov 2003 [EMAIL PROTECTED] wrote: Dear list members, I am trying to use nlm function to maximize a mixture likelihood of beta densities. There are five unknown parameters in the likelihood. Since I can get the analytic gradient, I attach the gradient attribute in my target likehood function. The code is as the following target - function(x) { resp - grad - rep(0,5)## I have 5 paramters grad[1] - ...; grad[2] - ...; grad[3] - ...; grad[4] - ...; grad[5] - ... attr(resp, gradient) - grad resp } nlm(targ, c(1,2,3,4,5)) It would probably help if you passed the function target() to nlm(), rather than passing targ(). The R gave me this error message Error in nlm(targ, c(1,2,3,4,5)) : probable coding error in analytic gradient I ran my code for defining gradient separately, and there seemed to be no coding error. I provided other options for nlm() function and it gave me the same error message. I removed the gradient part and let nlm() do the numerical derivative, it ran but the algorithm was not converging. I want to know if nlm can handle multiple parameters problems, and if yes, was there any error in my code? How do I properly provide the gradient for my function? Thanks a lot, Yuan Ji, Ph.D. Assistant Professor Department of Bistatistics The University of Texas M.D. Anderson Cancer Center 1515 Holcombe Blvd. - Unit 447 Houston, TX 77030-4009 (713)794-4153 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Accents in R
Cf. expression() On Monday 17 November 2003 17:14, Xavier Fernández i Marín wrote: Hi, How can I include accents and signs like 'ñ' 'à' in the plots generated by R? I try, but R automatically transforms the name ex: countries - c(México, España) countries [1] M\216éxico Espa\216ña I've seen in some Spanish texts about R how is it normal to include labels of the plots and other names with accents, but I can't. I'm using R 1.8.0 in a Mandrake 9.0 Thanks, Xavier __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Salvatore Barbaro University of Goettingen Department of Public Economics Platz der Goettinger Sieben 3 D-37073 Goettingen, Germany Tel +49 (0)551 3919704 http://www.gwdg.de/~sbarbar __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Symbolic math?
Depending on what you want to do ?deriv in R may be enough. --- Date: Mon, 17 Nov 2003 05:37:22 -0500 From: Hank Stevens [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R] Symbolic math? Hi Folks, I am using Windows 2000 and was wondering what (Open Source) software R users use or might recommend for symbolic computations (aside from the ol' noggin, e.g., Maxima, Mathomatic) . Thanks, Hank Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Accents in R
Xavier Fernández i Marín [EMAIL PROTECTED] writes: Hi, How can I include accents and signs like 'ñ' 'à' in the plots generated by R? I try, but R automatically transforms the name ex: countries - c(México, España) countries [1] M\216éxico Espa\216ña I've seen in some Spanish texts about R how is it normal to include labels of the plots and other names with accents, but I can't. I'm using R 1.8.0 in a Mandrake 9.0 You'll need to get rid of UTF-8 encoding, since R doesn't know how to deal with it. I'm not sure of the details on Mandrake, but I suspect you need to diddle /etc/sysconfig/i18n or set some environment variables (among the ones listed by locale). -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Symbolic math?
Hi, Have you tried Yacas? Yacas is a general purpose easy to use Computer Algebra System . It is built on top of its own programming language designed for this purpose, in which new algorithms can easily be implemented. In addition, it comes with extensive documentation on the functionality implemented and methods used to implement them. Is is open source. http://www.xs4all.nl/~apinkus/yacas.html Len Arne Henningsen [EMAIL PROTECTED] wrote: Hi, I sometimes use MuPAD (www.mupad.com). Unfortunately, it is not Open Source, but most versions are free of charge for non-commercial use (see http:// www.sciface.com/personal.shtml). Arne On Monday 17 November 2003 11:37, Hank Stevens wrote: Hi Folks, I am using Windows 2000 and was wondering what (Open Source) software R users use or might recommend for symbolic computations (aside from the ol' noggin, e.g., Maxima, Mathomatic) . Thanks, Hank Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 [EMAIL PROTECTED] http://www.uni-kiel.de/agrarpol/ahenningsen/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help - [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Rweb: how to use source()
For the code, just copy and paste it through the clipboard into Rweb. For the data, you enter the URL in the area where Rweb says External Data Entry. Alternately, you can use the R dput command on your machine to turn the data into an R statement and then add it to the source file, eliminating the need for reading an external data file. --- Date: Mon, 17 Nov 2003 07:24:35 -0500 From: Jonathan Baron [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R] Rweb: how to use source() I cannot discover how to set or find the working directory in Rweb, so that I can source() a file from the server. The file I source() must refer to a data file in its directory. setwd() does not do anything, and getwd() says that the working directory is in /var/www/cgi-bin/ (on Linux). (I have a student who installed R on her own computer and analyzed half of her data, and then her computer died. Rweb could let her finish, if I could just take what she's done so far, which I have, and put it on my server.) -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] LOCF - Last Observation Carried Forward
Here's a faster version of most.recent. It uses rep() in a vectorized manner. # Gabor Grothendieck's function: most.recent.cut - function(x) + as.numeric(as.vector(cut(seq(x),c(which(x),Inf),lab=which(x),right=F))) # Version that uses which() and vectorized rep() most.recent - function(x) { + # return a vector of indices of the most recent TRUE value + if (!is.logical(x)) + stop(x must be logical) + x.pos - which(x) + if (length(x.pos)==0 || x.pos[1] != 1) + x.pos - c(1, x.pos) + rep(x.pos, c(diff(x.pos), length(x) - x.pos[length(x.pos)] + 1)) + } x - sample(c(T,F),1e7,rep=T) system.time(most.recent.cut(x)) [1] 41.21 0.54 41.98NANA system.time(most.recent(x)) [1] 2.67 0.08 2.78 NA NA -- Tony Plate At Friday 10:21 PM 11/14/2003 -0500, Gabor Grothendieck wrote: From: Tony Plate [EMAIL PROTECTED]: Here's a function that does the essential computation (written to work in both S-plus and R). This looks like one of those tricky problems that do not vectorize easily. It would be simple to write a C-program to compute this very efficiently. But are there any more efficient solutions than ones like the below (that are written without resort to C)? most.recent - function(x) { # return a vector of indices of the most recent TRUE value if (!is.logical(x)) stop(x must be logical) x[is.na(x)] - FALSE # x is a logical vector r - rle(x) ends - cumsum(r$lengths) starts - ends - r$lengths + 1 spec - as.list(as.data.frame(rbind(start=starts, len=r$lengths, value=as.numeric(r$values), prev.end=c(NA, ends[-length(ends)] names(spec) - NULL unlist(lapply(spec, function(s) if (s[3]) seq(s[1], len=s[2]) else rep(s[4], len=s[2])), use.names=F) } x - c(F,T,T,F,F,F,T,F) most.recent(x) [1] NA 2 3 3 3 3 7 7 And using it to do the fill-forward: x - c(NA,2,3,NA,4,NA,5,NA,NA,NA,6,7,8,NA) x[most.recent(!is.na(x))] [1] NA 2 3 3 4 4 5 5 5 5 6 7 8 8 Some timings: x - sample(c(T,F),1e4,rep=T) system.time(most.recent(x)) [1] 0.33 0.01 0.47 NA NA x - sample(c(T,F),1e5,rep=T) system.time(most.recent(x)) [1] 4.27 0.06 6.44 NA NA x - sample(c(T,F),1e6,rep=T) system.time(most.recent(x)) [1] 47.27 0.17 47.97 NA NA -- Tony Plate PS. Actually, I just found a solution that I had lying around that is about 70 times as fast on random test data like the above. I was waiting for you to post this but didn't see it so I thought I would post mine. This one is 13x as fast and only requires a single line of code. set.seed(111) x - sample(c(T,F),1,rep=T) system.time(z1 - most.recent(x)) [1] 0.92 0.02 1.68 NA NA system.time(z2 - as.numeric(as.vector( cut(seq(x),c(which(x),Inf),lab=which(x),right=F [1] 0.07 0.00 0.12 NA NA all.equal(z1,z2) [1] TRUE __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Tony Plate [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Accents in R
Hello! If you are using a GNOME-Terminal or if you are running R inside Emacs just make yourself sure that you change the UTF-8 encoding before starting R. On Mon, 17 Nov 2003, Salvatore Barbaro wrote: Cf. expression() On Monday 17 November 2003 17:14, Xavier Fernández i Marín wrote: Hi, How can I include accents and signs like 'ñ' 'à' in the plots generated by R? I try, but R automatically transforms the name ex: countries - c(México, España) countries [1] M\216éxico Espa\216ña I've seen in some Spanish texts about R how is it normal to include labels of the plots and other names with accents, but I can't. I'm using R 1.8.0 in a Mandrake 9.0 Thanks, Xavier __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Ulises M. Alvarez LAB. DE ONDAS DE CHOQUE FISICA APLICADA Y TECNOLOGIA AVANZADA UNAM [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] A suggestion regarding multiple replies
On 17 Nov 2003 at 15:08, Ted Harding wrote: On 15-Nov-03 Ted Harding wrote: And the following (in today's ?for thread) is a perfect example of what I mean: === From: Peter Dalgaard [EMAIL PROTECTED] To: Angel [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [R] ?for Date: 17 Nov 2003 11:49:37 +0100 Further hint: ? is an operator, syntactically similar to + and -. You can apply operators to the result of a for loop. Consider for example x - 1; - for (i in 1:10) x - x * i (? has special semantics, but that is not noticed at parse time). === This is just the sort of thing I love to see posted to the list, since it is an eye-opener. In fact, to really see what goes on I had to rub my eyes as follows: - for (i in 1:10) print(i) and I'm posting it hoping that it will enlighten some other people. Best wishes to all, Ted. Indeed! look at the following: test - function(x) invisible(x) test(9) - test(9) [1] -9 Kjetil Halvorsen E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 17-Nov-03 Time: 15:08:38 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] A suggestion regarding multiple replies
[EMAIL PROTECTED] wrote: Indeed! look at the following: test - function(x) invisible(x) test(9) - test(9) [1] -9 or even: +test(9) [1] 9 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Fwd: License Agreement
*** Sigrid M. Volko, Ph.D. Assistant Director Office of Licensing and Technology Development Johns Hopkins University 100 N. Charles Street, 5th Floor Baltimore, MD 21201 phone: 410-516-4962 fax: 410-516-5113 This e-mail message (including any attachments hereto) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not an intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including the attachments hereto) is prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including any attachments hereto). Thank you for your cooperation. ---BeginMessage--- Dear Mr. Leisch, I was asked by one of our faculty members at Johns Hopkins University to assist him in licensing a software application that he has developed. This package is based on R, the statistical software that is distributed as freeware. In the course of my due diligence analysis, I reviewed the official R web page which states that R is an official part of the Free Software Foundation's GNU project. However, it does not explicitly state under which License Agreement R is made available. Reviewing the GNU official web page, I assume that R is made available under the GNU General Public License. I would, however, appreciate if you could confirm that this information is correct. I look forward to hearing from you soon. Mit besten Gruessen, Sigrid Volko *** Sigrid M. Volko, Ph.D. Assistant Director Office of Licensing and Technology Development Johns Hopkins University 100 N. Charles Street, 5th Floor Baltimore, MD 21201 phone: 410-516-4962 fax: 410-516-5113 This e-mail message (including any attachments hereto) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not an intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including the attachments hereto) is prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including any attachments hereto). Thank you for your cooperation. ---End Message--- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] cumulative distribution functions
On Mon, 17 Nov 2003 18:30:08 -, Monica Palaseanu-Lovejoy [EMAIL PROTECTED] wrote : hi y'all, I am wondering if there is any special command, function, package, etc to help me doing a cumulative distribution function, with y-scale - probability scale. I tried the help in R and i got the following answers: cumsum(base)Cumulative Sums, Products, and Extremes ecdf(stepfun) Empirical Cumulative Distribution Function cpgram(ts) Plot Cumulative Periodogram But i could not find either (stepfun) nor (ts) packages to read the specific help. Are they discarded? The cumsum seems not to do what i really was after. You need to execute library(stepfun) before help for ecdf will work. In general, the notation is topic(package) Description and you need library(package) to see ?topic. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ?for
Well ^C or ESC (on Windows GUI) is the answer I would give. On Tue, 18 Nov 2003, Ray Brownrigg wrote: Peter Dalgaard [EMAIL PROTECTED] writes: Prof Brian Ripley [EMAIL PROTECTED] writes: You have typed a syntactically incomplete statement: this is explained in ?help. Hint: ?for and help(for) work. [Original question added back in: On Sun, 16 Nov 2003, Angel wrote: I have always been intrigued by why ?for (or ?if,?while,etc) leave R wanting for more: ?for + I know the help for these is in ?Control, but I sometimes make the mistake of typing ?for instead. What is R expecting me to say to finish the statement? ] Further hint: ? is an operator, syntactically similar to + and -. You can apply operators to the result of a for loop. Consider for example x - 1; - for (i in 1:10) x - x * i (? has special semantics, but that is not noticed at parse time). Unfortunately the original question still hasn't been answered explicitly, not even in ?help. Try: ?for + (i in 0) 0 or: ?if + (T) T or: ?+ + 0 So you have to provide the rest of a syntactically complete statement. Just to see if you now understand exactly how ? works, what do you think: ? paste(help) will do? Ray Brownrigg -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] image processing
Greetings, R-ians: I am embarking on a project that I anticipate will require cleaning up some noisy 2-D images, and would like to use MCMC to that end. But I don't want to start from scratch if someone if the R-community has already plowed that field. (I love mixed metaphors.) Anyway, any advice, leads, code-snippets, or anything else helpful would be greatly appreciated. Thanks. Charles Annis, P.E. mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] phone: 561-352-9699 eFAX: 503-217-5849 http://www.StatisticalEngineering.com http://www.statisticalengineering.com/ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] rpart postscript graphics, Mac OS
I am running R on Mac OS X 10.2x. When I create postscript graphics of rpart tree objects, a tiny part of the tree gets trimmed off, even when it has only a few terminal nodes. This happens even without fancy but worse if fancy=T. (This doesn't happen with boxplot, scatter plots, etc.) How do I fix this? postscript(tree.eps) plot(davb.tree, u=T) text(davb.tree, use.n=T, fancy=F) dev.off() Thanks Kais __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ?for
On Mon, 2003-11-17 at 14:27, Prof Brian Ripley wrote: Well ^C or ESC (on Windows GUI) is the answer I would give. On Tue, 18 Nov 2003, Ray Brownrigg wrote: Peter Dalgaard [EMAIL PROTECTED] writes: Prof Brian Ripley [EMAIL PROTECTED] writes: You have typed a syntactically incomplete statement: this is explained in ?help. Hint: ?for and help(for) work. [Original question added back in: On Sun, 16 Nov 2003, Angel wrote: I have always been intrigued by why ?for (or ?if,?while,etc) leave R wanting for more: ?for + I know the help for these is in ?Control, but I sometimes make the mistake of typing ?for instead. What is R expecting me to say to finish the statement? ] Further hint: ? is an operator, syntactically similar to + and -. You can apply operators to the result of a for loop. Consider for example x - 1; - for (i in 1:10) x - x * i (? has special semantics, but that is not noticed at parse time). Unfortunately the original question still hasn't been answered explicitly, not even in ?help. Try: ?for + (i in 0) 0 or: ?if + (T) T or: ?+ + 0 So you have to provide the rest of a syntactically complete statement. Just to see if you now understand exactly how ? works, what do you think: ? paste(help) will do? Ray Brownrigg R 1.8.1 Beta using gnome-terminal on Fedora Core 1 gives: ? paste(help) help() for paste is shown in browser /usr/bin/mozilla ... Use help( paste , htmlhelp=FALSE) or options(htmlhelp = FALSE) to revert. However, using ESS with emacs on the same platform gives: ? paste(help) Error in help(paste(, htmlhelp = FALSE) : No documentation for 'paste(' in specified packages and libraries: you could try 'help.search(paste()' :-) Marc __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] \preformatted and $
Hi, I have been developing a package in R and have been working on documentation. I have a \details function that contains the following: \details{ some text \preformatted{ [my-section] user = apv host = 127.0.0.1 } } When I run R CMD check I get an error while checking the manual. If I remove: \preformatted{ [my-section] user = apv host = 127.0.0.1 } and replace it with [my-section] user = apv host = 127.0.0.1 the error goes away. Has anybody had this problem? I have also have a problem including a '$' in my documentation. I replace them with \$ which made latex happy but then \$ showed up in the HTML and R help. Any advice would be appreciated, Arend van der Veen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Looking for recommendations for optimal memory settings
We have a Windows 2000 operating system and I need to configure the workstations. What are your recommendations for users with very large data sets (300Mb)? The systems are Dell GX240s with 512 Mbs of Ram. What command line or environment variables work best? Sincerely, Joe Busch Urban Institute __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] reordering numbers in a vector
Suppose you initially create a vector a-c(5,1,3,4). You want to sort the vector before performing specific calculations to the numbers. You now have the vector [1,3,4,5]. How can you now revert back to your initial ordering of [5,1,3,4]? Is there a specific command or 'sort by' command that one could use? Thanks again- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] reordering numbers in a vector
Merrill Birkner wrote: Suppose you initially create a vector a-c(5,1,3,4). You want to sort the vector before performing specific calculations to the numbers. You now have the vector [1,3,4,5]. How can you now revert back to your initial ordering of [5,1,3,4]? Is there a specific command or 'sort by' command that one could use? Thanks again- I think what you want is ?order. a - c(5, 1, 3, 4) a.ord - a[order(a)] HTH, Sundar __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] reordering numbers in a vector
If you need only to sort a vector, then sort() does the job. To go back to the original vector, the following may work: x - unique(rpois(30,5)) x [1] 8 5 3 4 6 9 2 7 x.sorted - sort(x) x.sorted [1] 2 3 4 5 6 7 8 9 x.sorted[order(order(x))] [1] 8 5 3 4 6 9 2 7 HTH, Giovanni Date: Mon, 17 Nov 2003 15:21:18 -0800 (PST) From: Merrill Birkner [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Precedence: list Suppose you initially create a vector a-c(5,1,3,4). You want to sort the vector before performing specific calculations to the numbers. You now have the vector [1,3,4,5]. How can you now revert back to your initial ordering of [5,1,3,4]? Is there a specific command or 'sort by' command that one could use? Thanks again- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- __ [ ] [ Giovanni Petris [EMAIL PROTECTED] ] [ Department of Mathematical Sciences ] [ University of Arkansas - Fayetteville, AR 72701 ] [ Ph: (479) 575-6324, 575-8630 (fax) ] [ http://definetti.uark.edu/~gpetris/ ] [__] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] sampling without repetition
Hi, I'm trying to write a function that will divide a given range of numbers into 3 sets using sample(), without repetition. Currently I'm trying this approach: r - 1:10 s1 - sample(r,size=3) Next, I want to remove the selected elements from r and sample() from the remainder. r - r[ -(r=s1) ] s2 - sample(r,size=3) When I go to remove the elements contained in s2 from r I get an error: r - r[ -(r=s2) ] Error: subscript out of bounds I'm not sure why this is happening. I tried replacing the '=' with '==' but I get another error Warning message: longer object length is not a multiple of shorter object length in: r == s1 Essentially what I need is to get the indices into r of the elements of s1 s2. I have looked at which but I cant seem to work out how I can get the indices into r of all the elements of, say, s1. Does anybody have any suggestions? (Of course if there is a more elegant way of doing this whole thing I would appreciate any pointers) Thanks, --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- A committee is a life form with six or more legs and no brain. -- Lazarus Long, Time Enough For Love __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sampling without repetition
Rajarshi - Do you want three sets, three disjoint sets, or sets of size three ? It's not clear what you are attempting to do. - tom blackwell - u michigan medical school - ann arbor - On Mon, 17 Nov 2003, Rajarshi Guha wrote: Hi, I'm trying to write a function that will divide a given range of numbers into 3 sets using sample(), without repetition. Currently I'm trying this approach: r - 1:10 s1 - sample(r,size=3) Next, I want to remove the selected elements from r and sample() from the remainder. r - r[ -(r=s1) ] s2 - sample(r,size=3) When I go to remove the elements contained in s2 from r I get an error: r - r[ -(r=s2) ] Error: subscript out of bounds I'm not sure why this is happening. I tried replacing the '=' with '==' but I get another error Warning message: longer object length is not a multiple of shorter object length in: r == s1 Essentially what I need is to get the indices into r of the elements of s1 s2. I have looked at which but I cant seem to work out how I can get the indices into r of all the elements of, say, s1. Does anybody have any suggestions? (Of course if there is a more elegant way of doing this whole thing I would appreciate any pointers) Thanks, --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sampling without repetition
On Mon, 2003-11-17 at 20:01, Thomas W Blackwell wrote: Rajarshi - Do you want three sets, three disjoint sets, or sets of size three ? It's not clear what you are attempting to do. Sorry about that. I wanted to select 3 disjoint sets from a supplied vector of numbers. My initial example had r - 1:300 but there is no guarantee that r will contain a consecutive sequence of numbers. --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- A list is only as strong as its weakest link. -- Don Knuth __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sampling without repetition
Rajarshi - To obtain three disjoint subsets, I would do indic - sample(seq(3), length(r), TRUE) s1 - r[indic == 1] s2 - r[indic == 2] s3 - r[indic == 3] Note that the sizes of the three subsets have a joint multinomial distribution with parameters prob = c(1/3, 1/3, 1/3) and n = length(r). - tom blackwell - u michigan medical school - ann arbor - On Mon, 17 Nov 2003, Rajarshi Guha wrote: On Mon, 2003-11-17 at 20:01, Thomas W Blackwell wrote: Rajarshi - Do you want three sets, three disjoint sets, or sets of size three ? It's not clear what you are attempting to do. Sorry about that. I wanted to select 3 disjoint sets from a supplied vector of numbers. My initial example had r - 1:300 but there is no guarantee that r will contain a consecutive sequence of numbers. --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- A list is only as strong as its weakest link. -- Don Knuth __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sampling without repetition
r - 1:30 # Random allocation to sets tapply(r, sample(1:3,length(r),rep=T), c) $1 [1] 1 3 8 12 15 16 18 20 21 25 29 $2 [1] 2 5 6 7 9 10 13 14 17 19 22 27 30 $3 [1] 4 11 23 24 26 28 # Equal size sets (approximately) tapply(r, sample(seq(length(r))%%3), c) $0 [1] 1 6 9 10 12 15 22 24 28 30 $1 [1] 2 3 4 5 8 17 18 21 23 27 $2 [1] 7 11 13 14 16 19 20 25 26 29 At Monday 07:28 PM 11/17/2003 -0500, you wrote: Hi, I'm trying to write a function that will divide a given range of numbers into 3 sets using sample(), without repetition. Currently I'm trying this approach: r - 1:10 s1 - sample(r,size=3) Next, I want to remove the selected elements from r and sample() from the remainder. r - r[ -(r=s1) ] s2 - sample(r,size=3) When I go to remove the elements contained in s2 from r I get an error: r - r[ -(r=s2) ] Error: subscript out of bounds I'm not sure why this is happening. I tried replacing the '=' with '==' but I get another error Warning message: longer object length is not a multiple of shorter object length in: r == s1 Essentially what I need is to get the indices into r of the elements of s1 s2. I have looked at which but I cant seem to work out how I can get the indices into r of all the elements of, say, s1. Does anybody have any suggestions? (Of course if there is a more elegant way of doing this whole thing I would appreciate any pointers) Thanks, --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- A committee is a life form with six or more legs and no brain. -- Lazarus Long, Time Enough For Love __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Tony Plate [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sampling without repetition
On 17 Nov 2003 20:07:08 -0500, you wrote: Sorry about that. I wanted to select 3 disjoint sets from a supplied vector of numbers. My initial example had r - 1:300 but there is no guarantee that r will contain a consecutive sequence of numbers. It's still not clear whether the 3 sets should be of fixed size or random size, and whether they should cover all of r or just part of it. Thomas' solution gave you a random partition. If you just want 3 non-overlapping samples, each of size n, then do something like: indices - sample(1:length(r), size=3*n) sample1 - r[indices[1:n]] sample2 - r[indices[(n+1):(2*n)]] sample3 - r[indices[(2*n+1):(3*n)]] Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] rpart postscript graphics, Mac OS
Hi Kaiser Fung wrote: I am running R on Mac OS X 10.2x. When I create postscript graphics of rpart tree objects, a tiny part of the tree gets trimmed off, even when it has only a few terminal nodes. This happens even without fancy but worse if fancy=T. (This doesn't happen with boxplot, scatter plots, etc.) How do I fix this? postscript(tree.eps) plot(davb.tree, u=T) text(davb.tree, use.n=T, fancy=F) dev.off() It's hard to see your problem without the actual data to reproduce it. Does it help if you precede the plot command with par(xpd=NA)? Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] arima() in ts
I am trying to find a way to obtain the fitted values for a model fit using arima() in the ts package. I came across a suggestion in the mailing list archive that these values can be simply calculated as: model-arima(t, order = c(1,1,0)); fitted-t-model$residuals; But, the help file for arima() in the ts package describes the residuals values returned as being standardized residuals - I was wondering in what way the residuals have been standardized as they do not appear to always have a variance close to 1, and whether the standardization affects the validity of the above way of calculating the fitted values. If so, is there any easy way to get the fitted values? Bridget __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] sampling without repetition
On Mon, 2003-11-17 at 20:31, Duncan Murdoch wrote: On 17 Nov 2003 20:07:08 -0500, you wrote: Sorry about that. I wanted to select 3 disjoint sets from a supplied vector of numbers. My initial example had r - 1:300 but there is no guarantee that r will contain a consecutive sequence of numbers. It's still not clear whether the 3 sets should be of fixed size or random size, and whether they should cover all of r or just part of it. Thomas' solution gave you a random partition. If you just want 3 non-overlapping samples, each of size n, then do something like: Sorry for not providing all the details. The 3 sets can be of any size (which will be specified by the user of the function) and cover all of r (ie, set1 + set2 + set3 == r) Thanks to everybody for all the solutions. --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- I'd love to go out with you, but there are important world issues that need worrying about. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] RE: relationship between two discrete variables
Further to my queries re relating discrete variables I have had a couple of tips on things I could try. This has lead me to attempt a marginal homogeneity test (http://ourworld.compuserve.com/homepages/jsuebersax/margin.htm). o Does anyone have an opinion on whether this approach would be appropriate? o Does R have some built in help to do this? I found a reference to the McNemar test but not to the Stuart-Maxwell test. cheers [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Looking for recommendations for optimal memory settings
On Mon, 17 Nov 2003, Busch, Joe wrote: We have a Windows 2000 operating system and I need to configure the workstations. What are your recommendations for users with very large data sets (300Mb)? The systems are Dell GX240s with 512 Mbs of Ram. What command line or environment variables work best? The default ones. Just add another 1.5Gb of RAM and then consider using --max-mem-size, the only setting that will make any real difference. (The next minor version of R, probably 1.9.0, will make better use of 2Gb under Windows than the current one, so you may want to compile up pre-releases of that.) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help