Skip to content

data summary and some automated t.tests.

4 messages · Uwe Ligges, stephen sefick, David Freedman

#
I would like to preform a t.test to each of the measured variables
(sand.silt etc.) with a mean and sd for each of the treatments (up or
down), and out put this as a table....  I am having a hard time
starting- maybe it is to close to lunch.  Any suggestions would be
greatly appreciated.

Stephen Sefick

x <- (structure(list(sample. = structure(c(1L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 2L, 3L, 4L, 5L, 6L, 1L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 2L, 3L, 4L, 5L, 6L, 25L, 28L, 29L, 30L, 31L, 32L,
33L, 34L, 35L, 26L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L,
26L, 27L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 26L, 15L,
17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 16L, 15L, 17L, 18L, 19L,
20L, 21L, 22L, 23L, 24L, 16L, 36L, 39L, 40L, 41L, 42L, 43L, 44L,
45L, 46L, 37L, 36L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 37L,
38L), .Label = c("0805-r1", "0805-r10", "0805-r11", "0805-r12",
"0805-r13", "0805-r14", "0805-r2", "0805-r3", "0805-r4", "0805-r5",
"0805-r6", "0805-r7", "0805-r8", "0805-r9", "0805-u1", "0805-u10",
"0805-u2", "0805-u3", "0805-u4", "0805-u5", "0805-u6", "0805-u7",
"0805-u8", "0805-u9", "1005-r1", "1005-r10", "1005-r11", "1005-r2",
"1005-r3", "1005-r4", "1005-r5", "1005-r6", "1005-r7", "1005-r8",
"1005-r9", "1005-u1", "1005-u10", "1005-u11", "1005-u2", "1005-u3",
"1005-u4", "1005-u5", "1005-u6", "1005-u7", "1005-u8", "1005-u9"
), class = "factor"), date = structure(c(2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 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, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("dn", "up"
), class = "factor"), sand.silt = c(20L, 45L, 90L, 21L, 80L,
77L, 30L, 80L, 36L, 9L, 62L, 71L, 20L, 65L, 10L, 70L, 50L, 80L,
90L, 97L, 94L, 82L, 30L, 10L, 65L, 80L, 90L, 70L, 10L, 50L, 60L,
40L, 10L, 45L, 10L, 10L, 15L, 10L, 8L, 35L, 10L, 40L, 10L, 10L,
28L, 5L, 45L, 35L, 2L, 10L, 40L, 2L, 70L, 40L, 20L, 30L, 50L,
60L, 10L, 100L, 98L, 98L, 90L, 87L, 87L, 40L, 97L, 92L, 70L,
50L, 81L, 35L, 70L, 89L, 28L, 28L, 82L, 81L, 33L, 80L, 40L, 40L,
60L, 30L, 5L, 50L, 70L, 75L, 85L, 95L, 93L, 80L, 80L, 60L, 82L,
60L, 5L, 70L, 80L, 40L), gravel = c(8L, 45L, 7L, 5L, 10L, 5L,
35L, 7L, 45L, 60L, 0L, 0L, 5L, 8L, 25L, 0L, 45L, 15L, 0L, 1L,
2L, 5L, 6L, 15L, 10L, 5L, 3L, 10L, 20L, 0L, 20L, 31L, 20L, 35L,
70L, 30L, 60L, 60L, 70L, 50L, 70L, 40L, 50L, 30L, 48L, 85L, 20L,
30L, 20L, 60L, 30L, 8L, 10L, 30L, 30L, 10L, 0L, 0L, 10L, 0L,
0L, 0L, 2L, 8L, 8L, 30L, 0L, 3L, 15L, 29L, 11L, 60L, 15L, 8L,
60L, 25L, 8L, 9L, 42L, 1L, 50L, 40L, 10L, 60L, 60L, 30L, 10L,
10L, 0L, 0L, 0L, 2L, 2L, 0L, 1L, 25L, 10L, 10L, 10L, 50L), cobble = c(5L,
2L, 1L, 5L, 0L, 3L, 10L, 2L, 4L, 3L, 1L, 0L, 3L, 14L, 50L, 0L,
1L, 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, 0L, 0L, 0L, 5L, 0L, 0L, 0L,
10L, 0L, 0L, 2L, 0L, 0L, 0L, 0L, 3L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L), pool = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
6L, 0L, 0L, 0L, 0L, 3L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 4L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("sample.",
"date", "Replicate", "site", "sand.silt", "gravel", "cobble",
"boulder.bedrock", "fine.root", "course.root", "wood", "leaf",
"leaf.sand", "veg", "pool"), class = "data.frame", row.names = c(NA,
-100L)))
#
stephen sefick wrote:
I am a big fan of applying t.test()s, but in this case: Are you really 
sure? The integers and particularly boxplot(x) do not indicate very well 
that the variables are somehow close to Gaussian ...
And what is the treatment???

Best,
Uwe Ligges
#
Up and down are the treatments.  These are replicates within date for
percent cover of habiat.  This is habitat data for a stream
restoration - up is the unrestored and dn is the restored.  I have
looked at the density plots and they do not look gaussian - you are
absolutely right.  Even log(n+1) transformed they do not look
Gaussian.  Is there some other way that I would test for a difference
that you can think of?  My thoughts were to run a Permutation t.test,
but I am very new to permutations, and don't know if this applies.
The other thing that I was thinking was to use a npmanova (adonis in
vegan) to test if the centroids of the habitat classifications were
different.  I am in the process of working up my thesis data for
publication in a journal (there are other very interesting pieces to
the data set that I am working with, and this is one of the last
things that I need to wrap up before I can start editing/rewriting my
masters work).  Any thoughts would be greatly appreciated.
thanks,

Stephen Sefick

2009/5/16 Uwe Ligges <ligges at statistik.tu-dortmund.de>:

  
    
#
You might want to try using a non-parametric test, such as wilcox.test.

How about some modification of the following:

d=data.frame(grp=rep(1:2,e=5),replicate(10,rnorm(100))); head(d)
lapply(d[,-1],function(.column)wilcox.test(.column~grp,data=d))

David Freedman
stephen sefick wrote: