Pets try to copy their owners in every way possible, and since they live and grow older as they gain more experience, they also have levels just like heroes. However, whilst hereos increase their levels by gaining more experience, pets increase their levels entirely by growing older.
This is the graph you get if you plot levels against age:
The trend-line passes through the top points for each level (the maximum age to have the level before it increases) and the curve is followed on despite the miscorrelation with higher level points. This is because as age increases, it becomes more approximate as it says 'about *** months' or something similar, so these points can just be used as a rough guideline. The main point is that it conclusively proves that pet levels are decided entirely by age. Now we just need the formula. It seems to be a power curve of some sort.
What do the vertical strips of dots mean then? each 'strip' is the band of ages which a pet must fit into to be that certain level. If pets of ALL ages had been plotted on the graph, the vertical strips would reach the trend line, but most do not since there are missing gaps in the data. However, the fact that some dots (each representing individual pets) are on the same level (ie. have the same age) but have different levels implies that the gradient of the growth curve varies with different species of pets (thus they grow at different rates).
When a pet reaches level 30, a hero can ride on it's back which greatly decreases travel time between milestones.