﻿

# asp.net mvc pdf library : Batch convert pdf to png SDK software service wpf windows azure dnn gretl-guide16-part398

Chapter17. Robustcovariancematrixestimation
150
seriesdata: thekeypointisthatinmostcasesitislikelytobecombinedwithserialcorrelation
(autocorrelation), hencedemanding g aspecialtreatment. . In n White’s approach,
ˆ
Ú, theestimated
covariancematrixoftheu
t
, remains convenientlydiagonal: : thevariances, Eu
2
t
, maydiﬀer by
but thecovariances, Eu
t
u
s
, are e allzero. . Autocorrelation n in timeseries data means that at
leastsomeofthetheoﬀ-diagonalelementsof
ˆ
Úshouldbenon-zero.Thisintroducesasubstantial
complicationandrequires anotherpieceofterminology; estimates of thecovariancematrixthat
areasymptoticallyvalidinfaceofbothheteroskedasticityandautocorrelationoftheerrorprocess
aretermedHAC(heteroskedasticityandautocorrelationconsistent).
Theissue of HAC estimation is s treated in more e technical terms s in chapter 22. Here e we try to
conveysomeoftheintuitionat amorebasiclevel. . Webeginwithageneral l comment: : residual
maybepersistentthoughtime,andifweﬁtamodelthatdoesnottakethisaspectintoaccount
properly,weendupwithamodelwithautocorrelateddisturbances.Conversely,itisoftenpossible
tomitigateoreveneliminatetheproblemofautocorrelationbyincludingrelevantlaggedvariables
inatimeseriesmodel,orinotherwords,byspecifyingthedynamicsofthemodelmorefully.HAC
estimationshouldnot beseenastheﬁrstresortindealingwithanautocorrelatederrorprocess.
Thatsaid, the“obvious”extensionofWhite’s HCCMEto thecaseof autocorrelatederrors would
seem tobethis: : estimatetheoﬀ-diagonalelements s of
ˆ
Ú (thatis, theautocovariances, Eu
t
u
s
)
using,onceagain,theappropriateOLSresiduals:!ˆ
ts
ˆu
t
ˆu
s
. Thisisbasicallyright,butdemands
animportantamendment. Weseekaconsistentestimator,onethatconvergestowardsthetrueÚ
as thesamplesizetendstowards inﬁnity. . This s can’twork ifweallow unboundedserialdepen-
dence. Biggersampleswillenableustoestimatemoreofthetrue!
ts
elements(thatis,fortand
smorewidelyseparatedintime)butwillnotcontributeever-increasinginformationregardingthe
maximallyseparated !
ts
pairs, since e the maximalseparation itself grows s withthesamplesize.
Toensureconsistency,wehavetoconﬁneourattentiontoprocessesexhibitingtemporallylimited
dependence,orinotherwordscutoﬀthecomputationofthe!ˆ
ts
valuesatsomemaximumvalue
ofpt s(wherepistreatedasanincreasingfunctionofthesamplesize,T,althoughitcannot
increaseinproportiontoT).
Thesimplestvariantofthisideaisto truncatethecomputationatsomeﬁnitelagorderp,where
pgrowsas,say,T1=4. Thetroublewiththisisthattheresulting
ˆ
Úmaynotbeapositivedeﬁnite
matrix. Inpracticalterms,wemayendupwithnegativeestimatedvariances. Onesolutiontothis
problemisoﬀeredbyTheNewey–Westestimator(NeweyandWest,1987),whichassignsdeclining
weightstothesampleautocovariancesasthetemporalseparationincreases.
namely,
X
0
X
1
X
0ˆ
ÚXX
0
X
1
This isknownas a“sandwich” ” estimator. . Thebread, , which appears on bothsides, is X0X 1.
Thisisakkmatrix,andisalsothekeyingredientinthecomputationoftheclassicalcovariance
matrix.Theﬁllinginthesandwichis
ˆ
Ö
X
0
ˆ
Ú
X
kk
kT
TT
Tk
SinceÚEuu
0
,thematrixbeingestimatedherecanalsobewrittenas
ÖEX
0
uu
0
X
whichexpressesÖasthelong-runcovarianceoftherandomk-vectorX
0
u.
Fromacomputationalpointofview,itisnotnecessaryor desirabletostorethe(potentiallyvery
large)Tmatrix
ˆ
Úassuch.Rather,onecomputesthesandwichﬁllingbysummationas
ˆ
Ö
ˆ
0
p
X
j1
w
j
ˆ
j
ˆ
0
j
Convert pdf file to jpg file - Convert PDF to JPEG images in C#.net, ASP.NET MVC, WinForms, WPF project
How to convert PDF to JPEG using C#.NET PDF to JPEG conversion / converter library control SDK
.pdf to .jpg converter online; c# pdf to jpg
Convert pdf file to jpg file - VB.NET PDF Convert to Jpeg SDK: Convert PDF to JPEG images in vb.net, ASP.NET MVC, WinForms, WPF project
Online Tutorial for PDF to JPEG (JPG) Conversion in VB.NET Image Application
change pdf file to jpg online; convert multiple pdf to jpg
Chapter17. Robustcovariancematrixestimation
151
wherethekksampleautocovariancematrix
ˆ
j,forj0,isgivenby
ˆ
j
1
T
XT
tj1
ˆu
t
ˆu
t j
X
0
t
X
t j
andw
j
istheweightgiventotheautocovarianceatlagj>0.
Thisleavestwoquestions. Howexactlydowedeterminethemaximumlaglengthor“bandwidth”,
p,oftheHACestimator? Andhowexactlyaretheweightsw
j
tobedetermined?Wewillreturnto
the(diﬃcult)questionofthebandwidthshortly.Asregardstheweights,gretloﬀersthreevariants.
ThedefaultistheBartlettkernel,asusedbyNeweyandWest.Thissets
w
j
8
<
:
j
p1
jp
0
j>p
sotheweightsdeclinelinearlyasjincreases. TheothertwooptionsaretheParzenkernelandthe
w
j
8
>
>
<
>
>
:
1 6a
2
j
6a
3
j
0a
j
0:5
2a
j
3
0:5<a
j
1
0
a
j
>1
wherea
j
j=p1,andfortheQSkernel,
w
j
25
122d
2
j
sinm
j
m
j
cosm
j
!
whered
j
j=pandm
j
6d
i
=5.
Figure17.1showstheweightsgeneratedbythesekernels,forp4andj=1to9.
Figure17.1:ThreeHACkernels
Bartlett
Parzen
QS
Ingretlyouselectthekernelusingthesetcommandwiththehac_kernelparameter:
set hac_kernel parzen
set hac_kernel qs
set hac_kernel bartlett
SelectingtheHACbandwidth
Theasymptotic theorydevelopedby Newey, , Westand d others tells us ingeneral terms how the
HACbandwidth, p, shouldgrow withthesamplesize, T—thatis, pshould growinproportion
tosomefractionalpowerofT. Unfortunatelythisisoflittlehelpto o theappliedeconometrician,
workingwithagivendatasetofﬁxedsize. Variousrulesofthumbhavebeensuggested,andgretl
implementstwosuch. Thedefaultisp0:75T1=3,asrecommendedbyStockandWatson(2003).
Analternativeis p 4T=1002=9, asinWooldridge(2002b). . Ineachcaseonetakes s theinteger
partoftheresult. Thesevariantsarelabelednw1andnw2respectively, , inthecontextoftheset
commandwiththehac_lagparameter. Thatis,youcanswitchtotheversiongivenbyWooldridge
with
Online Convert Jpeg to PDF file. Best free online export Jpg image
Convert a JPG to PDF. You can drag and drop your JPG file in the box, and then start immediately to sort the files, try out some settings and then create the
change pdf to jpg image; changing pdf file to jpg
Online Convert PDF to Jpeg images. Best free online PDF JPEG
Online PDF to JPEG Converter. Download Free Trial. Convert a PDF File to JPG. Drag and drop your PDF in the box above and we'll convert the files for you.
convert pdf picture to jpg; convert pdf file to jpg online
Chapter17. Robustcovariancematrixestimation
152
set hac_lag nw2
AsshowninTable17.1thechoicebetweennw1andnw2doesnotmakeagreatdealofdiﬀerence.
T
p(nw1) p(nw2)
50
2
3
100
3
4
150
3
4
200
4
4
300
5
5
400
5
5
Table17.1:HACbandwidth:tworulesofthumb
Youalsohavetheoptionofspecifyingaﬁxednumericalvalueforp,asin
set hac_lag 6
neednotbeaninteger).Forexample,
set qs_bandwidth 3.5
Prewhiteninganddata-basedbandwidthselection
Analternativeapproachistodealwithresidualautocorrelationbyattackingtheproblemfromtwo
sides. The e intuitionbehind thetechniqueknown as VARprewhitening (Andrews and Monahan,
1992)canbeillustratedbyasimpleexample. Letx
t
beasequenceofﬁrst-order autocorrelated
randomvariables
x
t
x
1
u
t
Thelong-runvarianceofx
t
canbeshowntobe
V
LR
x
t
V
LR
u
t
2
Inmostcases,u
t
islikelytobelessautocorrelatedthanx
t
,soasmallerbandwidthshouldsuﬃce.
EstimationofV
LR
x
t
canthereforeproceedinthreesteps:(1)estimate;(2)obtainaHACestimate
of ˆu
t
x
t
ˆx
1
;and(3)dividetheresultby
2
.
Theapplicationoftheaboveconcepttoourproblemimpliesestimatingaﬁnite-orderVectorAu-
toregression(VAR)onthevectorvariables
t
X
t
ˆ
u
t
. Ingeneral,theVARcanbeofanyorder,but
inmostcases1issuﬃcient;theaimisnottobuildawatertightmodelfor
t
,butjustto“mopup”
asubstantialpartoftheautocorrelation.Hence,thefollowingVARisestimated
t
A
1
"
t
ThenanestimateofthematrixX
0
ÚXcanberecoveredvia
I
ˆ
A
1ˆ
Ö
"
I
ˆ
A
0
1
where
ˆ
Ö
"
isanyHACestimator,appliedtotheVARresiduals.
set hac_prewhiten on
VB.NET PDF File Merge Library: Merge, append PDF files in vb.net
VB.NET Components to combine various scanned images to PDF, such as tiff, jpg, png, gif, bmp, etc. Append one PDF file to the end of another one in VB.NET.
convert pdf to jpg converter; convert pdf to jpg
C# PDF File Merge Library: Merge, append PDF files in C#.net, ASP.
scanned images to PDF, such as tiff, jpg, png, gif, bmp, etc. Merge Microsoft Office Word, Excel and PowerPoint data to PDF form. Append one PDF file to the end
c# convert pdf to jpg; change pdf to jpg on
Chapter17. Robustcovariancematrixestimation
153
Thereisatpresentnomechanismforspecifyinganorderotherthan1fortheinitialVAR.
Afurtherreﬁnementisavailableinthiscontext,namelydata-basedbandwidthselection. Itmakes
intuitivesensethattheHAC bandwidth shouldnot simplybebasedon thesizeof thesample,
butshouldsomehowtakeintoaccountthetime-seriespropertiesofthedata(andalsothekernel
chosen). AnonparametricmethodfordoingthiswasproposedbyNeweyandWest(1994);agood
conciseaccountofthemethodisgiveninHall(2005).Thisoptioncanbeinvokedingretlvia
set hac_lag nw3
Thisoptionisthedefaultwhenprewhiteningisselected,butyoucanoverrideitbygivingaspeciﬁc
numericalvalueforhac_lag.
EventheNewey–Westdata-basedmethoddoesnotfullypindownthebandwidthforanyparticular
sample.Theﬁrststepinvolvescalculatingaseriesofresidualcovariances.Thelengthofthisseries
isgivenasafunctionofthesamplesize,butonlyuptoascalarmultiple—forexample,itisgiven
asOT
2=9
fortheBartlettkernel.Gretlusesanimpliedmultipleof1.
VARs:aspecialcase
Awell-speciﬁedvector autoregression(VAR)willgenerallyincludeenoughlagsofthedependent
variables to obviate the problem of residual autocorrelation, , in n which case e HAC C estimation n is
redundant—although theremay still be a need to correct for heteroskedasticity. . For r that rea-
sonplainHCCME,andnotHAC,isthedefaultwhenthe--robustﬂagisgiveninthecontextofthe
varcommand. However,ifforsomereasonyouneedHACyoucanforcetheissuebygivingthe
option--robust-hac.
17.4 Specialissueswithpaneldata
Sincepaneldatahavebothatime-seriesandacross-sectionaldimensiononemightexpectthat,in
general,robustestimationofthecovariancematrixwouldrequirehandlingbothheteroskedasticity
attention.
 Thevarianceoftheerrortermmaydiﬀeracrossthecross-sectionalunits.
 Thecovarianceoftheerrorsacrosstheunitsmaybenon-zeroineachtimeperiod.
 Ifthe“between”variationisnotremoved,theerrorsmayexhibitautocorrelation,notinthe
usualtime-seriessensebutinthesensethatthemeanerrorforunitimaydiﬀerfromthatof
unitj. (ThisisparticularlyrelevantwhenestimationisbypooledOLS.)
availableformodelsestimatedviaﬁxedeﬀects, pooledOLS,andpooledtwo-stageleastsquares.
ThedefaultrobustestimatoristhatsuggestedbyArellano(2003),whichisHACprovidedthepanel
isofthe“largen,smallT”variety(thatis,manyunitsareobservedinrelativelyfewperiods).The
Arellanoestimatoris
ˆ
Ö
A
X
0
X
1
0
@
Xn
i1
X
0
i
ˆu
i
ˆu
0
i
X
i
1
A
X
0
X
1
whereXisthematrixofregressors(withthegroupmeanssubtracted,inthecaseofﬁxedeﬀects)ˆu
i
denotesthevectorofresidualsforuniti,andnisthenumberofcross-sectionalunits.
2
Cameron
andTrivedi(2005)makeastrongcaseforusingthisestimator;theynotethattheordinaryWhite
2
Thisvarianceestimatorisalsoknownasthe“clustered(overentities)”estimator.
C# Create PDF from images Library to convert Jpeg, png images to
C# Create PDF from Raster Images, .NET Graphics and REImage File with XDoc Batch convert PDF documents from multiple image formats, including Jpg, Png, Bmp
convert pdf to jpg batch; bulk pdf to jpg
C# Image Convert: How to Convert Adobe PDF to Jpeg, Png, Bmp, &
C# sample code for PDF to jpg image conversion. This demo code convert PDF file all pages to jpg images. // Define input and output files path.
conversion of pdf to jpg; convert pdf file to jpg
Chapter17. Robustcovariancematrixestimation
154
inconsistentintheﬁxed-eﬀectspanelcontextforﬁxedT>2.
Incaseswhereautocorrelation isnotan issue theestimator r proposed by Beck and Katz (1995)
anddiscussedbyGreene(2003,chapter13)maybeappropriate. Thisestimator,whichtakesinto
accountcontemporaneouscorrelationacrosstheunitsandheteroskedasticitybyunit,is
ˆ
Ö
BK
X
0
X
1
0
@
Xn
i1
Xn
j1
ˆ
ij
X
0
i
X
j
1
A
X
0
X
1
Thecovariancesˆ
ij
areestimatedvia
ˆ
ij
ˆ
u
0
i
ˆ
u
j
T
whereisthelengthofthetimeseriesforeachunit. BeckandKatzcalltheassociatedstandard
errors “Panel-Corrected Standard Errors”(PCSE). . This s estimator r can beinvoked d in gretl via the
command
set pcse e on
TheArellanodefaultcanbere-establishedvia
set pcse e off
(Notethatregardlessofthepcsesetting,therobustestimatorisnotusedunlessthe--robustﬂag
isgiven,orthe“Robust”boxischeckedintheGUIprogram.)
17.5 Thecluster-robustestimator
Onefurthervarianceestimatorisavailableingretl,namelythe“cluster-robust”estimator.Thismay
beappropriate(forcross-sectionaldata,mostly)whentheobservationsnaturallyfallintogroupsor
clusters,andonesuspectsthattheerrortermmayexhibitdependencywithintheclustersand/or
have avariance that diﬀers s across clusters. . Suchclusters s maybebinary (e.g. employed versus
unemployedworkers),categoricalwithseveralvalues(e.g.productsgroupedbymanufacturer)or
ordinal(e.g.individualswithlow,middleorhigheducationlevels).
Forlinearregressionmodelsestimatedvialeastsquarestheclusterestimatorisdeﬁnedas
ˆ
Ö
C
X
0
X
1
0
@
mX
j1
X
0
j
ˆu
j
ˆu
0
j
X
j
1
A
X
0
X
1
wheremdenotesthenumberofclusters,andX
j
andˆu
j
denote,respectively,thematrixofregres-
sorsandthevector ofresidualsthatfallwithincluster j. Asnotedabove, , theArellanovariance
estimatorforpaneldatamodelsisaspecialcaseofthis,wheretheclusteringisbypanelunit.
FormodelsestimatedbythemethodofMaximumLikelihood(inwhichcasethestandardvariance
estimatoristheinverseofthenegativeHessian,H),theclusterestimatoris
ˆ
Ö
C
H
1
0
@
mX
j1
G
0
j
G
j
1
A
H
1
whereG
j
isthesumofthe“score”(thatis,thederivativeoftheloglikelihoodwithrespecttothe
parameterestimates)acrosstheobservationsfallingwithinclusterj.
small). Intheleastsquarescasethefactorism=m 1n 1=n k,wherenisthetotal
numberofobservationsandkisthenumberofparametersestimated;inthecaseofMLestimation
thefactorisjustm=m 1.
C# Image Convert: How to Convert Dicom Image File to Raster Images
RasterEdge.XDoc.Office.Inner.Office03.dll. RasterEdge.XDoc.PDF.dll. This demo code convert dicom file all pages to jpg images.
batch convert pdf to jpg; convert multi page pdf to jpg
VB.NET PDF Convert to Images SDK: Convert PDF to png, gif images
Convert PDF documents to multiple image formats, including Jpg, Png, Bmp, Gif, Tiff, Bitmap, .NET Graphics, and REImage. Turn multipage PDF file into image
advanced pdf to jpg converter; convert pdf photo to jpg
Chapter17. Robustcovariancematrixestimation
155
Availabilityandsyntax
Thecluster-robustestimatoriscurrentlyavailableformodelsestimatedviaOLSandTSLS,andalso
formostMLestimatorsotherthanthosespecializedfortime-seriesdata: binarylogitandprobit,
orderedlogitandprobit,multinomiallogit,Tobit,intervalregression,biprobit,countmodelsand
durationmodels.Inallcasesthesyntaxisthesame:yougivetheoptionﬂag--cluster=followed
bythenameoftheseriestobeusedtodeﬁnetheclusters,asin
ols y 0 0 x1 1 x2 --cluster=cvar
Thespeciﬁedclusteringvariablemust(a)bedeﬁned(notmissing)atallobservationsusedinesti-
matingthemodeland(b)takeonatleasttwodistinctvaluesovertheestimationrange.Theclusters
aredeﬁnedassetsofobservationshavingacommonvaluefortheclusteringvariable.Itisgenerally
expectedthatthenumberofclustersissubstantiallylessthanthetotalnumberofobservations.
Chapter18
Paneldata
18.1 Estimationofpanelmodels
PooledOrdinaryLeastSquares
butitprovidesabaselineforcomparisonwithmorecomplexestimators.
isthehausmancommand.
ingcross-sectionalunits.ThetestcomparespooledOLSagainsttheprincipalalternatives,theﬁxed
eﬀectsandrandomeﬀectsmodels. Thesealternativesareexplainedinthefollowingsection.
Theﬁxedandrandomeﬀectsmodels
randomeﬀects”.Inthecommand-lineinterfaceoneusesthepanelcommand,withorwithoutthe
--random-effectsoption.
ThepooledOLSspeciﬁcationmaybewrittenas
y
it
X
it
u
it
(18.1)
wherey
it
istheobservationonthedependentvariableforcross-sectionalunitiinperiodtX
it
is a1kvector ofindependentvariablesobservedfor unitin period tis ak1vector of
parameters,andu
it
isanerrorordisturbancetermspeciﬁctounitiinperiodt.
Theﬁxed and randomeﬀects models haveincommonthattheydecomposetheunitarypooled
errorterm,u
it
.Fortheﬁxedeﬀectsmodelwewriteu
it
i
"
it
,yielding
y
it
X
it
i
"
it
(18.2)
Thatis,wedecomposeu
it
intoaunit-speciﬁcandtime-invariantcomponent,
i
,andanobservation-
speciﬁcerror,"
it
.
1
The
i
sarethentreatedasﬁxedparameters(ineﬀect,unit-speciﬁcy-intercepts),
unit(andsuppressingtheglobalconstant).ThisissometimescalledtheLeastSquaresDummyVari-
ables(LSDV)method. Alternatively,onecansubtractthegroupmeanfromeachofvariablesand
estimateamodelwithoutaconstant.Inthelattercasethedependentvariablemaybewrittenas
˜y
it
y
it
¯y
i
The“groupmean”,
¯
y
i
,isdeﬁnedas
¯y
i
1
T
i
T
i
X
t1
y
it
1
Itispossibletobreakathirdcomponentoutofu
it
,namelyw
t
,ashockthatistime-speciﬁcbutcommontoallthe
unitsinagivenperiod.Intheinterestofsimplicitywedonotpursuethatoptionhere.
156
Chapter18. Paneldata
157
whereT
i
isthenumberofobservationsforuniti.Anexactlyanalogousformulationappliestothe
independentvariables.Givenparameterestimates,
ˆ
,obtainedusingsuchde-meaneddatawecan
recoverestimatesofthe
i
susing
ˆ
i
1
T
i
T
i
X
t1
y
it
X
it
ˆ
Thesetwomethods(LSDV,andusingde-meaneddata)arenumericallyequivalent. gretltakesthe
approachofde-meaningthedata.Ifyouhaveasmallnumberofcross-sectionalunits,alargenum-
beroftime-seriesobservationsperunit,andalargenumberofregressors,itismoreeconomical
intermsofcomputermemorytouseLSDV.Ifneedbeyoucaneasilyimplementthismanually.For
example,
genr unitdum
ols y x x du_*
(SeeChapter9fordetailsonunitdum).
Theˆ
i
estimatesarenotprintedaspartofthestandardmodeloutputingretl(theremaybealarge
numberofthese,andtypicallytheyarenotofmuchinherentinterest). Howeveryoucanretrieve
themafter estimationoftheﬁxedeﬀectsmodelifyouwish. . Inthegraphicalinterface,go o tothe
doseriesnewname=\$ahat,wherenewnameisthenameyouwanttogivetheseries.
Fortherandomeﬀectsmodelwewriteu
it
v
i
"
it
,sothemodelbecomes
y
it
X
it
v
i
"
it
(18.3)
Incontrasttotheﬁxedeﬀectsmodel,thev
i
sarenottreatedasﬁxedparameters,butasrandom
drawingsfromagivenprobabilitydistribution.
ThecelebratedGauss–Markovtheorem, according to whichOLSis thebestlinearunbiasedesti-
mator (BLUE), , depends on n the assumption that the error term is independently and identically
distributed(IID).Inthepanelcontext,theIIDassumptionmeansthatEu
2
it
,inrelationtoequa-
tion18.1,equalsaconstant,
2
u
,foralliandt,whilethecovarianceEu
is
u
it
equalszeroforall
standthecovarianceEu
jt
u
it
equalszeroforallji.
Iftheseassumptionsarenotmet—andtheyareunlikelytobemetinthecontextofpaneldata—
OLSisnotthemosteﬃcientestimator. Greatereﬃciencymaybegainedusinggeneralizedleast
squares(GLS),takingintoaccountthecovariancestructureoftheerrorterm.
Considerobservationsonagivenunitiattwodiﬀerenttimessandt.Fromthehypothesesabove
itcanbeworkedoutthatVaru
is
Varu
it
2
v
2
"
,whilethecovariancebetweenu
is
andu
it
isgivenbyEu
is
u
it
2
v
.
Inmatrixnotation,wemaygroupalltheT
i
observationsforunitiintothevectory
i
andwriteitas
y
i
X
i
u
i
(18.4)
Thevectoru
i
,whichincludesallthedisturbancesforindividuali,hasavariance–covariancematrix
givenby
Varu
i
Ö
i
2
"
I
2
v
J
(18.5)
whereJisasquarematrixwithallelementsequalto1.Itcanbeshownthatthematrix
K
i
I
i
T
i
J;
where
i
1
r
2
"
2
"
T
i
2
v
,hastheproperty
K
i
ÖK
0
i
2
"
I
Chapter18. Paneldata
158
Itfollowsthatthetransformedsystem
K
i
y
i
K
i
X
i
K
i
u
i
(18.6)
satisﬁes theGauss–Markovconditions, and OLSestimationof(18.6)provides eﬃcientinference.
Butsince
K
i
y
i
y
i
i
¯y
i
GLSestimationisequivalenttoOLSusing“quasi-demeaned”variables;thatis,variablesfromwhich
wesubtractafractionoftheiraverage.Noticethatfor2
"
!0,!1,whilefor2
v
!0,!0.
Thismeansthatifallthevarianceisattributableto theindividualeﬀects,thentheﬁxedeﬀects
estimatorisoptimal;if,ontheotherhand,individualeﬀectsarenegligible,thenpooledOLSturns
out,unsurprisingly,tobetheoptimalestimator.
To implementtheGLSapproachweneed tocalculate, whichinturnrequiresestimatesofthe
variances
2
"
and
2
v
. (Theseareoften n referred to o as the“within”and “between” ” variances s re-
spectively, sincetheformer refers tovariationwithineachcross-sectional unit and thelatter to
variationbetweentheunits). Severalmeansofestimatingthesemagnitudeshavebeensuggested
intheliterature(seeBaltagi,1995);bydefaultgretlusesthemethodofSwamyandArora(1972):
2
"
is estimatedbytheresidualvariancefromtheﬁxedeﬀects model,andthesum2
"
T
i
2
v
is
estimatedasT
i
timestheresidualvariancefromthe“between”estimator,
¯y
i
¯
X
i
e
i
Thelatter regressionis implemented byconstructing a a data set consisting of thegroup means
ofalltherelevantvariables. Alternatively,ifthe--nerloveoptionisgiven,gretlusesthemethod
suggestedbyNerlove(1971).Inthiscase
2
v
isestimatedasthesamplevarianceoftheﬁxedeﬀects,
ˆ
2
v
1
1
Xn
i1

i
¯
2
wherenisthenumberofindividualsand ¯isthemeanoftheﬁxedeﬀects.
Choiceofestimator
Whichpanelmethodshouldoneuse,ﬁxedeﬀectsorrandomeﬀects?
observationsonaﬁxedandrelativelysmallsetofunitsofinterest(say,thememberstatesofthe
EuropeanUnion),thereisapresumptioninfavorofﬁxedeﬀects.Ifitcomprisesobservationsona
largenumberofrandomlyselectedindividuals(asinmanyepidemiologicalandotherlongitudinal
studies),thereisapresumptioninfavorofrandomeﬀects.
Besidesthisgeneralheuristic,however,variousstatisticalissuesmustbetakenintoaccount.
1. Somepaneldatasetscontainvariableswhosevaluesarespeciﬁctothecross-sectionalunit
butwhichdonotvaryovertime.Ifyouwanttoincludesuchvariablesinthemodel,theﬁxed
eﬀectsoptionissimplynotavailable. Whentheﬁxedeﬀectsapproachisimplementedusing
dummyvariables,theproblemisthatthetime-invariantvariablesareperfectlycollinearwith
theper-unitdummies.Whenusingtheapproachofsubtractingthegroupmeans,theissueis
thatafterde-meaningthesevariablesarenothingbutzeros.
2. Asomewhatanalogousprohibitionappliestotherandomeﬀectsestimator.Thisestimatoris
ineﬀectamatrix-weightedaverageofpooledOLSandthe“between”estimator. Supposewe
haveobservationsonnunitsorindividualsandtherearekindependentvariablesofinterest.
Ifk>n,the“between”estimatorisundeﬁned—sincewehaveonlyneﬀectiveobservations—
andhencesoistherandomeﬀectsestimator.
2
Inabalancedpanel,thevalueofiscommontoallindividuals,otherwiseitdiﬀersdependingonthevalueofT
i
.
Chapter18. Paneldata
159
Ifonedoesnotfallfoulofoneorotheroftheprohibitionsmentionedabove,thechoicebetween
ﬁxedeﬀects andrandomeﬀects maybeexpressed interms ofthetwo o econometric desiderata,
eﬃciencyandconsistency.
eﬃciency.Intheﬁxedeﬀectsapproach,wedonotmakeanyhypothesesonthe“groupeﬀects”(that
is, thetime-invariantdiﬀerences in meanbetweenthegroups) beyondthefactthattheyexist—
andthatcanbetested; seebelow. . Asaconsequence, , oncetheseeﬀectsaresweptoutbytaking
deviationsfromthegroupmeans,theremainingparameterscanbeestimated.
Ontheotherhand,therandomeﬀectsapproachattemptstomodelthegroupeﬀectsasdrawings
representableas alegitimatepartof thedisturbanceterm, thatis, zero-meanrandomvariables,
uncorrelatedwiththeregressors.
Asaconsequence,theﬁxed-eﬀectsestimator“alwaysworks”,butatthecostofnotbeingableto
estimatetheeﬀectoftime-invariantregressors. Thericher r hypothesissetoftherandom-eﬀects
estimator ensuresthatparameters fortime-invariantregressorscan n beestimated,and thatesti-
tothinkthatindividualeﬀectsmaybecorrelatedwithsomeoftheexplanatoryvariables,thenthe
random-eﬀectsestimatorwouldbeinconsistent,whileﬁxed-eﬀectsestimateswouldstillbevalid.
ItispreciselyonthisprinciplethattheHausmantestisbuilt(seebelow):iftheﬁxed-andrandom-
eﬀectsestimatesagree,towithintheusualstatisticalmarginoferror,thereisno reasontothink
estimator.
Testingpanelmodels
Ifyouestimateaﬁxedeﬀectsorrandomeﬀectsmodelinthegraphicalinterface,youmaynotice
Panelmodelscarry certaincomplications thatmakeitdiﬃculttoimplementallofthetestsone
expectstoseeformodelsestimatedonstraighttime-seriesorcross-sectionaldata.
Nonetheless,variouspanel-speciﬁctestsareprintedalongwiththeparameterestimatesasamatter
ofcourse,asfollows.
Whenyouestimateamodelusing ﬁxedeﬀects, youautomatically getanF-testfor thenullhy-
pothesisthatthecross-sectionalunitsallhaveacommonintercept. Thatistosaythatallthe
i
s
areequal,inwhichcasethepooledmodel(18.1),withacolumnof1sincludedinthematrix,is
When you estimateusing random eﬀects, , theBreusch–Paganand d Hausmantests arepresented
automatically.
TheBreusch–Pagantestisthecounterpartto theF-testmentionedabove. . Thenullhypothesisis
thatthevarianceofv
i
inequation(18.3)equalszero;ifthishypothesisisnotrejected,thenagain
TheHausmantestprobestheconsistencyoftheGLSestimates. Thenullhypothesisisthatthese
estimates areconsistent—that is, thattherequirement of orthogonalityofthev
i
andthe X
i
is
satisﬁed.Thetestisbasedonameasure,H,ofthe“distance”betweentheﬁxed-eﬀectsandrandom-
eﬀectsestimates,constructedsuchthatunderthenullitfollowsthe
2
distributionwithdegrees
offreedomequalto thenumberoftime-varying regressorsinthematrixX. IfthevalueofHis
“large”thissuggeststhattherandomeﬀectsestimatorisnotconsistentandtheﬁxed-eﬀectsmodel
ispreferable.
TherearetwowaysofcalculatingH,thematrix-diﬀerencemethodandtheregressionmethod.The
procedureforthematrix-diﬀerencemethodisthis: