Full_Name: Paul Eckermann Version: 2.7.1 OS: Windows XP Service Pack 2 Submission from: (NULL) (129.127.183.12) This is the first time I have submitted a bug report, so apologies if I have not followed the correct protocol. If I enter length(rnorm(100*.29)) it returns 28 rather than 29. y<-(1:100)/100 z<-sapply(y,function(x) length(rnorm(x*100))) z!=100*y indicates that it has something to do with multiples of 7 (rounding error?), even though 29, 57 and 58 are the 3 values for which it returns incorrect values of z. I hope that this is not something obvious that I have missed. This can be overcome by doing the x*100 calculation outside the rnorm function, but I don't see why this needs to be done when the answer is (supposed to be) an integer. Regards, Paul Eckermann
Try printing floor(100*.29): you have forgotten about representation error.>From the help page:n: number of observations. If 'length(n) > 1', the length is taken to be the number required. and you asked for (just) less than 29 observations, and got what you asked for. On Thu, 7 Aug 2008, paul.eckermann at adelaide.edu.au wrote:> Full_Name: Paul Eckermann > Version: 2.7.1 > OS: Windows XP Service Pack 2 > Submission from: (NULL) (129.127.183.12) > > > This is the first time I have submitted a bug report, so apologies if I have not > followed the correct protocol. > > If I enter > > length(rnorm(100*.29)) > > it returns 28 rather than 29. > > y<-(1:100)/100 > z<-sapply(y,function(x) length(rnorm(x*100))) > z!=100*y > > indicates that it has something to do with multiples of 7 (rounding error?), > even though 29, 57 and 58 are the 3 values for which it returns incorrect values > of z. > > I hope that this is not something obvious that I have missed. This can > be overcome by doing the x*100 calculation outside the rnorm function, > but I don't see why this needs to be done when the answer is (supposed > to be) an integer.Supposed by whom?> Regards, > Paul Eckermann > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk 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, UK Fax: +44 1865 272595
That's not a bug. It's FAQ 7.31 Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research 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 Thierry.Onkelinx at inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -----Oorspronkelijk bericht----- Van: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org] Namens paul.eckermann at adelaide.edu.au Verzonden: donderdag 7 augustus 2008 11:33 Aan: r-devel at stat.math.ethz.ch CC: R-bugs at biostat.ku.dk Onderwerp: [Rd] Bug in rnorm? (PR#12016) Full_Name: Paul Eckermann Version: 2.7.1 OS: Windows XP Service Pack 2 Submission from: (NULL) (129.127.183.12) This is the first time I have submitted a bug report, so apologies if I have not followed the correct protocol. If I enter length(rnorm(100*.29)) it returns 28 rather than 29. y<-(1:100)/100 z<-sapply(y,function(x) length(rnorm(x*100))) z!=100*y indicates that it has something to do with multiples of 7 (rounding error?), even though 29, 57 and 58 are the 3 values for which it returns incorrect values of z. I hope that this is not something obvious that I have missed. This can be overcome by doing the x*100 calculation outside the rnorm function, but I don't see why this needs to be done when the answer is (supposed to be) an integer. Regards, Paul Eckermann ______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en bindt het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed bij a duly signed document
That's not a bug. It's FAQ 7.31 Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium=0D tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be=0D www.inbo.be=0D To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -----Oorspronkelijk bericht----- Van: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org] Namens paul.eckermann at adelaide.edu.au Verzonden: donderdag 7 augustus 2008 11:33 Aan: r-devel at stat.math.ethz.ch CC: R-bugs at biostat.ku.dk Onderwerp: [Rd] Bug in rnorm? (PR#12016) Full_Name: Paul Eckermann Version: 2.7.1 OS: Windows XP Service Pack 2 Submission from: (NULL) (129.127.183.12) This is the first time I have submitted a bug report, so apologies if I have not followed the correct protocol. If I enter length(rnorm(100*.29)) it returns 28 rather than 29. y<-(1:100)/100 z<-sapply(y,function(x) length(rnorm(x*100))) z!=3D100*y indicates that it has something to do with multiples of 7 (rounding error?), even though 29, 57 and 58 are the 3 values for which it returns incorrect values of z. I hope that this is not something obvious that I have missed. This can be overcome by doing the x*100 calculation outside the rnorm function, but I don't see why this needs to be done when the answer is (supposed to be) an integer. Regards, Paul Eckermann ______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en bindt het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed bij a duly signed document