amaatouq
amaatouq

Reputation: 2337

Standard Deviation of a percentage change in Python

I have 2 data sets. The first data set is called X has a mean value of m(X) and standard deviation of STD(X), the second set of data also has the mean value of m(Y) and standard deviation of STD(Y). I want to find out the the percentage change of data set 2 compared to data set 1 (i.e., change in averages over the old average multiplied by 100). So I have ((m(Y)−m(X))/m(X))∗100.

Now my question is, how do you take into account the standard deviation for this percentage change value (preferably in Python) in order to add it to the plot as error bars ?

Upvotes: 0

Views: 6491

Answers (1)

otus
otus

Reputation: 5732

I don't know if there's a single definition for the quantity you are looking for, but the normal rules for estimating errors are:

  • When adding or subtracting you add the absolute errors.
  • When multiplying or dividing you add the relative errors.

Assuming you follow that, the error in m(Y) - m(X) is std(X) + std(Y), which as a relative error is (std(X) + std(Y)) / (m(Y) - m(X)). Add the relative error in the denominator – std(X) / m(X) – and you have the relative error of the whole. Then multiply by the actual value if you want the error in your percentage.

Some things cancel out and the result is:

 100 * (std(X) + std(Y)) / m(X) + 100 * std(X) / (m(Y) - m(X))

Upvotes: 1

Related Questions