# FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www. gnu. org/copyleft/.

Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.

xMy system is 64-bit. If your copy of Windows is 32-bit then your directory structure is likely to be different from

“Ctrl+N” means press the “Ctrl” key and, while holding it down, press “N”.

[3]Astute programmers will note that my own programming leaves much to be desired. Adopting better practices when learning to program would have made doing econometrics much easier.

[4]Alternately, you could click on the open data button on the toolbar. It’s the one that looks like a folder on the far right-hand side.

**[5]** open "@gretldirdatapoeutown. gdt"

[6] ols price const utown —quiet

**[7]** scalar ut = $coeff(const)+$coeff(utown)

[8] scalar other = $coeff(const)

**[9]** printf "nThe average in Utown is %.4f and the average elsewhere is %.4fn",ut, other

1rrhis is probability in the frequency sense. Some authors fuss over the exact interpretation of a confidence interval (unnecessarily I think). You are often given stern warnings not to interpret a confidence interval as containing the unknown parameter with the given probability. However, the frequency definition of probability refers to the long run relative frequency with which some event occurs. If this is what probability is, then saying that a parameter falls within an interval with given probability means that intervals so constructed will contain the parameter that proportion of the time.

[11]You can also get the a level critical values from the console or in a script by issuing the command scalar c critical(t,38,a). Here a is the desired area in the right-tail of the t-distribution.

[12]This is true in Stata as well.

**[13]** open "@gretldirdatapoefood. gdt

[14] ols food_exp const income

[15]Your result may vary a little depending on how many digits are carried out to the right of the decimal.

[16]You can compute this easily using the gretl console by typing in: scalar f = 8013.2941 + (8013.2941/40) + 4.3818*(20-19.6047)**2

[17] open "@gretldirdatapoewa-wheat. gdt"

[18] ols greenough const time

[19] gnuplot greenough time

[20]For small g, ln(1 + g) = g.

[21] series a2 = advert"2

[22] ols sales price advert a2

[23] genr inc_age = income*age

**[24]** open "@gretldirdatapoepizza4.gdt"

**[25]** ols pizza const age income inc_age

[26]To get the gretl value of AIC: scalar aic_g = (1+ln(2*pi)+aic)*N

[27] square advert

**[28]** ols sales const price advert sq_advert

**[29]** scalar sseu = $ess

[31] # f-test

**[32]** open "@gretldirdatapoeandy. gdt"

**[33]** set echo off

[34] scalar unrest_df = $df

**[35]** ols sales const price

[36] scalar sser = $ess

**[37]** scalar Fstat=((sser-sseu)/2)/(sseu/(unrest_df))

**[38]** pvalue F 2 unrest_df Fstat

**[39]** # f-test using omit

**[40]** ols sales const price advert sq_advert

**[41]** omit advert sq_advert

**[43]** # f-test using restrict

[44] ols sales const price advert sq_advert

**[45]** restrict

**[46]** b[3]=0

**[47]** b[4]=0

[48] end restrict

**[50]** # overall f

[51] open "@gretldirdatapoeandy. gdt"

[52] list x2 = x1 kfc roys wendys co_owned

[53] list x1 = const nj d d_nj

[54] list x3 = x2 southj centralj pa1

**[56]** set echo off

[57] open "@gretldirdatapoeutown. gdt"

**[58]** # print first 8 observations

[59] smpl 1 8

**[60]** print price sqft age utown pool fplace —byobs

**[61]** ols food_exp const income —robust

[62] series res = $uhat

**[63]** setinfo res – d "Least Squares Residuals" – n "Residual"

**[64]** gnuplot res income —output=c:Tempolsres

[66] smpl 1986:1 2009:3

[67] ols d_u const g(0 to -2)

**[68]** list x = const inf(-1) d_u(0 to -1)

[69] matrix a = modelsel(inf, x)

[70]I’m still working on a more elegant solution. Stay tuned for future editions to see if I succeed.

[71]This graph was generated from the GUI. The plot command as shown in the script actually yields only the plots of the forecasted values and their intervals.

[72] scalar h = 8

2 matrix mult = zeros(h,2)

3 loop i=1..h

4 mult[i,1] = i-1

5 scalar b0 = $coeff(g)

6 scalar b1 = $coeff(d_u_1)*b0+$coeff(g_1)

[73]This demonstrates an important outcome of the Frisch-Waugh-Lovell Theorem.

[74]Function supplied by gretl guru Riccardo Lucchetti.

[75]This tip provided via the gretl users group by Grzegorz Konat.

[76]POE4 refers to these variables as U and A, respectively.

[77]It was not apparent from the plots of the differenced series that a squared trend was required. However, the squared trend was included in the model because it is statistically significant in each of the ADF regressions.

[78]Actually, the LM statistic for the ADF(1) was insignificant and a separate DF regression also had an insignificant LM statistic, indicating no lags are needed. I made the loop a bit fancier in order to produce the DF statistic by adding a conditional statement for when i=0 as we did earlier in the book.

**[79]** open "@gretldirdatapoereturns. gdt"

[80] scatters nasdaq allords ftse nikkei

[81]Actually, gretl genius Professor ‘Jack’ Lucchetti wrote the function and I’m very grateful!

[82]Your computer must have access to the internet to use this.

[83] b[1,1]-b[2,1]=0

**[84]** restrict "Grunfeld_sur

[85]Not sure why. To be determined.

**[86]** function matrix ame_l(matrix *param, list x)

**[87]** matrix me_matrix = dlogist(¶m, x)*param’

[88] matrix p = lincomb(x, param)

[89] cola <- gretldata

2 cola[1:12,]

3

3 attach(cola)

4 pepsi. price <- price[seq(1,nrow(cola),by=3)]

5 sevenup. price <- price[seq(2,nrow(cola),by=3)]

6 coke. price <- price[seq(3,nrow(cola),by=3)]

8

7 pepsi <- choice[seq(1,nrow(cola),by=3)]

8 sevenup <- 2*choice[seq(2,nrow(cola),by=3)]

[90] coke <- 3*choice[seq(3,nrow(cola),by=3)]

12

[91]Of course, if you decide to use more information in your prior then they can be substantially different.

**[92]** scalar sig_tild = sqrt(sum((y-mean(y))"2)/($nobs))

[93] scalar mu3 = sum((y-mean(y))"3)/($nobs)

**[94]** scalar mu4 = sum((y-mean(y))"4)/($nobs)

[95] scalar skew = mu3/sig_tild"3

**[96]** scalar kurt = mu4/sig_tild"4

**[97]** scalar JB = ($nobs/6)*(skew"2+(kurt-3)"2/4)

[98] pvalue X 2 JB

[99]You can also use =, but it only assigns in one direction-right is assigned to left.

X <- cbind(x1,x2)

## Leave a reply