Estimation and likelihood are examples of hypothetical thinking, one of the aspects of statistics that newcomers often find difficult.

The likelihood function

Example: The risk of a car accident

There are conditions that make serious automobile accidents more likely or less likely, but a good starting point in modeling accident risk is to assume a constant risk per mile. The appropriate probability distribution for this situation is the exponential. The parameter for the exponential distribution corresponds to the average mileage until an accident.

Over the past decade, new cars have been introduced that have driving assist features such as collision braking, blind-spot detection, and lane keeping. Suppose your task is to determine from existing experience with these cars what is the average mileage until an accident. For the sake of simplicity, imagine that the “existing experience” takes this form for the 100 cars you are tracking:

95 cars have driven 20K miles without an accident;

5 cars had accidents respectively at 1K, 4K, 8K, 12K, 16K

It’s tempting to compute the average mileage until an accident by totaling the miles driven—this comes out to 1,941,000 miles—and divide by the number of accidents. The result is 388K miles per accident.

Could this result be right? After all, we haven’t observed any car that went 100K miles, let alone 388K.

To gain insight, let’s construct the likelihood function using just one car’s data: the car whose accident occurred at 16K miles. As always, the likelihood function is a function of the parameter; the data are fixed at the observed value.

::: {.column-page-right}

Code

crash_likelihood <-function(m, mileage) {dexp(mileage, rate=1/m) }slice_plot(crash_likelihood(m, mileage=16000) ~ m, bounds(m=1000:250000),npts=1000) +xlab("Average time between accidents (miles)") +ylab("Likelihood") +geom_vline(xintercept=16000, color="red", alpha=0.5)nocrash_likelihood <-function(m, mileage) { (1-pexp(mileage, rate=1/m)) }slice_plot(nocrash_likelihood(m, mileage=16000) ~ m, bounds(m=1000:250000),npts=1000) +xlab("Average time between accidents (miles)") +ylab("") +ylim(0,1) +geom_vline(xintercept=16000, color="red", alpha=0.5)

Likelihood functions when the data involve just a single that travelled 16K miles. The red lines mark 16,000 miles on the horizontal axis.

Note in draft

Approximate confidence interval occurs were the likelihood ratio (compared to the peak) is about 0.147

The likelihood function has a distinct peak at the observed value of the crash mileage.

Now consider an alternative scenario, where the single car has driven 16K miles without any crash. The likelihood function for this scenario has a different shape as shown in

The New York Times report indicates 400 crashes out of 360,000 self-driving cars. Suppose we observe these data for Tesla

95 cars have driven 20K miles without an accident; 5 cars had accidents respectively at 1K, 4K, 8K, 12K, 16K