How do you calculate aerobic and anaerobic heart rates?
The classic DIY method is the Conconi test which requires you to be able to measure your power output and your heart rate, slowly increasing your power over time. E.g. starting at a very low level, you increase your output by a set amount every minute until you can no longer do it. At each stage you take your average heart rate. Then when you have the data, plot them on a graph, time along the bottom, heart rate on the y. 

For this you'd need to be in a relatively sterile environment - it's not something you could easily or accurately do on the road. A turbo trainer is perfect, incrementing your output in watts or speed. 

What you should see is that your curve will slowly grow with a reasonably consistent gradient, but there'll be a point where it takes over and climbs much more steeply. That's your anaerobic threshold. 

It will be quite vague, but it'll be accurate to within a few beats - certainly enough to be able to set your next training outing a few beats below it for your threshold session.

For more specific results, you'll need to do some lactic acid testing ...