Presentation is loading. Please wait.

Presentation is loading. Please wait.

Physics 114: Lecture 12 Mean of Means

Similar presentations


Presentation on theme: "Physics 114: Lecture 12 Mean of Means"— Presentation transcript:

1 Physics 114: Lecture 12 Mean of Means
Averaging of averages? John Federici NJIT Physics Department

2 Physics Cartoons

3 The Goal of Measurement
When we make measurements of a quantity, we are mainly after two things: (1) the value of the quantity (the mean), and (2) a sense of how well we know this value (for which we need the spread of the distribution, or standard deviation). Remember that the goal of measurement is to obtain these two bits of information. The mean is of no use without the standard deviation as well. We have seen that repeated measurement of a quantity can be used to improve the estimate of the mean. Let’s take a closer look at what is going on. HOW do we COMBINE data from REPEATED measurements? Say we create a random set of 100 measurements of a quantity whose parent distribution has a mean of 5 and standard deviation of 1: x = randn(1,100)+5; Create a histogram of that set of measurements: [y z] = hist(x,0:0.5:10); Here, y is the histogram (frequency of points in each bin), and z is the bin centers. Now plot it: plot(z,y,’.’). If you prefer bars, use stairs(z,y).

4 Histogram of “data” >> ylabel('# of occurances')
>> x = randn(1,100)+5; >> [y z] = hist(x,0:0.5:10); >> plot(z,y,'.') >> xlabel('Data Value') >> stairs(z,y)

5 Comparing Measurements
If you make repeated sets of 100 measurements, you will obtain different samples from the parent distribution, whose averages are approximations to the mean of the parent distribution. Let’s make 100 sets of 100 measurements: y = zeros(100,21); % here 21 represents the number of ‘bins’ in histo for i = 1:100; x = randn(1,100)+5; [y(i,:) z] = hist(x,0:0.5:10); end Plotting some of the histograms, for i = 1:16; subplot(4,4,i); stairs(z-0.25,y(i,:)); axis([2,8,0,25]); end Basic structure of “for” loops. For loops can be nested. To programmatically exit the loop, use a break statement. To skip the rest of the instructions in the loop and begin the next iteration, use a continue statement. for index = values statements end

6 Comparing Measurements
you can see that the samples means vary from one set of 100 measurements to another.

7 Comparing Measurements
Now the mean can be determined from the original values (xi): mean(x) or from the histograms themselves: mean(y(100,:).*z)/mean(y(100,:)) Make sure you understand why these two should be the same (nearly), and why they might be slightly different. Approximately, sum over all xi

8 Comparing Measurements
Now the mean can be determined from the original values (xi): mean(x) or from the histograms themselves: mean(y(100,:).*z)/mean(y(100,:)) Make sure you understand why these two should be the same (nearly), and why they might be slightly different. Since we have saved the histograms, let’s print out the means of these 16 sample distributions: for i=1:16; a = mean(y(i,:).*z)/mean(y(i,:)); fprintf('%f\n',a); end Here is one realization of those means. We might surmise that the mean of these means might be a better estimate of the mean of the parent distribution, and we would be right!

9 Distribution of Means Let’s now calculate the 100 means And plot them
a = zeros(1,100); for i=1:100; a(1,i) = mean(y(i,:).*z)/mean(y(i,:)); end And plot them subplot(1,1,1) plot(a,'.') This is the distribution of means. The mean of this distribution is 4.998, clearly very close to the mean of the parent distribution (5)

10 Mean of Means COMBINE data into ONE BIG DATA SET
We can think about this distribution in two different, but equivalent ways. If we simply sum all of the histograms, we obtain a much better estimate of the parent population: COMBINE data into ONE BIG DATA SET mom = sum(y); stairs(z-0.25,mom) mean(mom.*z)/mean(mom) gives: 4.998

11 Mean of Means Alternatively, we can think of these different estimates of the mean of the original population as being drawn from a NEW parent population, one representing the distribution of means. This NEW parent population has a different (smaller) standard deviation than the original parent population. std(a) is

12 We have seen this before!
This should remind you of HW #4 If one were to BLOCK the THz Beam in the transmission measurement, what waveform would you measure?

13 HomeWork #4 Is the noise in the THz transmission measurement statistical? 1 average

14 Does Averaging help? 1 Avg 10 Avg 1 Avg 10 Avg
“Averaging” of 10 traces together into 1 trace is the first “MEAN”. Then when you calculate the histogram of that AVERAGED trace (essentially, the MEAN OF THE MEAN), the distribution function narrows.

15 Calculation of Error in the Mean
Recall in Previous Lectures we introduced the general formula for propagation of errors of a combination of two measurements u and v as: Generalizing further for our case of N measurements of the mean m’, and ignoring correlations between measurements (i.e. setting the cross-terms to zero), we have We can make the assumption that all of the si are equal (this is just saying that the samples are all of equal size and drawn from the same parent population). Also so

16 Calculation of Error in the Mean
This is no surprise, and it says what we already knew, that the error in the mean gets smaller according to the square-root of the number of means averaged. Result from HW#4 Slope=-1/2

17 Calculation of Error in the Mean
This is no surprise, and it says what we already knew, that the error in the mean gets smaller according to the square-root of the number of means averaged. Again, this is the case when all of the errors in the means used are equal. What would we do if, say, some of the means were determined by averaging different numbers of observations instead of 100 each time? In this case, we can do what is called weighting the data. If we know the different values of si, then the weighted average of the data points is Even if we take the SAME number of observations each ‘experiment’, we may STILL want to weight the data…. If measurements were taken on DIFFERENT days, the noise might be different because the experimental conditions might be different.

18 Error in the Weighted Mean
In this case, if we want to combine a number of such weighted means to get the error in the weighted mean, we still have to calculate the propagation of errors: but now the si are not all the same, and also we use the weighted mean to get the gradient of the mean Inserting that into the above equation, we have

19 Relative Uncertainties
In some cases, we do not necessarily know the uncertainties of each measurement, but we do know the relative values of si. That is, we may know that some of our estimates of the mean used 100 measurements, and some used only 25. In that case, we can guess that the latter measurements have errors twice as large (since the standard deviations are proportional to the square-root of the number of measurements). So, say Then In other words, because of the nature of the ratio, the proportionality constant cancels and we need only the relative weights. To get the overall variance in this case, we must appeal to an average variance of the data: So the standard deviation is found using this, as

20 Calculation of Error in the Mean
This is no surprise, and it says what we already knew, that the error in the mean gets smaller according to the square-root of the number of means averaged. Slope=-1/2

21 REMINDER of Limitations of Averaging
Some of the major concepts of HW#4: Averaging will definitely help, but the trade-off is TIME to acquire the data Even if we had enough time (and money to PAY the people making the measurements), some of the experimental conditions MAY CHANGE during experiment – Temperature changes cause materials to expand or contract, changing, for example, optical alignment of mirrors and lenses. Systematic errors CAN NOT be removed even with averaging.

22 Previous Example of Systematic Error
February 12, 2010

23 This Systematic Error is Intermittent
10 Avg 100 Avg Best solution is to FIX the instrumentation to remove Systematic Errors.

24 ‘Non-statistical Fluctuations’
Essentially the point is that MOST experiments do not follow Gaussian distribution beyond 3 or 4 standard deviations. OUTLIER data points which can not be easily explained are an issue. In addition, even if you can ‘average away’ Gaussian distribution of noise, other sources of noise can then become dominate that are not Gaussian-like in behavior. Slope=-1/2 ‘Non-Statistical Fluctuations’

25 ‘Severe’ Outlier Data Points
What is a 'Black Swan‘? A black swan is an event or occurrence that deviates beyond what is normally expected of a situation and is extremely difficult to predict; the term was popularized by Nassim Nicholas Taleb, a finance professor, writer and former Wall Street trader. Black swan events are typically random and are unexpected. (ie. RARE events) For insurance, how do you determine the risk and price of insurance for a HIGHLY unlikely event (tidal wave on coast of NJ) but if it DID happen, the effects would be catastrophic ….

26 Elimination of Data points
The textbook describes Chauvenet’s criteria which essentially says that if an outlier data point occurs with much higher rate than would be expected by statistics, you can discard the data point as a ‘valid’ data point for calculating mean and standard deviation. HOWEVER Bevington textbook

27 In Class exercise Later in the course, we will be processing multiple THz data files to create images. The first step in this progress is to use FOR loops to generate the correct file names. x 0y 0.txt x 1y 0.txt x 2y 0.txt Use nested FOR loops to create the FILE NAMES starting with ‘x 0y 0.txt’ and ending with ‘x 5y 7.txt’ . Printout the names of the files as you create them. HINT: Format integers and the letters as ‘string’ variables.


Download ppt "Physics 114: Lecture 12 Mean of Means"

Similar presentations


Ads by Google