Linear Models, Model Evaluation, and Analysis of Variance (ANOVA)

Principles of Statistical Modeling and Model Selection

  • Objective of Statistical Modeling:

    • Statistical modeling aims to describe relationships between explanatory variables and response variables using mathematical functions.

    • The overarching goal is identifying a minimal adequate model (minimal adäquates Modell), which represents the simplest possible model that adequately explains the observed data without unnecessary parameters.

  • The Principle of Parsimony:

    • Governed by Occam's Razor and the philosophical heuristic often attributed to Albert Einstein: models should be as simple as possible, but no simpler.

    • A statistical test must answer whether a more complex model explains the variation in the data sufficiently well to justify the loss of degrees of freedom associated with estimating additional parameters.

  • Model Hierarchy:

    • Null Model (Nullmodell): Assumes the explanatory variable XX does not explain the response variable YY. The fitted value for every observation is simply the overall mean of the response variable (Y^=Yˉ\hat{Y} = \bar{Y}).

    • Linear Model (Lineare Regression): Models a straight-line relationship between predictor and response (Y=a+b⋅XY = a + b \cdot X), capturing directional trends with two estimated parameters.

    • Complex Functions (Komplexere Funktionen, e.g., Splines): Incorporates non-linear flexibility or local polynomial fits. While providing higher fit fidelity to specific data points, complex models risk overfitting and increased variance in parameter estimation.

Comparison of Null Model, Linear Regression, and Splines

Mathematical Foundations and Assumptions of Linear Models

  • General Linear Model Equation:

    • The expected or predicted value Y^i\hat{Y}_i for observation ii (where i=1,…,ni = 1, \dots, n) is expressed as a linear combination of explanatory terms:     Y^i=β0+β1Φ1(X1,i)+⋯+βpΦp(Xp,i)\hat{Y}_i = \beta_0 + \beta_1 \Phi_1(X_{1,i}) + \dots + \beta_p \Phi_p(X_{p,i})

    • For simple linear regression with a single metric predictor, this simplifies to:     Y^i=a+b⋅Xi\hat{Y}_i = a + b \cdot X_i     where aa is the intercept and bb is the slope.

  • Residuals and Sum of Squared Errors (SSE):

    • The residual of the ii-th observation is the direct difference between the observed value and the model prediction:     Residuali=Yi−Y^i\text{Residual}_i = Y_i - \hat{Y}_i

    • Model fitting via Ordinary Least Squares (OLS) identifies parameter values that minimize the Sum of Squared Errors (Quadratische Abweichung / SSE):     SSE=∑i=1n(Yi−Y^i)2=∑i=1n(Yi−a−b⋅Xi)2SSE = \sum_{i=1}^n (Y_i - \hat{Y}_i)^2 = \sum_{i=1}^n (Y_i - a - b \cdot X_i)^2

Residuals and Sum of Squared Errors Illustration
  • Prerequisites and Model Assumptions:

    • OLS optimization yields valid statistical inferences only if specific mathematical conditions are satisfied across the data:

    • Normality of Residuals: Residuals must follow a normal distribution with a mean of zero (ϵi∼N(0,σ2)\epsilon_i \sim N(0, \sigma^2)).

    • Homoscedasticity (Constant Variance): The spread or variance of the residuals must remain invariant across all levels of the explanatory variable XX.

    • Absence of Influential Outliers: No single data point or small subset of points should disproportionately exert leverage on the parameter estimates.

    • These assumptions are non-negotiable and must be verified for every single fitted linear model.

Diagnostic Assumptions: Normal Distribution of Errors and Homoscedasticity

Quantifying Model Quality and Goodness of Fit

  • Decomposition of Sums of Squares:

    • Total Sum of Squares (SStotalSS_{total}, Summe der quadratischen Abweichung):     SStotal=∑i=1n(yi−yˉ)2SS_{total} = \sum_{i=1}^n (y_i - \bar{y})^2

    • Represents the total variability in the response variable relative to the null model (overall arithmetic mean yˉ\bar{y}).

    • Sum of Squared Errors (SSESSE, Verbleibende quadratische Abweichung):     SSE=∑i=1n(yi−y^i)2=∑i=1n(yi−a−b⋅xi)2SSE = \sum_{i=1}^n (y_i - \hat{y}_i)^2 = \sum_{i=1}^n (y_i - a - b \cdot x_i)^2

    • Quantifies the residual, unexplained variation remaining after fitting the regression line.

    • Fundamental Relationship:

    • Because adding parameters cannot increase unexplained variability in OLS, the total sum of squares is always greater than or equal to the residual sum of squares:       SSE≤SStotalSSE \le SS_{total}

  • Coefficient of Determination (R2R^2, Bestimmtheitsmaß):

    • Definition: The proportion of total variation in the data explained by the statistical model:     R2=1−SSESStotalR^2 = 1 - \frac{SSE}{SS_{total}}

    • Mathematical Boundaries:

    • Since SSE≤SStotalSSE \le SS_{total}, the ratio satisfies SSESStotal≤1\frac{SSE}{SS_{total}} \le 1, ensuring:       0≤R2≤10 \le R^2 \le 1

    • If a model explains zero variation beyond the sample mean, SSE=SStotalSSE = SS_{total} and R2=0R^2 = 0.

    • If a model explains all variation with zero error (SSE=0SSE = 0):       R2=1−0SStotal=1−0=1R^2 = 1 - \frac{0}{SS_{total}} = 1 - 0 = 1

  • Adjusted Coefficient of Determination (Radj2R^2_{adj}):

    • Standard R2R^2 monotonically increases with every added parameter regardless of explanatory utility. The adjusted R2R^2 penalizes model complexity based on the degrees of freedom consumed:     Radj2=1−(SSESStotal⋅n−1n−2)R^2_{adj} = 1 - \left( \frac{SSE}{SS_{total}} \cdot \frac{n - 1}{n - 2} \right)

  • Residual Standard Error:

    • Represents the standard deviation of the residuals, reflecting the average unexplained variability per residual degree of freedom (n−2n - 2 for simple linear regression with parameters aa and bb):     Residual Standard Error=SSEn−2\text{Residual Standard Error} = \sqrt{\frac{SSE}{n - 2}}

Hypothesis Testing in Linear Models: t-Test and F-Test

  • Student's t-Test for Regression Coefficients:

    • Evaluates the null hypothesis that an individual estimated parameter equals zero (H0:β=0H_0: \beta = 0):     t=Estimated ParameterStandard Error of the Parameter=β^SE(β^)t = \frac{\text{Estimated Parameter}}{\text{Standard Error of the Parameter}} = \frac{\hat{\beta}}{SE(\hat{\beta})}

    • Intercept (aa): Testing whether a=0a = 0 is generally of minor biological interest unless the origin has specific physical significance.

    • Slope (bb): A statistically significant deviation of bb from 0 indicates that the explanatory variable has a directional effect on the response variable.

  • Fisher's F-Test and Variance Comparison:

    • Evaluates whether the full regression model reduces unexplained variation compared to the null model by an amount greater than expected by chance.

    • The general definition of the FF-ratio compares two variance estimates:     F=Variance of the DifferenceVariance of the Complex Model=varAvarBF = \frac{\text{Variance of the Difference}}{\text{Variance of the Complex Model}} = \frac{\text{var}_A}{\text{var}_B}     where each variance estimate is the sum of squared deviations divided by its respective degrees of freedom:     Variance=Sum of Squared ResidualsDegrees of Freedom\text{Variance} = \frac{\text{Sum of Squared Residuals}}{\text{Degrees of Freedom}}

  • ANOVA Table Construction for Linear Regression:

  | Model Tier | Sum of Squares | Degrees of Freedom (DF) | Mean Square / Variance | F-Statistic |   | :--- | :--- | :--- | :--- | :--- |   | Model Difference (Explained by Regression) | SStotal−SSESS_{total} - SSE | (n−1)−(n−2)=1(n - 1) - (n - 2) = 1 | SStotal−SSE1\frac{SS_{total} - SSE}{1} | F1,n−2=(SStotal−SSE)/1SSE/(n−2)F_{1, n-2} = \frac{(SS_{total} - SSE) / 1}{SSE / (n - 2)} |   | Complex Model Residuals | SSESSE | n−2n - 2 | SSEn−2\frac{SSE}{n - 2} | — |   | Null Model | SStotalSS_{total} | n−1n - 1 | — | — |

  • Comparison of t-Test and F-Test:

    • The tt-test evaluates individual coefficients independently. In simple linear regression with one metric predictor, the tt-test on the slope is mathematically equivalent to the FF-test (t2=Ft^2 = F).

    • The FF-test evaluates the overall explanatory contribution of a variable or factor. It becomes essential in models involving multiple predictors or categorical variables with more than two factor levels where multiple parameters are estimated simultaneously.

Linear Regression Case Study: Latitude vs. Forest Stand Height

  • Ecological Question:

    • Investigation of how geographic latitude (Breitengrad, in degrees ∘^{\circ}) influences the canopy stand height (Bestandshöhe, in meters m\text{m}) of spruce forests (Fichtenwälder).

  • Implementation Workflow in R:

    • Data Loading and Initial Scatter Plot: R baeume <- read.table("07_baeume.txt", header=TRUE) plot(baeumebreite,baeumebreite, baeumehoehe, xlab="Breitengrad (°)", ylab="Höhe (m)", pch=20, xlim=c(45,60), ylim=c(25,50)) &nbsp;&nbsp;&nbsp;&nbsp;

  • Model Fitting and Visualization of Regression Line: R lm_baum <- lm(hoehe ~ breite, data=baeume) abline(lm_baum, lwd=2, col="blue") &nbsp;&nbsp;&nbsp;&nbsp;

  • Model Diagnostics (Four Standard Diagnostic Plots): R par(mfrow=c(2,2)) plot(lm_baum) par(mfrow=c(1,1)) &nbsp;&nbsp;&nbsp;&nbsp;

Diagnostic Plots for Tree Height Linear Regression
  • Summary Output Decomposition (summary(lm_baum)):

    • Call: lm(formula = hoehe ~ breite, data = baeume)

    • Residual Distribution:

    • Minimum: −7.203-7.203

    • 1st Quartile (1Q1Q): −2.024-2.024

    • Median: −0.130-0.130

    • 3rd Quartile (3Q3Q): 2.0422.042

    • Maximum: 7.2157.215

    • Estimated Coefficients:

    • Intercept (aa): Estimate = 97.0973197.09731, Standard Error = 4.941684.94168, t=19.65t = 19.65, p<2×10−16p < 2 \times 10^{-16}

    • Slope (bb, breite): Estimate = −1.14091-1.14091, Standard Error = 0.095210.09521, t=−11.98t = -11.98, p<2×10−16p < 2 \times 10^{-16}

    • Model Fit Statistics:

    • Residual Standard Error: 2.792.79 on 9898 degrees of freedom (n=100n = 100 total trees)

    • Multiple R2R^2: 0.59440.5944 (59.44%59.44\% of variance explained)

    • Adjusted R2R^2: 0.59020.5902

    • FF-Statistic: 143.6143.6 on 11 and 9898 DF, p<2.2×10−16p < 2.2 \times 10^{-16}

  • ANOVA Table Decomposition (anova(lm_baum)):

    • breite: DF=1DF = 1, Sum of Squares = 1117.481117.48, Mean Square = 1117.481117.48, F=143.6F = 143.6, p<2.2×10−16p < 2.2 \times 10^{-16}

    • Residuals: DF=98DF = 98, Sum of Squares = 762.64762.64, Mean Square = 7.787.78

  • Final Equation and Formal Reporting:

    • A linear regression demonstrated that geographic latitude has a statistically significant negative effect on stand height in spruce forests (F1,98=143.6F_{1,98} = 143.6, p<2.2×10−16p < 2.2 \times 10^{-16}, R2=0.59R^2 = 0.59):     Bestandsho¨he=97.10−1.14⋅Breitengrad\text{Bestandshöhe} = 97.10 - 1.14 \cdot \text{Breitengrad}

    • Stand height decreases by approximately 1.14 m1.14\,\text{m} for each additional degree of latitude northward.

Allometric Scaling and Logarithmic Data Transformations

  • Biological Basis of Allometry:

    • Allometric relationships describe non-linear, scale-dependent proportional changes between morphological or physiological variables.

    • Across broad biological groups (insects, birds) and engineered transport (airplanes), physical variables such as body mass (MM, in kg\text{kg}) and flight velocity (VV, in m/s\text{m/s}) follow power-law scaling relationships rather than linear dynamics.

Allometric Relationship of Flight Velocity vs Body Mass Across Organisms and Airplanes
  • Mathematical Transformation:

    • A power-law scaling function of the form:     Y=α⋅XβY = \alpha \cdot X^\beta

    • Applying natural logarithms to both sides transforms the curvilinear relationship into a linear form suitable for standard linear regression:     ln⁡(Y)=ln⁡(α)+β⋅ln⁡(X)\ln(Y) = \ln(\alpha) + \beta \cdot \ln(X)     where ln⁡(α)\ln(\alpha) represents the intercept and β\beta represents the allometric scaling exponent (slope).

  • Case Study: Verbascum densiflorum (Großblütige Königskerze):

    • Research question: Determine the allometric scaling relationship between stem shoot diameter (Sprossdurchmesser, explanatory variable) and plant height (Pflanzenhöhe, response variable) in the great mullein.

Photograph of Verbascum densiflorum
  • Raw vs. Log-Transformed Data Profiles:

    • Raw data: Height increases exponentially with diameter, producing non-constant residual variance on the arithmetic scale.

    • Log-transformed data: Natural log transformation yields a linear relationship with homoscedastic residual spread.

Linearization of Verbascum densiflorum Growth via Logarithmic Transformation
  • Computational Workflow in R: ```R

    Import dataset

    koenigskerze <- read.table("08_koenigskerze.txt", header=TRUE)

    Transform raw values using natural logarithm (base e)

    loghoehe <- log(koenigskerzehoehe)logdurchmesser<−log(koenigskerzehoehe) logdurchmesser <- log(koenigskerzedurchmesser)

    Fit linear model on transformed variables

    lin_reg <- lm(loghoehe ~ logdurchmesser)     ```

  • Model Verification via plot(lin_reg):

    • Residuals vs Fitted: Residual mean centers evenly at 0 across fitted values without discernible curved patterns.

    • Normal Q-Q: Standardized residuals lie closely along the theoretical quantile reference line (data points labeled: 8, 10, 18).

    • Scale-Location: Residual spread remains stable along fitted values, verifying homoscedasticity.

    • Residuals vs Leverage: Points lie within Cook's distance contours (0.50.5 and 1.01.0), demonstrating an absence of distorting outliers (point 3 demonstrates highest leverage but remains within tolerance).

  • Summary Results (summary(lin_reg)):

    • Residuals: Min = −0.62440-0.62440, 1Q = −0.21954-0.21954, Median = −0.01936-0.01936, 3Q = 0.140240.14024, Max = 0.866520.86652

    • Intercept: Estimate = −0.05713-0.05713, SE = 0.190160.19016, t=−0.30t = -0.30, p=0.766p = 0.766

    • logdurchmesser: Estimate = 2.521242.52124, SE = 0.086560.08656, t=29.13t = 29.13, p<2×10−16p < 2 \times 10^{-16}

    • Residual Standard Error: 0.29390.2939 on 2828 degrees of freedom (n=30n = 30 plants)

    • Multiple R2R^2: 0.96810.9681, Adjusted R2R^2: 0.96690.9669

    • FF-Statistic: 848.4848.4 on 11 and 2828 DF, p<2.2×10−16p < 2.2 \times 10^{-16}

  • ANOVA Evaluation (anova(lin_reg)):

    • logdurchmesser: DF=1DF = 1, Sum of Squares = 73.30073.300, Mean Square = 73.30073.300, F=848.43F = 848.43, p<2.2×10−16p < 2.2 \times 10^{-16}

    • Residuals: DF=28DF = 28, Sum of Squares = 2.4192.419, Mean Square = 0.0860.086

  • Mathematical Formulation of the Final Model:

    • Logarithmic scale equation:     log⁡(hoehe)=−0.057+2.521⋅log⁡(durchmesser)\log(\text{hoehe}) = -0.057 + 2.521 \cdot \log(\text{durchmesser})

    • Power-law back-transformation to arithmetic units:     hoehe=e−0.057⋅durchmesser2.521\text{hoehe} = e^{-0.057} \cdot \text{durchmesser}^{2.521}

  • Visualization Code and Fitted Plot: R plot(logdurchmesser, loghoehe, pch=20, xlab="log(Durchmesser)", ylab="log(Höhe)") abline(lin_reg, col="red") &nbsp;&nbsp;&nbsp;&nbsp;

Fitted Allometric Regression Line for Verbascum densiflorum

Analysis of Variance (ANOVA) with Categorical Predictors

  • Distinction Between Linear Regression and ANOVA:

    • Linear Regression: Analyzes a metric, continuous response variable against one or more metric, continuous explanatory variables (e.g., age, height, latitude).

    • Analysis of Variance (ANOVA): Analyzes a metric response variable against one or more categorical explanatory variables (e.g., site, sex, experimental treatment).

    • The categories of a categorical variable are termed factors (Faktoren), and the individual distinct groups are termed factor levels (Faktorstufen or Levels).

    • One-Way ANOVA (Einfaktorielle Varianzanalyse): Involves exactly one explanatory factor.

    • Multi-Way ANOVA (Mehrfaktorielle Varianzanalyse): Involves two or more explanatory factors.

    • Note on Terminology: The overarching method is called Analysis of Variance (ANOVA); this should not be confused with the ANOVA table (ANOVA-Tabelle), which is a general statistical reporting format used for both regression and ANOVA models.

  • Advantages of ANOVA Over Pairwise t-Tests:

    • A standard Student's tt-test can only compare two groups at a time.

    • Conducting multiple pairwise tt-tests across three or more groups inflates the family-wise Type I error rate (false positive rate).

    • ANOVA tests the omnibus null hypothesis that all group means are simultaneously equal (μ1=μ2=⋯=μk\mu_1 = \mu_2 = \dots = \mu_k) at a controlled significance level.

    • ANOVA accommodates complex factorial designs and determines the exact proportion of total variability attributed to individual categorical factors.

  • Underlying Conceptual Logic of ANOVA:

    1. Calculate total variance in the response variable across all observations pooled together without regard to group membership (SStotalSS_{total}, deviation from the grand mean yˉ\bar{y}).

    2. Calculate the unexplained within-group variance by measuring deviations of individual points from their respective group-specific means (SSESSE, Sum of Squared Errors).

    3. If factor levels do not differ significantly, group means will be approximately identical (yˉA≈yˉB≈yˉC\bar{y}_A \approx \bar{y}_B \approx \bar{y}_C), and SSE≈SStotalSSE \approx SS_{total}.

    4. If factor levels exert a significant effect, calculating residuals from group-specific means substantially decreases the remaining error (SSE<SStotalSSE < SS_{total}).

    5. Compare the variance explained by group differences against the residual variance using an FF-test.

One-Way ANOVA Case Study: Ozone Concentration Across Garden Sites

  • Experimental Setup and Research Question:

    • Daily ozone concentrations (Ozonkonzentration, measured in parts per hundred million, pphm\text{pphm}) were recorded across three distinct commercial plant nurseries / garden centers: gartenA, gartenB, and gartenC.

    • Question: Does the geographic location/site (Standort) have a statistically significant effect on atmospheric ozone concentrations?

Boxplot of Ozone Concentration Across Garden Sites A, B, and C
  • Manual Calculation of Sums of Squares:

    • Total Sum of Squares (SStotalSS_{total}):

    • Data points across all three sites pooled together (n=30n = 30 total observations; 1010 per nursery):       SStotal=∑i=130(ozonei−mean(ozone))2=70.8SS_{total} = \sum_{i=1}^{30} (\text{ozone}_i - \text{mean}(\text{ozone}))^2 = 70.8

    • Sum of Squared Errors (SSESSE):

    • Measured against the site-specific group means (Garden A, B, and C):       SSE=∑g∈{A,B,C}∑i=110(ozoneg,i−mean(ozoneg))2=32.1SSE = \sum_{g \in \{A, B, C\}} \sum_{i=1}^{10} (\text{ozone}_{g,i} - \text{mean}(\text{ozone}_g))^2 = 32.1

    • Variability Comparison:

    • Because SSE=32.1<SStotal=70.8SSE = 32.1 < SS_{total} = 70.8, grouping observations by garden site accounts for a large portion of the total variance.

  • Execution in R:

    • Data Import and Model Fitting: R gaerten <- read.table("08_ozon.txt", header=TRUE) lm_ozon <- lm(ozone ~ garden, data=gaerten) &nbsp;&nbsp;&nbsp;&nbsp;

  • Diagnostic Plots Validation (plot(lm_ozon)):

    • Confirms that residuals within each factor level are normally distributed, variances are homogeneous across factor levels, and no extreme outliers distort estimates.

Diagnostic Plots for Ozone ANOVA Model
  • Deconstruction of Regression Output (summary(lm_ozon)):

    • Residuals:

    • Min: −2.5200-2.5200, 1Q: −0.5075-0.5075, Median: 0.08000.0800, 3Q: 0.41750.4175, Max: 2.08002.0800

    • Coefficients (Treatment Contrasts):

    • R orders factors alphabetically by default; gardenA serves as the baseline reference level.

    • (Intercept): Estimate = 2.9800 pphm2.9800\,\text{pphm}, SE = 0.34500.3450, t=8.638t = 8.638, p=2.97×10−9p = 2.97 \times 10^{-9}

      • Direct estimate of the mean ozone concentration at gardenA (yˉA=2.98 pphm\bar{y}_A = 2.98\,\text{pphm}).

    • gardenB: Estimate = 1.7400 pphm1.7400\,\text{pphm}, SE = 0.48790.4879, t=3.566t = 3.566, p=0.00138p = 0.00138

      • Represents the difference between gardenB and gardenA. The mean for gardenB is:         yˉB=2.98+1.74=4.72 pphm\bar{y}_B = 2.98 + 1.74 = 4.72\,\text{pphm}

    • gardenC: Estimate = −1.0100 pphm-1.0100\,\text{pphm}, SE = 0.48790.4879, t=−2.070t = -2.070, p=0.04812p = 0.04812

      • Represents the difference between gardenC and gardenA. The mean for gardenC is:         yˉC=2.98−1.01=1.97 pphm\bar{y}_C = 2.98 - 1.01 = 1.97\,\text{pphm}

    • Parameter and Freedom Counts:

    • Three parameters are estimated to establish the three independent group means.

    • Total sample size n=30n = 30. Degrees of freedom lost = 33. Residual degrees of freedom = 30−3=2730 - 3 = 27.

    • Goodness of Fit:

    • Residual Standard Error: 1.0911.091 on 2727 degrees of freedom

    • Multiple R2R^2:       R2=1−SSESStotal=1−32.13370.834=0.5464R^2 = 1 - \frac{SSE}{SS_{total}} = 1 - \frac{32.133}{70.834} = 0.5464

      • Over 54.6%54.6\% of total ozone variation is directly explained by the nursery location.

    • Adjusted R2R^2: 0.51280.5128

    • FF-Statistic: 16.2616.26 on 22 and 2727 DF, p=2.321×10−5p = 2.321 \times 10^{-5}

  • ANOVA Table Output (anova(lm_ozon)):

    • garden: DF=2DF = 2, Sum of Squares = 38.70138.701, Mean Square = 19.350319.3503, F=16.259F = 16.259, p=2.321×10−5p = 2.321 \times 10^{-5}

    • Residuals: DF=27DF = 27, Sum of Squares = 32.13332.133, Mean Square = 1.19011.1901

    • Interpretation:

    • The factor garden consumes 22 degrees of freedom (k−1=3−1=2k - 1 = 3 - 1 = 2) beyond the null model.

    • Mean Square for garden (19.350319.3503) relative to residual Mean Square (1.19011.1901) produces F=16.259F = 16.259, confirming a significant effect of garden location on ozone concentration.

  • Direct Group Mean Calculation in R:

    • Group means can be computed directly without extracting regression coefficients using tapply(): ```R tapply(gaertenozone,gaertenozone, gaertengarden, mean)

    Output:

    A B C

    2.98 4.72 1.97

        ```

  • Graphical Presentation via Barplot with Confidence Intervals:

    • For reporting ANOVA results, a bar plot depicting group means with standard error bars is preferred over a box plot (which displays medians and interquartile ranges): ```R

    Install and load sciplot package

    install.packages("sciplot") library(sciplot)

    Generate mean bar plot with standard error bars

    bargraph.CI(x.factor=garden, response=ozone, data=gaerten, xlab="Gärtnerei", ylab="Ozonkonzentration (pphm)")     ```

Barplot with Error Bars of Mean Ozone Concentration by Garden
  • Standardized Reporting of ANOVA Results:

    • A one-way ANOVA determined that the location of the commercial nursery has a statistically significant effect on atmospheric ozone concentrations (F2,27=16.3F_{2, 27} = 16.3, p=2.32×10−5p = 2.32 \times 10^{-5}, R2=0.55R^2 = 0.55).

    • Summary Tables:

    ANOVA Table for Ozone Concentrations Across Nurseries:     | Independent Variable | DF | Sum Sq | Mean Sq | F-Value | p-Value |     | :--- | :--- | :--- | :--- | :--- | :--- |     | Gärtnerei (Site) | 2 | 38.70 | 19.35 | 16.3 | 2.32×10−52.32 \times 10^{-5} |     | Residuals | 27 | 32.13 | 1.19 | — | — |

    Group Mean Concentrations:     | Nursery (Gärtnerei) | Mean Ozone Concentration (pphm\text{pphm}) |     | :--- | :--- |     | A | 2.982.98 |     | B | 4.724.72 |     | C | 1.971.97 |

Summary Workflow for Linear Models and ANOVA in R

  • Standard Protocol for Linear Regression (Continuous Predictor):

    1. Model Formulation: Fit model using mein_modell <- lm(abhVar ~ unabhVar, data=daten).

    2. Assumption Verification: Evaluate model validity prior to drawing inferences using plot(mein_modell).

    3. Parameter Evaluation: Extract regression parameters, standard errors, and R2R^2 using summary(mein_modell).

    4. Significance Testing: Evaluate variable importance via variance decomposition using anova(mein_modell).

    5. Visual and Written Reporting: Plot scatter data with plot(unabhVar, abhVar), superimpose regression trend with abline(mein_modell), and report test statistics (FDF1,DF2F_{DF1, DF2}, pp, R2R^2) alongside the final fitted equation.

  • Standard Protocol for Analysis of Variance (Categorical Predictor):

    1. Model Formulation: Fit model using the same function syntax: mein_modell <- lm(abhVar ~ unabhVar, data=daten).

    2. Assumption Verification: Check residual normality and homoscedasticity across factor levels via plot(mein_modell).

    3. Factor Evaluation: Interpret summary contrast coefficients (summary(mein_modell)) or calculate group means directly via tapply(abhVar, unabhVar, mean).

    4. Omnibus Significance Testing: Check omnibus factor significance via anova(mein_modell).

    5. Visual and Written Reporting: Depict group means and standard errors using sciplot::bargraph.CI(), accompanied by an ANOVA summary table and reported FF-statistics.