Another factor is method of measuring. Most digital measurements (Strava, many on board computers, etc) measure "moving time" as noted in [MENTION=413198]prj71[/MENTION]'s graphic above. Thus, your average speed is limited to only those times you're actually moving. Others may measure average speed in total, including stops.
Say you left your house at 9:00 and rode 10 miles in 30 minutes. Then you stopped to take a rest for 30 minutes. Then you rode 10 miles back home in 30 minutes, and got home at 90 minutes later at 10:30. Your moving average speed would be 20 mph (20 miles rode in 60 minutes' time). Your total average speed would be 13.3 mph (20 miles rode in 90 minutes' time).
This is especially relevant if you stop for water or snacks along a longer ride. Three of us on this forum recently rode 30 miles on the C&O canal towpath. I think it took us well over 3 hours. Our total average speed was under 10 mph. But we stopped along the way to chat, use the potty, look at our bikes, take a picture of the water fall, etc. Our moving average speed was somewhere in the 12-14 mph range, as that's the pace we rode when we were moving.