24
Dec 15

Creating frequency table and histogram and using Excel macros - Exercise 2.3

Creating frequency table and histogram and using Excel macros.

Most of Exercise 2.3 you have to do by hand. I use this opportunity to show how to use Excel macros to automate repetitive tasks.

Simulation steps

  1. Simulate the coin 10 times
  2. The sum of the simulated values gives the binomial variable with 10 repetitions.
  3. We need to record 20 observations on the binomial. For this, we put references to the cell, containing the binomial, to 20 cells.
  4. Next we want to convert references to numbers. Doing this by hand would be tedious, so I show how to use macros to repeat the same operation 20 times.

There are two ways to create macros.

One is by telling Excel to record your actions on the screen; then it remains to execute the created macro the necessary number of times. Anybody can do this.

Another, more complex and versatile, way is by programming in Visual Basic. This second way is so powerful that financial analysts use it for creating automated trading strategies. I learnt everything I know about Visual Basic from Office Help. Unfortunately, Microsoft decided to move the most part of Office Help, including all examples, to the Office site. One of their arguments is that chm files used for Office Help are not secure. However, you can still find and download them to use offline. For example, the help file for Excel is "Excel 2013 Developer Documentation.chm"

Ex_2.3_Frame

Creating frequency table and histogram - click to view video

2 Responses for "Creating frequency table and histogram and using Excel macros - Exercise 2.3"

  1. […] except that the observations are put in the order of decreasing frequencies. Recall that on the histogram we put frequencies against values of the variable, so on the Pareto chart we additionally move more […]

  2. […] don't know that all simulation can be done in Excel. See examples: Exercise 2.1, Exercise 2.2, Exercise 2.3, Exercise 2.4, Example 2.2, and this post about active learning. Even the law of large numbers […]

Leave a Reply

You must be logged in to post a comment.