Spencer Graves
2008-Mar-21 17:12 UTC
[R] function for the average or expected range?; CORECTION
Hi, All: ** My previous email on this subject seemed to contain an error; check the correction: Is there a function in R to compute the expected range of a sample of size n from some distribution? I ask, because I was recently asked about the control chart constant 'd2', which is the expected range for a sample of size n from a standard normal. There is a fairly simple formula for the expected value of the range, given, e.g., in Kendall and Stuart (1969) The Advanced Theory of Statistics, vol. 1, Distribution Theory, 3rd ed. (Hafner, expression (14.82), sec. 14.25: The exact distribution of the range, p. 339). Unfortunately, either I don't understand this formula, or it's wrong. Using expression (14.1) in the same reference, I get the following: E(R) = n*integral{-Inf to Inf of [(F(x))**(n-1) - (1-F(x))**(n-1)]dF(x). Thanks, Spencer Graves
Greg Snow
2008-Mar-21 19:45 UTC
[R] function for the average or expected range?; CORECTION
The "ptukey" and "qtukey" functions may be what you want (or at least in the right direction). You could also easily estimate this by simulation. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Spencer Graves > Sent: Friday, March 21, 2008 11:13 AM > To: r-help at r-project.org > Subject: [R] function for the average or expected range?; CORECTION > > Hi, All: > > ** My previous email on this subject seemed to contain an > error; check the correction: > > Is there a function in R to compute the expected range > of a sample of size n from some distribution? I ask, because > I was recently asked about the control chart constant 'd2', > which is the expected range for a sample of size n from a > standard normal. > > There is a fairly simple formula for the expected value > of the range, given, e.g., in Kendall and Stuart (1969) The > Advanced Theory of Statistics, vol. 1, Distribution Theory, > 3rd ed. (Hafner, expression (14.82), sec. 14.25: The exact > distribution of the range, p. 339). > Unfortunately, either I don't understand this formula, or it's wrong. > Using expression (14.1) in the same reference, I get the following: > > E(R) = n*integral{-Inf to Inf of [(F(x))**(n-1) - > (1-F(x))**(n-1)]dF(x). > > Thanks, > Spencer Graves > > ______________________________________________ > R-help at r-project.org 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. >