Jump to content

File:BAC driving risk.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file(SVG file, nominally 614 × 461 pixels, file size: 15 KB)

Summary

Description
English: Curve describing the increased relative risk for a traffic crash with elevated blood alcohol content. Based on data from Figure 1 / Table 3 of Blomberg, Richard D.; Peck, Raymond C.; Moskowitz, Herbert; Burns, Marcelline; Fiorentino, Dary (August 2009). "The Long Beach/Fort Lauderdale relative risk study". Journal of Safety Research. 40 (4): 285–292. doi:10.1016/j.jsr.2009.07.002. PMID 19778652.
Date
Source Own work
Author Mathnerd314159
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with Matplotlib.
Source code
InfoField

Python code

import numpy as np
import matplotlib.pyplot as plt
from numpy.polynomial.polynomial import Polynomial

points = [
  (0,1),
  (0.01,1.03),
  (0.02,1.03),
  (0.03,1.06),
  (0.04,1.18),
  (0.05,1.38),
  (0.06,1.63),
  (0.07,2.09),
  (0.08,2.69),
  (0.09,3.54),
  (0.1,4.79),
  (0.11,6.41),
  (0.12,8.9),
  (0.13,12.06),
  (0.14,16.36),
  (0.15,22.1),
  (0.16,29.48),
  (0.17,39.05),
  (0.18,50.99),
  (0.19,65.32),
  (0.2,81.79),
  (0.21,99.78),
  (0.22,117.72),
  (0.23,134.26),
  (0.24,146.9),
  (0.25,153.68)]
x = np.array([point[0] for point in points])
y = np.array([point[1] for point in points])

spl = Polynomial.fit(x, y, 16) # highest order without ringing
roots_arr = [0,0.10]
for n in range(1,5):
  dspl = spl.deriv(n)
  roots = dspl.roots()
  for r in roots:
    if isinstance(r,complex):
      if abs(r.imag) > 0.001:
        continue
      r = r.real
    if not (0.11 < r < 0.25):
      continue
    r = round(r, 2)
    if r == 0.24:
      continue
    roots_arr.append(r)
roots = np.array(roots_arr)

x_fine = np.linspace(0, 0.25, 1000)
y_fine = spl(x_fine)

# check fit
if False:
  y_spl_err = spl(x)-y
  plt.plot(x,y_spl_err,'.')
  plt.show()
  plt.plot(x_fine,y_fine,'-',x,y,'.')
  plt.show()

roots_y = spl(roots)
plt.plot(x_fine,y_fine,'-',roots,roots_y,'o')
plt.grid(False)
plt.axis('off')
for i in range(len(roots)):
    plt.annotate(f'{roots_y[i]:.0f}x @ {roots[i]:.2f}%', (roots[i], roots_y[i]), textcoords="offset points", xytext=(0,10), ha='right')
plt.savefig('BAC_driving_risk.svg')
plt.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Captions

Curve describing the increased relative risk for a traffic crash with elevated blood alcohol content.

Items portrayed in this file

depicts

19 July 2024

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current03:58, 20 July 2024Thumbnail for version as of 03:58, 20 July 2024614 × 461 (15 KB)Mathnerd314159Uploaded own work with UploadWizard
The following pages on the English Wikipedia use this file (pages on other projects are not listed):

Metadata