From "Generalized Additive Models: an introduction with R" by Simon N. Wood, page 55, Exercise 1.9, Question 1:

4 car journeys in London of length 1, 3, 4 and 5 kilometres took 0.1, 0.4, 0.5 and 0.6 hours respectively. Find a least squares estimate of the mean journey speed.

Hint: use a simple one parameter linear model, with journey time as the response (y) variable and journey length as the predictor (x) variable, think about the meaning of the parameter.

The answer given at the back of the book is: $\frac{51}{6.3}\approx8.1$ kilometres per hour.

Question: is that answer correct? It seems to me that it is stated in squared kilometres per hour. Why not $\frac{\sqrt{51}}{6.3}\approx1.13356$ kilometres per hour?

My working:

This is a no intercept linear model because at time zero no distance will have been covered.

$y_i=\beta x_i+\epsilon_i$

Using ordinary least squares regression I can obtain an estimate of $\beta$:


So the model is:


Which means a one kilometre change in $x_i$ results in a 0.1235 time change in $y_i$.

This is where I start to get confused.

The total distance covered by the four cars is $\sum_{i=1}^4{x_i}=13$ kilometres.

The total squared distances covered by the four cars is $\sum_{i=1}^4{x_i^2}=51$ kilometres$^2$.

The total time taken by these four cars is $\sum_{i=1}^4{y_i}=1.6$ hours.

As we are told to use least squares, we should then surly do:

$\frac{\sqrt{51}}{1.6}\approx 4.46$ kilometres per hour

I'm guessing I'm probably wrong would appreciate an explanation :)

EDIT: Made correction based on @Whuber's comment

  • 2
    $\begingroup$ Let's do a reality check: the data reflect journeys with mean speeds of 1 km/0.1 hr = 10 kph, 3 km/0.4 hr = 7.5 kph, 4 km/0.5 hr = 8 kph, and 5 km/0.6 hr = 8.33 kph. This range of speeds from 7.5 to 10 kph shows that an answer of 1.13 kph is grossly wrong and that 8.1 kph is reasonable. Moreover, the total distance is 1+3+4+5=13 km, not 6.3 km, in a period of 0.1+0.4+0.5+0.6=1.6 hours. $\endgroup$ – whuber Jan 13 '13 at 18:59
  • $\begingroup$ @whuber you comment makes sense to me, and 13/1.6 = 8.1 kph so that would be the correct answer and I can see why my answer would be way off. But why in the solution is it 51/6.3? $\endgroup$ – Clair Crossupton Jan 13 '13 at 19:20
  • 2
    $\begingroup$ Where did your last formula come from? You could have stopped after "So the model is," noting that $0.1235$ hr/km is saying the same thing as $1/0.1235 = 8.10$ km/hr. The subtle point here is that this is not a "least squares estimate" of speed: it is a transformed estimate of the reciprocal of speed. A least squares estimate of speed has to be obtained by regressing distance against time, not time against distance. (The answers will be close in this example, but they do differ: you would get $8.08$ kph.) Thus the exercise is misleading (at best). $\endgroup$ – whuber Jan 13 '13 at 19:24
  • $\begingroup$ In writing these comments and seeing your edits, it occurs to me you would benefit from a more careful analysis of the units of measurement. You have given $\sum x_i^2$ as squared kilometers, which is correct. What are the units in $\sum x_i y_i$? What are the units in your last formula that yields $4.46$? (Hint: they are not km/hr.) $\endgroup$ – whuber Jan 13 '13 at 19:28
  • 2
    $\begingroup$ I fully understand now, thanks! I didn't take into account that 6.3 was in units of km-hr. I can see the km unit cancellation that takes place in km^2 / (km-hr) = km/hr, hence there's no reason to take the square root. I think this has been a great lesson in paying closer attention to what the units are. $\endgroup$ – Clair Crossupton Jan 13 '13 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.