Re: [R] array searches
Hi, This is truly amazing stuff. Inspired by Jim's and Olivier's suggestions, I'm trying to expand it to work with a m x n matrix, where the first column is dates and the next columns are all signals. I dare say a suitable application of 'apply' should work. Thanks a ton. Murali From: jim holtman [EMAIL PROTECTED] To: Murali Menon [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] array searches Date: Fri, 16 Feb 2007 10:21:40 -0500 try this: x - scan(textConnection(30/01/2007 0 + 31/01/2007 -1 + 01/02/2007 -1 + 02/02/2007 -1 + 03/02/2007 1 + 04/02/2007 1 + 05/02/2007 1 + 06/02/2007 1 + 07/02/2007 1 + 08/02/2007 1 + 09/02/2007 0 + 10/02/2007 0 + 11/02/2007 0 + 12/02/2007 1 + 13/02/2007 1 + 14/02/2007 1 + 15/02/2007 0 + 16/02/2007 0 + ), what=list(date=, value=0)) Read 18 records x$date - as.Date(x$date, %d/%m/%Y) # determine the breaks x.breaks - c(TRUE, diff(x$value) != 0) # determine the value at the break; assume that it is the minimum x.bdate - x$date[x.breaks] data.frame(date=x.bdate[cumsum(x.breaks)], value=x$value) date value 1 2007-01-30 0 2 2007-01-31-1 3 2007-01-31-1 4 2007-01-31-1 5 2007-02-03 1 6 2007-02-03 1 7 2007-02-03 1 8 2007-02-03 1 9 2007-02-03 1 10 2007-02-03 1 11 2007-02-09 0 12 2007-02-09 0 13 2007-02-09 0 14 2007-02-12 1 15 2007-02-12 1 16 2007-02-12 1 17 2007-02-15 0 18 2007-02-15 0 On 2/16/07, Murali Menon [EMAIL PROTECTED] wrote: Folks, I have a dataframe comprising a column of dates and a column of signals (-1, 0, 1) that looks something like this: 30/01/2007 0 31/01/2007 -1 01/02/2007 -1 02/02/2007 -1 03/02/2007 1 04/02/2007 1 05/02/2007 1 06/02/2007 1 07/02/2007 1 08/02/2007 1 09/02/2007 0 10/02/2007 0 11/02/2007 0 12/02/2007 1 13/02/2007 1 14/02/2007 1 15/02/2007 0 16/02/2007 0 What I need to do is for each signal *in reverse chronological order* to find the date that it first appeared. So, for the zero on 16/02/2007 and 15/02/2007, the 'inception' date would be 15/02/2007, because the day before, the signal was 1. Likewise, the 'inception' date for the signal 1 on 08/02/2007 and the five days prior, would be 03/02/2007. I need to create a structure of inception dates that would finally look as follows: -1 31/01/2007 -1 31/01/2007 -1 31/01/2007 1 03/02/2007 1 03/02/2007 1 03/02/2007 1 03/02/2007 1 03/02/2007 1 03/02/2007 0 09/02/2007 0 09/02/2007 0 09/02/2007 1 12/02/2007 1 12/02/2007 1 12/02/2007 0 15/02/2007 0 15/02/2007 Is there a clever way of doing this? My sadly C-oriented upbringing can only think in terms of for-loops. Thanks! Murali _ The average US Credit Score is 675. The cost to see yours: $0 by Experian. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? _ fast as 1 year __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with RMySQL
Hi R users, I am using RMySQL to connect to a database in MySQL. I have 3 questions. 1)When I give the following command dbListTables(con) I get the output stack imbalance in .Call, 142 then 143 stack imbalance in -, 140 then 141 stack imbalance in {, 138 then 139 stack imbalance in standardGeneric, 126 then 127 stack imbalance in class, 121 then 122 stack imbalance in -, 119 then 120 stack imbalance in {, 117 then 118 stack imbalance in -, 111 then 112 stack imbalance in {, 109 then 110 [1] newtable ravi Could somebody tell me why it shows a stack imbalance? 2)For this command testcmd1-fetch(dbSendQuery(con,select ticker from ravi where banks=100)) dim(testcmd1) The output is [1] 500 1 However when I give the same command directly in MySQL command prompt I get an output greater than 2000!! (Does fetch have a limitation?) 3) Also is it possible to get output where the NA values are removed? Thanks in advance for the help Ravi [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Wrinting integers in a matrix faile
write.matrix(as.integer(b),'data.out') Mohsen Jafarikia wrote: Hello everyone, I am using the following program to get the p-value of some numbers (column 'LR' of the data.dat file). I want to write the 1st and 2nd column of the output file (data.out) as an integer while the program change them to double. Could anybody please tell me how I can write the code which writes the values of the first two columns as integer? Thanks library ('MASS') MP-read.table(file='data.dat') names(MP)-c('B','R','S','L','LR','Q') a-as.matrix((1-pchisq(MP$LR, df=1))) b-cbind(MP$B,MP$R,a,MP$S,MP$L,MP$LR,MP$Q) write.matrix(b,'data.out') __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] kernel regression
Dear R community, I have tried to use the kernel regression in the NP package. I work in a population biology study and the regression function (npr) dealing with continuous and categorical variables seems to be appropriate for such study with non parametric data. I have 3 questions: First: Is there a way to have for each predictor a value indicating the explanation of each predictor in the model. (not only the R2 for the whole model but for each predictor). Second: What should be the correct tolerance value for the bandwidth. I use 0.01. Third: What is the suitable bootstrap repetition number (but.num) in the npsigtest function? I use the default value (499), with 7 variables(5 continous,2 categorical) and 1600 data point, it takes 23 hours to compute the test and normally for publication purpose 999 bootstraps is the minimal number of repetitions. Is it possible to do the test on a set of suitable observation? Could somebody also give me some references of publications using such analysis in ecological domain? Than you for answers and best regards. Romain Mayor. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] optim(method=L-BFGS-B) abnormal termination
Hi, my call of optim() with the L-BFGS-B method ended with the following error message: ERROR: ABNORMAL_TERMINATION_IN_LNSRCH Further tracing shows: Line search cannot locate an adequate point after 20 function and gradient evaluations final value 0.086627 stopped after 7 iterations Could someone pls tell me whether it is possible to increase the limit of 20 evaluations? Is it even worth doing so? My function(s) to be minimized are polynomial functions of tens of variables - let say 10 - 60 variables, all of them constrained to the (0,1) interval. Is it even possible and meaningfull to attempt such minimization? (Suppose I have good starting values.) Thaks, Petr -- Petr Klasterecky Dept. of Probability and Statistics Charles University in Prague Czech Republic __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] question about boxplot
You can also set axes=FALSE as in boxplot( p.prop ~ R + bins, axes=FALSE ) and then add your own labels with axis(). the argument 'at' for axis() in the case of boxplots are usually integers going from 1 to # of groups, though I don't know specifically for your crossed factors. For rotated names, you probably want to set axis(#arguments#,labels=FALSE) and then use text() with 'srt' (don't forget to use xpd=TRUE in text()). par(cxy) may help with positioning text relative to axis. all the best, st --- Michael Kubovy [EMAIL PROTECTED] wrote: On Feb 22, 2007, at 2:56 PM, Smith, Phil ((CDC/CCID/NCIRD)) wrote: boxplot( p.prop ~ R + bins ) This command makes nice boxplot for the factor R crossed with the factor bins. I am having alot of trouble getting control of the labels on the X axis. I want to control it more by specifying what the labels are, controling the 'size' of those labels (by using cex), and then control the rotation of the character strings of those labels (by using srt or crt). There is a names argument to boxplot, but I haven't had much luck controlling what it prints, the size of the font, and the character rotation. Would you consider an easy way out---an alternative with reasonable defaults? data(ToothGrowth) bwplot(dose ~ len | supp, ToothGrowth) _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Never miss an email again! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mixture of 2 normals - starting values
Hi, you can also look at the function normalmix.init in the mixtools package. Tatiana Tatiana Benaglia Ph.D. Candidate Department of Statistics Penn State University On Feb 23, 2007, at 12:02 AM, [EMAIL PROTECTED] wrote: Hi, I have a problem of estimating a mixture of two normal distributions. I need to find the starting points automatically, since this is a part of a larger piece of image processing code. I found the mix2normal1 function in VGAM package that mentions a method of finding starting values for mu1 and mu2 but refers the reader to a book by Everitt and Hand. Unfortunately, I do not have an easy access to this book. Could anybody point me to a description of the method that I could use? Any help will be appreciated. Thanks in advance, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how much performance penalty does this incur, scalar as a vector of one element?
The 64 bit version of VisualWorks Smalltalk has an immediate ShortDouble, which sacrifices two bits of exponent for a tag. It thus has the same precision as an IEEE double, but one fourth as much range. Overflows automatically get promoted to ordinary Double's, which are pointers to objects holding real IEEE doubles. Luke Tierney [EMAIL PROTECTED] writes: Systems that support integer scalars often represent them as immediate values within pointers by sacrificing one or two bits of precision in the integers, but that doesn't work for double precision floats except possibly on 64-bit systems. -- Jeff __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] TRUE/FALSE as numeric values
Hello, I want to select in a column of a dataframe all numbers smaller than a value x but when I type in test-(RSF_EU$AREA=x) I receiv as answer: test [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE [18] TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE [35] FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE FALSE FALSE TRUE FALSE [52] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE How can i get the values smaller than x and not the TRUE/FALSE reply? Thanks in advance, Thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] TRUE/FALSE as numeric values
On Fri, 23 Feb 2007 14:38:56 +0100 Thomas Preuth [EMAIL PROTECTED] wrote: Hello, I want to select in a column of a dataframe all numbers smaller than a value x but when I type in test-(RSF_EU$AREA=x) I receiv as answer: test [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE [18] TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE [35] FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE FALSE FALSE TRUE FALSE [52] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE How can i get the values smaller than x and not the TRUE/FALSE reply? if the dataframe is called RSF_EU, and you want the entire dataframe for those rows, then RSF_EU [ (RSF_EU$AREA = x ), ] if you want to get only that column vector and nothing else RSF_EU$AREA [ ( RSF_EU$AREA = x ) ] Such concepts are very well-explained in An Introduction to R which you would benefit by reading at the earliest. Ranjan Thanks in advance, Thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] TRUE/FALSE as numeric values
You can also: test - RSF_EU[which(RSF_EU$AREA=x),] On 23/02/07, Thomas Preuth [EMAIL PROTECTED] wrote: Hello, I want to select in a column of a dataframe all numbers smaller than a value x but when I type in test-(RSF_EU$AREA=x) I receiv as answer: test [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE [18] TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE [35] FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE FALSE FALSE TRUE FALSE [52] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE How can i get the values smaller than x and not the TRUE/FALSE reply? Thanks in advance, Thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] TRUE/FALSE as numeric values
RSF_EU$AREA[RSF_EU$AREA=x] ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:r-help- [EMAIL PROTECTED] Namens Thomas Preuth Verzonden: vrijdag 23 februari 2007 14:39 Aan: r-help@stat.math.ethz.ch Onderwerp: [R] TRUE/FALSE as numeric values Hello, I want to select in a column of a dataframe all numbers smaller than a value x but when I type in test-(RSF_EU$AREA=x) I receiv as answer: test [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE [18] TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE [35] FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE FALSE FALSE TRUE FALSE [52] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE How can i get the values smaller than x and not the TRUE/FALSE reply? Thanks in advance, Thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] TRUE/FALSE as numeric values
On Fri, 2007-02-23 at 14:38 +0100, Thomas Preuth wrote: Hello, I want to select in a column of a dataframe all numbers smaller than a value x but when I type in test-(RSF_EU$AREA=x) I receiv as answer: test [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE [18] TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE [35] FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE FALSE FALSE TRUE FALSE [52] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE How can i get the values smaller than x and not the TRUE/FALSE reply? Thanks in advance, Thomas You need to subset your object based on the results you achieved above. What you did was only half the job. See this example, with a number of ways to get what you want: ## some dummy data to work with dat - 10 * runif(100) dat - data.frame(AREA = dat, FOO = dat + rnorm(100)) ## select values of AREA less than mean AREA mn - mean(dat$AREA) want1 - with(dat, AREA[AREA = mn]) ## or want2 - dat$AREA[dat$AREA = mn] ## or want3 - subset(dat$AREA, dat$AREA = mn) ## or want4 - subset(dat, AREA = mn)$AREA ## check they all do same thing all.equal(want1, want2, want3, want4) ## TRUE want2 is closest to how you tried to do it: dat$AREA[dat$AREA = mn] ^^ Notice that you only did the inner bit marked, which as you found returns TRUE/FALSE depending on whether that element of AREA met the criterion of being less than or equal to your x. This information is used to select elements from AREA using the subsetting functions for objects. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Question concerning survival analysis
Hi I have a data set consisting of pictures on which individual plants were identified and categorized into alive, dead and unknown if it was not clear. The time of these pictures ranges from 1937 to today and the intervals range between 13 and 1 year. I am trying to get an understanding of the mortality rate which I can then use in an individual based model. Therefore I thought of using survival analysis. I have ordered my data in the required format, and classified the events as interval censored (event=3) for the cases where the plant died and right censored (event=0) but I have still a problem I managed to obtain a Surv() object by calling surv - with(survival, Surv(time, time2, event, type=interval)) where survival is my dataset surv [1] [13, 16] 68+ 16+ 68+ 68+ 68+ [26, 34] 68+ [9] 68+ 16+ [54, 58] [64, 67] 68+ [34, 54] [34, 54] [58, 63] [17] [48, 58] [48, 63] [34, 54] And it looks correct (I set the year 1937 to 0) But where to from here? I understand that most of the analysis can not be done with interval censored data? As far as I understand it, I have to use interval censored as the observation intervals are not equal and in addition quite large. The data is from one site, no interference. As I said, I would like to have an estimate of the hazard function (I guess) to get information about the mortality rate of the individuals. Any help welcome, Rainer -- NEW EMAIL ADDRESS AND ADDRESS: [EMAIL PROTECTED] [EMAIL PROTECTED] WILL BE DISCONTINUED END OF MARCH Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Leslie Hill Institute for Plant Conservation University of Cape Town Rondebosch 7701 South Africa Fax:+27 - (0)86 516 2782 Fax:+27 - (0)21 650 2440 (w) Cell: +27 - (0)83 9479 042 Skype: RMkrug email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] controling axes on boxplot() thanks to ST, JvdH, MK
Hi R-ers: I asked a question about how to control the axes on boxplot. Here is what worked: namz - c( R=1/Q1 , R=0/Q1 , R=1/Q2 , R=0/Q2 , R=1/Q3 , R=0/Q3 , R=1/Q4 , R=0/Q4 ) boxplot( p.prop ~ R + bins , boxwex= .5 , plot = TRUE , axes = FALSE ) axis( side = 1 , at=c(1:8) , labels = namz , tick=TRUE , cex.axis = .8 , las=2 ) axis( side = 2 , at = seq(0,1,.1) , labels = seq(0,1,.1) ) My thanks to Steven Tucker, Joerg van den Hoff, and Michal Kubovy for their suggesions All the best, Phil Smith CDC -Original Message- From: Smith, Phil (CDC/CCID/NCIRD) Sent: Thu 2/22/2007 2:56 PM To: r-help@stat.math.ethz.ch Cc: Subject: question about boxplot Here is a question from an old guy: I want to use the boxplot function as follows: boxplot( p.prop ~ R + bins ) This command makes nice boxplot for the factor R crossed with the factor bins. I am having alot of trouble getting control of the labels on the X axis. I want to control it more by specifying what the labels are, controling the 'size' of those labels (by using cex), and then control the rotation of the character strings of those labels (by using srt or crt). There is a names argument to boxplot, but I haven't had much luck controlling what it prints, the size of the font, and the character rotation. Can somebody enlighten me on how to do this? Please respond to my work email address: [EMAIL PROTECTED] Many thanks! Phil Smith Centers for Disease COntrol and Prevention [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to plot two graphs on one single plot?
Hi, I am trying to plot two distribution graph on one plot. But I dont know how. I set them to the same x, y limit, even same x, y labels. Code: x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') plot(x2, y2, type='p', col=red, xlab='x', ylab='y') They just dont show up in one plot. Any hint will be very helpful. Thanks, Yun __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R Mailing list in Cape Town - South Africa
Hi I hope that I don't break any rules - I just want to announce that we started a mailing list for R in Cape Town. The address is: https://cbio.uct.ac.za/mailman/listinfo/sabior The basic idea of the mailing list is to bring R users in the region around Cape Town and in South Africa closer together and probably arrange informal gettogethers. We also try to provide a forum to discuss issues concerning R in Biology and distribute announcements of R courses and similar events in the Cape Town area. We definitely do not want to establish an alternative forum to the official R lists and do not want to draw subscribers away from them - it is a huge advantage that one large list provides the main forum to get help. I hope that the new mailing list will be a useful medium to spread the word and information about R in South Africa, Rainer -- [EMAIL PROTECTED] Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Leslie Hill Institute for Plant Conservation University of Cape Town Rondebosch 7701 South Africa __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to plot two graphs on one single plot?
par(mfrow=c(2,1)) #your plot #after plot par(mfrow=c(1,1)) On 23/02/07, Yun Zhang [EMAIL PROTECTED] wrote: Hi, I am trying to plot two distribution graph on one plot. But I dont know how. I set them to the same x, y limit, even same x, y labels. Code: x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') plot(x2, y2, type='p', col=red, xlab='x', ylab='y') They just dont show up in one plot. Any hint will be very helpful. Thanks, Yun __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Google Custom Search Engine for R
Hi, Since R is a (very) generic name, I've been having some trouble searching the web for this topic. Due to this, I've just created a Google Custom Search Engine that includes several of the most relevant sites that have information on R. See it in action at: http://google.com/coop/cse?cx=018133866098353049407%3Aozv9awtetwy This is really a preliminary test. Feel free to add yourself to the project and contribute with suggestions. Sérgio Nunes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how much performance penalty does this incur, scalar as a vector of one element?
Thanks -- that's good to know. Best, luke On Fri, 23 Feb 2007, Jeffrey J. Hallman wrote: The 64 bit version of VisualWorks Smalltalk has an immediate ShortDouble, which sacrifices two bits of exponent for a tag. It thus has the same precision as an IEEE double, but one fourth as much range. Overflows automatically get promoted to ordinary Double's, which are pointers to objects holding real IEEE doubles. Luke Tierney [EMAIL PROTECTED] writes: Systems that support integer scalars often represent them as immediate values within pointers by sacrificing one or two bits of precision in the integers, but that doesn't work for double precision floats except possibly on 64-bit systems. -- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to plot two graphs on one single plot?
Thanks. Now R plots two graphs on one plot. Yet they are still on two graphs, vertically parallelized with each other. But what I want to do is actually plotting two distribution on one single graph, using the same x and y axis. Like: | | | (dist2) | (dist 1) | --- Is it possible to do that? Thanks, Yun Henrique Dallazuanna wrote: par(mfrow=c(2,1)) #your plot #after plot par(mfrow=c(1,1)) On 23/02/07, *Yun Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, I am trying to plot two distribution graph on one plot. But I dont know how. I set them to the same x, y limit, even same x, y labels. Code: x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') plot(x2, y2, type='p', col=red, xlab='x', ylab='y') They just dont show up in one plot. Any hint will be very helpful. Thanks, Yun __ R-help@stat.math.ethz.ch mailto:R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná Brasil __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to plot two graphs on one single plot?
Hum, ok, i don't was understanding, you can try: plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') lines(x2, d2, type='p', col='red') Or perhaps ?curve On 23/02/07, Yun Zhang [EMAIL PROTECTED] wrote: Thanks. Now R plots two graphs on one plot. Yet they are still on two graphs, vertically parallelized with each other. But what I want to do is actually plotting two distribution on one single graph, using the same x and y axis. Like: | | | (dist2) | (dist 1) | --- Is it possible to do that? Thanks, Yun Henrique Dallazuanna wrote: par(mfrow=c(2,1)) #your plot #after plot par(mfrow=c(1,1)) On 23/02/07, *Yun Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, I am trying to plot two distribution graph on one plot. But I dont know how. I set them to the same x, y limit, even same x, y labels. Code: x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') plot(x2, y2, type='p', col=red, xlab='x', ylab='y') They just dont show up in one plot. Any hint will be very helpful. Thanks, Yun __ R-help@stat.math.ethz.ch mailto:R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná Brasil -- Henrique Dallazuanna Curitiba-Paraná Brasil [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to plot two graphs on one single plot?
Hi Yun, If you're asking how to place new graphic material on the same plot (e.g., several lines/points/etc in a single x-y region), this is covered in the Intro to R manual. E.g., you can do: plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') points(x2, y2, col=red) see ?lines ?points ?text ?abline Also, see the new option in par Best, Matt On 2/23/07, Yun Zhang [EMAIL PROTECTED] wrote: Hi, I am trying to plot two distribution graph on one plot. But I dont know how. I set them to the same x, y limit, even same x, y labels. Code: x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') plot(x2, y2, type='p', col=red, xlab='x', ylab='y') They just dont show up in one plot. Any hint will be very helpful. Thanks, Yun __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to plot two graphs on one single plot?
?par try par(new=TRUE) between plots Clint BowmanINTERNET: [EMAIL PROTECTED] Air Dispersion Modeler INTERNET: [EMAIL PROTECTED] Air Quality Program VOICE: (360) 407-6815 Department of Ecology FAX:(360) 407-7534 USPS: PO Box 47600, Olympia, WA 98504-7600 Parcels:300 Desmond Drive, Lacey, WA 98503-1274 On Fri, 23 Feb 2007, Yun Zhang wrote: Thanks. Now R plots two graphs on one plot. Yet they are still on two graphs, vertically parallelized with each other. But what I want to do is actually plotting two distribution on one single graph, using the same x and y axis. Like: | | | (dist2) | (dist 1) | --- Is it possible to do that? Thanks, Yun Henrique Dallazuanna wrote: par(mfrow=c(2,1)) #your plot #after plot par(mfrow=c(1,1)) On 23/02/07, *Yun Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, I am trying to plot two distribution graph on one plot. But I dont know how. I set them to the same x, y limit, even same x, y labels. Code: x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') plot(x2, y2, type='p', col=red, xlab='x', ylab='y') They just dont show up in one plot. Any hint will be very helpful. Thanks, Yun __ R-help@stat.math.ethz.ch mailto:R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná Brasil __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Google Custom Search Engine for R
Hi Sergio, There was a discussion on this board recently about the difficulty of searching for R related material on the web. I think the custom google search engine is a good idea. It would be helpful if we could have access to the full list of websites it is indexing so that we could make suggestions about other sites that are missing. As it is, it only tells us that there are 35 websites, and shows us the first several. Also, you might check out Sasha Goodman's Rseek: http://www.rseek.org/ Have you tried to compare the success of yours with Rseek? All the Best, Matt On 2/23/07, Sérgio Nunes [EMAIL PROTECTED] wrote: Hi, Since R is a (very) generic name, I've been having some trouble searching the web for this topic. Due to this, I've just created a Google Custom Search Engine that includes several of the most relevant sites that have information on R. See it in action at: http://google.com/coop/cse?cx=018133866098353049407%3Aozv9awtetwy This is really a preliminary test. Feel free to add yourself to the project and contribute with suggestions. Sérgio Nunes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Repeated measures in Classification and Regresssion Trees
Dear R members, I have been trying to find out whether one can use multivariate regression trees (for example mvpart) to analyze repeated measures data. As a non-parametric technique, CART is insensitive to most of the assumptions of parametric regression, but repeated measures data raises the issue of the independence of several data points measured on the same subject, or from the same plot over time. Any perspectives will be welcome, Andy Park (Assistant Professor) Centre for Forest Interdisciplinary Research (CFIR), Department of Biology, University of Winnipeg, 515 Portage Avenue, Winnipeg, Manitoba, R3B 2E9, Canada Phone: (204) 786-9407 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to plot two graphs on one single plot?
Thanks, it works. Thank you very much. Yun Matthew Keller wrote: Hi Yun, If you're asking how to place new graphic material on the same plot (e.g., several lines/points/etc in a single x-y region), this is covered in the Intro to R manual. E.g., you can do: plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') points(x2, y2, col=red) see ?lines ?points ?text ?abline Also, see the new option in par Best, Matt On 2/23/07, Yun Zhang [EMAIL PROTECTED] wrote: Hi, I am trying to plot two distribution graph on one plot. But I dont know how. I set them to the same x, y limit, even same x, y labels. Code: x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') plot(x2, y2, type='p', col=red, xlab='x', ylab='y') They just dont show up in one plot. Any hint will be very helpful. Thanks, Yun __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Neural Net forecasting
Are there any packages in R that are suitable for doing time series forecasting using neural networks? I have looked in the nnet package and neural package and they both seem geared towards classification. thanks, Spencer [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Google Custom Search Engine for R
Hi, I've just created this search engine for testing today. I think that if you volunteer as a contributor (see link on the left side) you can then see and add to the list of sites. I've also noticed that I can add sites by importing a XML file. Is there any list of sites that could be easily converted to XML? Sérgio Nunes On 2/23/07, Matthew Keller [EMAIL PROTECTED] wrote: Hi Sergio, There was a discussion on this board recently about the difficulty of searching for R related material on the web. I think the custom google search engine is a good idea. It would be helpful if we could have access to the full list of websites it is indexing so that we could make suggestions about other sites that are missing. As it is, it only tells us that there are 35 websites, and shows us the first several. Also, you might check out Sasha Goodman's Rseek: http://www.rseek.org/ Have you tried to compare the success of yours with Rseek? All the Best, Matt On 2/23/07, Sérgio Nunes [EMAIL PROTECTED] wrote: Hi, Since R is a (very) generic name, I've been having some trouble searching the web for this topic. Due to this, I've just created a Google Custom Search Engine that includes several of the most relevant sites that have information on R. See it in action at: http://google.com/coop/cse?cx=018133866098353049407%3Aozv9awtetwy This is really a preliminary test. Feel free to add yourself to the project and contribute with suggestions. Sérgio Nunes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Neural Net forecasting
Hello, Yes, time ago Luis Torgo posted a link to his web site where you can find his book which covers with an example what you are looking for. The link is this: http://www.liacc.up.pt/~ltorgo/DataMiningWithR/ Regards, Carlos Ortega. On 2/23/07, sj [EMAIL PROTECTED] wrote: Are there any packages in R that are suitable for doing time series forecasting using neural networks? I have looked in the nnet package and neural package and they both seem geared towards classification. thanks, Spencer [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Google Custom Search Engine for R
I just seen the link you suggested - RSeek - and it uses exactly the same service from Google. The only difference is that it is not open to new contributions. Maybe Sasha could open it to volunteers. Also it seems to be much more complete than my initial attempt (as expected :). I think that RSeek deserves a link in R's homepage. Sérgio Nunes On 2/23/07, Sérgio Nunes [EMAIL PROTECTED] wrote: Hi, I've just created this search engine for testing today. I think that if you volunteer as a contributor (see link on the left side) you can then see and add to the list of sites. I've also noticed that I can add sites by importing a XML file. Is there any list of sites that could be easily converted to XML? Sérgio Nunes On 2/23/07, Matthew Keller [EMAIL PROTECTED] wrote: Hi Sergio, There was a discussion on this board recently about the difficulty of searching for R related material on the web. I think the custom google search engine is a good idea. It would be helpful if we could have access to the full list of websites it is indexing so that we could make suggestions about other sites that are missing. As it is, it only tells us that there are 35 websites, and shows us the first several. Also, you might check out Sasha Goodman's Rseek: http://www.rseek.org/ Have you tried to compare the success of yours with Rseek? All the Best, Matt On 2/23/07, Sérgio Nunes [EMAIL PROTECTED] wrote: Hi, Since R is a (very) generic name, I've been having some trouble searching the web for this topic. Due to this, I've just created a Google Custom Search Engine that includes several of the most relevant sites that have information on R. See it in action at: http://google.com/coop/cse?cx=018133866098353049407%3Aozv9awtetwy This is really a preliminary test. Feel free to add yourself to the project and contribute with suggestions. Sérgio Nunes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Repeated measures in Classification and Regresssion Trees
Andrew: Good question! AFAIK most of the so-called machine learning machinery -- regression and classification trees, SVM's, neural nets, random forests, and other more chic methods (I make no attempt to keep up with all of them) -- ignore error structure; that is, they assume the data are at least independent (not necessarily identically distributed). I don't think merely exchangeable is good enough either, though I may be wrong about this. But I believe you have put your finger on a key issue: although all this cool methodology is usually not terribly concerned with inference (x-validation and bootstrapping being the usual methodology rather than, say, asymptotics), one wonders how biased the estimators are when there are various correlations in the data. I suspect a lot, depending on the nature of the correlations and the methods. I think the moral is: thermodynamics still rules -- there's no free lunch. You are just as likely to produce nonsense using all this nonparametric methodology as you are using parametric methods if you ignore the error structure of the data. Incidentally, I should point out that George Box fulminated on this very issue about 50 years ago. In his statistics classes he always used to say that all the fuss (then) about using non-parametric rank-based methods (e.g. Mann-Whitney-Wilcoxon) rather than parametric t-statistics was silly since the t-statistics were relatively insensitive to deopartures from normality anyway and it was lack of independence, not exact normality, that was the key practical issue, and both approaches were sensitive to that. He published several papers to this effect, of course. Needless to say, I would welcome other -- especially better informed and contrary -- views on these issues, either on or off list. Cheers, Bert Gunter Genentech Nonclinical Statistics South San Francisco, CA 94404 650-467-7374 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Park Sent: Friday, February 23, 2007 7:51 AM To: r-help@stat.math.ethz.ch Subject: [R] Repeated measures in Classification and Regresssion Trees Dear R members, I have been trying to find out whether one can use multivariate regression trees (for example mvpart) to analyze repeated measures data. As a non-parametric technique, CART is insensitive to most of the assumptions of parametric regression, but repeated measures data raises the issue of the independence of several data points measured on the same subject, or from the same plot over time. Any perspectives will be welcome, Andy Park (Assistant Professor) Centre for Forest Interdisciplinary Research (CFIR), Department of Biology, University of Winnipeg, 515 Portage Avenue, Winnipeg, Manitoba, R3B 2E9, Canada Phone: (204) 786-9407 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Neural Net forecasting
The tsDyn package has the 'nnetTs' model, for fitting univariate NNET time series model. The model is presented as a NonLinearAutoRegressive model. Boundled with tsDyn there is a vignette with some working examples. Hope this helps. Bests, Antonio. 2007/2/23, sj [EMAIL PROTECTED]: Are there any packages in R that are suitable for doing time series forecasting using neural networks? I have looked in the nnet package and neural package and they both seem geared towards classification. thanks, Spencer [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Antonio, Fabio Di Narzo Ph.D. student at Department of Statistical Sciences University of Bologna, Italy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Google Custom Search Engine for R
I always just google for the terms I want and then add R-help to the search, which limits it to the R-help mailing list. It's quite effective. From: [EMAIL PROTECTED] on behalf of Matthew Keller Sent: Fri 23/02/2007 3:51 PM To: Sérgio Nunes Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Google Custom Search Engine for R Hi Sergio, There was a discussion on this board recently about the difficulty of searching for R related material on the web. I think the custom google search engine is a good idea. It would be helpful if we could have access to the full list of websites it is indexing so that we could make suggestions about other sites that are missing. As it is, it only tells us that there are 35 websites, and shows us the first several. Also, you might check out Sasha Goodman's Rseek: http://www.rseek.org/ Have you tried to compare the success of yours with Rseek? All the Best, Matt On 2/23/07, Sérgio Nunes [EMAIL PROTECTED] wrote: Hi, Since R is a (very) generic name, I've been having some trouble searching the web for this topic. Due to this, I've just created a Google Custom Search Engine that includes several of the most relevant sites that have information on R. See it in action at: http://google.com/coop/cse?cx=018133866098353049407%3Aozv9awtetwy This is really a preliminary test. Feel free to add yourself to the project and contribute with suggestions. Sérgio Nunes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] using integrate in a function definition
Dear list members, I'm quite new to R, and though I tried to find the answer to my probably very basic question through the available resources (website, mailing list archives, docs, google), I've not found it. If I try to use the integrate function from within my own functions, my functions seem to misbehave in some contexts. The following example is a bit silly, but illustrates what's happening: The following behaves as expected: jjj-function(www) {2*integrate(dnorm,0,www)$value} kkk-function(www) {2*(pnorm(www)-0.5)} jjj(2) [1] 0.9544997 kkk(2) [1] 0.9544997 However, if I do: plot(jjj,0,5) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ whereas plot(kkk,0,5) produces a nice plot. xxx-seq(0:5) yyy-jjj(xxx) zzz-kkk(xxx) produces no errors, but: yyy [1] 0.6826895 zzz [1] 0.6826895 0.9544997 0.9973002 0.367 0.994 1.000 Why is this? Is this some R language feature that I've completely missed? Ultimately my problem is that I have a mathematical function describing a distribution, and I want to use this in a Kolmogorov-Smirnov test where I need a cumulative distribution function. If I use the following (synthetic) dataset with ks.test with either the jjj or kkk function, I get: ppp-c(1.74865955,1.12220426,0.24760427,0.24351439,0.10870853, 0.72023272,0.40245392,0.16002948,0.24203950,0.44029851, 0.34830446,1.66967152,1.71609574,1.17540830,0.22306379, 0.64382628,0.37382795,0.84361547,1.92138362,0.02844235, 0.11238473,0.21237557,1.01058073,2.33108243,1.36034473, 1.88951679,0.18230647,0.96571916,0.91239760,2.05574766, 0.33681130,2.76006257,0.83952491,1.24038831,1.46199671, 0.24694163,0.01565159,0.94816108,1.04642673,0.36556444, 2.20760578,1.59518590,0.83951030,0.07113652,0.97422886, 0.59835793,0.08383890,1.09180853,0.43508943,0.35368637, 0.75805978,0.12790161,1.56798563,1.68669770,0.56168021) ks.test(ppp,kkk) One-sample Kolmogorov-Smirnov test data: ppp D = 0.1013, p-value = 0.5895 alternative hypothesis: two.sided [ which seems correct as the samples come from abs(rnorm()) ] ks.test(ppp,jjj) One-sample Kolmogorov-Smirnov test data: ppp D = 0.9875, p-value 2.2e-16 alternative hypothesis: two.sided [ which is *incorrect* ] Note: This example is artificial as I have used a function for which I know the integral; my real problem involves a distribution that I can only integrate numerically. How would I go about to solve this problem? With kind regards, Theo. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using integrate in a function definition
Your function jjj is not vectorized. Try this: jjj - function(www) sapply(www, function(x)2*integrate(dnorm,0,x)$value) plot(jjj, 0, 5) It should work. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of theo borm Sent: Friday, February 23, 2007 1:43 PM To: r-help@stat.math.ethz.ch Subject: [R] using integrate in a function definition Dear list members, I'm quite new to R, and though I tried to find the answer to my probably very basic question through the available resources (website, mailing list archives, docs, google), I've not found it. If I try to use the integrate function from within my own functions, my functions seem to misbehave in some contexts. The following example is a bit silly, but illustrates what's happening: The following behaves as expected: jjj-function(www) {2*integrate(dnorm,0,www)$value} kkk-function(www) {2*(pnorm(www)-0.5)} jjj(2) [1] 0.9544997 kkk(2) [1] 0.9544997 However, if I do: plot(jjj,0,5) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ whereas plot(kkk,0,5) produces a nice plot. xxx-seq(0:5) yyy-jjj(xxx) zzz-kkk(xxx) produces no errors, but: yyy [1] 0.6826895 zzz [1] 0.6826895 0.9544997 0.9973002 0.367 0.994 1.000 Why is this? Is this some R language feature that I've completely missed? Ultimately my problem is that I have a mathematical function describing a distribution, and I want to use this in a Kolmogorov-Smirnov test where I need a cumulative distribution function. If I use the following (synthetic) dataset with ks.test with either the jjj or kkk function, I get: ppp-c(1.74865955,1.12220426,0.24760427,0.24351439,0.10870853, 0.72023272,0.40245392,0.16002948,0.24203950,0.44029851, 0.34830446,1.66967152,1.71609574,1.17540830,0.22306379, 0.64382628,0.37382795,0.84361547,1.92138362,0.02844235, 0.11238473,0.21237557,1.01058073,2.33108243,1.36034473, 1.88951679,0.18230647,0.96571916,0.91239760,2.05574766, 0.33681130,2.76006257,0.83952491,1.24038831,1.46199671, 0.24694163,0.01565159,0.94816108,1.04642673,0.36556444, 2.20760578,1.59518590,0.83951030,0.07113652,0.97422886, 0.59835793,0.08383890,1.09180853,0.43508943,0.35368637, 0.75805978,0.12790161,1.56798563,1.68669770,0.56168021) ks.test(ppp,kkk) One-sample Kolmogorov-Smirnov test data: ppp D = 0.1013, p-value = 0.5895 alternative hypothesis: two.sided [ which seems correct as the samples come from abs(rnorm()) ] ks.test(ppp,jjj) One-sample Kolmogorov-Smirnov test data: ppp D = 0.9875, p-value 2.2e-16 alternative hypothesis: two.sided [ which is *incorrect* ] Note: This example is artificial as I have used a function for which I know the integral; my real problem involves a distribution that I can only integrate numerically. How would I go about to solve this problem? With kind regards, Theo. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Looking for info on R Advanced programming in the West Coast
Hi Tim, We'll be offering our R/S Advanced Programming course in San Franciscon on March 15-16. All the Best - Elvis Tim McDonald tim_b_mcdonald at yahoo.com writes: Hi folks, If you know of any upcoming R Advanced Programming in the West Coast - USA, please let me know. Thanks - Tim - Need Mail bonding? - Never Miss an Email [[alternative HTML version deleted]] __ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Google Custom Search Engine for R
Thanks for emailing. I've added volunteers on RSeek on a trial basis. There are several concerns, though: One big issue is quality. Allowing volunteers means that someone might need to police the volunteers, as they can put in advertisements for books, links to sites that try to hack your computer, and links to commercial software. Importantly, there seems to be no built in policing mechanism yet in the Google coop architecture, nor any means of sharing the maintenance. Another issue is that I have to periodically visit the Google coop webpage and manually check if people have volunteered. Google has not added automatic acceptance. As for open sourcing the php and javascript that makes up R seek, I'm open to doing that during spring break if there is enough interest. --Sasha On 2/23/07, Matthew Keller [EMAIL PROTECTED] wrote: Hi Sasha, You might check out a recent discussion on the R forums (below). One possible suggestion about Rseek: can you allow others to contribute to it as well (ie, make Rseek open source just like R is?). Also, is Rseek going to be linked from the main R page anytime soon? Thanks for your efforts, Matt -- Forwarded message -- From: Sérgio Nunes [EMAIL PROTECTED] Date: Feb 23, 2007 11:01 AM Subject: Re: [R] Google Custom Search Engine for R To: Matthew Keller [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch I just seen the link you suggested - RSeek - and it uses exactly the same service from Google. The only difference is that it is not open to new contributions. Maybe Sasha could open it to volunteers. Also it seems to be much more complete than my initial attempt (as expected :). I think that RSeek deserves a link in R's homepage. Sérgio Nunes On 2/23/07, Sérgio Nunes [EMAIL PROTECTED] wrote: Hi, I've just created this search engine for testing today. I think that if you volunteer as a contributor (see link on the left side) you can then see and add to the list of sites. I've also noticed that I can add sites by importing a XML file. Is there any list of sites that could be easily converted to XML? Sérgio Nunes On 2/23/07, Matthew Keller [EMAIL PROTECTED] wrote: Hi Sergio, There was a discussion on this board recently about the difficulty of searching for R related material on the web. I think the custom google search engine is a good idea. It would be helpful if we could have access to the full list of websites it is indexing so that we could make suggestions about other sites that are missing. As it is, it only tells us that there are 35 websites, and shows us the first several. Also, you might check out Sasha Goodman's Rseek: http://www.rseek.org/ Have you tried to compare the success of yours with Rseek? All the Best, Matt On 2/23/07, Sérgio Nunes [EMAIL PROTECTED] wrote: Hi, Since R is a (very) generic name, I've been having some trouble searching the web for this topic. Due to this, I've just created a Google Custom Search Engine that includes several of the most relevant sites that have information on R. See it in action at: http://google.com/coop/cse?cx=018133866098353049407%3Aozv9awtetwy This is really a preliminary test. Feel free to add yourself to the project and contribute with suggestions. Sérgio Nunes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] TRUE/FALSE as numeric values
It is inefficient to use which() rather than a logical index, since you allocate two numeric index vectors (one the length of the original vector) and use an interpreted function rather than optimized C code. Also, in this usage which() handles NAs incorrectly. I think the clearest answer is probably with(RSF_EU, AREA[AREA = x]) On Fri, 23 Feb 2007, Henrique Dallazuanna wrote: You can also: test - RSF_EU[which(RSF_EU$AREA=x),] On 23/02/07, Thomas Preuth [EMAIL PROTECTED] wrote: Hello, I want to select in a column of a dataframe all numbers smaller than a value x but when I type in test-(RSF_EU$AREA=x) I receiv as answer: test [1] TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE [18] TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE [35] FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE FALSE FALSE TRUE FALSE [52] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE How can i get the values smaller than x and not the TRUE/FALSE reply? Thanks in advance, Thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optim(method=L-BFGS-B) abnormal termination
I usually see this message only when my gradient and objective functions do not match each other. I debug by comparing a finite difference approximation to the gradient with the result of the gradient function. I think you can also run optim() without supplying a gr() function - optim() will then use a finite difference approximation. If optim() works fine like this with your function, that's a strong sign that your gradient function doesn't match your objective function. It is of course possible that your gradient function is properly specified, and the function along the line being searched is so badly behaved that the line search can't find a minimum in 20 steps. If that's the case you might want to look in scaling issues, or reformulating the problem. It's also possible that even if you have a theoretically well-behaved objective and gradient, your computation of may be subject to rounding error and giving apparently discontinuous results to optim(). I'd look into all of the above possibilities before I tried increasing the limit of 20 evaluations in the line search - in my experience 20 steps is plenty to find an adequate point for a reasonably well-behaved function. It may be possible to increase the number of steps, but I don't see how from the docs for ?optim. Of course, the source is available. hope this helps, Tony Plate Petr Klasterecky wrote: Hi, my call of optim() with the L-BFGS-B method ended with the following error message: ERROR: ABNORMAL_TERMINATION_IN_LNSRCH Further tracing shows: Line search cannot locate an adequate point after 20 function and gradient evaluations final value 0.086627 stopped after 7 iterations Could someone pls tell me whether it is possible to increase the limit of 20 evaluations? Is it even worth doing so? My function(s) to be minimized are polynomial functions of tens of variables - let say 10 - 60 variables, all of them constrained to the (0,1) interval. Is it even possible and meaningfull to attempt such minimization? (Suppose I have good starting values.) Thaks, Petr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using integrate in a function definition
theo borm wrote: jjj-function(www) {2*integrate(dnorm,0,www)$value} kkk-function(www) {2*(pnorm(www)-0.5)} xxx-seq(0:5) yyy-jjj(xxx) zzz-kkk(xxx) produces no errors, but: yyy [1] 0.6826895 zzz [1] 0.6826895 0.9544997 0.9973002 0.367 0.994 1.000 Why is this? Is this some R language feature that I've completely missed? Yes. Some functions work on vectors (and matrices), so when you give a vector, it returns a vector. This is true for most common functions (sin, cos), arithmetic operations (with the caveat that different dimensions for the arguments may cause unexpected outcomes) and some internal functions (dnorm, pnorm). So, if you write sin(0:10) or dnorm((-3):3), you get a vector. Some other functions don't, and this is the case with integrate. For example: fff - function(x) x integrate(fff, 0, 1) # ok integrate(fff, 0, 1:5) # will integrate from 0 to 1 and ignore 2:5 'plot' will probably fall into some code that uses this vector-in-vector-out hypothesis, and then fail when the size of x differs from the size of y. Alberto Monteiro PS: fff - function(x) 1 integrate(fff, 0, 1) # error. why? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] some caracter dont work with JGR
Hi, I testing JGR and I like, but my ~ caracter dont work. My keyboard is Brazilian ABNT2. The key is OK, only in JGR it dont work. Anybody have any idea about this? Thanks Ronaldo -- Mais variado que baldeação em Cacequi. -- Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. Ecologia Evolutiva | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8190 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] pdf with an exact size
Is it possible to create a pdf output file with an (as nearly as possible) exact size? For example, if I want to draw in an A4 paper (210 x 297 mm) a square of 100 x 100 mm, how can I do it? FWIW, about 6 months ago I learned here how to create an exact png image. For example, if I want a 500 x 500 black square in a 1000 x 1000 white png, occupying the center of the png, the procedure is this: png(image.png, width=1000, height=1000, bg=white) par(mar=c(0,0,0,0)) # reset margins plot(0, xlim=c(0, 999), ylim=c(0, 999), col=white) par(usr=c(0, 999, 0, 999)) points(c(250, 250, 749, 749, 250), c(250, 749, 749, 250, 250), type=l, col=black) dev.off() However, I don't know how do this with a pdf monstr... oops... file. Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] pdf with an exact size
I must be stupid and/or crazy... I figured out the solution a few minutes after I asked :-/ Is it possible to create a pdf output file with an (as nearly as possible) exact size? Yes: pdf(a4.pdf, width=210, height=297, bg=white, paper=a4) par(mar=c(0,0,0,0)) # reset margins plot(0, xlim=c(0, 210), ylim=c(0, 297), col=white) par(usr=c(0, 210, 0, 297)) points(c(100, 100, 200, 200, 100), c(100, 200, 200, 100, 100, 100), type=l, col=black) dev.off() Alberto Monteiro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with weights on lmer function
Em Quinta 22 Fevereiro 2007 20:36, Andrew Robinson escreveu: Hi Ronaldo, I suggest that you send us a small, well-documented, code example that we can reproduce. It certainly looks as though there is a problem, but given this information it's hard to know what it is! Cheers Andrew Andrew and all R users. Look this example: test-structure(list(subject = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2), .Label = c(S1, S2), class = factor), time = c(0, 7, 15, 22, 32, 39, 46, 53, 0, 7, 14, 24, 28, 34, 41, 48), noccup = c(0, 1, 2, 1, 6, 4, 3, 3, 0, 18, 21, 14, 7, 14, 12, 8), ntotal = c(100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100)), .Names = c(subject, time, noccup, ntotal), class = data.frame, row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) I have 2 subject over 8 times. Each subject is compound by 100 pieces. I measure the number of piece occuped in any time. I try this: m1-lmer(noccup/ntotal~time+(time|subject),family=binomial,weights=ntotal) Error in lmer(noccup/ntotal ~ time + (time | subject), family = binomial, : object `weights' of incorrect type I dont understand why this error. m1-lmer(noccup/ntotal~1+(time|subject),family=binomial,weights=ntotal) Error in lmer(noccup/ntotal ~ time + (time | subject), family = binomial, : object `weights' of incorrect type Why weights is of incorrect type? In glm this is correct type. Thanks Ronaldo -- The right half of the brain controls the left half of the body. This means that only left handed people are in their right mind. -- Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. Ecologia Evolutiva | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8190 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to use apply with two variables
Hi, this is a made-up example. Function myfun returns two arguments. Can apply be used so that myfun is called only once? Thanks Serguei mat-matrix(runif(50),nrow=10,ncol=5) myfun-function(x) { mymean-mean(x) mysd-sd(x) return(mymean,mysd) } out1-t(apply(mat,1,function(x) myfun(x)$mymean)) out2-t(apply(mat,1,function(x) myfun(x)$mysd)) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to use apply with two variables
Yes. Just try it and see. BTW, your usage of return() is not recommended anymore. This is probably easier: myfun-function(x) c(mean=mean(x), sd=sd(x)) out - apply(mat, 1, myfun) ## or... out2 - cbind(mean=rowMeans(mat), sd=sd(t(mat))) Andy From: Serguei Kaniovski Hi, this is a made-up example. Function myfun returns two arguments. Can apply be used so that myfun is called only once? Thanks Serguei mat-matrix(runif(50),nrow=10,ncol=5) myfun-function(x) { mymean-mean(x) mysd-sd(x) return(mymean,mysd) } out1-t(apply(mat,1,function(x) myfun(x)$mymean)) out2-t(apply(mat,1,function(x) myfun(x)$mysd)) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Notice: This e-mail message, together with any attachments,...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mixture of 2 normals - starting values
If you don't have too much noise, the peaks in the derivative curves can be used: See: http://research.stowers-institute.org/efg/R/Statistics/MixturesOfDistributions/index.htm efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have a problem of estimating a mixture of two normal distributions. I need to find the starting points automatically, since this is a part of a larger piece of image processing code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Overlaying graphics
Rusers: This is a very fundamental and silly question. How can I overlay different maps on the same x and y scales? I do neither want to change X and Y axes nor show different x and y ticks on top of each other. Thanks Taka Indiana University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using integrate in a function definition
Ravi Varadhan wrote: Your function jjj is not vectorized. Try this: jjj - function(www) sapply(www, function(x)2*integrate(dnorm,0,x)$value) plot(jjj, 0, 5) It should work. Yes it does. Thanks! Thinking of it, it now starts to make some sort of sense that integrate should return a scalar; the result is really a list of which I only used the value component. And now I also understand the x,q: vector of quantiles. phrases in the documentation of dnorm. Now if I do something silly: jjj-function(www) {2*integrate(dnorm,0,www)$value+sin(www)-sin(www)} then jjj(1:5) [1] 0.6826895 0.6826895 0.6826895 0.6826895 0.6826895 Evidently the inherritance of being vectorized (which was why my kkk function worked) could lead to some unexpected (and probably hard to debug) results :-/ Thanks. with kind regards, Theo. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Google Custom Search Engine for R
Whereas R is very generic, CRAN is much less so. I've had very good luck adding CRAN to my search terms, e.g. try to Google cran 3d scatterplot This produces all R-related hits on the first Google page. Hope this helps Steven McKinney Statistician Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre email: [EMAIL PROTECTED] tel: 604-675-8000 x7561 BCCRC Molecular Oncology 675 West 10th Ave, Floor 4 Vancouver B.C. V5Z 1L3 Canada -Original Message- From: [EMAIL PROTECTED] on behalf of Matthew Keller Sent: Fri 2/23/2007 7:51 AM To: Sérgio Nunes Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Google Custom Search Engine for R Hi Sergio, There was a discussion on this board recently about the difficulty of searching for R related material on the web. I think the custom google search engine is a good idea. It would be helpful if we could have access to the full list of websites it is indexing so that we could make suggestions about other sites that are missing. As it is, it only tells us that there are 35 websites, and shows us the first several. Also, you might check out Sasha Goodman's Rseek: http://www.rseek.org/ Have you tried to compare the success of yours with Rseek? All the Best, Matt On 2/23/07, Sérgio Nunes [EMAIL PROTECTED] wrote: Hi, Since R is a (very) generic name, I've been having some trouble searching the web for this topic. Due to this, I've just created a Google Custom Search Engine that includes several of the most relevant sites that have information on R. See it in action at: http://google.com/coop/cse?cx=018133866098353049407%3Aozv9awtetwy This is really a preliminary test. Feel free to add yourself to the project and contribute with suggestions. Sérgio Nunes __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthew C Keller Postdoctoral Fellow Virginia Institute for Psychiatric and Behavioral Genetics __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using integrate in a function definition
Hi, Many thanks for the explanation. Alberto Monteiro wrote: PS: fff - function(x) 1 integrate(fff, 0, 1) # error. why? Guess: because integrate itself expects a vectorized function ? fff(1:5) [1] 1 ggg-function(x) { sapply(x, function(x)1) } ggg(1:5) [1] 1 1 1 1 1 integrate(ggg,0,1) 1 with absolute error 1.1e-14 hhh-function(x) 1+0*x integrate(hhh, 0, 1) 1 with absolute error 1.1e-14 I sense a certain lack of intuitiveness here :-/ regards, Theo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] pdf with an exact size
On Fri, Feb 23, 2007 at 04:24:54PM -0200, Alberto Monteiro wrote: Is it possible to create a pdf output file with an (as nearly as possible) exact size? For example, if I want to draw in an A4 paper (210 x 297 mm) a square of 100 x 100 mm, how can I do it? FWIW, about 6 months ago I learned here how to create an exact png image. For example, if I want a 500 x 500 black square in a 1000 x 1000 white png, occupying the center of the png, the procedure is this: png(image.png, width=1000, height=1000, bg=white) par(mar=c(0,0,0,0)) # reset margins plot(0, xlim=c(0, 999), ylim=c(0, 999), col=white) par(usr=c(0, 999, 0, 999)) points(c(250, 250, 749, 749, 250), c(250, 749, 749, 250, 250), type=l, col=black) dev.off() However, I don't know how do this with a pdf monstr... oops... file. Alberto Monteiro going via `bitmap' and using the `pdfwrite' type is probably the better idea since in this case `ghostscript` is used for pdf generation which seems over all to generate cleaner/better pdf-output in comparsion to the R internal pdf-device (I believe there was recently some discussion of this on the list?). joerg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to plot two graphs on one single plot?
Broadly speaking, there are a few classes of plotting functions. 1) New graph functions. The plot() function starts a new graph. 2) Add to a graph functions The points(), lines(), text() etc. functions add something to the current graph. 3) Control graph functions par() controls various aspects of the graph. R graphics experts might have some better classification and terminology. So you want your second plotting function to be points() rather than plot(), to add to the existing graph. Try x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') points(x2, y2, type='p', col=red, xlab='x', ylab='y') Steven McKinney Statistician Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre email: [EMAIL PROTECTED] tel: 604-675-8000 x7561 BCCRC Molecular Oncology 675 West 10th Ave, Floor 4 Vancouver B.C. V5Z 1L3 Canada -Original Message- From: [EMAIL PROTECTED] on behalf of Yun Zhang Sent: Fri 2/23/2007 7:34 AM To: Henrique Dallazuanna Cc: r-help@stat.math.ethz.ch Subject: Re: [R] How to plot two graphs on one single plot? Thanks. Now R plots two graphs on one plot. Yet they are still on two graphs, vertically parallelized with each other. But what I want to do is actually plotting two distribution on one single graph, using the same x and y axis. Like: | | | (dist2) | (dist 1) | --- Is it possible to do that? Thanks, Yun Henrique Dallazuanna wrote: par(mfrow=c(2,1)) #your plot #after plot par(mfrow=c(1,1)) On 23/02/07, *Yun Zhang* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, I am trying to plot two distribution graph on one plot. But I dont know how. I set them to the same x, y limit, even same x, y labels. Code: x1=rnorm(25, mean=0, sd=1) y1=dnorm(x1, mean=0, sd=1) x2=rnorm(25, mean=0, sd=1) y2=dnorm(x2, mean=0, sd=1) plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x', ylab='y') plot(x2, y2, type='p', col=red, xlab='x', ylab='y') They just dont show up in one plot. Any hint will be very helpful. Thanks, Yun __ R-help@stat.math.ethz.ch mailto:R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná Brasil __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.