Using gret l for Principles of Econometrics, 4th Edition

Testing for Normality

Your book discusses the Jarque-Bera test for normality which is computed using the skewness and kurtosis of the least squares residuals. To compute the Jarque-Bera statistic, you’ll first need to obtain the summary statistics from your data series.

From gretl script

1 open "@gretldirdatapoehip. gdt"

2 summary

You could also use the point and click method to get the summary statistics. This is accom­plished from the output window of your regression. Simply highlight the hip series and then choose Data>Summary statistics>selected variables from the pull-down menu. This yields the re­sults in Table C.1.

One thing to note, gretl reports excess kurtosis rather than kurtosis. The excess kurtosis is measured relative to that of the normal distribution which has kurtosis of three. Hence, your computation is

T „ N 2 (Excess Kurtosis)[92] [93] [94] [95] [96] [97] [98]

JB = Skewness2 +

6 4

0.01382 +

—0.668472

4

(C.8)

Using the results in section C.1 for the computation of skewness and kurtosis, the gretl code is:

C.5 Script

1 set echo off

2 open "@gretldirdatapoehip. gdt"

3 summary

4 scalar y_bar = mean(y)

5 scalar y_var = sum((y-y_bar)"2)/($nobs-1)

6 scalar y_se = sqrt(y_var)

7 scalar se_ybar = sqrt(y_var/$nobs)

8

8 scalar mu2 = sum((y-y_bar)"2)/($nobs)

9 scalar mu3 = sum((y-mean(y))"3)/($nobs)

10 scalar mu4 = sum((y-mean(y))"4)/($nobs)

11 printf "n mean = %5.4fn sample variance = %5.4fn sample

12 std deviation = %5.4fn",y_bar, y_var, y_se

13 printf "n mu2 = %5.4fn mu3 = %5.4fn mu4 = %5.4fn",mu2,mu3,mu4

15

14 scalar sig_tild = sqrt(mu2)

15 scalar skew = mu3/sig_tild"3

16 scalar ex_kurt = mu4/sig_tild"4 -3

17 printf "n std dev. of the mean = %5.4fn skewness = %5.4fn

18 excess kurtosis = %5.4fn",se_ybar, skew, ex_kurt

21

19 # Using the estimates

20 scalar zs = (18 - mean(y))/sd(y)

21 pvalue z zs

22 scalar zz = invcdf(n,.95)

23 scalar ystar = sd(y)*zz+mean(y)

24 print ystar

28

25 # Confidence interval

26 open "@gretldirdatapoehip. gdt"

27 scalar y_sd = sd(y)

28 scalar ybar_sd = y_sd/sqrt($nobs)

29 scalar lb = mean(y) - 2.01*ybar_sd

30 scalar ub = mean(y) + 2.01*ybar_sd

31 scalar lb = mean(y) - critical(t,$nobs-1,0.025)*ybar_sd

32 scalar ub = mean(y) + critical(t,$nobs-1,0.025)*ybar_sd

33 printf "nThe 95% confidence interval is (%5.4f, %6.4f)n",lb, ub

38

34 # t-test

35 open "@gretldirdatapoehip. gdt"

36 scalar df = $nobs-1

37 scalar y_bar = mean(y)

38 scalar y_sd = sd(y)

39 scalar ybar_sd = y_sd/sqrt($nobs)

40 scalar tstat = (y_bar-16.5)/(ybar_sd)

41 scalar c = critical(t, df,0.025)

42 pvalue t df tstat

43 scalar tstat = (y_bar-17)/(ybar_sd)

scalar c = critical(t, df,0.025) pvalue t df tstat

# Jarque-Bera

scalar sig_tild = sqrt(sum((y-mean(y))rt2)/($nobs))

scalar mu3 = sum((y-mean(y))rt3)/($nobs)

scalar mu4 = sum((y-mean(y))rt4)/($nobs)

scalar skew = mu3/sig_tildrt3

scalar kurt = mu4/sig_tildrt4

scalar JB = ($nobs/6)*(skewrt2+(kurt-3)rt2/4)

49

50

51

52

53

54

55

56

57

58

59

pvalue X 2 JB

critical

Output: same type as input Arguments: c (character)

... (see below) p (scalar, series or matrix)

Examples: cl = critical(t, 20, 0.02S)

c2 = critical(F, 4, 48, 0.05)

Critical value calculator. Returns jrsuch that P(X> x) = p, where the distribution Xs determined by the character c. Between the arguments rand p, zero or more additional scalar arguments are required to specify the parameters of the distribution, as follows.

• Standard normal (c = z, n, or N): no extra arguments

• Student's t (t): degrees of freedom

• Chi square (c, x, or X): degrees of freedom

• Snedecor's F (f or F): df (num.); df (den.)

• Binomial (b or B): probability; trials

• Poisson (p or P): mean

See also cdf, invcdf, pvalue.

Figure C.1: Obtaining critical values from the t distribution using hansl.

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

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 Александр
- телефон для консультаций и заказов спец.оборудования, дробилок, уловителей, дражираторов, гереторных насосов и инженерных решений.