0
$\begingroup$

I tried, but without success so far, to reproduce Greenes' empirical results using his gasoline data available at: https://pages.stern.nyu.edu/~wgreene/Text/econometricanalysis.htm
You will find the R-code expected to generate the first column of Table 6.12. However, the results are is quite different from the published numbers... Does anybody see a typo in my code, in the way I manipulate the data? Is anybody able to produce estimates that are close to the published ones?

Dat = read.csv( file= "TableF2_2.csv", header = TRUE )
nrow( Dat )
# Year = Year, 1953-2004,
# GasExp = Total U.S. gasoline expenditure,
# Pop = U.S. total population in thousands
# GasP = Price index for gasoline,
# Income = Per capita disposable income,
# Pnc = Price index for new cars,
# Puc = Price index for used cars,
# Ppt = Price index for public transportation,
Dat$GAS = Dat$GASEXP / Dat$GASP
Dat$YEAR_t = Dat$YEAR - 1952
reg <- lm( log( GAS / POP ) ~ log( INCOME/POP ) + log( GASP ) + log( PNC ) + log( PUC ) + YEAR_t,
         data = as.data.frame(Dat) )
summary( reg )
SSR = sum( residuals( reg )^2 )
SSR
$\endgroup$
3
  • 2
    $\begingroup$ Hi: It may not matter but don't do those divisions inside the lm itself. I would create new variables and then use those. The lm call might give a different result because of the subtle way that formulae work in R. For more details on this by doing ?I at the R prompt. $\endgroup$
    – mark leeds
    Apr 19, 2023 at 5:21
  • $\begingroup$ @mark leeds: thank you for the hint. Unfortunately the results are identical when I run the alternate formulations: reg <- lm( I(log( GAS / POP )) ~ I(log( INCOME/POP )) + I(log( GASP )) + I(log( PNC )) + I(log( PUC )) + YEAR_t, data = as.data.frame(Dat) ) or lm( y ~ X) after having defined y and X to correspond to the gasoline demand function. $\endgroup$
    – Bertrand
    Apr 19, 2023 at 7:15
  • 1
    $\begingroup$ I'm sorry for leading you down the wrong trail. The only other thing I can think of is to take "Dat" and compare it to what Greene uses which means emailing him and asking if he could provide his version of Dat. Also, you didn't use Year_t in your call. Were you supposed to ? Could Greene be running a GLS instead of an OLS ? I don't have time to run your code right now. Maybe this weekend. $\endgroup$
    – mark leeds
    Apr 19, 2023 at 17:32

1 Answer 1

1
$\begingroup$

INCOME is already per capita, no need to divide it again by the total population.

You can reproduce the results using the following code

fm <- log(GASEXP/POP) ~ log(INCOME) + log(GASP) +
          log(PNC) + log(PUC) + I(YEAR - 1952)
m <- lm(fm, data = gasoline)
m1 <- lm(fm, data = subset(gasoline, YEAR <= 1973))
m2 <- lm(fm, data = subset(gasoline, YEAR > 1973))
cbind(`1953-2004` = coef(m), 
      `1953-1973` = coef(m1),
      `1974-2004` = coef(m2))
##                   1953-2004    1953-1973     1974-2004
## (Intercept)    -26.67868575 -22.16467953 -15.328319431
## log(INCOME)      1.62496242   0.84819339   0.373900694
## log(GASP)        0.94607774   0.96773822   0.875978379
## log(PNC)        -0.08343220   0.69875951  -0.001146371
## log(PUC)        -0.08467492  -0.29053156  -0.021671064
## I(YEAR - 1952)  -0.01392611   0.01006345   0.004491833

Hope it helps

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.