2010年2月19日 星期五

[遊記] Muir Woods National Monuments



因為薏棻的妹妹們過來這邊
由於他們自助多半都是在城市逛
我們就想說去戶外走走散心也不錯
這時候想起上學期Ellen說這邊有些國家公園不錯
就決定星期六的時候去國家公園走走

上網查了一下發現這個國家公園還滿近的
而且評價也還不錯就決定去了這個Muir Woods 國家公園
當天天氣還不錯,一路上風景也很好
一邊走一邊拍照,心情也開心了起來
每次開學就被行程還有計畫壓的累死了
真的需要轉移一下注意力

還記得在ohio的時候還可以常常照相
不知不覺就可以抒解壓力
這邊一個不小心就弄作業弄不完了...
還是要多照照相才行...這次照相的時候都有一點生疏快門光圈設定了
我們在入口的地方照相
走在步道上,真的有進入森林的感覺
真的很難想像這邊之前原本是沒有樹木的



一開始還一邊走一邊看路線,入口處隨便照了一張
剛好是山谷中陽光從上面照下來的樣子,
感覺有一種老天爺給予的恩澤照下來的感覺(好啦...應該是我想太多了)
還有大大的年輪跟高高的樹木
魔戒裡面的樹人應該就是這樣高大的吧
如果它忽然動起來我應該會很害怕~~
走一走會覺得自己好渺小喔
面對大自然的時候,人類的渺小就自然地顯露了
很多煩惱也因為這樣一趟而散開了許多 (雖然之後趕作業時又回來了)



去一個地方重要的是什麼呢?
當然是gift shop阿~~
到了 gift shop時外面有好幾隻大大的熊...
讓我想到黃金羅盤裡面小孩子騎熊的樣子...嘿嘿嘿
就給他騎上去了~~看起來還有模有樣的



總歸來說,這是個讓人散心的好地方~~
希望新的一年
生活可以不要那麼忙碌
有機會多多散散心走一走~~

[統計] PK formula (Pollaczek–Khinchine formula)

cite: http://en.wikipedia.org/wiki/Pollaczek%E2%80%93Khinchine_formula

PK formula for M/G/1 queue
可以看到只要moment fitted
我們就可以預期得到一樣的 long term waiting time
不過問題是
我們怎麼知道真實世界的moment是怎樣呢?

Pollaczek–Khinchine formula

From Wikipedia, the free encyclopedia

Jump to: navigation, search

The Pollaczek-Khinchine formula is used in queuing theory to determine the mean time spent waiting in the queue to be serviced (the queuing delay) and the mean end-to-end time through the system. The formula is applicable in a single server situation with arrivals distributed according to a Poisson distribution and a general service time distribution. [Known as a M/G/1 system in Kendall's notation.] The formula was developed by Felix Pollaczek and Aleksandr Khinchin.

[edit] Formula

The formula states that the mean queuing delay is given by:
F_q=\frac{1}{\lambda_s}\times \frac{\rho}{1-\rho}\times\frac{1+C_s^2}{2}
The average time in the system, F, is given by:
F=F_q+\frac{1}{\lambda_s}
In the above equations, the variables are defined as:
λs=rate of service
λa=rate of arrival
\rho=\frac{\lambda_a}{\lambda_s}, which is called "traffic intensity," ranges between 0 and 1, and is the mean fraction of time that the server is busy. [If the arrival rate λa is greater than or equal to the service rate λs, the queuing delay becomes infinite.]
Cs is the coefficient of variation of the service time (the ratio of its standard deviation to its mean). This equals σsλs, where σs is the standard deviation of the service time, as the mean service time is 1/λs. Cs = 0 when service times are constant, and Cs = 1 when service times follow an Exponential distribution.

[edit] Examples

If ρ equals 0.5, that is the server is busy 50% of the time, and Cs = 1, then
F_q=\frac{1}{\lambda_s}\times \frac{\rho}{1-\rho}\times\frac{1+C_s^2}{2}
F_q=\frac{1}{\lambda_s}\times \frac{0.5}{0.5}\times\frac{1+1}{2}
F_q=\frac{1}{\lambda_s}
That is, when the server is busy only half the time, the mean queuing time equals the mean service time. That may help explain the long wait at the post office!

As ρ increases, the mean queuing time increases rapidly. If the server is 90% utilized, then the mean queuing delay is nine times the mean service time.

Note that, if the service time is always the same (Cs = 0), then the mean queuing delay is half what it would be if the service time were exponentially distributed (Cs = 1).

[統計] Beta distribution

Beta distribution是最常用的一個分配
我們看到的一般是
General beta (α,β,min, max)
前面兩個是shape parameters 後面兩個是 range parameters

其他相關的可以參考wiki連結
http://en.wikipedia.org/wiki/Beta_distribution

[轉錄] Histogram 製作方法

實用參考連結。

Creating a Histogram in Excel

Sales Forecast Example - Part III

In Part II of this Monte Carlo Simulation example, we completed the actual simulation. (If you haven't already, Download the example spreadsheet). We ended up with a column of 5000 possible values (observations) for our single response variable, profit. The last step is to analyze the results. We will start off by creating a histogram in Excel, a graphical method for visualizing the results.

We can glean a lot of information from this histogram:

  • It looks like profit will be positive, most of the time.
  • The uncertainty is quite large, varying between -1000 to 3400.
  • The distribution does not look like a perfect Normal distribution.
  • There doesn't appear to be outliers, truncation, multiple modes, etc.

The histogram tells a good story, but in many cases, we want to estimate the probability of being below or above some value, or between a set of specification limits.

Creating a Histogram in Excel

Method 1: Using the Histogram Tool in the Analysis Tool-Pak.

This is probably the easiest method, but you have to re-run the tool each to you do a new simulation. AND, you still need to create an array of bins (which will be discussed below).

Method 2: Using the FREQUENCY function in Excel.

This is the method used in the spreadsheet for the sales forecast example. One of the reasons I like this method is that you can make the histogram dynamic, meaning that every time you re-run the MC simulation, the chart will automatically update. This is how you do it:

Step 1: Create an array of bins

The figure below shows how to easily create a dynamic array of bins. This is a basic technique for creating an array of N evenly spaced numbers.

To create the dynamic array, enter the following formulas:
B6 = $B$2
B7 = B6+($B$3-$B$2)/5
Then, copy cell B7 down to B11

Array of Bins in Excel
Figure 2: A dynamic array of 5 bins.

After you create the array of bins, you can go ahead and use the Histogram tool, or you can proceed with the next step.

Step 2: Use Excel's FREQUENCY formula

The next figure is a screen shot from the example Monte Carlo simulation. I'm not going to explain the FREQUENCY function in detail since you can look it up in the Excel's help file. But, one thing to remember is that it is an array function, and after you enter the formula, you will need to press Ctrl+Shift+Enter. Note that the simulation results (Profit) are in column G and there are 5000 data points ( Points: J5=COUNT(G:G) ).

The Formula for the Count column:
FREQUENCY(data_array,bins_array)

a) Select cells J8:J48
b) Enter the array formula: {=FREQUENCY(G:G,I8:I48)}
c) Press Ctrl+Shift+Enter

Layout for Creating a Scaled Histogram
Figure 3: Layout in Excel for Creating a Dynamic Scaled Histogram.

Creating a Scaled Histogram

If you want to compare your histogram with a probability distribution, you will need to scale the histogram so that the area under the curve is equal to 1 (one of the properties of probability distributions). Histograms normally include the count of the data points that fall into each bin on the y-axis, but after scaling, the y-axis will be the frequency (a not-so-easy-to-interpret number that in all practicality you can just not worry about). The frequency doesn't represent probability!

To scale the histogram, use the following method:
Scaled = (Count/Points) / (BinSize)

a) K8 = (J8/$J$5)/($I$9-$I$8)
b) Copy cell K8 down to K48
c) Press F9 to force a recalculation (may take a while)

Step 3: Create the Histogram Chart

Bar Chart, Line Chart, or Area Chart:

To create the histogram, just create a bar chart using the Bins column for the Labels and the Count or Scaled column as the Values. Tip: To reduce the spacing between the bars, right-click on the bars and select "Format Data Series...". Then go to the Options tab and reduce the Gap. Figure 1 above was created this way.

A More Flexible Histogram Chart

One of the problems with using bar charts and area charts is that the numbers on the x-axis is actually just labels. This can make it very difficult to overlay data that uses a different number of points or to show the proper scale when bins are not all the same size. However, you CAN use a scatter plot to create a histogram. After creating a line using the Bins column for the X Values and Count or Scaled column for the Y Values, add Y Error Bars to the line that extend down to the x-axis (by setting the Percentage to 100%). You can right-click on these error bars to change the line widths, color, etc.

Histogram Via Error Bars