Hi: Try this:
Trat <- c(2:30) # number of treatments gl <- c(2:30, 40, 60, 120) # Write a one-line 2D function to get the Tukey distribution quantile: f <- function(x,y) qtukey(0.95, x, y) outer(Trat, gl, f) It's slow (takes a few seconds) but it seems to work. HTH, Dennis On Wed, Nov 3, 2010 at 3:52 AM, Silvano <silv...@uel.br> wrote: > Hi, > > I'm building Tukey's table using qtukey function. > > It happens that I can't get the values of Tukey's one degree of freedom and > also wanted to eliminate the first column. > Firstly, one needs at least two treatments to find a studentized range (which is why you get NaNs across the first row when you set Trat = 1). Secondly, if you have at least two groups, you need at least two observations per group to get a variance estimate, which means that the variance estimate of the difference needs to have at least 2 df. If one group has only observation in it, the variance of the difference is the variance of the group with >= 2 observations, which doesn't make intuitive sense. This is why you get NaNs along the first column. HTH, Dennis > > The program is: > > Trat <- c(1:30) # number of treatments > gl <- c(1:30, 40, 60, 120) # degree freedom > > tukval <- matrix(0, nr=length(gl), nc=length(Trat)) > > for(i in 1:length(gl)) > for(j in 1:length(Trat)) > tukval[i,j] <- qtukey(.95, Trat[j], gl[i]) > > rownames(tukval) <- gl > colnames(tukval) <- paste(Trat, "", sep="") > tukval > > require(xtable) > xtable(tukval) > > > Some suggest? > > -------------------------------------- > Silvano Cesar da Costa > Departamento de EstatÃstica > Universidade Estadual de Londrina > Fone: 3371-4346 > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]]
______________________________________________ R-help@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.