41  Basic Statistical Modelling Framework

Statistical modeling provides a structured way to analyze data and make inferences about a population from a sample. A statistical model is a mathematical representation describing relationships between variables, used for prediction, estimation, and hypothesis testing, everything covered earlier in this topic (t-tests, ANOVA, chi-square) is, in a sense, a special case of statistical modeling.

41.0.1 Key Components of a Statistical Model

1. Data

  • Collected observations that serve as input for analysis.
  • Can be structured (numerical, categorical) or unstructured (text, images).
  • Example: a dataset of plot-level fertilizer dose and resulting crop yield.

2. Variables

  • Dependent variable (response): the outcome being measured (e.g., crop yield).
  • Independent variables (predictors): factors believed to influence the outcome (e.g., fertilizer dose, rainfall, irrigation type).

3. Mathematical Representation

A model typically follows the general form:

\[Y = f(X) + \varepsilon\]

where \(Y\) is the dependent variable, \(X\) is the independent variable, \(f(X)\) is the functional relationship between them, and \(\varepsilon\) is the error term capturing what the model doesn’t explain.

4. Assumptions

Statistical models rely on assumptions such as:

  • Linearity. Linear models assume a straight-line relationship.
  • Normality. Errors should be approximately normally distributed.
  • Independence. Observations shouldn’t be correlated with one another.

5. Estimation Methods

  • Ordinary Least Squares (OLS). For regression models.
  • Maximum Likelihood Estimation (MLE). For probability-based models.

6. Model Fitting and Evaluation

Once a model is built, its performance is assessed using:

  • Goodness-of-fit metrics. \(R^2\) for regression.
  • Statistical significance. P-values for individual coefficients.
  • Cross-validation. To check how well the model generalizes beyond the data it was fit on.

41.0.2 Types of Statistical Models

1. Descriptive Models

Summarize data patterns without making predictions. Example: mean, median, and standard deviation of a season’s yield. Covered in Descriptive Analytics.

2. Inferential Models

Generalize findings from a sample to a population. Example: the hypothesis tests and confidence intervals covered earlier in this topic.

3. Predictive Models

Use historical data to forecast future outcomes. Example: regression analysis predicting yield from fertilizer dose, the worked example below, and covered in much greater depth under Regression Models.

4. Probabilistic Models

Estimate probabilities of different outcomes. Example: logistic regression for classifying whether a crop will meet a yield threshold.


41.0.3 Example: Simple Linear Regression in R

A basic example of statistical modeling: using linear regression to predict crop yield from fertilizer dose across five plots.

Fertilizer Dose (kg/acre) Yield (quintals/acre)
20 18
40 22
60 27
80 33
100 38

Fitting a line through these points gives a slope of about 0.255 (each extra kg/acre of fertilizer is associated with about a 0.26-quintal/acre increase in yield) and an intercept of about 12.3, with \(R^2 \approx 0.996\). Fertilizer dose explains nearly all the variation in yield in this small, clean example.


Summary

Concept Description
**T-Tests**
Degrees of Freedom & Types of T-Tests Why t-tests need degrees of freedom while Z-tests don't, and the three types of t-test
One-Sample T-Test Tests a sample mean against a claimed value; worked example tests a hybrid maize yield claim, one-tailed
Independent Samples T-Test Compares means of two independent groups; worked example compares two seed varieties using Welch's t-test
Paired Samples T-Test Compares the same subjects under two conditions; worked example tests yield before/after a fertilizer program
**ANOVA**
ANOVA and the F-Test The F-statistic is the ratio of between-group to within-group variance that ANOVA tests
One-Way ANOVA Compares means across 3+ groups on one factor; worked example compares three seed treatment methods
Two-Way ANOVA Compares means across two factors and their interaction; worked example: fertilizer type x irrigation method on plant height
**Chi-Square Test**
Chi-Square Test of Independence Tests association between two categorical variables; worked example covers Yates' correction and Cramer's V
Chi-Square Goodness-of-Fit Test Tests whether observed proportions match a theoretical distribution; worked example verifies a Mendelian 3:1 ratio
**Basic Statistical Modelling Framework**
Key Components of a Statistical Model Data, variables, mathematical form, assumptions, estimation methods, and model evaluation
Types of Statistical Models Descriptive, inferential, predictive, and probabilistic models
Simple Linear Regression in R A worked OLS regression predicting yield from fertilizer dose