Yuanyang Zhen (mandarin duck formation) is really a masterpiece of General Qi Jiguan (1528 - 1587 CE). If memory serves, he adopted it for a southern tribe (Se zhou?) and he modified it to fit into the Ming army.
Before we get into the YYZ, we need to get an idea of the Ming military main battle creed. Ever since the Yong Le reign, the Ming army adhere to the imperial creed that firearms are post loosely in the lead and calvary densely at the rear. Infantry is posted in the middle as well as with the calvary which also carries firearms with them. Infantry has coverage of chariots (also armed with firearms of various sorts). This is mainly used against enemies of the north. First the troops will form a square formation according to the creed, then volleys after volleys of firearms (cannons, muskets, grenades, etc) and archery will launch into the charging enemy (Mongolians or Jurchens usually). They could do this all day until they worn the enemy down enough. Then they will have the calvary charged at the now broken enemy line(s) with the infantry in support. This is quite brutal back in the days.
But in the southern this battle tactic doesn't quite work especially in rice field, bog and swarmpy areas. So the reliance of firearms becomes less effective because of the demness to the gun powder and the harsh terrains for the horses. Rather infantry, especially those who are trained in he YYZ, becomes more important in battling the pirates.
The YYZ is built according to the age old Yinyang and Wuxing philosophy. For example there is the retangular shield representing the moon and the round shield representing the sun. These two shields formed the character Ming (talk about patriotism). There are 2 Longxi, which is a bamboo weapon. 4 spears, and 2 "short weaponry" (nine teeth hoe, fork, or crugle). There would be a captain with a flag. Basically, this would be 2 units of 5 troops and they would march in a file of 2 line (unlike the western 4 lines colum). This the basic YYZ formation. When they form a battle line of 2 ranks, it would be called San Cai Zhen (3 talents formation). Each weaponry is assigned a specific task and they serve as one unite. The analogy by General Qi is that it would be like the body and its 4 limbs (five limbs). When the body moves every limb moves in unison with the body.