**The stats themselves don't change**

...but the *effective* stats will.

Though in the game-world, the animal **becomes** its larger self, with all that implies, the mechanical truth is you don't **replace** the stats with those of the new form, only **add modifiers** appropriate to it.

The flavor text along each step of the way describes in-fiction reality, but we'll have to go through a bit of a process to find the mechanical "how-to", rather than just flavor text.

---

The mechanical description of *polymorph any object* states that:

> This spell functions like *greater polymorph*, except that it changes one object or creature into another.

So, the spell exclusively changes objects and creatures into those of different types, and offers absolutely no mechanical description of what that looks like, until we get to what's almost a footnote in  PFSRD:

> This spell can also be used to duplicate the effects of *baleful polymorph*, *greater polymorph*, ...

To be clear this spell provides no unique mechanics for changing and animal into another form, aside from its duration table - the details of transformation are left to those other spells listed.  The mechanical effects of this particular transformation would be handled under the rules of *greater polymorph*, as the only one that could actually do what you describe.

---

[Greater Polymorph][1] further redirects you:

> If you use this spell to cause the target to take on the form of an animal or magical beast, it functions as *beast shape IV*.

---

So among other steps in [*beast shape IV*][2]'s transformation process, we finally get to the stat effects:

> *Huge Animal* - If the form you take is that of a Huge animal, you gain a +6 size bonus to your Strength, a -4 penalty to your Dexterity, and a +6 natural armor bonus.

---

Last thing to take into account, and it's up for interpretation, is just what *beast form* modifiers are already applied to your creature intrinsically.

The wording of the *beast form* spell seems to assume the target is a Medium, humanoid race (like any PC), and thus offers non-size-related bonuses for turning from that into a Medium animal:

> *Medium animal*: If the form you take is that of a Medium animal, you gain a +2 size bonus to your Strength and a +2 natural armor bonus.

It makes little sense and would be redundant for a Medium Allosaurus to gain these benefits if it were to simply be changed into the form it already occupies - Medium Allosaurus.  Similarly, once it has grown at level 7 to become a Large creature, it makes little sense for it to gain the benefits of being Large, in addition to those of being changed into a Huge animal.

Were I GMing your game, both of these bonuses would be assumed as built into the Allosaurus stat block, and so would be subtracted from the modifers for *Huge Animal*.

This would leave you, prior to level 7, with the following adjustments to your stat-sheet:

* +4 natural armor (+6 for *Huge Animal*, -2 for already having *Medium Animal*)
* +4 Strength bonus (same calculation, +6 -2)
* -4 Dexterity penalty (-4 for going to Huge size category, there being no bonus or malus listed for *Medium Animal*)

At 7th level, when your companion grows to Large size, apply the modifiers listed on its [animal companion entry][3] before applying these:

 * +2 natural armor (+6 for *Huge Animal*, -4 for already having *Large Animal*)
 * +2 Strength bonus (same calculation, +6 -4)
 * -2 Dexterity Penalty (-4 for going to Huge size category, +2 because that's already counted under Large)

Entirely subjective:

Note that instead of what I'd call the pure "size-related" strength bonus of +2 when your companion grows, it gains +8 Strength at level 7.  The difference of 6 I would count as natural changes, and thus not subtract it from your *Huge Animal* Strength modifier, which leaves you with the one outlined above.

  [1]: http://www.d20pfsrd.com/magic/all-spells/p/polymorph/
  [2]: http://www.d20pfsrd.com/magic/all-spells/b/beast-shape/
  [3]: http://www.d20pfsrd.com/classes/core-classes/druid/animal-companions/#TOC-Allosaurus