Well, it is clear enough that the problem is in interpreting the documentation. 
However, when you claim you tested something, and found it inconsistent with 
tables, it would be advisable to back it up with examples!

The description in the help files and in the sources is admittedly confusing. 
The original paper has this, rather more clear, description in the abstract:

"We consider the probability distribution of the maximum of r statistics each 
distributed as the Studentized range of means calculated from c random samples 
of size n from normal populations. The rc samples are assumed to be mutually 
independent and a common pooled—within—samplevariance is used throughout."

So the connection is nranges == r, and nmeans == c. (n never actually factors 
in because sqrt(n) is part of the standardization)

For the typical application, r is 1 for the usual studentized range 
distribution. E.g. for two large groups:

> qtukey(.95,2,df=Inf)
[1] 2.771808

As there is only one difference to consider, this should be distributed like 
the absolute value of the difference between two standard normals, and yes: We 
get our old friend 1.96 from

> qtukey(.95,2,df=Inf)/sqrt(2)
[1] 1.959964

It is less than fortunate that the help file speaks of "sample size for range". 
It is marginally defensible, because it is about the standardized range of a 
sample _of means_, but it is likely to confuse the actual reader into believing 
that it has to do with the sample size for each mean.

-pd

> On 10 Jul 2017, at 05:04 , Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote:
> 
> We cannot help you understand what you are doing if you do not show us what 
> you are doing.  Here are some discussions about how to communicate questions 
> about R [1][2][3].
> 
> [1] 
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> 
> [2] http://adv-r.had.co.nz/Reproducibility.html
> 
> [3] https://cran.r-project.org/web/packages/reprex/index.html
> -- 
> Sent from my phone. Please excuse my brevity.
> 
> On July 6, 2017 11:36:47 AM PDT, Ursula Garczarek 
> <ursula.garcza...@cytel.com> wrote:
>> Dear all,
>> I wanted to compare Bonferroni vs TukeyHSD correction over a range of
>> groups and group sizes, and wanted to use the function qtukey.
>> 
>> In the help documentation it says
>> 
>> qtukey(p, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE)
>> Arguments
>> q
>> 
>> vector of quantiles.
>> 
>> p
>> 
>> vector of probabilities.
>> 
>> nmeans
>> 
>> sample size for range (same for each group).
>> 
>> df
>> 
>> degrees of freedom for s (see below).
>> 
>> nranges
>> 
>> number of groups whose maximum range is considered.
>> 
>> log.p
>> 
>> logical; if TRUE, probabilities p are given as log(p).
>> 
>> lower.tail
>> 
>> logical; if TRUE (default), probabilities are P[X � x], otherwise, P[X
>>> x].
>> 
>> 
>> But when I test it, "nmeans" actually should be the number of groups,
>> and not "nrange" to fit with tables of the studentized range
>> distribution.
>> 
>> Can that be - it should be a rather old procedure, so I wonder whether
>> I get something completely wrong...
>> 
>> Regards,
>> Ursula
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> This email and any attachments are confidential and may
>> ...{{dropped:8}}
> 
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to