Two Pokémon of the same species and the same level never have quite the same stats. Three hidden values make the difference: IVs, which are innate, EVs, which are earned in battle, and nature. Mastering them can mean gaining dozens of points in each stat. Here is how, with two calculators to do your math.
These mechanics matter little for finishing the adventure, but a lot for the Battle Frontier, the Battle Tower and battles against friends. The fourth generation also brings a valuable clue: the characteristic, shown in each Pokémon’s summary.
The formulas below are those of Diamond, Pearl and Platinum; they stayed the same in later generations.


