# Week 4: Synergy and Randomness

After the integration of compliance into the model of pain, I was informed by Prof Darling that compliance is not as simple as the arithmetic average of its component parts. If we were to draw a comparison to an analysis of variance, we would have determined the main effect of compliance but not the interaction between compliance and the 5 factors. Therefore, a second term was added to the compliance equation: the synergistic term.

The synergy between the 5 factors can be described as a string of interactions (see equation below) divided by a scaling term, in this case 160 to reduce the overall range to 0-1. The Synergistic Term of Compliance

This equation as a whole was then multiplied by the synergistic modifier, which served to blend the effect of synergy into the compliance value. This effect is added on top of the additive effect, as the additive effect is always present in the compliance equation.

After creating a more complete model of compliance, the final step in creating the dynamic model of pain was to introduce an element of randomness into the pain equation. Pain, by its nature, is random. The exact timing and severity of spikes will differ for every person and over time, so the model needed an element of randomness in order to illustrate that point. A JavaScript function known as NORMAL() that takes uniform random numbers from a normal distribution with a defined mean and standard deviation was added into the equation, which produced the desired randomness.