(Intercept) x1 x2 x3
1.281539 1.244548 2.221301 -1.335892
AMOD-5440
Trent University
2026-09-11
The R programming language and interface is the language of statistics in the 21st century.
Assignments will conducted with Crowdmark.
| Quiz Score | Maximum Assignment Report Grade |
|---|---|
| 80–100% | No cap |
| 70–79% | 85% |
| 60–69% | 75% |
| Below 60% | 65% and subject to instructor review |
Data mining, a.k.a. statistical learning refers to a set of tools for understanding data. These tools can be classified as:
Almost all models we will cover this semester share some common language.
In multiple linear regression, the unknown function is just summation:
\[ Y = \beta_0 + \beta_1 X_1 + \cdots + \beta_p X_p + \varepsilon, \] such that \(Y\) is related to the \(X\)s via a linear combination, the sum of each of the \(X\)s multiplied by a scale factor \(\beta_i\), for \(i=1, 2, \cdots, p\).
Note: you will never have to do mathematical derivations in your assignments. Each of these \(X\)s corresponds to a vector of observations in \(\textsf{R}\), as does the \(Y\).
\[ Y = 0.5 + 1.0 X_1 + 2.5 X_2 - 1.3 X_3 + \varepsilon \]
When the outcome is known for past observations, we can use those data to build a model and make predictions for new observations.
Example: Use information from previous patients and their surgical outcomes to predict the probability of a favourable outcome for a new patient.
\[ \text{Past Data} \;\longrightarrow\; \text{Model} \;\longrightarrow\; \text{Prediction for New Data} \]
Goal: Accurately predict the response variable \(Y\) for future observations.
When the goal is inference, we are interested in understanding the relationship between the predictors \(X\) and the response \(Y\), not just making accurate predictions.
Example: Suppose we want to understand how age, smoking status, and exercise habits affect the probability of a favourable surgical outcome. In this case, we care about which variables matter and how they affect the outcome.
\[ X \;\longrightarrow\; \text{Model} \;\longrightarrow\; Y \]
Goal: Understand and explain the relationship between \(X\) and \(Y\), rather than treating the model as a black box.
In many scientific studies, explanation and understanding are more important than prediction.
Example: the “stopped clock” estimator. If you ask me what time it is, and I always respond 11 o’clock, I will almost always be wrong. But it is an estimate, and it will be correct … sometimes. Namely, at 11am and 11pm!
Even with the best possible model, predictions are not perfect. Prediction error is often divided into two components:
Error that can be decreased by improving the model, collecting more data, or choosing better predictors.
Example: If I estimate the current time by always saying “11:00”, my predictions will be poor. Looking at a clock provides a much more accurate estimate.
Error that remains even when the best possible model is used.
Example: A clock may be slightly inaccurate, or it may not display seconds. Even with access to the clock, some uncertainty remains.
Key idea: Reducible error comes from our estimate of \(f\), while irreducible error comes from the random error term \(\varepsilon\), which cannot be eliminated.
Using the data from before, \(X_1, X_2, X_3\) which are linearly combined (with noise) to make \(Y\). Let’s try to predict the value of \(Y\) at a particular combination of \(X\)s.
What is the true, average value?
\[ \begin{split} Y = f(2, 1, -1) &= 0.5 + 1.0 (2) + 2.5 (1) - 1.3 (-1)\\ & = 6.3 \end{split} \]
What are some of the questions we might ask about the function \(f(\cdot)\)?
These are what you think of when you think of statistical methods, especially the family of linear models.
There are two, or maybe three, considerations when choosing a method.
Summarized as “how accurately can the model reproduce the given data?”.
Summarized as “is there a direct interpretation of the coefficients of your model which can be translated into scientific language?”
So, instead, we square the differences. This leads to mean squared error (MSE):
\[ \text{MSE} = \frac{1}{n} \sum_{i=1}^{n} \left(y_i - \hat{f}(x_i)\right)^2 \]
This is the mean (average) across the \(i\) data points of the squared difference between \(y_i\) and \(\hat{f}(x_i) = \hat{y}_i\).
This is what is used to give us regression!
