Using gret l for Principles of Econometrics, 4th Edition

Interval Estimation and Hypothesis Testing

In this chapter, I will discuss how to generate confidence intervals and test hypotheses using gretl. Gretl includes several handy utilities that will help you obtain critical values and p-values from several important probability distributions. As usual, you can use the dialog boxes or hansl - gretl’s programming language - to do this.

3.1 Confidence Intervals

It is important to know how precise your knowledge of the parameters is. One way of doing this is to look at the least squares parameter estimate along with a measure of its precision, i. e., its estimated standard error. The confidence interval serves a similar purpose, though it is much more straightforward to interpret because it gives you upper and lower bounds between which the unknown parameter will lie with a given probability.[10]

In gretl you can obtain confidence intervals either through a dialog or by manually building them using saved regression results. In the ‘manual’ method one can use the genr or scalar commands to generate upper and lower bounds based on regression results that are saved in gretl’s memory, letting gretl do the arithmetic. You can either look up the appropriate critical value from a table or use the gretl’s critical function. Both are demonstrated below.

Consider the equation of a confidence interval from POE4

P[bk - tcse(bk) < вк < bk + tcse(bk)] = 1 - a (3.1)

Recall that bk is the least squares estimator of вк, and that se(bk) is its estimated standard error. The constant tc is the a/2 critical value from the t-distribution and a is the total desired probability associated with the “rejection” area (the area outside of the confidence interval).

You’ll need to know the critical value tc, which can be obtained from a statistical table, the Tools>Statistical tables dialog contained in the program, or using the gretl command critical. First, try using the dialog box shown in Figure 3.1. Pick the tab for the t distribution and tell gretl how much weight to put into the right-tail of the probability distribution and how many degrees of freedom your t-statistic has, in our case, 38. Once you do, click on OK. You’ll get the result shown in Figure 3.2. It shows that for the t(38) with a/2 right-tail probability of 0.025 and a = 0.05, the critical value is 2.02439.[11] Then generate the lower and upper bounds (using

image066

Figure 3.1: Obtaining critical values using the Tools>Statistical tables dialog box.

image067

Figure 3.2: The critical value obtained from Tools>Statistical tables dialog box. the gretl console) with the commands:

1 open "@gretldirdatapoefood. gdt"

2 ols food_exp const income

3 scalar lb = $coeff(income) - 2.024 * $stderr(income)

4 scalar ub = $coeff(income) + 2.024 * $stderr(income)

5 print lb ub

The first line opens the dataset. The second line (ols) solves for the estimates that minimize the sum of squared errors in a linear model that has food_exp as the dependent variable with a constant and income as independent variables. The next two lines generate the lower and upper bounds for the 95% confidence interval for the slope parameter fj2. The last line prints the results of the computation.

The gretl language syntax needs a little explanation. When gretl makes a computation, it will save certain results like coefficient estimates, their standard errors, sum of squared errors and so on in memory. These results can then be used to compute other statistics, provided you know the accessor’s name that gretl uses to store and recall the computation. These so-called accessors carry $ prefixes and a list of what can be accessed after estimation can be found in the function reference. Lines 3 and 4 use accessors for the coefficients ($coeff(income)) and standard errors ($stderr(income)) of the variable in parentheses. The list of accessors is actually growing quite rapidly in response to user requests, so a trip to the function reference may be worth your while to see what is available.

In the above example, gretl uses the least squares estimates and their estimated standard errors to compute confidence intervals. Following the ols command, least squares estimates are stored in $coeff(variable name). Since в2 is estimated using the variable income, its coefficient estimate is saved in $coeff(income). The corresponding standard error is saved in $stderr(income). Also, don’t forget that the function reference (Figure 1.10) includes a list of accessors.

Equivalently, you could use gretl’s built-in critical function to obtain the desired critical value. The general syntax for the function depends on the desired probability distribution. This follows since different distributions contain different numbers of parameters (e. g., the t-distribution has a single degrees of freedom parameter while the standard normal has none!). This example uses the t-distribution and the script becomes:

1 open "@gretldirdatapoefood. gdt"

2 ols food_exp const income

3 scalar lb = $coeff(income) - critical(t,$df,0.025) * $stderr(income)

4 scalar ub = $coeff(income) + critical(t,$df,0.025) * $stderr(income)

5 print lb ub

The syntax for the t-distribution is critical(t, degrees of freedom, a/2). The degrees of freedom from the preceding regression are saved as $df and for a 1 — a = 95% confidence interval, a/2 = 0.025.

The example found in section 3.1.3 of POE4 computes a 95% confidence interval for the income parameter in the food expenditure example. The gretl commands above were used to produce the output found in Figure 3.3.

Generated scalar lb = 5.97205 Generated scalar ub = 14.4472

lb = 5.9720525

ub = 14.447233

Figure 3.3: Obtaining the 95% confidence interval for the income coefficient in the food expenditure example.

To use the dialogs to get confidence intervals is easy as well. First estimate the model using least squares in the usual way. Choose Model>Ordinary least squares from the main pull­down menu, fill in the dependent and independent variables in the ols dialog box and click OK. The results appear in the model window. Now choose Analysis>Confidence intervals for coefficients from the model window’s pull-down menu (seen in Figure 4.1). This generates the result shown in Figure 3.4. The circled a icon can be used to change the size of the confidence

image068

Figure 3.4: The 95% confidence interval for the income coefficient in the food expenditure example using the dialog.

interval, which can be set to any (integer) percentage level you desire.

Добавить комментарий

Using gret l for Principles of Econometrics, 4th Edition

Simulation

In appendix 10F of POE4, the authors conduct a Monte Carlo experiment comparing the performance of OLS and TSLS. The basic simulation is based on the model y = x …

Hausman Test

The Hausman test probes the consistency of the random effects estimator. The null hypothesis is that these estimates are consistent-that is, that the requirement of orthogonality of the model’s errors …

Time-Varying Volatility and ARCH Models: Introduction to Financial Econometrics

In this chapter we’ll estimate several models in which the variance of the dependent variable changes over time. These are broadly referred to as ARCH (autoregressive conditional heteroskedas - ticity) …

Как с нами связаться:

Украина:
г.Александрия
тел./факс +38 05235  77193 Бухгалтерия

+38 050 457 13 30 — Рашид - продажи новинок
e-mail: msd@msd.com.ua
Схема проезда к производственному офису:
Схема проезда к МСД

Партнеры МСД

Контакты для заказов оборудования:

Внимание! На этом сайте большинство материалов - техническая литература в помощь предпринимателю. Так же большинство производственного оборудования сегодня не актуально. Уточнить можно по почте: Эл. почта: msd@msd.com.ua

+38 050 512 1194 Александр
- телефон для консультаций и заказов спец.оборудования, дробилок, уловителей, дражираторов, гереторных насосов и инженерных решений.