Skip to main content
Tweeted twitter.com/#!/StackStats/status/256818079143698433
appended answer 39112 as supplemental
Source Link
whuber
  • 333.6k
  • 63
  • 792
  • 1.3k

I've got a completely randomized block design with three treatments and four replications. Biodiversity was measured in four successive years.

I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design.

My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(
  Treatment=rep(c("Control", "Irrigation", "Fertailization"), 16), 
  Block=rep(1:4, 12), 
  Year=rep(2000:2003, 12), 
  Value=runif(48, 0.5, 1.5)
)
# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))

My questions:

  1. Is my model correct?

  2. Is the post-hoc comparison appropriate?

  3. How could I include the bock effect?


If I understood you right, "Year" should be nested in "Block" - so the correct model would be coded like this:

fit <- lme(Value ~ Treatment,  random = ~1|Block/Year, data = mydata)

There seems to be a linear temporal trend in the data. How could I account for this in the model?

I've got a completely randomized block design with three treatments and four replications. Biodiversity was measured in four successive years.

I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design.

My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(
  Treatment=rep(c("Control", "Irrigation", "Fertailization"), 16), 
  Block=rep(1:4, 12), 
  Year=rep(2000:2003, 12), 
  Value=runif(48, 0.5, 1.5)
)
# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))

My questions:

  1. Is my model correct?

  2. Is the post-hoc comparison appropriate?

  3. How could I include the bock effect?

I've got a completely randomized block design with three treatments and four replications. Biodiversity was measured in four successive years.

I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design.

My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(
  Treatment=rep(c("Control", "Irrigation", "Fertailization"), 16), 
  Block=rep(1:4, 12), 
  Year=rep(2000:2003, 12), 
  Value=runif(48, 0.5, 1.5)
)
# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))

My questions:

  1. Is my model correct?

  2. Is the post-hoc comparison appropriate?

  3. How could I include the bock effect?


If I understood you right, "Year" should be nested in "Block" - so the correct model would be coded like this:

fit <- lme(Value ~ Treatment,  random = ~1|Block/Year, data = mydata)

There seems to be a linear temporal trend in the data. How could I account for this in the model?

formatting,
Source Link
Peter Flom
  • 128.3k
  • 36
  • 184
  • 425

I've got a completlycompletely randomized block design with three treatments and four replications. Biodiversity was measured in four successive years.

I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design.

My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(
  Treatment=rep(c("Control", "Irrigation", "Fertailization"), 16), 
  Block=rep(1:4, 12), 
  Year=rep(2000:2003, 12), 
  Value=runif(48, 0.5, 1.5)
)
# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))

My questions:

  1. Is my model correct?

  2. Is the post-hoc comparison appropriate?

  3. How could I include the bock effect?

I've got a completly randomized block design with three treatments and four replications. Biodiversity was measured in four successive years.

I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design.

My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(
  Treatment=rep(c("Control", "Irrigation", "Fertailization"), 16), 
  Block=rep(1:4, 12), 
  Year=rep(2000:2003, 12), 
  Value=runif(48, 0.5, 1.5)
)
# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))

My questions:

  1. Is my model correct?

  2. Is the post-hoc comparison appropriate?

  3. How could I include the bock effect?

I've got a completely randomized block design with three treatments and four replications. Biodiversity was measured in four successive years.

I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design.

My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(
  Treatment=rep(c("Control", "Irrigation", "Fertailization"), 16), 
  Block=rep(1:4, 12), 
  Year=rep(2000:2003, 12), 
  Value=runif(48, 0.5, 1.5)
)
# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))

My questions:

  1. Is my model correct?

  2. Is the post-hoc comparison appropriate?

  3. How could I include the bock effect?

I've got a completelycompletly randomized block design with three treatments and four replications. Biodiversity was measured in four successive years. 

I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design. 

My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(
  Treatment=rep(c("Control", "Irrigation", "Fertailization"), 16), 
                     Block=rep(1:4, 12), 
  Year=rep(2000:2003, 12), 
  Value=runif(48, 0.5, 1.5))
)
# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
 
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))
  • Is my model correct?
  • Is the post-hoc comparison appropriate?
  • How could I include the bock effect?

My questions:

  1. Is my model correct?

  2. Is the post-hoc comparison appropriate?

  3. How could I include the bock effect?

I've got a completely randomized block design with three treatments and four replications. Biodiversity was measured in four successive years. I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design. My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(Treatment=rep(c("Control","Irrigation","Fertailization"), 16), 
                     Block=rep(1:4,12), Year=rep(2000:2003, 12), Value=runif(48,0.5,1.5))

# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
 
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))
  • Is my model correct?
  • Is the post-hoc comparison appropriate?
  • How could I include the bock effect?

I've got a completly randomized block design with three treatments and four replications. Biodiversity was measured in four successive years. 

I figured that a mixed model with repeated measures as random terms should be appropriate to analyse this design. 

My hypothesis is that considering all years, biodiversity is different between the treatments.

This is my analysis:

library(nlme)
library(multcomp)
# Made-up random dataset
mydata <- data.frame(
  Treatment=rep(c("Control", "Irrigation", "Fertailization"), 16), 
  Block=rep(1:4, 12), 
  Year=rep(2000:2003, 12), 
  Value=runif(48, 0.5, 1.5)
)
# Model Treatment is a fixed effect, Year is a random effect
fit <- lme(Value ~ Treatment,  random = ~1|Year, data = mydata)
# Post-hoc comparison
summary(glht(fit,linfct=mcp(Treatment="Tukey")))

My questions:

  1. Is my model correct?

  2. Is the post-hoc comparison appropriate?

  3. How could I include the bock effect?

tweaked code to fit in window; light editing & formatting
Source Link
gung - Reinstate Monica
  • 147.5k
  • 89
  • 406
  • 717
Loading
Source Link
Laura
  • 71
  • 1
  • 2
Loading