Chapter19. Dynamicpanelmodels
170
main()
{
decl dpd d = new w DPD();
dpd.Load("abdata.in7");
dpd.SetYear("YEAR");
// model-specific code here
delete dpd;
}
Intheexamplesbelowwetakethistemplateforgrantedandshowjustthemodel-specificcode.
Example1
ThefollowingOx/DPDcode—drawnfromabest1.ox—replicatescolumn(b)ofTable4inArellano
andBond(1991),aninstanceofthedifferences-onlyorGMM-DIFestimator.Thedependentvariable
isthelogofemployment,n;theregressorsincludetwolagsofthedependentvariable,currentand
laggedvaluesofthelogreal-productwage,w,thecurrentvalueofthelogofgrosscapital,k,and
currentandlaggedvaluesofthelogofindustryoutput,ys. Inadditionthespecificationincludes
aconstantandfiveyeardummies;unlikethestochasticregressors,thesedeterministictermsare
notdifferenced. Inthisspecificationtheregressorsw,kandysaretreatedasexogenousandserve
astheirowninstruments.InDPDsyntaxthisrequiresenteringthesevariablestwice,ontheX_VAR
andI_VARlines. TheGMM-type(block-diagonal)instrumentsinthisexamplearethesecondand
subsequentlagsofthelevelofn.Both1-stepand2-stepestimatesarecomputed.
dpd.SetOptions(FALSE); // don’t use robust standard d errors
dpd.Select(Y_VAR, {"n", 0, 2});
dpd.Select(X_VAR, {"w", 0, 1, , "k", , 0, 0, , "ys", , 0, 1});
dpd.Select(I_VAR, {"w", 0, 1, , "k", , 0, 0, , "ys", , 0, 1});
dpd.Gmm("n", 2, 99);
dpd.SetDummies(D_CONSTANT + D_TIME);
print("\n\n***** Arellano & Bond (1991), , Table e 4 (b)");
dpd.SetMethod(M_1STEP);
dpd.Estimate();
dpd.SetMethod(M_2STEP);
dpd.Estimate();
Hereisgretlcodetodothesamejob:
open abdata.gdt
list X = = w w w(-1) k k ys s ys(-1)
dpanel 2 2 ; ; n X const --time-dummies --asy y --dpdstyle
dpanel 2 2 ; ; n X const --time-dummies --asy y --two-step --dpdstyle
Notethatingretltheswitchtosuppressrobuststandarderrorsis--asymptotic,hereabbreviated
to--asy.
4
The--dpdstyleflagspecifiesthattheconstantanddummiesshouldnotbedifferenced,
inthecontextofaGMM-DIFmodel.Withgretl’sdpanelcommanditisnotnecessarytospecifythe
exogenous regressorsastheirowninstrumentssincethisisthedefault;similarly,theuseofthe
secondandalllongerlagsofthedependentvariableasGMM-typeinstrumentsisthedefaultand
neednotbestatedexplicitly.
4
Optionflagsingretlcanalwaysbetruncated,downtotheminimaluniqueabbreviation.
Convert pdf pages to jpg - 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
batch convert pdf to jpg online; convert pdf pages to jpg online
Convert pdf pages to jpg - 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
.net pdf to jpg; .pdf to jpg converter online
Chapter19. Dynamicpanelmodels
171
Example2
TheDPDfileabest3.oxcontainsavariantoftheabovethatdifferswithregardtothechoiceof
instruments: thevariableswandkarenowtreatedaspredetermined,andareinstrumentedGMM-
styleusingthesecondandthirdlags oftheirlevels. . Thisapproximatescolumn(c)ofTable4in
Arellano andBond(1991). Wehavemodifiedthecodeinabest3.ox x slightlyto allowtheuseof
robust(Windmeijer-corrected)standarderrors,whicharethedefaultinbothDPDandgretlwith
2-stepestimation:
dpd.Select(Y_VAR, {"n", 0, 2});
dpd.Select(X_VAR, {"w", 0, 1, , "k", , 0, 0, , "ys", , 0, 1});
dpd.Select(I_VAR, {"ys", 0, 1});
dpd.SetDummies(D_CONSTANT + D_TIME);
dpd.Gmm("n", 2, 99);
dpd.Gmm("w", 2, 3);
dpd.Gmm("k", 2, 3);
print("\n***** Arellano & Bond d (1991), , Table 4 (c)\n");
print("
(but using g different instruments!!)\n");
dpd.SetMethod(M_2STEP);
dpd.Estimate();
Thegretlcodeisasfollows:
open abdata.gdt
list X = = w w w(-1) k k ys s ys(-1)
list Ivars = ys ys(-1)
dpanel 2 2 ; ; n X const ; GMM(w,2,3) GMM(k,2,3) Ivars --time --two-step --dpd
Notethatsincewearenowcallingforaninstrumentsetotherthenthedefault(followingthesecond
semicolon), itis necessary toincludetheIvars specificationfor thevariableys. . However, , itis
notnecessarytospecifyGMM(n,2,99) sincethisremainsthedefaulttreatmentofthedependent
variable.
Example3
Our thirdexamplereplicatestheDPDoutputfrombbest1.ox: : thisusesthesamedatasetasthe
previousexamplesbutthemodelspecificationsarebasedonBlundellandBond(1998),andinvolve
comparisonoftheGMM-DIFandGMM-SYS(“system”)estimators.Thebasicspecificationisslightly
simplifiedinthatthevariableysisnotusedandonlyonelagofthedependentvariableappearsas
aregressor.TheOx/DPDcodeis:
dpd.Select(Y_VAR, {"n", 0, 1});
dpd.Select(X_VAR, {"w", 0, 1, , "k", , 0, 1});
dpd.SetDummies(D_CONSTANT + D_TIME);
print("\n\n***** Blundell & Bond (1998), , Table e 4: 1976-86 GMM-DIF");
dpd.Gmm("n", 2, 99);
dpd.Gmm("w", 2, 99);
dpd.Gmm("k", 2, 99);
dpd.SetMethod(M_2STEP);
dpd.Estimate();
print("\n\n***** Blundell & Bond (1998), , Table e 4: 1976-86 GMM-SYS");
dpd.GmmLevel("n", 1, 1);
dpd.GmmLevel("w", 1, 1);
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.
to jpeg; change from pdf to jpg on
C# Image Convert: How to Convert Tiff Image to Jpeg, Png, Bmp, &
RasterEdge.XDoc.Office.Inner.Office03.dll. RasterEdge.XDoc.PDF.dll. This demo code convert TIFF file all pages to jpg images.
convert pdf to jpg 100 dpi; pdf to jpeg
Chapter19. Dynamicpanelmodels
172
dpd.GmmLevel("k", 1, 1);
dpd.SetMethod(M_2STEP);
dpd.Estimate();
Hereisthecorrespondinggretlcode:
open abdata.gdt
list X = = w w w(-1) k k k(-1)
list Z = = w w k
# Blundell & Bond (1998), Table 4: 1976-86 GMM-DIF
dpanel 1 1 ; ; n X const ; GMM(Z,2,99) --time e --two-step --dpd
# Blundell & Bond (1998), Table 4: 1976-86 GMM-SYS
dpanel 1 1 ; ; n X const ; GMM(Z,2,99) GMMlevel(Z,1,1) \
--time --two-step --dpd d --system
Notetheuseofthe--systemoptionflagto specifyGMM-SYS,includingthedefaulttreatmentof
thedependent variable, , which h corresponds to o GMMlevel(n,1,1). . In n this casewe also o want t to
uselagged differences of theregressors w andk k as s instruments for thelevels equations so o we
needexplicitGMMlevel entriesforthosevariables. . Ifyouwantsomethingotherthanthedefault
treatmentforthedependentvariableasaninstrumentforthelevelsequations,youshouldgivean
explicitGMMlevelspecificationforthatvariable—andinthatcasethe--systemflagisredundant
(butharmless).
Forthesakeofcompleteness,notethatifyouspecifyatleastoneGMMlevelterm,dpanelwillthen
includeequationsinlevels,butitwillnotautomaticallyaddadefaultGMMlevelspecificationfor
thedependentvariableunlessthe--systemoptionisgiven.
19.4 Cross-countrygrowthexample
Thepreviousexamplesallused theArellano–Bond dataset; ; for r this exampleweusethedataset
CEL.gdt,whichisalso includedinthegretldistribution. . AswiththeArellano–Bonddata, , there
arenumerousmissingvalues. Detailsoftheprovenanceofthedatacanbefoundbyopeningthe
datasetinformationwindowinthegretlGUI(Datamenu,Datasetinfoitem).Thisisasubsetofthe
Barro–Lee138-countrypaneldataset,anapproximationto whichis usedinCaselli, Esquiveland
Lefort(1996)andBond, Hoeffler andTemple(2001).Bothofthesepapersexplorethedynamic
panel-dataapproachinrelationtotheissuesofgrowthandconvergenceofpercapitaincomeacross
countries.
The dependent variable is s growth in real GDP per r capita over r successivefive-year periods; ; the
regressors arethelogoftheinitial(fiveyearsprior)valueofGDPper capita,thelog-ratio ofin-
vestmentto GDP,s, inthepriorfiveyears,andthelogof annualaveragepopulationgrowth,n,
overthepriorfiveyearsplus0.05asstand-infortherateoftechnicalprogress,g,plustherateof
depreciation,(withthelasttwotermsassumedtobeconstantacrossbothcountriesandperiods).
Theoriginalmodelis
Ñ
5
y
it
y
i;t 5
s
it
n
it
g
t
i
it
(19.7)
whichallowsforatime-specificdisturbance
t
. TheSolowmodelwithCobb–Douglasproduction
functionimpliesthat  ,butthisassumptionisnotimposedinestimation. . Thetime-specific
disturbanceiseliminatedbysubtractingtheperiodmeanfromeachoftheseries.
5
Wesayan“approximation”becausewehavenotbeenabletoreplicateexactlytheOLSresultsreportedinthepapers
cited,thoughitseemsfromthedescriptionofthedatainCasellietal.(1996)thatweoughttobeabletodoso.Wenote
thatBondetal.(2001)useddataprovidedbyProfessorCaselliyetdidnotmanagetoreproducethelatter’sresults.
C# Create PDF from images Library to convert Jpeg, png images to
Batch convert PDF documents from multiple image formats, including Jpg, Png, Bmp, Gif, Tiff, Bitmap, .NET Graphics, and REImage.
change format from pdf to jpg; convert pdf image to jpg
VB.NET PDF Convert to Images SDK: Convert PDF to png, gif images
Resize converted image files in VB.NET. Convert PDF to Jpg, Png, Bmp, Gif, Tiff and Bitmap in ASP.NET. Embed PDF to image converter in viewer.
changing pdf to jpg; convert pdf file into jpg format
Chapter19. Dynamicpanelmodels
173
Equation(19.7)canbetransformedtoanAR(1)dynamicpanel-datamodelbyaddingy
i;t 5
toboth
sides,whichgives
y
it
1y
i;t 5
s
it
n
it
g
i
it
(19.8)
whereallvariablesarenowassumedtobetime-demeaned.
In(rough)replicationofBondetal.(2001)wenowproceedtoestimatethefollowingtwomodels:
(a)equation(19.8)viaGMM-DIF,usingasinstrumentsthesecondandalllongerlagsofy
it
,s
it
and
n
it
g; and(b)equation (19.8)viaGMM-SYS,using Ñy
i;t 1
s
i;t 1
andÑn
i;t 1
gas
additionalinstrumentsinthelevelsequations.Wereportrobuststandarderrorsthroughout.(Asa
purelynotationalmatter,wenowuse“t 1”torefertovaluesfiveyearspriortot,asinBondetal.
(2001)).
Thegretlscript to o do thisjob b is s shown below. . Notethatthefinal l transformed versions of the
variables(logs,withtime-meanssubtracted)arenamedly(y
it
),linv(s
it
)andlngd(n
it
g).
open CEL.gdt
ngd = n n + + 0.05
ly = log(y)
linv = log(s)
lngd = log(ngd)
# take out time means
loop i=1..8 --quiet
smpl (time == i) ) --restrict --replace
ly -= = mean(ly)
linv -= mean(linv)
lngd -= mean(lngd)
endloop
smpl --full
list X = = linv v lngd
# 1-step p GMM-DIF
dpanel 1 1 ; ; ly X ; GMM(X,2,99)
# 2-step p GMM-DIF
dpanel 1 1 ; ; ly X ; GMM(X,2,99) ) --two-step
# GMM-SYS
dpanel 1 1 ; ; ly X ; GMM(X,2,99) ) GMMlevel(X,1,1) ) --two-step --sys
ForcomparisonweestimatedthesametwomodelsusingOx/DPDandtheStatacommandxtabond2.
(Ineachcaseweconstructedacomma-separatedvaluesdatasetcontainingthedataastransformed
inthegretlscriptshownabove,usingamissing-valuecodeappropriatetothetargetprogram.)For
reference,thecommandsusedwithStataarereproducedbelow:
insheet using g CEL.csv
tsset unit time
xtabond2 ly y L.ly linv lngd, gmm(L.ly, lag(1 99)) gmm(linv, lag(2 99))
gmm(lngd, lag(2 99)) rob nolev
xtabond2 ly y L.ly linv lngd, gmm(L.ly, lag(1 99)) gmm(linv, lag(2 99))
gmm(lngd, lag(2 99)) rob nolev twostep
xtabond2 ly y L.ly linv lngd, gmm(L.ly, lag(1 99)) gmm(linv, lag(2 99))
gmm(lngd, lag(2 99)) rob nocons twostep
FortheGMM-DIFmodelallthreeprogramsfind382usableobservationsand30instruments,and
yieldidenticalparameterestimatesandrobuststandarderrors(uptothenumberofdigitsprinted,
ormore);seeTable19.1.
6
6
Thecoefficientshownforly(-1)intheTablesisthatreporteddirectlybythesoftware;forcomparabilitywiththe
originalmodel(eq.19.7)itisnecesarytosubtract1,whichproducestheexpectednegativevalueindicatingconditional
convergenceinpercapitaincome.
VB.NET PDF - Convert PDF with VB.NET WPF PDF Viewer
Create multiple pages Tiff file from PDF document. Convert PDF to image file formats with high quality, support converting PDF to PNG, JPG, BMP and GIF.
convert pdf to jpg 300 dpi; best pdf to jpg converter for
C# TIFF: C#.NET Code to Convert JPEG Images to TIFF
Use C# Code to Convert Jpeg to Tiff. string[] imagePaths = { @"C:\demo1.jpg", @"C:\demo2.jpg", @"C:\demo3.jpg" }; // Construct List<REImage> object.
batch pdf to jpg converter; convert pdf pages to jpg
Chapter19. Dynamicpanelmodels
174
1-step
2-step
coeff
std.error
coeff
std.error
ly(-1)
0.577564
0.1292
0.610056
0.1562
linv
0.0565469
0.07082
0.100952
0.07772
lngd
0.143950
0.2753
0.310041
0.2980
Table19.1:GMM-DIF:Barro–Leedata
Resultsfor GMM-SYSestimationareshowninTable19.2. Inthiscaseweshowtwosetsofgretl
results:thoselabeled“gretl(1)”wereobtainedusinggretl’s--dpdstyleoption,whilethoselabeled
“gretl(2)”didnotusethatoption—theintentbeingtoreproducetheHmatricesusedbyOx/DPD
andxtabond2respectively.
gretl(1)
Ox/DPD
gretl(2)
xtabond2
ly(-1)
0.9237(0.0385)
0.9167(0.0373)
0.9073(0.0370)
0.9073(0.0370)
linv
0.1592(0.0449)
0.1636(0.0441)
0.1856(0.0411)
0.1856(0.0411)
lngd
0.2370(0.1485)  0.2178(0.1433)  0.2355(0.1501)  0.2355(0.1501)
Table19.2: 2-stepGMM-SYS:Barro–Leedata(standarderrorsinparentheses)
Inthiscaseallthreeprogramsuse479observations;gretlandxtabond2use41instrumentsand
producethesameestimates(whenusing thesamematrix)whileOx/DPDnominallyuses66.7
ItisnoteworthythatwithGMM-SYSplus“messy”missingobservations,theresultsdependonthe
precisearrayofinstrumentsused,whichinturndependsonthedetailsoftheimplementationof
theestimator.
19.5 Auxiliaryteststatistics
Wehaveconcentrated aboveonthe parameter estimatesand standarderrors. . Itmaybeworth
addingafewwords ontheadditionalteststatisticsthattypicallyaccompanybothGMM-DIFand
GMM-SYSestimation. TheseincludetheSargantestforoveridentification,oneormoreWaldtests
forthejointsignificanceoftheregressors(andtimedummies,ifapplicable)andtestsforfirst-and
second-orderautocorrelationoftheresidualsfromtheequationsindifferences.
AsinOx/DPD,theSarganteststatisticreportedbygretlis
S
0
@
XN
i1
ˆ
vvv
0
i
ZZZ
i
1
A
AAA
N
0
@
XN
i1
ZZZ
0
i
ˆ
vvv
i
1
A
wherethe
ˆ
v
v
v
i
arethetransformed(e.g.differenced)residualsforuniti. Underthenullhypothesis
thattheinstrumentsarevalid,Sisasymptoticallydistributedaschi-squarewithdegreesoffreedom
equaltothenumberofoveridentifyingrestrictions.
Ingeneralweseeagoodlevelofagreementbetweengretl,DPDandxtabond2withregardtothese
statistics,withafewrelativelyminorexceptions. Specifically,xtabond2computesbotha“Sargan
test”anda“Hansentest”foroveridentification,butwhatitcallstheHansentestis,apparently,what
DPDcallstheSargantest. (Wehavehaddifficultydeterminingfromthextabond2documentation
(Roodman,2006)exactlyhowitsSargantestiscomputed.) Inadditiontherearecaseswherethe
degreesof freedom for theSargan testdiffer r between DPDand d gretl; ; this s occurswhen theA
A
A
N
matrixissingular (section19.1). . Inconceptthedfequalsthenumberofinstruments s minus the
7
Thisisacaseoftheissuedescribedinsection19.1:thefullA
A
A
N
matrixturnsouttobesingularandspecialmeasures
mustbetakentoproduceestimates.
C# WPF PDF Viewer SDK to convert and export PDF document to other
Create multiple pages Tiff file from PDF document. Convert PDF to image file formats with high quality, support converting PDF to PNG, JPG, BMP and GIF.
changing file from pdf to jpg; change pdf file to jpg file
VB.NET Create PDF from images Library to convert Jpeg, png images
Components to batch convert PDF documents in Visual Basic .NET class. Support create PDF from multiple image formats in VB.NET, including Jpg, Png, Bmp, Gif
.net convert pdf to jpg; convert .pdf to .jpg
Chapter19. Dynamicpanelmodels
175
numberofparametersestimated;forthefirstofthesetermsgretlusestherankofAAA
N
,whileDPD
appearstousethefulldimensionofthismatrix.
19.6 Memo: : dpaneloptions
flag
effect
--asymptotic
Suppressestheuseofrobuststandarderrors
--two-step
Callsfor2-stepestimation(thedefaultbeing1-step)
--system
CallsforGMM-SYS,withdefaulttreatmentofthedependentvariable,
asinGMMlevel(y,1,1)
--time-dummies
Includesperiod-specificdummyvariables
--dpdstyle
Compute thematrix as in DPD; also suppresses s differencing of
automatic timedummiesandomissionofinterceptintheGMM-DIF
case
--verbose
When--two-stepisselected,printsthe1-stepestimatesfirst
--vcv
Callsforprintingofthecovariancematrix
--quiet
Suppressestheprintingofresults
Thetimedummiesoptionsupportsthequalifiernoprint,asin
--time-dummies=noprint
Thismeansthatalthoughthedummiesareincludedinthespecificationtheircoefficients,standard
errorsandsoonarenotprinted.
Chapter20
Nonlinearleastsquares
20.1 Introductionandexamples
Gretlsupportsnonlinearleastsquares(NLS)usingavariantoftheLevenberg–Marquardtalgorithm.
Theusermustsupplyaspecificationoftheregressionfunction;priortogivingthisspecificationthe
parameterstobeestimatedmustbe“declared”andgiveninitialvalues. Optionally,theusermay
supply analytical derivatives ofthe regressionfunction with respectto o each h ofthe parameters.
Ifderivatives arenotgiven, theuser must instead givealistof theparametersto beestimated
(separatedbyspacesorcommas), precededbythekeywordparams. . Thetolerance(criterionfor
terminatingtheiterativeestimationprocedure)canbeadjustedusingthesetcommand.
Thesyntaxforspecifyingthefunctiontobeestimatedisthesameasforthegenrcommand.Here
aretwoexamples,withaccompanyingderivatives.
# Consumption function from Greene
nls C = = alpha a + beta * Y^gamma
deriv alpha = 1
deriv beta = Y^gamma
deriv gamma = beta * Y^gamma * log(Y)
end nls
# Nonlinear function from Russell Davidson
nls y = = alpha a + beta * x1 + (1/beta) * x2
deriv alpha = 1
deriv beta = x1 1 - - x2/(beta*beta)
end nls s --vcv
Notethecommandwordsnls(whichintroducestheregressionfunction),deriv(whichintroduces
thespecification of aderivative), and end d nls, , which terminates the e specification and calls s for
estimation. Ifthe--vcv v flagisappendedto thelastlinethecovariancematrixoftheparameter
estimatesisprinted.
20.2 Initializingtheparameters
Theparametersoftheregressionfunctionmustbegiveninitialvaluespriortothenlscommand.
Thiscanbedoneusingthegenrcommand(or, intheGUIprogram,viathemenuitem“Variable,
Definenewvariable”).
Insomecases,wherethenonlinearfunctionisageneralizationof(orarestrictedformof)alinear
model,itmaybeconvenienttorunanolsandinitializetheparametersfromtheOLScoefficient
estimates.Inrelationtothefirstexampleabove,onemightdo:
ols C 0 0 Y
genr alpha = $coeff(0)
genr beta = $coeff(Y)
genr gamma = 1
Andinrelationtothesecondexampleonemightdo:
176
Chapter20. Nonlinearleastsquares
177
ols y 0 0 x1 1 x2
genr alpha = $coeff(0)
genr beta = $coeff(x1)
20.3 NLSdialogwindow
Itis probablymost convenient to composethe e commands s for r NLS estimationin theformof f a
gretlscriptbutyoucanalso dosointeractively, byselecting theitem“Nonlinear LeastSquares”
under the “Model, Nonlinear models” menu. . This s opens a a dialog g box x where you can type the
functionspecification(possiblyprefacedbygenrlinestosettheinitialparametervalues)andthe
derivatives,ifavailable. AnexampleofthisisshowninFigure20.1. Notethatinthiscontextyou
donothavetosupplythenlsandend nlstags.
Figure20.1: NLSdialogbox
20.4 Analyticalandnumericalderivatives
Ifyouareabletofigureoutthederivativesoftheregressionfunctionwithrespecttotheparam-
eters, itis advisableto supply thosederivatives asshownin theexamples above. . Ifthatis s not
possible,gretlwillcomputeapproximatenumericalderivatives.However,thepropertiesoftheNLS
algorithmmaynotbesogoodinthiscase(seesection20.7).
This is s done by y using the params statement, , which should be followed d by a list of identifiers
containingtheparameterstobeestimated.Inthiscase,theexamplesabovewouldreadasfollows:
# Greene
nls C = = alpha a + beta * Y^gamma
params alpha beta gamma
end nls
# Davidson
nls y = = alpha a + beta * x1 + (1/beta) * x2
params alpha beta
end nls
Ifanalyticalderivatives aresupplied, , they y arechecked for r consistencywith h thegiven nonlinear
function.Ifthederivativesareclearlyincorrectestimationisabortedwithanerrormessage.Ifthe
Chapter20. Nonlinearleastsquares
178
derivativesare“suspicious”awarningmessageis issuedbutestimationproceeds. . Thiswarning
maysometimesbetriggeredbyincorrectderivatives,butitmayalsobetriggeredbyahighdegree
ofcollinearityamongthederivatives.
Notethatyoucannotmixanalyticalandnumericalderivatives:youshouldsupplyexpressionsfor
allofthederivativesornone.
20.5 Controllingtermination
TheNLSestimationprocedureisaniterativeprocess.Iterationisterminatedwhenthecriterionfor
convergenceismetorwhenthemaximumnumberofiterationsisreached,whichevercomesfirst.
Letkdenotethenumberofparameters beingestimated. . Themaximum m number r ofiterationsis
100k1whenanalyticalderivativesaregiven,and200k1whennumericalderivatives
areused.
Let denoteasmall number. . Theiterationis s deemed to haveconverged if atleast one e of the
followingconditionsissatisfied:
 Boththeactualandpredictedrelativereductionsintheerrorsumofsquaresareatmost.
 Therelativeerrorbetweentwoconsecutiveiteratesisatmost.
Thisdefaultvalueofisthemachineprecisiontothepower3/4,butitcanbeadjustedusingthe
setcommandwiththeparameternls_toler. Forexample
set nls_toler .0001
willrelaxthevalueofto0.0001.
20.6 Detailsonthecode
Theunderlying enginefor NLSestimationis based ontheminpack suiteoffunctions, available
fromnetlib.org. Specifically,thefollowingminpackfunctionsarecalled:
lmder
Levenberg–Marquardtalgorithmwithanalyticalderivatives
chkder
Checkthesuppliedanalyticalderivatives
lmdif
Levenberg–Marquardtalgorithmwithnumericalderivatives
fdjac2
ComputefinalapproximateJacobianwhenusingnumericalderivatives
dpmpar
Determinethemachineprecision
OnsuccessfulcompletionoftheLevenberg–Marquardtiteration,aGauss–Newtonregressionisused
to calculatethe e covariancematrixfor r theparameter estimates. . If f the--robust flagis given a
robustvariantiscomputed.Thedocumentationforthesetcommandexplainsthespecificoptions
availableinthisregard.
SinceNLSresults areasymptotic, thereis room for debateover whether or notacorrectionfor
degreesoffreedomshouldbeappliedwhencalculatingthestandarderroroftheregression(and
thestandarderrorsoftheparameter estimates). . For r comparabilitywithOLS,andinlightofthe
reasoninggiveninDavidsonandMacKinnon(1993),theestimatesshowningretldouseadegrees
offreedomcorrection.
1
Ona32-bitIntelPentiummachinealikelyvalueforthisparameteris1:8210
12
.
Chapter20. Nonlinearleastsquares
179
20.7 Numericalaccuracy
Table20.1shows theresults of runningthegretlNLS S procedureonthe27StatisticalReference
DatasetsmadeavailablebytheU.S.NationalInstituteofStandardsandTechnology(NIST)fortest-
ingnonlinearregressionsoftware.
2
Foreachdataset,twosetsofstartingvaluesfortheparameters
aregiveninthetestfiles, sothefulltestcomprises54runs. . Twofulltestswereperformed,one
usingallanalyticalderivativesandoneusingallnumericalapproximations.Ineachcasethedefault
tolerancewasused.
3
Outofthe54runs,gretlfailedtoproduceasolutionin4caseswhenusinganalyticalderivatives,
and in5caseswhenusing numericapproximation. . Ofthefourfailures s inanalyticalderivatives
mode,twowereduetonon-convergenceoftheLevenberg–Marquardtalgorithmafterthemaximum
numberofiterations(onMGH09andBennett5,bothdescribedbyNISTasof“Higherdifficulty”)and
twowereduetogenerationofrangeerrors(out-of-boundsfloatingpointvalues)whencomputing
theJacobian (on BoxBOD D andMGH17, , described d as of “Higher difficulty”and“Averagedifficulty”
respectively).TheadditionalfailureinnumericalapproximationmodewasonMGH10(“Higherdiffi-
culty”,maximumnumberofiterationsreached).
Thetablegivesinformationonseveralaspects of thetests: : thenumber r of outrightfailures, the
averagenumberofiterationstakentoproduceasolutionandtwosortsofmeasureoftheaccuracy
oftheestimatesforboththeparametersandthestandarderrorsoftheparameters.
For each h ofthe 54 runs in eachmode, , if f the run produced a solution theparameter estimates
obtainedbygretlwerecomparedwiththeNISTcertifiedvalues. Wedefinethe“minimumcorrect
figures”foragivenrunasthenumberofsignificantfigurestowhichtheleastaccurategretlesti-
mateagreedwiththecertifiedvalue,forthatrun.Thetableshowsboththeaverageandtheworst
casevalueofthisvariableacrossalltherunsthatproducedasolution. Thesameinformationis
shownfortheestimatedstandarderrors.
4
Thesecondmeasureofaccuracyshownisthepercentageofcases,takingintoaccountallparame-
tersfromallsuccessfulruns,inwhichthegretlestimateagreedwiththecertifiedvaluetoatleast
the6significantfigureswhichareprintedbydefaultinthegretlregressionoutput.
Usinganalyticalderivatives,theworstcasevaluesfor bothparametersandstandarderrorswere
improvedto 6correctfiguresonthetestmachinewhenthetolerancewas tightenedto1.0e 14.
Using numerical derivatives, , the same tightening g of the e tolerance raised the worst values s to o 5
correctfiguresfor theparameters and 3figuresfor standard errors, atacostof oneadditional
failureofconvergence.
Notetheoverall superiority ofanalyticalderivatives: : onaveragesolutions s to thetest problems
wereobtainedwithsubstantiallyfeweriterationsandtheresultsweremoreaccurate(mostnotably
fortheestimatedstandarderrors). Notealsothatthesix-digitresultsprintedbygretlarenot100
percentreliablefordifficultnonlinearproblems(inparticularwhenusingnumericalderivatives).
Havingregisteredthiscaveat,thepercentageofcaseswheretheresultsweregoodtosixdigitsor
betterseemshighenoughtojustifytheirprintinginthisform.
2
Foradiscussionofgretl’saccuracyintheestimationoflinearmodels,seeAppendixD.
3
Thedatashown in the table weregathered froma pre-releasebuild of gretl version 1.0.9,compiledwithgcc3.3,
linkedagainstglibc2.3.2,andrununderLinuxonani686PC(IBMThinkPadA21m).
4Forthestandarderrors,Iexcludedoneoutlierfromthestatisticsshowninthetable,namelyLanczos1. Thisisan
odd case,usinggenerated data withan almost-exactfit: : the e standard errors are9 or 10ordersof magnitudesmaller
than the coefficients. . Inthis s instance gretlcould reproduce the certified standard errorsto only3figures(analytical
derivatives)and2figures(numericalderivatives).
Documents you may be interested
Documents you may be interested