Skip to main content
Statistics LibreTexts

5.1.3a: The Additive Model

  • Page ID
    33638
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)
    • Load the glucose in blood serum data.
    • Obtain the ANOVA table with interaction.
    • Obtain the ANOVA table without interaction.
    • Obtain estimators and CIs for means for each treatment level.
    • Obtain Tukey’s multiple comparisons CIs and grouping.

    1. Load the glucose in blood serum data by using the following commands:

    setwd("~/path-to-folder/")
    glucose_data <- read.table("glucose_data.txt",header=T)
    attach(glucose_data)
    

    2. Obtain the ANOVA table with interaction by using the following commands:

    anova<-aov(glucose ~ factor(method) + factor(doping) + factor(method)*factor(doping),data=glucose_data)
    summary(anova)
    Df Sum Sq Mean Sq   F value   Pr(>F)    
    factor(method)                 1    264     264    98.347 3.92e-07 ***
    factor(doping)                 2  57026   28513 10632.526  < 2e-16 ***
    factor(method):factor(doping)  2     14       7     2.577    0.117    
    Residuals                     12     32       3                       
    ---
    Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    

    Here we can see that the interaction term is not significant, and we can drop it from the model. Also, notice that I have defined method and doping as factors since they have numeric values.

    3. Obtain the ANOVA table without interaction by using the following commands:

    anova1<-aov(glucose ~ factor(method) + factor(doping),data=glucose_data)
    summary(anova1)
    Df Sum Sq Mean Sq F value   Pr(>F)    
    factor(method)  1    264     264   80.27 3.58e-07 ***
    factor(doping)  2  57026   28513 8677.63  < 2e-16 ***
    Residuals      14     46       3                     
    ---
    Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    

    The Error SS is now 46.001, which is the sum of the interaction SS and the error SS of the model with the interaction. The df values were also added the same way.

    4. Obtain estimators and CIs for means for each treatment level by using the following commands:

    library(lsmeans)
    lsmeans(anova1,"method")
    method lsmean    SE df lower.CL upper.CL
    1    123 0.604 14      122      125
    2    116 0.604 14      114      117
    Results are averaged over the levels of: doping
    Confidence level used: 0.95
    lsmeans(anova1,"doping")
    doping lsmean   SE df lower.CL upper.CL
    1   43.7 0.74 14     42.1     45.3
    2  136.8 0.74 14    135.2    138.4
    3  178.3 0.74 14    176.7    179.9
    Results are averaged over the levels of: method
    Confidence level used: 0.95
    

    5. Obtain Tukey’s multiple comparisons CIs and grouping by using the following commands:

    tukey_multiple_comparisons<-TukeyHSD(anova1,conf.level=0.95,ordered=TRUE)
    tukey_multiple_comparisons
    Tukey multiple comparisons of means
    95% family-wise confidence level
    factor levels have been ordered
    Fit: aov(formula = glucose ~ factor(method) + factor(doping), data = glucose_data)
    $`factor(method)`
    diff      lwr      upr p adj
    1-2 7.655556 5.822828 9.488283 4e-07
    $`factor(doping)`
    diff       lwr       upr p adj
    2-1  93.10000  90.36089  95.83911     0
    3-1 134.61667 131.87755 137.35578     0
    3-2  41.51667  38.77755  44.25578     0
    tukey_grouping<-multcompLetters4(anova1,tukey_multiple_comparisons)
    print(tukey_grouping)
    $`factor(method)`
    1   2
    "a" "b"
    $`factor(doping)`
    3   2   1
    "a" "b" "c"
    detach(glucose_data)
    

    This page titled 5.1.3a: The Additive Model is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Penn State's Department of Statistics.

    • Was this article helpful?