"Fossies" - the Fresh Open Source Software Archive

Member "gretl/scripts/ramanathan/ps8-6.inp" (2 Oct 2015, 888 Bytes) of package /windows/misc/gretl-2020e-win32.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Charmm source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # PS8.6, to reproduce Example 8.7 
    2 open data8-2
    3 ols exptrav 0 income 
    4 # save absolute value of errors as absuhat1 
    5 genr absuhat1=abs($uhat)
    6 # auxiliary regression for the Glejer test 
    7 ols absuhat1 0 pop
    8 # compute test statistic and p-value 
    9 genr LM1=$nrsq
   10 pvalue X 1 LM1
   11 # since heteroscedasticity is detected, divide model by pop and
   12 # estimate by OLS 
   13 genr pcexp=exptrav/pop
   14 genr pcincm=income/pop
   15 genr invpop=1/pop
   16 # estimate transformed model -- note that there is no constant term 
   17 ols pcexp invpop pcincm
   18 # test for heteroscedasticity on the transformed model 
   19 genr absuhat2=abs($uhat)
   20 ols absuhat2 0 pop
   21 genr LM2=$nrsq
   22 # the high p-value suggests that we cannot reject homoscedasticity and 
   23 # hence OLS is acceptable 
   24 pvalue X 1 LM2
   25 # wls command is a short cut -- coeff., tstat, ess, should be the same
   26 # but Rsquared will be different 
   27 genr w = invpop^2
   28 wls w exptrav 0 income
   29 
   30