Skip to content
Prev 15354 / 20628 Next

LMER: Visualizing three-way interaction

Dear Klemens,

Here is my ?0.02

library(ggplot2)
dataset <- expand.grid(
  x = seq(0, 1, length = 41),
  y = seq(0, 1, length = 41),
  z =factor( c("A", "B"))
)
dataset$fit <- with(dataset,
  ifelse(
    z == "A",
     x - 2 * x^2 + 0.5 * x * y + 3 * y - y ^ 2,
    -x - 1 * x^2 - 2 * x * y - 3 * y + y ^ 2
  )
)
ggplot(dataset, aes(x = x, y = y, fill = fit)) +
  geom_raster() +
  facet_wrap(~ z) +
  scale_fill_gradient2()
ggplot(dataset, aes(x = x, y = y, z = fit)) +
  geom_contour(aes(colour = ..level..), binwidth = 0.25) +
  facet_wrap(~ z) +
  scale_colour_gradient2()
ggplot(dataset, aes(x = x, y = y)) +
  geom_raster(aes(fill = fit)) +
  geom_contour(aes(z = fit), binwidth = 0.25) +
  facet_wrap(~ z) +
  scale_fill_gradient(low = "black", high = "white")

Best regards,

Thierry
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data. ~ John Tukey


2017-04-12 19:06 GMT+02:00 Evan Palmer-Young <ecp52 at cornell.edu>: