## Traditional Average & Variance Computation

Suppose you have the following data: 4, 6, 12, 9 and you want to calculate the simple statistics of average (arithmetic mean) and variance, how do you calculate that?

Average = Variance = Our focus in particular tutorial is for the time average and time variance of the measurement data. Let us use symbols to ease the algebraic manipulation. Symbol denotes the data number -th. The subscript represent the order of the data when it comes out. In our example above, , , and . Notation represents the average while represents variance of the -th data. In symbolic notation, we say that the usual way to compute the time average is (1)

While the time variance is (2)

Now let us consider a case when you have a device to measure something, say number of pedestrians passing through a gate of a subway stations. Every measurement time, for example, every minutes, you get the total number of people who pass through that gate. At each time (i.e. every minutes), you get an additional data and you need to calculate those simple statistics of average and variance of the measurement. How do you calculate them?

Let us use the same data as above for our example. The first measurement, give 4 person passed through the gate. The average is the same as the measurement and there is no variance because we have only single data. The second, third and fourth measurement, give 6, 12 and 9 pedestrians respectively who passed through the gate. The average and variance calculation is shown in the table below.

 Time ( ) Measurement ( ) Average ( ) Variance ( ) 1 2 3 4 So far there is nothing interesting to be discussed about unless if we got so much measurement data. All of sudden, the computation of simple statistics of time average and time-variance become problems .

Experiment with your own input data using the interactive Mean and Variance below. The mean and variance are computed in a traditional way using above formulation. All the data are inputted before the program compute the mean and variance.
To use the program: Type your input data in the box below, separated by comma or space. Only numbers input are accepted. Then click "Compute Mean and Variance" button. Alternatively, click Random Input button repeatedly to create simulated data. To restart with the example data, click "Reset" button. The chart may not work fully if you use Internet Explorer; It is recommended you use FireFox or Google Chrome for better browsing experience.

Preferable reference for this tutorial is

Teknomo, Kardi. (2006) Recursive Average and Variance.
http://people.revoledu.com/kardi/tutorial/RecursiveStatistic/index.html
{"ft_lang_label":"__label__en","ft_lang_prob":0.8534169,"math_prob":0.97180206,"size":2765,"snap":"2021-04-2021-17","text_gpt3_token_len":605,"char_repetition_ratio":0.13871786,"word_repetition_ratio":0.021141648,"special_character_ratio":0.2238698,"punctuation_ratio":0.121031746,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99654496,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60],"im_url_duplicate_count":[null,1,null,1,null,null,null,null,null,1,null,4,null,4,null,4,null,4,null,null,null,6,null,null,null,1,null,2,null,null,null,null,null,null,null,6,null,4,null,1,null,1,null,4,null,1,null,1,null,4,null,1,null,1,null,4,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-25T20:11:40Z\",\"WARC-Record-ID\":\"<urn:uuid:c7143919-de37-4fe9-97cb-49ec6737b49e>\",\"Content-Length\":\"21716\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:74d399c8-343d-4481-9389-c0cc2ad387d5>\",\"WARC-Concurrent-To\":\"<urn:uuid:0bdc05e9-8c3b-4877-9d90-144ea23b99af>\",\"WARC-IP-Address\":\"45.118.133.171\",\"WARC-Target-URI\":\"https://people.revoledu.com/kardi/tutorial/RecursiveStatistic/TimeStastistics.htm\",\"WARC-Payload-Digest\":\"sha1:W6WQJYXZWGRROCHURS7T2SIWHSVBQZQ2\",\"WARC-Block-Digest\":\"sha1:XHF5CWD52SCQOCKBHLZDU6MA5JDLTWQR\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610703644033.96_warc_CC-MAIN-20210125185643-20210125215643-00241.warc.gz\"}"}