Strip plot analysis using R

See Video ⮞ ☝


Introduction

A strip-plot (split-block) design is used when two factors are independently randomized in perpendicular strips within each block. It has three error strata, and the interaction is often estimated with greater precision than either main effect because the two strip factors intersect.

  • Vertical strip plot for the first factor also called the vertical factor.
  • Horizontal strip plot for the second factor also called the horizontal factor.
  • Intersection plot for the interaction between the two factors.

Unlike a split-plot design, neither factor is nested within the other. Each factor is assigned to strips in one direction, and the second factor is assigned across perpendicular strips. Randomization is conducted independently within each block for both directions.

In this case the interaction plot is of course the smallest.
**Layout vertical and horizontal strips**

Layout vertical and horizontal strips

The design trades precision across effects: the two main effects use their respective strip error terms, while the interaction uses the intersection residual. The analysis must preserve these separate strata.

In the example, variety and fertilizer are crossed in strips within blocks. The physical layout and randomization determine whether this is truly a strip plot; merely arranging factors in rows and columns does not establish the design.

This design facilitates the physical operations and increases the precision for estimation of interaction effect.

Example data set

The example used here is comprised of three varieties and four different fertilizer levels. If varieties are kept in main plots and fertilizer levels in sub plots then the given layout for one block indicates the difference between a split plot and a strip plot design.

**Difference between strip and split plot layout**

The diagram illustrates the layout. Verify that each block contains every level of each factor in its assigned strip direction and that treatment combinations occur at the intersections.

Let’s start how to carry out analysis of strip plot design in R studio.

Import data

Clear workspace objects only if needed and save anything to retain. Graphics and console cleanup are optional.

rm(list = ls(all = TRUE))
graphics.off()
shell("cls")

Import the CSV file with the correct path and header setting. Check the data for one observation per block-by-variety-by-fertilizer intersection and inspect missing or duplicated records.

data <- read.csv(file = "data_strip.csv", 
                 header = TRUE)
head(data)
#   block varieties fertilizer yield
# 1     1        V1         F1  10.2
# 2     1        V1         F2  11.1
# 3     1        V1         F3   6.8
# 4     1        V1         F4   5.3
# 5     1        V2         F1   8.0
# 6     1        V2         F2   9.7

Use str() to confirm the response is numeric and block and treatment columns are coded as categories.

Convert variety labels to factors when necessary, preserving the intended level order.

Convert fertilizer levels to factors and verify their labels and ordering before fitting the model.

str(data)
# 'data.frame': 48 obs. of  4 variables:
#  $ block     : int  1 1 1 1 1 1 1 1 1 1 ...
#  $ varieties : Factor w/ 3 levels "V1","V2","V3": 1 1 1 1 2 2 2 2 3 3 ...
#  $ fertilizer: Factor w/ 4 levels "F1","F2","F3",..: 1 2 3 4 1 2 3 4 1 2 ...
#  $ yield     : num  10.2 11.1 6.8 5.3 8 9.7 8.6 3.4 2 10.9 ...
data$varieties = as.factor(data$varieties)
data$fertilizer = as.factor(data$fertilizer)

str(data)
# 'data.frame': 48 obs. of  4 variables:
#  $ block     : int  1 1 1 1 1 1 1 1 1 1 ...
#  $ varieties : Factor w/ 3 levels "V1","V2","V3": 1 1 1 1 2 2 2 2 3 3 ...
#  $ fertilizer: Factor w/ 4 levels "F1","F2","F3",..: 1 2 3 4 1 2 3 4 1 2 ...
#  $ yield     : num  10.2 11.1 6.8 5.3 8 9.7 8.6 3.4 2 10.9 ...

Fit analysis of variance model

A strip-plot ANOVA partitions error into block-by-variety, block-by-fertilizer, and residual interaction strata. Each treatment effect must be tested against its corresponding error term.

  • The horizontal-factor analysis
  • The vertical-factor analysis
  • The interaction analysis

Use agricolae::strip.plot() with the correct block, column factor, row factor, and response. Confirm the function’s factor orientation matches the field layout and review the reported strata.

attach(data)
library(agricolae)

model = strip.plot(BLOCK = block,
                   COL = varieties,
                   ROW = fertilizer,
                   Y = yield)
# 
# ANALYSIS STRIP PLOT:  yield 
# Class level information
# 
# varieties     :  V1 V2 V3 
# fertilizer    :  F1 F2 F3 F4 
# block     :  1 2 3 4 
# 
# Number of observations:  48 
# 
# model Y: yield ~ block + varieties + Ea + fertilizer + Eb + fertilizer:varieties + Ec 
# 
# Analysis of Variance Table
# 
# Response: yield
#                      Df  Sum Sq Mean Sq F value    Pr(>F)    
# block                 3  13.692   4.564  2.4086 0.1007122    
# varieties             2 163.007  81.503 57.0397 0.0001248 ***
# Ea                    6   8.573   1.429  0.7541 0.6144958    
# fertilizer            3 152.685  50.895 17.1086 0.0004638 ***
# Eb                    9  26.773   2.975  1.5700 0.1983665    
# fertilizer:varieties  6  40.320   6.720  3.5465 0.0170071 *  
# Ec                   18  34.107   1.895                      
# ---
# Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 
# cv(a) = 16 %, cv(b) = 23 %, cv(c) = 18.4 %, Mean = 7.491667
Yield is significantly affected by both main and interaction effects.

LSD mean comparison test

Follow-up mean comparisons should be based on the appropriate stratum and model estimands. Use them only when they address the research question and report uncertainty as well as group labels.

Specify the error degrees of freedom and mean square for each term separately. In a strip plot, the error term for variety, fertilizer, and their interaction differs; using one residual for all comparisons can invalidate inference.

The significance level is commonly set to alpha = 0.05; verify the function’s argument definition rather than assuming its default. State the comparison procedure and multiplicity adjustment. Bonferroni is one option, but it can be conservative for many comparisons.

# Main effects
library(agricolae)
# First factor variable (varieties)
LSD_A = LSD.test(y = yield,
                 trt = varieties,
                 DFerror = model$gl.a,
                 MSerror = model$Ea,
                 alpha = 0.05,
                 p.adj = "bonferroni",
                 group = TRUE,
                 console = TRUE)
# 
# Study: yield ~ varieties
# 
# LSD t Test for yield 
# P value adjustment method: bonferroni 
# 
# Mean Square Error:  1.428889 
# 
# varieties,  means and individual ( 95 %) CI
# 
#    yield      std  r      LCL      UCL Min  Max
# V1 9.025 2.217055 16 8.293764 9.756236 4.6 12.3
# V2 8.550 2.279474 16 7.818764 9.281236 3.4 12.0
# V3 4.900 2.880741 16 4.168764 5.631236 0.9 10.9
# 
# Alpha: 0.05 ; DF Error: 6
# Critical Value of t: 3.287455 
# 
# Minimum Significant Difference: 1.389358 
# 
# Treatments with the same letter are not significantly different.
# 
#    yield groups
# V1 9.025      a
# V2 8.550      a
# V3 4.900      b
# Second factor variable (fertilizer)
LSD_B = LSD.test(y = yield,
                 trt = fertilizer,
                 DFerror = model$gl.b,
                 MSerror = model$Eb,
                 alpha = 0.05,
                 p.adj = "bonferroni",
                 group = TRUE,
                 console = TRUE)
# 
# Study: yield ~ fertilizer
# 
# LSD t Test for yield 
# P value adjustment method: bonferroni 
# 
# Mean Square Error:  2.974815 
# 
# fertilizer,  means and individual ( 95 %) CI
# 
#       yield      std  r      LCL       UCL Min  Max
# F1 8.483333 3.193981 12 7.357012  9.609654 2.0 12.3
# F2 9.416667 1.407017 12 8.290346 10.542988 6.5 11.2
# F3 7.408333 2.888365 12 6.282012  8.534654 2.2 10.3
# F4 4.658333 2.349258 12 3.532012  5.784654 0.9  7.6
# 
# Alpha: 0.05 ; DF Error: 9
# Critical Value of t: 3.364203 
# 
# Minimum Significant Difference: 2.368845 
# 
# Treatments with the same letter are not significantly different.
# 
#       yield groups
# F2 9.416667      a
# F1 8.483333      a
# F3 7.408333      a
# F4 4.658333      b
# Interaction (varieties:fertilizer)
LSD_AB = LSD.test(y = yield,
                  trt = varieties:fertilizer,
                  DFerror = model$gl.c,
                  MSerror = model$Ec,
                  alpha = 0.05,
                  p.adj = "bonferroni",
                  group = TRUE,
                  console = TRUE)
# 
# Study: yield ~ varieties:fertilizer
# 
# LSD t Test for yield 
# P value adjustment method: bonferroni 
# 
# Mean Square Error:  1.894815 
# 
# varieties:fertilizer,  means and individual ( 95 %) CI
# 
#        yield       std r       LCL       UCL  Min  Max
# V1:F1 11.175 1.1870833 4 9.7290165 12.620983 10.1 12.3
# V1:F2  9.725 1.0436315 4 8.2790165 11.170983  8.6 11.1
# V1:F3  9.025 1.5305228 4 7.5790165 10.470983  6.8 10.3
# V1:F4  6.175 1.4453950 4 4.7290165  7.620983  4.6  7.5
# V2:F1  9.375 1.9465782 4 7.9290165 10.820983  7.8 12.0
# V2:F2  9.775 1.3937360 4 8.3290165 11.220983  7.9 11.2
# V2:F3  9.425 0.5909033 4 7.9790165 10.870983  8.6 10.0
# V2:F4  5.625 2.1360009 4 4.1790165  7.070983  3.4  7.6
# V3:F1  4.900 2.0896571 4 3.4540165  6.345983  2.0  6.7
# V3:F2  8.750 1.8266545 4 7.3040165 10.195983  6.5 10.9
# V3:F3  3.775 1.1786291 4 2.3290165  5.220983  2.2  4.9
# V3:F4  2.175 1.0242884 4 0.7290165  3.620983  0.9  3.4
# 
# Alpha: 0.05 ; DF Error: 18
# Critical Value of t: 4.04629 
# 
# Minimum Significant Difference: 3.93845 
# 
# Treatments with the same letter are not significantly different.
# 
#        yield groups
# V1:F1 11.175      a
# V2:F2  9.775     ab
# V1:F2  9.725     ab
# V2:F3  9.425    abc
# V2:F1  9.375    abc
# V1:F3  9.025    abc
# V3:F2  8.750   abcd
# V1:F4  6.175   bcde
# V2:F4  5.625   cdef
# V3:F1  4.900    def
# V3:F3  3.775     ef
# V3:F4  2.175      f

Compute mean and standard error

Calculate variety means and their uncertainty at the experimental-unit level. In this design, raw standard errors may not match the model-based uncertainty for a main effect.

Summarize fertilizer and variety-by-fertilizer combinations using the same definitions and levels used in the model. For interaction interpretation, focus on the relevant combinations or simple effects.

# For main effects
library(dplyr)
MeanSE_A = data %>%
          group_by(varieties) %>%
          summarise(avg_A = mean(yield),
                    se = sd(yield)/sqrt(length(yield)))
MeanSE_B = data %>%
          group_by(fertilizer) %>%
          summarise(avg_B = mean(yield),
                    se = sd(yield)/sqrt(length(yield)))
# For interaction
MeanSE_AB = data %>%
          group_by(varieties, fertilizer) %>%
          summarise(avg_AB = mean(yield),
                    se = sd(yield)/sqrt(length(yield)))
print(MeanSE_A)
# # A tibble: 3 x 3
#   varieties avg_A    se
#   <fct>     <dbl> <dbl>
# 1 V1         9.02 0.554
# 2 V2         8.55 0.570
# 3 V3         4.9  0.720
print(MeanSE_B)
# # A tibble: 4 x 3
#   fertilizer avg_B    se
#   <fct>      <dbl> <dbl>
# 1 F1          8.48 0.922
# 2 F2          9.42 0.406
# 3 F3          7.41 0.834
# 4 F4          4.66 0.678
print(MeanSE_AB)
# # A tibble: 12 x 4
# # Groups:   varieties [3]
#    varieties fertilizer avg_AB    se
#    <fct>     <fct>       <dbl> <dbl>
#  1 V1        F1          11.2  0.594
#  2 V1        F2           9.72 0.522
#  3 V1        F3           9.02 0.765
#  4 V1        F4           6.18 0.723
#  5 V2        F1           9.38 0.973
#  6 V2        F2           9.78 0.697
#  7 V2        F3           9.43 0.295
#  8 V2        F4           5.62 1.07 
#  9 V3        F1           4.9  1.04 
# 10 V3        F2           8.75 0.913
# 11 V3        F3           3.78 0.589
# 12 V3        F4           2.17 0.512
attach(MeanSE_A)
attach(MeanSE_B)
attach(MeanSE_AB)

Visualize effects

Plot varieties

Use ggplot2 to create the figure from a clearly structured summary data frame. Show the factor levels and response units explicitly.

Map variety and its estimated mean to the axes, and use a consistent grouping scheme for fertilizer. Prefer model-based means and intervals when the design is unbalanced or inference is a goal.

Use geom_col() or geom_bar(stat = "identity") for precomputed means. Choose a layout that makes the two crossed factors easy to compare.

Add uncertainty bars that correspond to the estimates shown. Identify whether they represent SE, confidence intervals, or another quantity; avoid interpreting them as a multiple-comparison test.

Use labs() for a descriptive title and axis labels. Add a caption that states the design, error-bar definition, and comparison method.

library(ggplot2)
# Create plot object 
p1 = ggplot(MeanSE_A, aes(x = varieties,
                          y = avg_A))
# Adding layers to p2 object
# Adding bars
plotA = p1 + 
          geom_bar(stat = "identity",
                   color = "black",
                   position = position_dodge(width=0.9))
# Adding error bars  
plotB = plotA +
          geom_errorbar(aes(ymax = avg_A + se,
                            ymin = avg_A - se), 
                        position = position_dodge(width=0.9), 
                        width = 0.25)
# Changing main title, X and Y labels
plotC = plotB + 
          labs(title = "",
               x = "varieties",
               y = "yield")

Comments

  1. What is the difference between casino games and slots?
    Slot games are the 우리 카지노 계열사 most popular 메리트카지노 가입쿠폰 types of casino games, and the majority 카지노 사이트 are slots. and 개집 왕 the most 더킹카지노 슬롯 commonly played slot games.

    ReplyDelete

Post a Comment