Boxplots and Time Series Data
0
0
Entering edit mode
4.6 years ago
selplat21 ▴ 20

Hello,

I am looking at continuous data for body length over the course of 200 years (date) and am trying to plot a boxplot for the distribution of body length in each of k predefined bins over time.

For example, how would I bin these data in 20 year chunks and plot a histogram in each for body length.

Can an ANOVA be run on these distributions?

Thank you!

R • 1.3k views
ADD COMMENT
0
Entering edit mode

Do you have one measurement for each timepoint or multiple individuals? Why are you so eager to run ANOVA?

ADD REPLY
0
Entering edit mode

There are multiple individuals at every time point (independent sampling). I want to run the ANOVA because I have a couple alternate hypotheses that in one of these time bins, there body length might be expected to change, so I wanted to run ANOVA and then a post hoc test to determine whether pre- and post- this time bin, there are differences.

ADD REPLY
0
Entering edit mode

Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized. SUBMIT ANSWER is for new answers to original question.

ADD REPLY
0
Entering edit mode

Will do! My apologies.

ADD REPLY
0
Entering edit mode

Sounds like a t-test for me. Two groups, lots of measures in each one. As for representing it, you can bin several time points together but I don't really see the benefit here, you can draw boxplots for each time point

ADD REPLY
0
Entering edit mode

I've done t-tests, which have been useful here as you suggested, but I wanted to look at boxplots in each bin as there are alternative bins of time that could be causal. The changes we see fit more of an additive model than a linear one.

It seems like I can scrap the ANOVA, but for visual purposes I would like to look at data each bin.

What seems to be working for me is binning dates through the mutate function and then running something like this in ggplot2

ggplot( aes(x=bin, y=length) ) + geom_boxplot() + theme_ipsum() + xlab("Time")

Thanks all!

ADD REPLY
1
Entering edit mode

Just make sure that you understand what the ANOVA test measures. As its name applies is tests the variation of different bins, not necessarily the values. Also be careful with covariates.

ADD REPLY
0
Entering edit mode

ANOVA (one-way) is the test for the equality of means in 3 or more groups. While the test is derived from between- and within-group variation, it's not a test of variance.

To answer the boxplot question, the following is an illustration of what I think you want. Some fake data first:

y<- rnorm(1000)
x<- runif(1000)
bins<- cut( x, breaks=seq(0,1,length=20) ) 
boxplot( y ~ bins )
ADD REPLY
0
Entering edit mode

Yes, you're right. but it assumes that the variance is equal between populations and if this assumption is not met then it might not test for the difference of means.

ADD REPLY

Login before adding your answer.

Traffic: 1520 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6