So far as I can tell, affinity has not undergone any changes from 3U to 4U. Therefore, my answer from 3U applies.
From the Monster Hunter Wiki:
Affinity
Affinity is a hunters chance to deal either more or less damage with a weapon attack. It is measured in percentages, and varies based on weapons, armor, and skills. A positive affinity means attacks have that percentage chance to use 125% attack power, while a negative affinity is the chance to use 75% attack power. Some monsters can cause a status condition which lowers affinity temporarily. Note: Affinity doesn't effect element, shelling, crag S or clust S; however, affinity does affect status-inflicting weaponry. While they may both appear under weapon element, they are considered separate in comparison to one another as far as the game coding and mechanics are concerned.
Essentially, it's your chance to land a critical hit. Critical Eye is the skill that increases your affinity, and is gained through the Expert Armor Skill. This will increase your affinity by +10% at the basic level, to +30% at the max.
Note that you can't change the amount of damage you do; Affinity just increases (or decreases) the chance of doing more (or less) damage.
For the most part, affinity doesn't play a huge role in your damage; it's only an extra 25% damage.
+30%: +7.5% damage
+20%: +5%
+10%: +2.5%
-5%: -1.25%
-10%: -2.5%
-15%: -3.75%
The opposite also holds true for negative affinity; at most, you'd be losing 3.75% damage at -15% affinity, from the skill alone.
Weapons do have their own inherent affinty, and can be combined with the skill. This is additive, and can cancel each other out. The most notable affinity weapons are your basic Rustshards; they start with -70% affinity, which means, even then, you're still doing 82.5% of the listed damage.
4U has some extra armor skills that can increase your affinity beyond 30%, but the same calculation is relevant; it's essentially an extra 2.5% overall damage for every 10% affinity you have.
Best Answer
Gaijin Hunter wrote a really in depth guide on how damage is calculated.
The oversimplified result of damage is just: Damage = [Physical damage] + [Elemental Damage] * Overall Defense.
There is also things to take note of when attacking. Weapon power, motion value, and sharpness all play a part in the "Physical" calculations.
"Elemental" calculation is determined by "shown amount" / 10 x resistance.
Overall Defense is everything from the Monster's resistances, The type of quest (caravan, gathering hall, low rank, high rank, G) food bonus, etc.
The numbers you see on the weapons are very much "increased" than what you will actually do. In the example used on the guide (Shagara Charge Blade) has 648 damage and 230 dragon element, but attacking the Shagara's head deals a total of 28 damage once all calculations are done.