As on Blackboard
You want to find out about differences in blood pressure (bp) between Black British, White British and Asian British patients. You have a large sample of data collected in GP surgeries.
lm().‘Univariate’ LM: bp ~ ethnicity
Possible other EVs to include?
I can think of age, body weight, sex, income…
Get a feel for “how data may pan out”…:
bp) between two groups (A, B).bp in A and B, together with age since bp tends to go up with age.Sketch a scatter plot where a naive t-test would indicate that mean bp is lower in B, but the difference is entirely explained by a group difference in mean age.
Hint: sketch the regression lines, not just data points!
Something like this, but with more data points obviously, and a clear pattern.
Different mean bp in A and B is entirely down to different mean age in A and B.
exercise (h per week) on blood pressure (bp).Now sketch a scatter plot where a naive y ~ x regression would come out positive (slope > 0), obscuring the beneficial effect of exercise in lowering bp.
Both groups show the same negative relationship between exercise and bp. However, mean bp is higher in A even though they exercise more.
If you can only use anova from base R, what’s the right model for answering each of the two research questions:
bp ~ age + groupbp ~ group + exerciseWhy does it matter?
Measuring yield for two substrates at six temperatures.
yield).subst);temp);subst is a factor,
but what about temp?
What is…
temp as covariate?temp as covariate?. . .
Write down the DOF used up by temp…
model_1 with temp as covariate;model_2 with temp as factor.Make sense of changes in all values…
Analysis of Variance Table
Response: yield
Df Sum Sq Mean Sq F value Pr(>F)
temp 1 1006.66 1006.66 135.702 < 2.2e-16
subst 1 132.00 132.00 17.794 4.879e-05
Residuals 117 867.93 7.42
Analysis of Variance Table
Response: yield
Df Sum Sq Mean Sq F value Pr(>F)
factor(temp) 5 1423.85 284.771 71.392 < 2.2e-16
subst 1 132.00 132.001 33.093 7.625e-08
Residuals 113 450.74 3.989
Lines: fit / predictions from model_1 (temp as covariate).
Crosshairs: fit / predictions from model_2 (temp as factor) for subst = glucose.
But model_2 can’t predict at 24°C…
BS2004 Revision lecture W4