5/19/2011 Quote of the Day

I am going to start posting quotes that I like to my blog. I have been recording quotes that I like for a few years. I will continue to update my list, and use it as a source for quotes to post. A great source for quotes is Bartlett’s Familiar Quotations.

Today’s quote is from Doron Zeilberger.

Whenever I want to learn a new subject, I announce a graduate course in it, since the best way to learn is by teaching. But even better than teaching humans is teaching computers, i.e. program! Since computers will not let you wave your hands and wing it.

Opinion 37 [April 15, 1999]

Also from the same source is the following quote.

In order to understand something really deeply, you should program it.

Opinion 37 [April 15, 1999]

I have never taught a course, so I cannot fully relate to his experience of learning by teaching. However, my unfamiliarity with teaching is one of the reasons that I think that programming is a great way to learn something. While teaching a course requires students, a classroom, a lesson plan, and other constraints, “teaching computers” only requires a computer and a programming language.


Installing Your Own Personal WeBWork Server, Part IV

Part IPart IIPart III | Part IV

This series of posts covers the installation of WeBWork. This post, Part IV of the series, will cover how to configure your WeBWork server so that you can access the 20,000 freely available problems.

… Continued from Part III

The last post of this series, Part III, concluded with an image showing the virtual machine and the WeBWork site loaded on my computer. Let’s pick up where we left off, by loading the virtual machine and pointing our browser to http://localhost:14627/webwork2. It is not necessary to log in to the wwadmin account on the Ubuntu machine, as Apache will serve the web pages without logging in. However, it is necessary that the virtual machine is turned on. The window can be minimized to free desktop space. I should mention at this point that I logged into the wwadmin account a few days ago and updated the machine’s software using Ubuntu’s update manager. I am not exactly sure why, but this caused problems with the WeBWork installation (i.e., I received errors when trying to use the site), so I reverted to an earlier snapshot of the virtual machine. I wanted to mention this in case you were considering upgrading the software. An upgrade of the WeBWork software would possibly solve the issues that I was having, but I have not tried this yet.


Predicting Y When the Dependent Variable is a Transformation of Y

I am going to try to start posting more frequently. This post covers topics that I’ve been thinking about lately, including model estimation with ordinary least squares (OLS) and forecasting when OLS is used to fit a statistical model with a dependent variable that is a transformation of some variable we wish to forecast.

Suppose we run a regression with the following specification:


Let’s assume that the error term is distributed normally, and let’s use OLS to solve for the coefficients in the model. Using a superscript to denote the m observations in the dataset, our m-by-n+1 design matrix \mathbf{X} is

\left[\begin{array}{ccccc} 1 & X_{1}^{(1)} & X_{2}^{(1)} & \cdots & X_{n}^{(1)}\\ 1 & X_{1}^{(2)} & X_{2}^{(2)} & \cdots & X_{n}^{(2)}\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 1 & X_{1}^{(m)} & X_{2}^{(m)} & \cdots & X_{n}^{(m)}\end{array}\right]

If the coefficient vector is labeled \overrightarrow{\beta} and the vector containing the Y variable’s values is labeled \overrightarrow{y}, then the OLS estimation for the coefficients can be calculated by solving \mathbf{X}^{\top}\mathbf{X}\overrightarrow{\beta}=\mathbf{X}^{\top}\overrightarrow{y} for \overrightarrow{\beta}.


Now we have a set of coefficients that we can use to predict values of Y when we receive additional observations that have values for our independent variables X1, X2, …, Xn, and no observed values of Y. Everything is fine.


Probability Distributions Reference Table

Table Description

I have uploaded a reference table that I created with common probability distributions. Although the same formulas and similar descriptions can be obtained on Wikipedia, I find it useful to have the information contained on one table. The table does not have charts that plot probability density or probability mass functions (PDFs and PMFs) or cumulative distribution functions (CDFs). These charts can be found on Wikipedia or plotted with graphing software using the equations on the table. I find it helpful to look at PDF and CDF plots when learning about the distributions. There might be some closed form CDFs, moment generating functions, or other equations that I omitted from the table. Also, some distributions have various formulations. For example, the four distributions defined below are all very similar, and I imagine that each might be referred to as a negative binomial, although certain specifications are more conventional than others.

  1. A distribution of the number of failures in a sequence of Bernoulli trials, before a specified number of successes.
  2. A distribution of the number of successes in a sequence of Bernoulli trials, before a specified number of failures.
  3. A distribution of the number of successes and failures in a sequence of Bernoulli trials, until a specified number of successes.
  4. A distribution of the number of successes and failures in a sequence of Bernoulli trials, until a specified number of failures.

In cases where there are multiple ways to define a distribution, I either used the definition that I prefer, or gave multiple formulations of the distribution. I am including a link to both a PDF of the table and an Excel file that has the table and a VBA macro that centers images across a column or multiple columns. Also included is a link to the MathML markup file that was used to generate the equations on the table. Excel’s equation editor was giving me problems, and I did not want to type \LaTeX code manually, so I searched for a what you see is what you get (WYSIWYG) equation editor on the internet. I ended up finding an open source project, Formulator MathML Editor (, which I think is great. After getting started, I also found a \LaTeX editor, LyX (, which probably would have worked just as well, with the advantage that I’m more familiar with \LaTeX than MathML. I have spotted and corrected a few errors that I made when creating the table (e.g., I originally had the continuous uniform distribution’s variance equal to \frac{1}{12}\left(b+a\right)^{2}, which was corrected to \frac{1}{12}\left(b-a\right)^{2}), but there still may be some errors. Please let me know if you find any.


PDF: Probability-Distributions.pdf
Excel: Probability-Distributions.xlsm
MathML: Distribution-Formulas.mml


Installing Your Own Personal WeBWork Server, Part III

Part IPart II | Part III | Part IV

This series of posts covers the installation of WeBWork. This post, Part III of the series, has instructions for installing Ubuntu and WeBWork within VirtualBox.

Creating a New Virtual Machine

The first step requires the configuration of a new virtual machine in VirtualBox. This new virtual machine will be used to install a copy of Ubuntu with WeBWork. To configure a new virtual machine, you must click New from the VirtualBox Manager. The images below show the progression of steps and my selected settings when configuring a new virtual machine. Please customize these settings according to your preferences and system. For example, if you are using a 32-bit system, please make sure to select Ubuntu (32 bit) when prompted, as opposed to the 64-bit option that I selected.