A yellow light (in a traffic light with sequence red-yellow-green) needs to be set based on the usual traffic conditions. If a yellow light is too short then a driver may go through it unintentionally or have to slam on the brakes. If the yellow light is too long then the driver may try to run the light.