TF ErrorAna StatInference
Statistical Inference
Frequentist -vs- Bayesian Inference
When it comes to testing a hypothesis, there are two dominant philosophies known as a Frequentist or a Bayesian perspective.
The dominant discussion for this class will be from the Frequentist perspective.
frequentist statistical inference
- Statistical inference is made using a null-hypothesis test; that is, ones that answer the question Assuming that the null hypothesis is true, what is the probability of observing a value for the test statistic that is at least as extreme as the value that was actually observed?
The relative frequency of occurrence of an event, in a number of repetitions of the experiment, is a measure of the probability of that event.
Thus, if nt is the total number of trials and nx is the number of trials where the event x occurred, the probability P(x) of the event occurring will be approximated by the relative frequency as follows:
Bayesian inference.
- Statistical inference is made by using evidence or observations to update or to newly infer the probability that a hypothesis may be true. The name "Bayesian" comes from the frequent use of Bayes' theorem in the inference process.
Bayes' theorem relates the conditional probability|conditional and marginal probability|marginal probabilities of events A and B, where B has a non-vanishing probability:
- .
Each term in Bayes' theorem has a conventional name:
- P(A) is the prior probability or marginal probability of A. It is "prior" in the sense that it does not take into account any information about B.
- P(B) is the prior or marginal probability of B, and acts as a normalizing constant.
- P(A|B) is the conditional probability of A, given B. It is also called the posterior probability because it is derived from or depends upon the specified value of B.
- P(B|A) is the conditional probability of B given A.
Bayes' theorem in this form gives a mathematical representation of how the conditional probabability of event A given B is related to the converse conditional probabablity of B given A.
Example
Suppose there is a school having 60% boys and 40% girls as students.
The female students wear trousers or skirts in equal numbers; the boys all wear trousers.
An observer sees a (random) student from a distance; all the observer can see is that this student is wearing trousers.
What is the probability this student is a girl?
The correct answer can be computed using Bayes' theorem.
- probability that the student observed is a girl = 0.4
- probability that the student observed is wearing trousers = 60+20/100 = 0.8
- probability the student is wearing trousers given that the student is a girl
- probability the student is a girl given that the student is wearing trousers
Method of Maximum Likelihood
- The principle of maximum likelihood is the cornerstone of Frequentist based hypothesis testing and may be written as
- The best estimate for the mean and standard deviation of the parent population is obtained when the observed set of values are the most likely to occur;ie: the probability of the observing is a maximum.
Least Squares Fit to a Line
Applying the Method of Maximum Likelihood
Our object is to find the best straight line fit for an expected linear relationship between dependent variate
and independent variate .
If we let represent the "true" linear relationship between independent variate and dependent variate such that
Then the Probability of observing the value
with a standard deviation is given byassuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.
If you repeat the experiment
times then the probability of deducing the values and from the data can be expressed as the joint probability of finding values for each- = Max
The maximum probability will result in the best values for
andThis means
- = Min
The min for
occurs when the function is a minimum for both parameters A & B : ie- If
- All variances are the same (weighted fits don't make this assumption)
Then
or
The above equations represent a set of simultaneous of 2 equations and 2 unknowns which can be solved.
The Method of Determinants
for the matrix problem:
the above can be written as
solving for
assuming is knownor
- similarly
Solutions exist as long as
Apply the method of determinant for the maximum likelihood problem above
If the uncertainty in all the measurements is not the same then we need to insert back into the system of equations.
Uncertainty in the Linear Fit parameters
As always the uncertainty is determined by the Taylor expansion in quadrature such that
- = error in parameter P: here covariance has been assumed to be zero
By definition of variance
- : there are 2 parameters and N data points which translate to (N-2) degrees of freedom.
The least square fit ( assuming equal ) has the following solution for the parameters A & B as
uncertainty in A
- only the term survives
Let
- : Assume
- Both sums are over the number of observations
If we redefine our origin in the linear plot so the line is centered a x=0 then
or
- Note
- The parameter A is the y-intercept so it makes some intuitive sense that the error in the Y -intercept would be dominated by the statistical error in Y
uncertainty in B
- assuming
Linear Fit with error
From above we know that if each independent measurement has a different error
then the fit parameters are given by
Weighted Error in A
Let
- Compare with the unweighted error
Weighted Error in B
Correlation Probability
Once the Linear Fit has been performed, the next step will be to determine a probability that the Fit is actually describing the data.
The Correlation Probability (R) is one method used to try and determine this probability.
This method evaluates the "slope" parameter to determine if there is a correlation between the dependent and independent variables , x and y.
The liner fit above was done to minimize \chi^2 for the following model
What if we turn this equation around such that
If there is no correlation between
and thenIf there is complete correlation between
and then
- and
- and
So one can define a metric BB^{\prime} which has the natural range between 0 and 1 such that
since
and one can show that
Thus
- Note
- The correlation coefficient (R) CAN'T be used to indicate the degree of correlation. The probability distribution can be derived from a 2-D gaussian but knowledge of the correlation coefficient of the parent population is required to evaluate R of the sample distribution.
Instead one assumes a correlation of
in the parent distribution and then compares the sample value of with what you would get if there were no correlation.The smaller
is the more likely that the data are correlated and that the linear fit is correct.
= Probability that any random sample of UNCORRELATED data would yield the correlation coefficient
where
(ROOT::Math::tgamma(double x) )
- = number of degrees of freedom = Number of data points - Number of parameters in fit function
Derived in "Pugh and Winslow, The Analysis of Physical Measurement, Addison-Wesley Publishing, 1966."
Least Squares fit to a Polynomial
Let's assume we wish to now fit a polynomial instead of a straight line to the data.
- a function which does not depend on
Then the Probability of observing the value
with a standard deviation is given byassuming an experiment done with sufficiently high statistics that it may be represented by a Gaussian parent distribution.
If you repeat the experiment
times then the probability of deducing the values from the data can be expressed as the joint probability of finding values for each
Once again the probability is maximized when the numerator of the exponential is a minimum
Let
where
= number of data points and = order of polynomial used to fit the data.The minimum in
is found by setting the partial derivate with respect tot he fit parameters to zero
You now have a system of coupled equations for the parameters with each equation summing over the measurements.
The first equation
looks like thisYou could use the method of determinants as we did to find the parameters
for a linear fit but it is more convenient to use matrices in a technique referred to as regression analysisRegression Analysis
The parameters
in the previous section are linear parameters to a general function which may be a polynomial.The system of equations is composed of
equations where the equation is given as
may be represented in matrix form as
where
or in matrix form
- = a row matrix of order
- = a row matrix of the parameters
- = a matrix
- the object if to find the parameters
- To find just invert the matrix
- Thus if you invert the matrix you find and as a result the parameters .
Matrix inversion
The first thing to note is that for the inverse of a matrix
to exist its determinant can not be zero
The inverse of a matrix is defined such that
If we divide both sides by the matrix
then we haveThe above ratio of the unity matrix to matrix
is always equal to as long as both the numerator and denominator are multiplied by the same constant factor.If we do such operations we can transform the ratio such that the denominator has the unity matrix and then the numerator will have the inverse matrix.
This is the principle of Gauss-Jordan Elimination.
Gauss-Jordan Elimination
If Gauss–Jordan elimination is applied on a square matrix, it can be used to calculate the inverse matrix. This can be done by augmenting the square matrix with the identity matrix of the same dimensions, and through the following matrix operations:
If the original square matrix,
, is given by the following expression:Then, after augmenting by the identity, the following is obtained:
By performing elementary row operations on the
matrix until it reaches reduced row echelon form, the following is the final result:The matrix augmentation can now be undone, which gives the following:
or
A matrix is non-singular (meaning that it has an inverse matrix) if and only if the identity matrix can be obtained using only elementary row operations.
Error Matrix
As always the uncertainty is determined by the Taylor expansion in quadrature such that
- = error in parameter P: here covariance has been assumed to be zero
Where the definition of variance
- : there are parameters and data points which translate to degrees of freedom.
Applying this for the parameter
indicates that- But what if there are covariances?
In that case the following general expression applies
- ?
where
- = a row matrix of the parameters
- = a row matrix of order
- = a matrix
- :only one in the sum over survives the derivative
similarly
substituting
A
term appears on the top and bottom.- Move the outer most sum to the inside
where
- = the element of the unity matrix = 1
- Note
- : the matrix is symmetric.
- = Covariance/Error matrix element
The inverse matrix tells you the variance and covariance for the calculation of the total error.
- Remember
- = error in the parameters
- = error in the model's prediction
- If Y is a power series in x
Chi-Square Distribution
The above tools allow you to perform a least squares fit to data using high order polynomials.
- The question though is how high in order should you go? (ie; when should you stop adding parameters to the fit?)
One argument is that you should stop increasing the number of parameters if they don't change much. The parameters, using the above techniques, are correlated such that when you add another order to the fit all the parameters have the potential to change in value. If their change is miniscule then you can ague that adding higher orders to the fit does not change the fit. There are techniu
A quantitative way to express the above uses the
value of the fit. The above technique seeks to minimize . So if you add higher orders and more parameters but the value does not change appreciably, you could argue that the fit is a good as you can make it with the given function.Derivation
If you assume a series of measurements have a Gaussian parent distribution
Then
- = probability of measureing the value from a Gaussian distribution with s sample mean from a parent distribution of with
Go Back Forest_Error_Analysis_for_the_Physical_Sciences#Statistical_inference