James Casey
2013-May-14 21:55 UTC
[R] R-Help: nparLD Package Non-parametric Repeated Measures
Hi, I'm trying to analyze repeated measurements of body temperature data collected from 7 randomly chosen subjects (e.g. turtles). I am using R, along with the nparLD package to test for an effect of diel period (fixed factor: day or night) and season (sub-plot fixed factor: spring, summer, fall) on body temperature. Based on this set-up (LD-F2), I am using the non-parametric nparLD pacakge([url]http://www.inside-r.org/packages/cran/nparLD/docs/ld.f2[/url]) because data transformations were unsuccessful and I am randomly missing some paired values. Main issue/question: In R the nparLD ANOVA-type Test showed a significant p-value for diel period, no effect of season, and no interaction between diel period and season. But a post-hoc Wilcoxon Signed-Rank Test did NOT find a significant difference (p = 0.054) for diel period (day vs night) body temperature. How is it possible to have a significant effect for day vs night, based on the nparLD package, but NO significant difference between day and night for the post-hoc Wilcoxon test? Also, if I only have two levels of the fixed effect (day vs night), do I need to run a post-hoc test or just look at the mean values after the ANOVA-type test? Data info: The repeated measurements on the 7 subjects had 2 fixed effects: 1. Diel period (day or night) 2. Season (Spring, summer, and fall)(Subplot Factor) Mean values for body temperature and for diel period are below. Diel column (D=Day, N = Night). State column (RT=Spring, RF = Summer, PT = Fall). Subject, N=7. NA = missing value. All comments (good and bad) are greatly appreciated! Thanks, James -- output of sessionInfo(): [code]> data=read.csv(file.choose(), header=TRUE) > attach(data) > datastp diel state subject 1 26.2 D RT 1 2 26.4 N RT 1 3 24.1 D RT 2 4 NA N RT 2 5 NA D RT 3 6 25.2 N RT 3 7 27.1 D RT 4 8 26.5 N RT 4 9 26.9 D RT 5 10 27.1 N RT 5 11 26.2 D RT 6 12 26.0 N RT 6 13 26.3 D RT 7 14 26.7 N RT 7 15 26.0 D RF 1 16 26.6 N RF 1 17 24.2 D RF 2 18 25.6 N RF 2 19 25.6 D RF 3 20 26.6 N RF 3 21 26.1 D RF 4 22 26.9 N RF 4 23 27.2 D RF 5 24 27.4 N RF 5 25 26.2 D RF 6 26 26.7 N RF 6 27 27.2 D RF 7 28 27.5 N RF 7 29 25.0 D PT 1 30 24.8 N PT 1 31 NA D PT 2 32 NA N PT 2 33 NA D PT 3 34 NA N PT 3 35 26.7 D PT 4 36 26.9 N PT 4 37 27.6 D PT 5 38 27.5 N PT 5 39 25.2 D PT 6 40 24.9 N PT 6 41 27.1 D PT 7 42 27.0 N PT 7>ex.f2<-ld.f2(y=stp, time1=diel, time2=state, subject=subject,time1.name="Diel", time2.name="State", description=FALSE)> ex.f2$ANOVA.testStatistic df p-value Diel 4.9028447 1.000000 0.02681249 State 0.2332795 1.374320 0.70586274 Diel:State 2.1937783 1.062943 0.13717393 [/code] [code]> detach(data) > data=read.csv(file.choose(), header=TRUE) > attach(data) > dataday night 1 26.2 26.4 2 26.0 26.6 3 25.0 24.8 4 24.2 25.6 5 25.6 26.6 6 27.1 26.5 7 26.1 26.9 8 26.7 26.9 9 26.9 27.1 10 27.2 27.4 11 27.6 27.5 12 26.2 26.0 13 26.2 26.7 14 25.2 24.9 15 26.3 26.7 16 27.2 27.5 17 27.1 27.0> library(coin)> wilcoxsign_test(day ~ night, distribution="exact")Exact Wilcoxon-Signed-Rank Test data: y by x (neg, pos) stratified by block Z = -1.9234, p-value = 0.05482 alternative hypothesis: true mu is not equal to 0 [/code] [[alternative HTML version deleted]]
Gerrit Eichner
2013-May-16 08:39 UTC
[R] R-Help: nparLD Package Non-parametric Repeated Measures
Hello, James, see my comments inline.> ... Main issue/question: In R the nparLD ANOVA-type Test showed a > significant p-value for diel period, no effect of season, and no > interaction between diel period and season. But a post-hoc Wilcoxon > Signed-Rank Test did NOT find a significant difference (p = 0.054) for > diel period (day vs night) body temperature. > > How is it possible to have a significant effect for day vs night, based on > the nparLD package, but NO significant difference between day and night for > the post-hoc Wilcoxon test?Those tests -- in general -- test different hypotheses and use different test statistics, the first one, in addition, using a distributional approximation to obtain a p-value. You may want to look at the references cited in the respective online help pages for technical details.> Also, if I only have two levels of the fixed effect (day vs night), do I > need to run a post-hoc test or just look at the mean values after the > ANOVA-type test?Hm, actually no (of course depending on your scientific question) since the ANOVA-table -- if you believe its p-value -- already tells you that there is a (marginally) significant main "Diel-period"-effect, i.e., a difference between day and night. However, I recommend that you consult with a local statistician since this is actually not an R-problem and since I have the impression that there exist some uncertainties in your statistical expertise. Hth -- Gerrit> Data info: > > The repeated measurements on the 7 subjects had 2 fixed effects: > > 1. Diel period (day or night) > 2. Season (Spring, summer, and fall)(Subplot Factor) > > Mean values for body temperature and for diel period are below. Diel column > (D=Day, N = Night). State column (RT=Spring, RF = Summer, PT = Fall). > Subject, N=7. NA = missing value. > > All comments (good and bad) are greatly appreciated! > > Thanks, > James > > > > -- output of sessionInfo(): > > [code] >> data=read.csv(file.choose(), header=TRUE) >> attach(data) >> data > stp diel state subject > 1 26.2 D RT 1 > 2 26.4 N RT 1 > 3 24.1 D RT 2 > 4 NA N RT 2 > 5 NA D RT 3 > 6 25.2 N RT 3 > 7 27.1 D RT 4 > 8 26.5 N RT 4 > 9 26.9 D RT 5 > 10 27.1 N RT 5 > 11 26.2 D RT 6 > 12 26.0 N RT 6 > 13 26.3 D RT 7 > 14 26.7 N RT 7 > 15 26.0 D RF 1 > 16 26.6 N RF 1 > 17 24.2 D RF 2 > 18 25.6 N RF 2 > 19 25.6 D RF 3 > 20 26.6 N RF 3 > 21 26.1 D RF 4 > 22 26.9 N RF 4 > 23 27.2 D RF 5 > 24 27.4 N RF 5 > 25 26.2 D RF 6 > 26 26.7 N RF 6 > 27 27.2 D RF 7 > 28 27.5 N RF 7 > 29 25.0 D PT 1 > 30 24.8 N PT 1 > 31 NA D PT 2 > 32 NA N PT 2 > 33 NA D PT 3 > 34 NA N PT 3 > 35 26.7 D PT 4 > 36 26.9 N PT 4 > 37 27.6 D PT 5 > 38 27.5 N PT 5 > 39 25.2 D PT 6 > 40 24.9 N PT 6 > 41 27.1 D PT 7 > 42 27.0 N PT 7 > > >> ex.f2<-ld.f2(y=stp, time1=diel, time2=state, subject=subject, > time1.name="Diel", time2.name="State", description=FALSE) > >> ex.f2$ANOVA.test > Statistic df p-value > Diel 4.9028447 1.000000 0.02681249 > State 0.2332795 1.374320 0.70586274 > Diel:State 2.1937783 1.062943 0.13717393 > [/code] > > [code] >> detach(data) >> data=read.csv(file.choose(), header=TRUE) >> attach(data) >> data > day night > 1 26.2 26.4 > 2 26.0 26.6 > 3 25.0 24.8 > 4 24.2 25.6 > 5 25.6 26.6 > 6 27.1 26.5 > 7 26.1 26.9 > 8 26.7 26.9 > 9 26.9 27.1 > 10 27.2 27.4 > 11 27.6 27.5 > 12 26.2 26.0 > 13 26.2 26.7 > 14 25.2 24.9 > 15 26.3 26.7 > 16 27.2 27.5 > 17 27.1 27.0 > >> library(coin) > >> wilcoxsign_test(day ~ night, distribution="exact") > > Exact Wilcoxon-Signed-Rank Test > > data: y by x (neg, pos) > stratified by block > Z = -1.9234, p-value = 0.05482 > alternative hypothesis: true mu is not equal to 0 > > [/code] > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.