library(BorderEffect)
data(field_trial)
head(field_trial)
#> x y trt blk rep response
#> 1 0 0 T3 B2 R7 2.172413
#> 2 50 0 T3 B2 R14 2.221019
#> 3 100 0 T1 B1 R15 2.159862
#> 4 150 0 T2 B1 R15 2.305717
#> 5 200 0 T2 B2 R9 2.229770
#> 6 250 0 T1 B1 R10 2.160772bt <- border_test(be, pattern = "outer1", nsim = 300, seed = 42)
bt
#> Edge-effect test (pattern = outer1, nsim = 300)
#> kappa (observed) = -63.699317
#> 95% CI = [-69.199418, -61.462462]
#> Decision: efecto de borde presente (presence)
plot(bt)The bundled field_trial is simulated
(via rnorm) using the exact design of the motivating
dataset in the paper (a 12x8 staggered “tres bolillos” layout, 3
treatments, 2 blocks, 550 x 210 cm, border mean 2.21 vs interior 1.74).
The original field-recorded values are not distributed with the paper,
but any data with the same structure is analyzed the same way.
To analyze real data, provide a data frame (or CSV) with the plot
coordinates x, y, the trt and
blk factors, and the response. An example CSV
in this exact format ships with the package:
csv <- system.file("extdata", "field_trial.csv", package = "BorderEffect")
d <- read.csv(csv)
names(d)[names(d) == "block"] <- "blk" # the CSV names the block column `block`
be2 <- border_effect(response ~ trt + blk, data = d, coords = d)
border_test(be2, pattern = "outer1", nsim = 300, seed = 1)
#> Edge-effect test (pattern = outer1, nsim = 300)
#> kappa (observed) = -63.699317
#> 95% CI = [-69.885329, -61.892111]
#> Decision: efecto de borde presente (presence)To reproduce the paper’s exact layout and plug in your own 96 recorded yields (in plot order), rebuild the layout and attach the response: