Using gret l for Principles of Econometrics, 4th Edition
Wheat Yield
Figure 4.15 plots the average wheat yield in Greenough Shire over time (in tonnes per hectare- we’re in OZ!) using the data in wa-wheat. gdt. The results from the example in section 4.4 of your textbook is easily produced in gretl. Start by loading the data and estimating the effect of time, time on yield greenough using least squares. The following script will load the data file, estimate the model using least squares, and generate a graph of the actual and fitted values of yield (greenough) from the model.
The resulting plot appears below in Figure 4.15. The fitted line can be added. Right-clicking on
Figure 4.15: The plot of the actual yield in Greenough Shire over time |
the graph brings up a menu of choices. Choose Edit and the plot controls dialog box appears as shown in Figure 4.16. There is a pull-down menu in the box called fitted line from which you can choose to fit a line, a quadratic, or a cubic equation. I chose line and the result appears in the figure. From the lines tab a few of the defaults; the legend for the series is changed to Actual Yield and the line style was changed to line/points. The X-axis tab was used to change the axis label to ‘Year.’
The simple gnuplot command works well enough. However, I took advantage of having declared the dataset structure to be time-series to improve the look. I also added a description and label to be used in the graph using the - d and - n switches for setinfo. The commands are
1 setinfo greenough - d "Wheat yield in tonnes" - n "Yield in tonnes"
2 gnuplot greenough —with-lines —time-series —linear-fit
There are three options listed after the plot. The first (—with-lines) tells gnuplot to connect the points using lines. The second option (—time-series) tells gnuplot that the graph is of time - series. In this case, the dataset’s defined time variable will be used to locate each point’s position on the X-axis. The final option plots the least squares fit of a line. To make the graph look like Figure 4.15 some further manipulation was done using the plot controls.
To explore the behavior of yield further, create a new variable using the series command from t3 = time311,000,000 as shown below. This rescaling of time cubed merely changes the scale of the coefficient by a corresponding amount and has no effect on the shape or fit of the model. It
is particularly useful for long time-series since cubing large integers may exceed your computer's capacity to yield accurate results (i. e., numerical overflow). The new plot appears in Figure 4.17.
1 series t3=time"3/1000000
2 ols greenough const t3
3 gnuplot greenough —with-lines —time-series