?
? Some preliminaries to set up the data
? Some preliminaries to set up the data
? These commands obtain the group (farm) means of the 4 inputs,
? then computes the logs of the group means.
?
SETPANEL ; Group = farm ; Pds = t $
NAMELIST ; (new) ; means=cowsbar,landbar,laborbar,feedbar $
NAMELIST ; factors = cows,land,labor,feed $
CREATE ; means = Group Mean (factors,pds=t)$
CREATE ; milkbar=Group Mean (milk,pds=t) $
CREATE ; yb=log(milkbar)
; x1b=log(cowsbar) ;x2b=log(landbar)
; x3b=log(laborbar) ;x4b=log(feedbar)$
NAMELIST ; cobbdgls = one,x1,x2,x3,x4 $
NAMELIST ; quadrtic =x11,x22,x33,x44,x12,x13,x14,x23,x24,x34 $
NAMELIST ; translog = cobbdgls,quadrtic $
NAMELIST ; time = year93,year94,year95,year96,year97 $ Omit year98
?
? Part 1. Examine the data
?
DSTAT ; Rhs = * $
? Part 2. Conventional and Robust standard errors.
? The standard errors are almost identical. But, in spite of
? this, the LM statistic is 65.07 with only 4 degress of freedom,
? so the hypothesis of homoscedasticity is rejected anyway.
?
REGRESS ; Lhs = yit ; Rhs = cobbdgls ; Table = OLS$
REGRESS ; Lhs = yit ; Rhs = cobbdgls ; Het ; Table = White$
REGRESS ; Lhs = yit ; Rhs = cobbdgls ; Cluster = 6 ; Table = Cluster $
MAKETABLE ; OLS, White, Cluster ; StandardErrors$
?
? Part 3. The LAD and QUANTILE estimators
? For the coefficients that are highly significant (ONE,X1,X4),
? the LAD results are almost the same. For the others, they
? differ quite a bit. Though this makes intuitive sense, it
? is hard to justify. The standard errors of the LAD estimator
? seem generally smaller, again, contrary to expectations.
?
REGRESS ; Lhs = yit ; Rhs = cobbdgls; Alg = LAD ; NBT = 25 $
QREG ; LHS = YIT ; RHS = COBBDGLS ; Qnt = .25 $
? Now repeat with different values for the quantile to see if the
? regression coefficients are sensitive to the choice of quantile.
QREG ; LHS = YIT ; RHS = COBBDGLS ; Qnt = .25 ; table = quant25$
QREG ; LHS = YIT ; RHS = COBBDGLS ; Qnt = .50 ; table = quant50$
QREG ; LHS = YIT ; RHS = COBBDGLS ; Qnt = .75 ; table = quant75$
MAKETABLE ; quant25,quant50,quant75 $
?
? Part 4. Hypothesis testing.
? First run the regression, putting the time variables first in
? the list. This makes it convenient, but it is not necessary.
REGRESS ; Lhs = yit ; Rhs = time,cobbdgls $
CALC ; ru = rsqrd ; dfn = col(time) ; dfd = n-kreg $
REGRESS ; Lhs = yit ; Rhs = cobbdgls $
CALC ; rl = rsqrd ; list
; f = ((ru-rl)/dfn)/((1-ru)/dfd) ; fc = ftb(.95,dfn,dfd) $
?
? Now use matrix algebra to compute the Wald statistic. The
? chi squared value is 9.377. The statistic has 5 degrees of freedom.
? Is the hypothesis rejected? Execute the command in lower case below
? to get the critical value from the chi squared table.
? What do you find? What is the conclusion.
?
REGRESS ; Lhs = yit ; Rhs = time,cobbdgls $
MATRIX ; bt = b(1:5) ; vt = varb(1:5,1:5) ; list ; w = bt'bt $
CALC ; list ; cc = ctb(.95,5) $
? The built in calculation reports both F and chi squared.
?
REGRESS ; Lhs = yit ; Rhs = time,cobbdgls ; Test: time $
?
? Part 5. Test the null hypothesis of the translog model against the
? alternative of the Cobb-Douglas (with time variables included.)
? The resulting chi squared statistic is 41.954. The critical
? value is 18.307, so the hypothesis is rejected.
?
REGRESS ; Lhs = yit ; Rhs = translog,time ; Test: quadrtic $
? Part 6. Testing for constant returns to scale. The test is of the hypothesis
? that the four output elasticities sum to one.
? The first regression does not impose the restriction.
? The second computes the conventional F statistic. The value is
? 55.67. There is one restriction, so the critical value is 3.84
? (square of critical t value with 1477 degrees of freedom which is
? standard normal, or 1.96).
?
REGRESS ; LHS = YIT ; RHS = One,X1,X2,X3,X4 $
REGRESS ; LHS = YIT ; RHS = One,X1,X2,X3,X4
; Test: x1 + x2 + x3 + x4 = 1 $
?
? A second way is to use the WALD command for computing standard
? errors and hypothesis tests for functions of parameters. The two WALD
? commands do exactly the same thing. They show two ways to form the
? command. The chi squared value is 55.67, which is larger than the critical
? value of 3.84, so this hypothesis is rejected.
?
WALD ; Fn1 = b_X1+b_X2 + b_X3 + b_X4 - 1 $
WALD ; Start = B ; Var = VARB
; Labels = b0,b1,b2,b3,b4 ; Fn1 = b1+b2+b3+b4 - 1 $
? Constant returns in the translog model involves several restrictions.
? The first order terms must sum to 1.0 and each row of the matrix of
? second order terms must sum to zero. Here is how to impose the
? restrictions and test the hypothesis at the same time.
REGRESS ; Lhs = yit ; Rhs = Translog
; CLS: x1+ x2+ x3+ x4 = 1,
x11+x12+x13+x14 = 0,
x12+x22+x23+x24 = 0,
x13+x23+x33+x34 = 0,
x14+x24+x34+x44 = 0 $
? Part 7. Look for normally distributed disturbances by examining residuals.
?
? First compute the residuals. Then, look at a kernel density estimate.
? The distribution looks somewhat bell shaped, but there is a noticeable skew.
? Maybe they are not normally distributed. The chi squared statistic
? is 81.98, with two degrees of freedom. The critical value
? is 5.99 (Find this with CALC;List;CTB(.95,2)$) So, we will reject the
? hypothesis of normality.
?
REGRESS ; Lhs = yit ; Rhs =translog; Res = u $
KERNEL ; Rhs = u; normal ; Grid
; Title=OLS Residuals and Normal with Same Mean and SD$
DSTAT ; Rhs=u ; all ; normal test$
CREATE ; u2 = u*u ; u3 = u2*u ; u4 = u2*u2 $
CALC ; su = sqr ( xbr ( u2 )) ; m3 = xbr( u3 ) ; m4 = xbr ( u4) $
CALC ; List ; c = n *( ( m3/su^3)^2 / 6 + (m4/su^4 - 3)^2 /24 ) $