Using gret l for Principles of Econometrics, 4th Edition

Log-Log Model

Finally, a log-log model is used. This functional form is often used to estimate demand equations as it implies a constant price elasticity for the commodity in question. This example uses the newbroiler. gdt which is adapted from Epple and McCallum (2006). The variable Q is per capita consumption of chicken, in pounds and P is the real price in dollars. The sample is from 1950-2001. The estimated log-log model is

l_q = 3.71694 - 1.12136 l_p

(0.022359) (0.048756)

T = 52 R2 = 0.9119 F(1, 50) = 528.96 <7 = 0.11799
(standard errors in parentheses)

The coefficient on logarithm of P is 1.121 which means that a 1% increase in the real price of chicken will decrease quantity demanded by 1.121%.

Once again, the predictor of quantity needs to be corrected since the model is estimated in logarithms. Qc = exp (b + b2 ln(x) + 72/2) = eln(Q)e<J /2. The R2 statistic can be computed as the squared correlation between Q and Q. The script for this exercise is:

1 open "@gretldirdatapoenewbroiler. gdt"

2 logs q p

3 ols l_q const l_p

4 series yht=$yhat

5 series pred = exp(yht)

6 series corrected_pred=pred*exp($sigma"2/2)

7 scalar r2= corr(corrected_pred, q)"2

8 gnuplot corrected_pred q p

The results are

? scalar r2= corr(corrected_pred, q)"2 Generated scalar r2 = 0.881776

and the corresponding graph is found in Figure 4.20.

4.5

Подпись: Figure 4.20: This is a plot generated from a log-log model of chicken demand.
Подпись: The figure looks good. The nonlinear relationship between weight and price is quite evident and the fit is reasonable good.

Script

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

set echo off

# estimate model by LS and predict food_exp open "@gretldirdatapoefood. gdt"

ols food_exp const income

scalar yhat0 = $coeff(const) + $coeff(income)*20

# prediction interval ols food_exp const income

scalar yhat0 = $coeff(const) + $coeff(income)*20 scalar f=8013.2941+(8013.2941/40)+4.3818*(20-19.6047)rt2 scalar ub=yhat0+2.0244*sqrt(f) scalar lb=yhat0-2.0244*sqrt(f)

# prediction interval using accessors ols food_exp const income

scalar yhat0=$coeff(const)+20*$coeff(income) scalar sig2 = $ess/$df

scalar f = sig2 + sig2/$nobs + ((20-mean(income))rt2)*($stderr(income)rt2) scalar lb = yhat0-critical(t,$df,0.025)*sqrt(f) scalar ub = yhat0+critical(t,$df,0.025)*sqrt(f)

# correlations

ols food_exp const income --anova c1 = corr(food_exp,$yhat)

# linear-log model

series l_income = ln(income) ols food_exp const l_income series yhat2 = $yhat gnuplot yhat2 food_exp income

# simple data plot

open "@gretldirdatapoech4sim1.gdt" gnuplot e x

# residual plot

open "@gretldirdatapoech4sim2.gdt" ols y const x series ehat = $uhat gnuplot ehat x

# normality tests

open "@gretldirdatapoefood. gdt"

ols food_exp const income

series uhat1 = $uhat

summary uhat1

normtest uhat1 —jbera

normtest uhat1 —all

modtest —normality

# polynomial

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

open "@gretldirdatapoewa-wheat. gdt" ols greenough const time gnuplot greenough time

setinfo greenough - d "Wheat yield in tonnes" - n "Yield in tonnes" gnuplot greenough —with-lines —time-series

series t3=timert3/1000000 ols greenough const t3

gnuplot greenough —with-lines —time-series

open "@gretldirdatapoewa-wheat. gdt" series lyield = log(greenough) ols lyield const time

# log-linear model

open "@gretldirdatapoecps4_small. gdt" logs wage

ols l_wage const educ

scalar lb = $coeff(educ) - 1.96 * $stderr(educ) scalar ub = $coeff(educ) + 1.96 * $stderr(educ) print lb ub

open "@gretldirdatapoecps4_small. gdt" logs wage

ols l_wage const educ series y = exp($yhat) scalar corrl = corr(y, wage) scalar Rsquare = corr1rt2 print corr1 Rsquare

# simple prediction in log-linear model open "@gretldirdatapoecps4_small. gdt" logs wage

ols l_wage const educ

scalar l_wage_12 = $coeff(const)+$coeff(educ)*12 scalar nat_pred = exp(l_wage_12) scalar corrected_pred = nat_pred*exp($sigmart2/2) print l_wage_12 nat_pred corrected_pred

smpl educ=12 --restrict summary wage smpl full

# prediction intervals using a loop open "@gretldirdatapoecps4_small. gdt" logs wage

ols l_wage const educ scalar sig2 = $ess/$df matrix sem = zeros(21,5) loop for i = 1..21 --quiet

scalar yh = ($coeff(const) + $coeff(educ)*i)

scalar f = sig2 + sig2/$nobs + ((i-mean(educ))rt2)*($stderr(educ)rt2)

sem[i,1]=i

sem[i,2] = yh

sem[i,3]=sqrt(f)

sem[i,4]=exp(yh-critical(t,$df,0.025)*sqrt(f)) sem[i,5]=exp(yh+critical(t,$df,.025)*sqrt(f)) endloop print sem

nulldata 21 —preserve series ed=sem[,1] series wage=exp(sem[,2]) series lb=sem[,4] series ub=sem[,5]

# corrected predictions in log-linear model open "@gretldirdatapoenewbroiler. gdt" logs q p

ols l_q const l_p series yht=$yhat series pred = exp(yht)

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

series corrected_pred=pred*exp($sigmart2/2) scalar r2= corr(corrected_pred, q)rt2 gnuplot corrected_pred q p

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

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