Está en la página 1de 439

IRIS Toolbox Reference Manual

Version #2 13 523 Runs in Matlab R2010a or later

Jaromr Bene
23 May 2013

by

ss oolox eferene wnul gopyright PHHU!PHIQ tromr feneF

Preface
ss is wtl toolox for mroeonomi modellingF st is freeD openEsoure softwre distriuted under fh liene termsF he urrent version of ss runs in wtl PHIH or lterF

Contents
Part I  IRIS sessions
1 Installing IRIS 2 Starting, quitting, and conguring IRIS 3 Getting on-line help

7
8 10 20

Part II  Modelling
4 Model le language 5 Model objects and functions 6 Simulation plans 7 System priors 8 Posterior objects and functions 9 Probability distribution package 10 Steady-state le language 11 Steady-state objects and functions 12 Matrices with named rows and columns

22
23 66 152 164 169 176 182 187 190

Part III  Multivariate time series analysis


13 Vector autoregressions: VAR objects and functions 14 Structural vector autoregressions: SVAR objects and functions

195
196 231

15 Bayesian VAR prior dummies: BVAR package 16 Factor-augmented vector autoregressions: FAVAR objects and functions

241 246

Part IV  Time series and database management


17 Dates and date ranges 18 Time series objects and functions 19 Basic database management

256
257 280 349

Part V  Reporting and publishing


20 Report functions 21 Quick-report le language 22 Quick-report functions 23 Graphics functions

375
376 415 421 426

Preface
ss is wtl toolox for mroeonomi modellingF st is freeD openEsoure softwre distriuted under fh liene termsF he urrent version of ss runs in wtl PHIH or lterF

Part I 
IRIS sessions

snstlling ss

1 Installing IRIS
Requirements
wtl PHHW or lterF

Optional components

Optimization Toolbox
he yptimiztion oolox is needed to ompute the stedy stte of nonEliner modelsD nd to run estimtionF

LaTeX
ve is free typesetting system used to produe hp reports in ssF e reommend wiueD ville from www.miktex.orgF

Components not needed


ome omponents were needed in the pst ut re not ny longerF

X12-ARIMA
gourtesy of the FF gensus fureuD the IPEeswe progrm is now inoported inD nd disE triuted with ssF ou don9t need to re out nything to e le to use itF

Symbolic Math Toolbox


ss is now equipped with its own symoliGutomti di'erentitorD so you do not need to hve the ymoli wth oolox instlled to e le to ompute ext ylor expnsionsF

Installing IRIS

Step 1
hownlod the ltest ss zip rhiveD IRIS_Tbx_#_YYYYMMDD.zipD from www.iris-toolbox.comD nd sve it in temporry lotion on your diskF

Step 2
nzip the rhive into folder on your hrd driveD eFgF C:\IRIS_TbxF e will ll this diretory the ss root folderF V

snstlling ss snstlling ss on network drive my use some minor prolemsD espeilly on w indows systemsY hek out help changeNotification in wtlF

Step 3
efter instlling new version of ssD we reommend tht you remove ll older versions of ss from the wtl serh pthD nd restrt wtlF

Getting started
ih time you wnt to strt working with ssD run the following line
>> addpath C:\IRIS_Tbx; irisstartup

where C:\IRIS_Tbx needs to eD oviouslyD repled with the proper ss root folder hosen in tep P oveF elterntivelyD you n put the ss root folder permnently on the wtl seth pth @using the menu pile E et thAD nd only run the irisstartup ommnd t the eginning of eh ss sessionF ee lso the setion on trting nd quitting ss P10 F

Syntax highlighting
ou n get the model (les @iFeF the (les tht desrie the model equtionsD vrilesD prmetersA syntxEhighlightedF yntx highlighting improves enormously the redility of the (lesF st helps you understnd the model etterD nd disover typos nd mistkes more quiklyF edd ny numer of extensions you wnt to use for model (les @suh s modD modelD etFA to the wtl editorF ypen the menu pile E referenesD nd lik on the iditorGheugger E vnguge t @mke sure wtl9 is seleted t the top s the vngugeAF se the edd utton in the pile extensions pnel to ssoite ny numer of new extensions with the editorF eEstrt the editorF he ss model (les will e syntx highligted from tht moment onF

trtingD quittingD nd on(guring ss

2 Starting, quitting, and conguring IRIS


his setion desries how to strt nd quit n ss sessionD nd how to ustomise some of the ss on(gurtion optionsF he most ommon wy of strting n ss session @fter you hve instlled the ss (les on your diskA is to run the following line in the wtl ommnd windowX
addpath C:\IRIS_Tbx; irisstartup();

he (rst ommndD addpathD dds the ss root folder to the wtl serh pthF he seond ommndD irisstartupD initilises ss nd puts the other neessry ss sufoldersD lssesD nd internl pkges on the serh pthF xever dd these other sufoldersD lsses nd pkges to the serh pth y yourselfF

Starting and quitting IRIS


irisstartup P16 E trt n ss sessionF irisfinish P11 E glose the urrent ss sessionF iriscleanup P11 E emove ss from wtl nd len upF

Getting information about IRIS


irisget P12 E uery urrent ss on(g optionsF irisroot P14 E gurrent ss root folderF irisrequired P13 E hrow error if the instlled version of ss fils to omply with the required minimumF irisversion P18 E gurrent ss versionF

Changes in conguration
irisset P15 E ghnge on(gurle ss optionsF irisreset P14 E eset ss on(gurtion options to strtEup vluesF irisuserconfig P17 E ser on(gurtion (le lled t the ss strtEupF

IH

trtingD quittingD nd on(guring ssX irisfinish

Getting on-line help on conguration functions


help config help function_name

iriscleanup
Remove IRIS from Matlab and clean up
Syntax
iriscleanup

Description
his sript removes ss foldersD inluding the root folderD from oth the wtl serh pthD nd lers persistent vriles in some of the kend funtionsF e short messge is displyed with the list of folders removed from the pthF

irisnish
Close the current IRIS session
Syntax
irisfinish irisfinish -shutup

Description
his funtion removes ll ss sufolders from the temporry wtl serh pthD nd lers persistent vriles in some of the kend funtionsF e short messge is displyed with the list of

II

trtingD quittingD nd on(guring ssX irisget sufolders removed from the pth unless you ll use the option -shutupF xote tht the ss root folder stys on the permnent wtl pthF

Example

irisget
Query current IRIS cong options
Syntax
Value = irisget(Option) S = irisget()

Input arguments
Option hr E xme of the queried ss on(gurtion optionF

Output arguments
Value F F F E gurrent vlue of the queried on(gurtion optionF S strut E truture with ll on(gurtion options nd their urrent vluesF

Description
ou n view ny of the modi(le options listed in irisset P15 D plus the following nonEmodi(le ones @these nnot e hnged y the userAX userConfigPath= hr E he pth to the user on(gurtion (le lled y the lst exeuted irisstartup P16 F irisRoot= hr E he urrent ss root diretoryF version= hr E he urrent ss version stringF hen lled without ny input rgumentsD the irisget funtion returns strut with ll options nd their urrent vluesF IP

trtingD quittingD nd on(guring ssX irisrequired

Example
irisget(dateformat) ans = YFP g = irisget(); g.dateformat ans = YFP

irisrequired
Throw error if the installed version of IRIS fails to comply with the required minimum
Syntax
irisrequired(V)

Input arguments
V hr E ext string desriing the oldest eptle distriution of ssF

Description
sf the version of ss present on the omputer does not omply with the minimum requirement vD n error is thrownF

Example
ell of the three lls re vlidX IQ

trtingD quittingD nd on(guring ssX irisroot


irisrequired(2 111222); irisrequired(2 111222); irisrequired 2 111222;

irisreset
Reset IRIS conguration options to start-up values
Syntax
irisreset

Description
he irisreset funtion resets ll on(gurtion options to their defult ftory vluesD or to those in the tive irisuserconfig.m (le @if one existsAF

irisroot
Current IRIS root folder
Syntax
irisroot X = irisroot()

Output arguments
X hr E th to the ss root folderF

Description
he irisroot funtion is equivlent to the following ll to irisget P12 IR

trtingD quittingD nd on(guring ssX irisset


irisget(irisroot)

irisset
Change congurable IRIS options
Syntax
irisset(Option,Value) irisset(Option,Value,Option,Value,...)

Input arguments
Option hr E xme of the ss on(gurtion option tht will e modi(edF Value F F F E xew vlue tht will e ssigned to the optionF

Modiable IRIS conguration options

Dates and formats


dateFormat= hr | p9 E hte formt used to disply dtes in the ommnd windowD g dtsesD nd reportsF xote tht the defult dte formt for grphs is ontrolled y the plotdateformat= optionF he defult p9 mens tht the yerD frequeny letterD nd period is displyedF ee lso help on dat2str P263 for more dte formtting detilsF he dateformat= option is lso found in mny ss funtions whenever it is relevntD nd n e used to overwrite the irisset= settingsF freqLetters= hr | rfw9 E pive letters used to represent the (ve possile frequenies of the ss dtesX yerlyD hlfEyerlyD qurterlyD iEmonthlyD nd monthlyD suh s the 9 in PHIHI9 denotingF months= ellstr | {tnury9DF F F Dheemer9} E welve strings representing the nmes of the twelve monthsF his option n e used whenever you wnt to reple the defult inglish nmes with your lol lngugeF F plotDateFormat= hr | X9 E hte formt used to disply dtes in grphs inluding grphs in reportsF he defult is X9D whih is di'erent from the dateformat= optionF IS

trtingD quittingD nd on(guring ssX irisstartup tseriesFormat= hr | empty E pormt string for displying time series dt on the sreenF ee help on the wtl sprintf funtion for how to set up formt stringsF sf empty the defult formt of the num2str funtion is usedF tseriesMaxWSpace= numeri | 5 E wximum numer of white spes printed etween individul olumns of multivrite tseries ojet on the sreenF standinMonth= (rst9 | lst9 | numeri E his option spei(es whih month will e used to represent lowerEfrequeny periods @suh s qurtersA when monthEdisplying formt is used in dateformat=F

External tools used by IRIS


pdflatexPath= hr E votion of the pdflatex.exe progrmF his progrm is lled to ompile report nd pulish mE(lesF fy defultD ss ttempts to lote pdflatex.exe y running e9s kpsewhichD nd which on nix pltformsF epstopdfPath= hr E votion of the epstopdf.exe progrmF his progrm is lled to onvert i grphis (les to hps in reportsF

Other options
extensions= ellstr | {model9D9s9Dq9} E vist of extensions tht re utomtilly ssoE ited with the wtl editorF he dvntge of suh ssoitions is tht the ss model (les P23 D stedyEstte (les P182 D nd quikEreport P421 (les get syntxEhighlightedF

Description Example

irisstartup
Start an IRIS session
Syntax
irisstartup irisstartup -shutup

IT

trtingD quittingD nd on(guring ssX irisuserconfig

Description
e reommend tht you keep the ss root diretory on the permnent wtl serh pthF ih time you wish to strt working with ssD you run irisstartup form the ommnd lineF et the end of the sessionD you n run irisfinish P11 to remove ss sufolders from the temporry wtl serh pthD nd to ler persistent vriles in some of the kend funtionsF he irisstartup P16 performs the following stepsX edds neessry ss sudiretories to the temporry wtl serh pthF emoves redundnt ss folders @eFgF other or older instlltionsA from the wtl serh pthF esets ss on(gurtion options to defultD updtes the lotion of eGve exeutlesD nd lls irisuserconfig P17 to modify the on(gurtion optionF essoites the defult ss extensions with the wtl iditorF sf they hd not een ssoited eforeD wtl must e reEstrted for the ssoition to tke e'etF rints n introdutory messge on the sreen unless irisstartup is lled with the -shutup input rgumentF

irisusercong
User conguration le called at the IRIS start-up
Syntax
function c = irisuserconfig(c) c.option = value; c.option = value; ... end

Description
ou n rete your own on(gurtion (le to modify the generl ss options of your hoosing t eh ss strtEupF he (le must e sved s irisuserconfig.m on the wtl serh pthF

IU

trtingD quittingD nd on(guring ssX irisversion he irisuserconfig.m (le must e n mE(le funtion tking one input rgument @ strut with the ftory settingsAD nd returning one output rgument @ strut with the userEmodi(ed settingsAY see irisset P15 for the list of options you n hngeF sn dditionD you n lso dd your own new optionsD whih will e then lso essile through irisset P15 nd irisget P12 F

Example
sf you wnt the nmes of months to e displyed in pinnishD rete the following mE(le nd sve it in folder whih is on the wtl serh pthX
function c = irisuserconfig(c) c.months = { ... Tammikuu,Helmikuu,Maaliskuu, ... Huhtikuu,Toukokuu,Kesakuu, ... Heinakuu,Elokuu,Syyskuu, ... Lokakuu,Marraskuu,Joulukuu}; end

his modi(tion will tke e'et fter you next run irisstartup P16 F our grphs will e then )uent in pinnishX
x = tseries(mm(2 9,1):mm(2 9,6),@rand); plot(x,dateformat,MmmmYY);

irisversion
Current IRIS version
Syntax
irisversion X = irisversion()

Output arguments
X hr E tring desriing the urrently instlled ss versionF IV

trtingD quittingD nd on(guring ssX irisversion

Description
he version string onsists of the genertion numerD followed y dot nd the distriution dte @yyyymmddAF he irisversion funtion is equivlent to the following ll to lling irisget(version)F

IW

qetting onEline help

3 Getting on-line help


se either help or idoc to get help on ss funtionsX help displys the help topi in the ommnd windowD idoc displys the help topi in n rwv rowser windowF he following help topis re villeX
help help help help help help help help help help help help help help help help help help help help help help help help help help help help help help help help dates dates/function_name dbase dbase/function_name modellang modellang/keyword model model/function_name plan plan/function_name poster poster/function_name logdist logdist/function-name sstatelang sstatelang/keyword sstate sstate/function_name tseries tseries/function_name VAR VAR/function_name SVAR SVAR/function_name BVAR BVAR/function_name FAVAR FAVAR/function_name report report/function_name qreportlang qreportlang/keyword

PH

qetting onEline help


help help help help qreport qreport/keyword grfun grfun/function_name

ou n use idoc insted of help in the ove listF

PI

Part II 
Modelling

PP

wodel (le lnguge

4 Model le language


wodel (le lnguge is used to write model (lesF he model (les re plin text (les @sved under ny (lenme with ny extensionA tht desries the modelX its equtionsD vrilesD prmetersD etF he model (leD on the other hndD does not desrie wht to do with the modelF o run the tsks you wnt to perform with the modelD you need (rst to lod the model (le into wtl using the model P119 funtionF his funtion retes model ojetF hen you write your own mE(les using wtl nd ss funtions to perform the desired tsks with the model ojetF hy do ll the keywords @exept pseudofuntionsA strt with n exlmtion pointc hy do the omments hve the sme style s in wtlc hy do sustitutions nd stedyEstte referenes use the dollr signc feuse this wyD you n get the model (les syntxEhighlighted in the wtl editorF yntx highlighting improves enormously the redility of the (lesD nd helps understnd the model more quiklyF ee the setup instrutions P8 for more detilsF

Variables, parameters, substitutions and functions


!transition_variables P52 E vist of trnsition vrilesF !transition_shocks P51 E vist of trnsition shoksF !measurement_variables P44 E vist of mesurement vrilesF !measurement_shocks P43 E vist of mesurement shoksF !exogenous_variables P31 E vist of exogenous vrilesF !parameters P46 E vist of prmetersF !autoexogenise P29 E he(nition of vrileGshok pirs for use in utoexogenised simultion plnsF

Equations
!transition_equations P50 E flok of trnsition equtionsF !measurement_equations P42 E flok of mesurement equtionsF !dtrends P30 E flok of deterministi trend equtionsF !links P40 E he(ne dynmi linksF

PQ

wodel (le lnguge

Linearised and log-linearised variables


!log_variables P41 E vist of logElinerised vrilesF !allbut P29 E snverse list of logElinerised vrilesF <...> P56 E egulr expression in logEvrile listF

Model pseudofunctions
seudofuntions do not strt with n exlmtion pointF min P60 E he(ne the loss funtion in timeEonsistent optiml poliy modelF

Special operators
!! P28 E tedyEstte version of n equtionF !! P27 E feginning of lising in desriptions nd lelsF !ttrend P54 E viner time trend in deterministi trend equtionsF {...} P64 E vg or ledF & P55 E eferene to the stedyEstte level of vrileF =# P56 E wrk n eqution for ext nonEliner simultionF

Preparser pseudofunctions
seudofuntions do not strt with n exlmtion pointF diff P57 E pirst di'erene pseudofuntionF dot P59 E qross rte of growth pseudofuntionF difflog P58 E pirst logEdi'erene pseudofuntionF movavg P61 E woving verge pseudofuntionF movprod P63 E woving produt pseudofuntionF movsum P62 E woving sum pseudofuntionF

PR

wodel (le lnguge

Preparser control commands


!substitutions P47 E he(ne text sustitutionsF !import P39 E snlude the ontent of nother model (leF !export P32 E grete rryEround (le to e sved on the diskF !if...!elseif...!else...!end P37 E ghoose lok of ode depending on onditionF !switch...!case...!end P48 E with mong severl rnhes of the model ode depending on the vlue of n expressionF !for...!do...!end P32 E por loop for utomted retion of model odeF % P54 E vine ommentsF %{...%} P54 E flok ommentsF

Getting on-line help on model le language


hen getting help on model (le lngugeD type the nmes of the keywords nd ommnds without the exlmtion pointX
help help help help modellang modellang/!keyword modellang/!command modellang/pseudofunction

Matlab functions and user functions in model les


ou n use ny of the uiltEin funtions @wtl funtionsD funtions within the ooloxes you hve on your omputerD nd so onAF sn dditionD you n lso use your own funtions @written s n mE(leA s long s the mE(le is on the wtl serh pth or in the urrent diretoryF sn your own mE(le funtionsD you n lso @optionllyA supply the (rst derivtives tht will e used to ompute ylor expnsions when the model is eing solvedD nd lso the seond derivtives tht will e used when the funtion ours in loss funtionF puntions in whih you wish to use your own derivtive must e listed in !userdiff P?? setion in the model (leF purthermoreD the funtion itself must omply with the following requirementsF hen sked for the derivtivesD the funtion is lled with two extr input rguments on top of tht funtion9s regulr input rgumentsF he (rst extr input rgument is text string diff @inditing the ll to the funtion is supposed to return derivtiveAF he seond extr input rgument is numer or PS

wodel (le lnguge vetor of two numersY it determines with respet to whih input rgument or rguments the (rst derivtive or the seond derivtive is requestedF por instneD your funtion tkes three input rgumentsD myfunc(x,y,z)F o e le to supply derivtes voiding thus numeril di'erentitionD the funtion must e written so tht the following three lls
myfunc(x,y,z,diff,1) myfunc(x,y,z,diff,2) myfunc(x,y,z,diff,3)

return the (rst derivtive wrt to the (rstD seondD nd third input rgumentD respetivelyD while
myfunc(x,y,z,diff,[1,2])

returns the seond derivtive wrt to the (rst nd seond input rgumentsF xote tht seond derivtives re only needed for funtions tht our in n eqution de(ning optiml poliy ojetiveD min P60 F sf ny of these lls filD the respetive derivtive will e simply evluted numerillyF

Basic rules IRIS model les


here n e four types of equtions in ss modelsX trnsition equtions whih re simply the endogenous dynmi equtionsD mesurement equtions whih link the model to oservlesD deterministi trend equtions whih n e dded t the top of mesurement equtionsD nd dynmi links whih n e used to link some prmeters or stedyEstte vlues to eh otherF here n e two types of vriles nd two types of shoks in ss modelsX trnsition vriles nd shoksD nd mesurement vriles nd shoksF ih model must hve t lest one trnsition @k endogenousA vrile nd one trnsition equtionF ih vrileD shokD or prmeter must e delred in the pproprite delrtion setionF he delrtion setions nd equtions setions n e written in ny orderF ou n hve s mny delrtion setions or equtions setions of the sme kind s you wish in one model (leY they ll get omined together t the time the model is eing lodedF rnsition vriles n our with lgs nd leds in trnsition equtionsF rnsition vriles nnotD thoughD hve leds in mesurement equtionsF PT

wodel (le lngugeX !! wesurement vriles nd the shoks nnot hve ny lgs or ledsF rnsition shoks nnot our in mesurement equtionsD nd the mesurement shoks nE not our in trnsition equtionsF ixogenous vriles n only our in dtrends @deterministi trend equtionsAD nd must e lwys supplied in the input dtse to ommnds like model/simulateD model/jforecastD model/filterD model/estimateD etF hey re not returned in the output dtsesF ou n hoose etween lineristion nd logElineristion for eh individul trnsition nd mesurement vrileF hoks re lwys linerisedF ixogenous vriles must e lwys introdued so tht their e'et on the respetive mesurement vrile is linerF

!!
Beginning of aliasing in descriptions and labels
Syntax in descriptions of variables, shocks, and parameters
Description !! Alias Name

Syntax in equations labels


Label !! Alias Equation;

Description
hen used in desriptions of vrilesD shoksD nd prmetersD or in eqution lelsD the doule exlmtion mrk strts n lis @ut the exlmtion mrks re not inluded in itAF he lis n e used to speifyD for exmpleD ve ode ssoited with the vrileD shokD prmeterD or equtionF he lises n e retrieved from the model ode y using the pproprite query in the funtion model/get P100 F

Example
!transition_variables Output gap !! $\hat y_t$ Y_GAP

PU

wodel (le lngugeX !!

sn the resulting model ojetD the desription of the vriles Y_GAP will e
Output gap

while its lis will e


$\hat y_t$.

!!
Steady-state version of an equation
Syntax
Equation !! Steady_state_equation;

Description
por eh trnsition or mesurement equtionD you n provide seprte stedyEstte version of itF he stedyEstte version is used when you run the sstate P138 funtionF his is useful when you n sustntilly simplify some prts of the dynmi equtionsD nd help therefore the numeril solver to hieve fster nd more urte resultsF hy is doule exlmtion pointD !!D used to strt the stedyEstte versions of equtionsc feuse if you ssoite your model (le extension with the wtl editorD nything fter n exlmtion point is displyed red mking it esier to spot the stedyEstte equtionsF

Example 1
he following stedy stte version will eD of ourseD vlid only in sttionry models where we n sfely remove lgs nd ledsF
Lambda = Lambda{1}*(1+r)*beta !! r = 1/beta - 1;

PV

wodel (le lngugeX !autoexogenise

Example 2
log(A) = log(A{-1}) + epsilon_a !! A = 1;

!allbut
Inverse list of log-linearised variables
Syntax
!log_variables !allbut VARIABLE_NAME, VARIABLE_NAME, VARIABLE_NAME, ...

Description
ee help on !log_variables P41 F

!autoexogenise
Denition of variable/shock pairs for use in autoexogenised simulation plans
Syntax
!autoexogenise Variable_Name := Shock_Name; Variable_Name := Shock_Name; Variable_Name := Shock_Name;

Description
he setion !autoexogenise de(nes vrileGshok pirs tht n e used to utomte the retion of exogeniseEendogenise types of simultion plns P152 using the funtion autoexogenise P153 F PW

wodel (le lngugeX !dtrends

Example

!dtrends
Block of deterministic trend equations
Syntax for linearised measurement variables
!dtrends Variable_Name += Expression; Variable_Name += Expression; Variable_Name += Expression; ...

Syntax for log-linearised measurement variables


!dtrends log(Variable_Name) += Expression; log(Variable_Name) += Expression; log(Variable_Name) += Expression; ...

Syntax with equation labels


!dtrends Equation label Variable_Name += Expression; Equation label LOG(Variable_Name) += Expression;

Description Example
!dtrends Infl += pi_; Rate += rho_ + pi_;

QH

wodel (le lngugeX !exogenous_variables

!exogenous_variables
List of exogenous variables
Syntax
!exogenous_variables Variable_Name, Variable_Name, ... ...

Syntax with descriptors


!exogenous_variables Variable_Name, Variable_Name, ... Description of the variable... Variable_Name

Syntax with steady-state values


!exogenous_variables Variable_Name, Variable_Name, ... Variable_Name = Value

Description
he !exogenous_variables keyword strts new delrtion lok for exogenous vrilesD iFeF vriE les tht n pper only in !dtrends P30 equtionsF he nmes of the vriles must e sepE rted y ommsD semiEolonsD or line reksF ou n hve s mny delrtion loks s you wish in ny order in your model (leX hey ll get omined together when you red the model (le inF ih vrile must e delred @extly oneAF ou n dd desriptors to the vriles @enlosed in single or doule quotesD preeding the nme of the vrileAY these will e stored inD nd essile fromD the model ojetF ou n lso ssign stedyEstte vlues to the vriles stright in the model (le @following n equl sign fter the nme QI

wodel (le lngugeX !for...!do...!end of the vrileAY this isD thoughD rther rre nd unneessry prtie euse you n ssign nd hnge stedyEstte vlues more onveniently in the model ojetF

Example
!exogenous_variables X, Tax effects Y Population growth effects Z =

+ .5i;

!export
Create a carry-around le to be saved on the disk
Syntax
!export(FILENAME) FILE_CONTENTS !end

Description
ou n inlude in the model (le the ontents of (les you need or wnt to rry round together with the modelY typil exmple is your own mE(le funtions used in the model equtionsF he (le or (les re reted nd sve under the nme spei(ed in the !export keyword t the time you lod the model using the funtion model P119 F he ontents of the export (les is re lso stored in the model ojetsF ou n mnully reErete nd reEsve the (les y running the funtion export P90 F xote tht if no (lenme is provided or FILENAME is emptyD the orresponding !export lok is disrded without n error or wrningF

!for...!do...!end
For loop for automated creation of model code
QP

wodel (le lngugeX !for...!do...!end

Short-cut syntax
!for List_of_Tokens !do Template !end

Full syntax
!for ?Control_Name = List_of_Tokens !do Template !end

Description
se the 9 3forF F F 3doF F F 3end9 ommnd to speify templte nd let the ss preprser utomtilly rete multiple instnes of the templte y iterting over list of tokensF he preprser yles over the individul strings from the listY in eh itertionD the urrent string is used to reple ll ourenes of the ontrol vrile in the templteF he nme of the ontrol nme is either question mrkD 9 c9D in the revited syntxD or ny string @not to lnk spesA spei(ed y the user strting with question mrk in the full syntxD suh s 9 cx9D 9 c59D 9 cxewi9D etF he tokens @text stringsA in the list must e seprted y ommsD lnk spesD or line reks nd they themselves must not ontin ny of thoseF sn eh itertionD ll ourrenes of the ontrol vrile in the templte re repled with the urrently proessed stringY ll ourrenes in the templte of ?.Control_Name re repled with the urrently proessed string onverted to lower seY this option is xy ville with the shortEut syntxY ll ourrenes in the templte of ?:Control_Name re repled with the urrently proessed string onverted to upper seY this option is xy ville with the shortEut syntxY he list of tokens n e sed on wtl expressionsF he expressions must e enlosed in squre rketsD nd must evlute into either numeri vetorD hr vetorD or ell rry of numeris ndGor stringsF QQ

wodel (le lngugeX !for...!do...!end

Example 1
sn model ode (leD insted of writing numer of de(nitions of growth rtes like the following ones
dP dW dX dY = = = = P/P{-1} W/W{-1} X/X{-1} Y/Y{-1} 1; 1; 1; 1;

you n use 9 3forF F F 3doF F F 3end9 s followsX


!for P, W, X, Y !do d? = ?/?{-1} - 1; !end

Example 2
e redo the exmple ID ut using now the ft tht you n hve s mny vrile delrtion setions or eqution setions s you wishF he 9 3forF F F 3doF F F 3end9 struture n therefore not only produe the equtions for youD ut lso mke sure ll the growth rte vriles re properly delredF
!for P, W, X, Y !do !transition_variables d? !transition_equations d? = ?/?{-1} - 1; !end

he preprser expnds this struture to the following X


!transition_variables dP !transition_equations

QR

wodel (le lngugeX !for...!do...!end


dP = P/P{-1} - 1; !transition_variables dW !transition_equations dW = W/W{-1} - 1; !transition_variables dX !transition_equations dX = X/X{-1} - 1; !transition_variables dY !transition_equations dY = Y/Y{-1} - 1;

yviouslyD you now do not inlude the growth rte vriles in the setion where you delre the rest of the vrilesF

Example 3
sn model ode (leD insted of writing numer of utoregression proesses like the following ones
X = rhox*X{-1} + ex; Y = rhoy*Y{-1} + ey; Z = rhoz*Z{-1} + ez;

you n use 9 3forF F F 3doF F F 3end9 s followsX


!for ?# = X, Y, Z !do ?# = rho?.#*?{-1} + e?.#; !end

Example 4
e redo ixmple QD ut now for six vriles nmed eI9D eP9D fI9D fP9D gI9D gP9D nesting two 9 3forF F F 3doF F F 3end9 strutures one within the otherX QS

wodel (le lngugeX !for...!do...!end


!for ?letter = A, B, C !do !for ?number = 1, 2 !do ?letter?number = rho?.letter?number*?letter?number{-1} + e?.letter?number; !end !end

he preprser produes the following six equtionsX


A1 A2 B1 B2 C1 C2 = = = = = = rhoa1*A1{-1} rhoa2*A2{-1} rhob1*B1{-1} rhob2*B2{-1} rhoc1*C1{-1} rhoc2*C2{-1} + + + + + + ea1; ea2; eb1; eb2; ec1; ec2;

Example 5
e use wtl expression @the olon opertorA to simplify the list of tokensF he following lok of ode
!for 1, 2, 3, 4, 5, 6, 7 !do a? = a?{-1} + res_a?; !end

n e simpli(ed s followX
!for [ 1 : 7 ] !do a? = a?{-1} + res_a?; !end

QT

wodel (le lngugeX !if...!elseif...!else...!end

!if...!elseif...!else...!end
Choose block of code depending on a condition
Syntax with else and elseif clauses
!if Condition1 Block1 !elseif Condition2 Block2 !elseif Condition3 ... !else Block3 !end

Syntax with an else clause only


!if Condition1 Block1 !else Block2 !end

Syntax without an else clause


!if Condition Block1 !end

Description
he !if...!elseif...!else...!end ommnd works the sme wy s its ounterprt in the wtl progrmming lngugeF

QU

wodel (le lngugeX !if...!elseif...!else...!end se the !if...!else...!end ommnd to rete rnhes or versions of the model odeF hether lok of ode in prtiulr rnh is used or disrdedD depends on the ondition fter the opening !if ommnd nd the onditions fter susequent !elseif ommnds if presentF he ondition must e wtl expression tht evlutes to true or flseF he ondition n refer to model prmetersD or to other (elds inluded in the dtse pssed in through the option assign=9 in the model P119 funtionF

Example 1
!if B < Inf % This is a linearised sticky-price Phillips curve. pi = A*pi{-1} + (1-A)*pi{1} + B*log(mu*rmc); !else % This is a flexible-price mark-up rule. rmc = 1/mu; !end

sf you set the prmeter B to snf in the prmeter dtse when reding in the model (leD then the )exileEprie equtioD rmc = D is used nd the hillips urve eqution disrdedF o use the hillips urve eqution instedD you need to reEred the model (le with B set to numer other thn snfF sn this exmpleD B needs to eD oviouslyD delred s model prmeterF

Example 2
!if exogenous == true x = y; !else x = rho*x{-1} + epsilon; !end

hen reding the model (le inD rete prmeter dtseD inlude t lest (eld nmed exogenous in itD nd use the assign= option to pss the dtse inF xote tht you do not need to delre exogenous s prmeter in the model (leF
P = struct(); P.exogenous = true; ... m = model(my.model,assign=,P);

QV

wodel (le lngugeX !links sn this seD the model will ontin the (rst equtionD x = rho*x{-1} + epsilon; will e usedD nd the other disrdedF o use the other equtionD x = yD you need to reEred the model (le with exogenous set to flseX
P = struct(); P.exogenous = false; ... m = model(my.model,assign=,P);

ou n lso use n revite syntx to ssign ontrol prmeters when redin the model (leY for instne
m = model(my.model,exogenous=,true);

!import
Include the content of another model le
Syntax
!import(FILENAME)

Description
he !import ommnd lods the ontent of the spei(ed (le FILENAMEF his llows you to split the model ode into severl prts @eh sved in seprte (leA nd to reuse some its of the modelF

Example
!import(mesurement_equations.model)

QW

wodel (le lngugeX !log_variables

!links
Dene dynamic links
Syntax
!links Parameter_Name := Expression; Variable_Name := Expression;

Syntax with equation labels


!links Equation label Parameter_Name := Expression; Equation label Variable_Name := Expression;

Description
he dynmi links relte prtiulr prmeter @or stedyEstte vlueA on the vr to funtion of other prmeters or stedyEstte vlues on the rF Expression n e ny expression involving prmeter nmesD vriles nmesD wtl funtions nd onstntsD or your own mE(le funtions on the pthY it must not refer to ny lgs or ledsF Expression must evlute to single numerF st is the user9s responsiility to properly hndle the imginry @iFeF growthA prt of the stedyEstte vluesF he links re utomtilly refreshed in solve P134 D sstate P138 D nd chksstate P76 funtionsD nd lso in eh itertion within the estimate P82 funtionF hey n lso e refreshed mnully y lling refresh P124 F he links must not involve prmeters ouring in !dtrends P30 equtions tht will e estimted using the outoflik= option of the estimate P82 funtionF

Example
!links R := 1/beta; alphak := 1 - alphan - alpham;

RH

wodel (le lngugeX !log_variables

!log_variables
List of log-linearised variables
Syntax
!log_variables VARIABLE_NAME, VARIABLE_NAME, VARIABLE_NAME, ...

Inverted syntax
!log_variables !allbut VARIABLE_NAME, VARIABLE_NAME, VARIABLE_NAME, ...

Syntax with regular expression(s)


!log_variables VARIABLE_NAME, VARIABLE_NAME, VARIABLE_NAME, ... <REGEXP>, <REGEXP>, ...

Description
vist ll logEvriles under this hedingsF ynly mesurement or trnsition vriles n e delred s logEvrilesF sn nonEliner modelsD ll vriles re linerised round the stedy stte or lnedEgrowth pthF sf you wish to logElinerise some of them instedD put them on !log_variables listF ou n lso use the !allbut keyword to indite n inverse listX ll vriles will e logElinerised exept those listedF o rete the list of logEvrilesD you n lso use regulr expressionsD eh enlosed in pir of ngle rketsD < nd >F ell mesurement nd trnsition vriles whose nmes mth one of the regulr expressions will e delred s logEvrilesF ee lso help on regulr expressions in the wtl doumenttionF

RI

wodel (le lngugeX !measurement_equations

Example 1
he following lok of ode will use the vriles YD CD ID nd K to e delred s logEvrilesD nd hene logElinerised in the model solutionD while r nd pie will e linerisedX
!transition_variables Y, C, I, K, r, pie !log_variables Y, C, I, K

ou n do the sme jo y writing


!transition_variables Y, C, I, K, r, pie !log_variables !allbut r, pie

Example 2
e gin hieve the sme result s oveD ut now using regulr expressionF
!transition_variables Y, C, I, K, r, pie !log_variables <[A-Z]\w*>

he regulr expression [A-Z]\w* selets ll vriles whose nmes strt with n upperEse letterF reneD gin the vriles YD CD ID nd K will e delred s logEvrilesF

!measurement_equations
Block of measurement equations
RP

wodel (le lngugeX !measurement_shocks

Syntax
!measurement_equations Equation1; Equation2; Equation3; ...

Syntax with equation labels


!measurement_equations Equation1; Equation label Equation2; Equation3; ...

Description
he !measurement_equations keyword strts new lok of mesurement equtionsY the equtions n streth over multiple lines nd must e seprted y semiEolonsF ou n hve s mny eqution loks s you wish in ny order in your model (leX hey ll get omined together when you red the model (le inF ou n dd desriptive lels to the equtions @in single or doule quotesD preeding the equtionAY these will e stored inD nd essile fromD the model ojetF

Example
!measurement_equations Inflation observations Infl = 4 *(P/P{-1} - 1);

!measurement_shocks
List of measurement shocks

RQ

wodel (le lngugeX !measurement_variables

Syntax
!measurement_shocks SHOCK_NAME, SHOCK_NAME, ... ...

Syntax with descriptors


!measurement_shocks SHOCK_NAME, SHOCK_NAME, ... Description of the shock... SHOCK_NAME

Description
he !measurement_shocks keyword strts new delrtion lok for mesurement shoks @iFeF shoks or errors to mesurement equtionAY the nmes of the shoks must e seprted y ommsD semiE olonsD or line reksF ou n hve s mny delrtion loks s you wish in ny order in your model (leX hey ll get omined together when you red the model (le inF ih shok must e delred @extly oneAF ou n dd desriptors to the shoks @enlosed in single or doule quotesD preeding the nme of the shokAY these will e stored inD nd essile fromD the model ojetF

Example
!measurement_shocks u1, Output measurement error u2 u3

!measurement_variables
List of measurement variables
Syntax
!measurement_variables

RR

wodel (le lngugeX !measurement_variables


Variable_Name, Variable_Name, ... ...

Syntax with descriptors


!measurement_variables Variable_Name, Variable_Name, ... Description of the variable... Variable_Name

Syntax with steady-state values


!measurement_variables Variable_Name, Variable_Name, ... Variable_Name = Value

Description
he !measurement_variables keyword strts new delrtion lok for mesurement vriles @iFeF oservlesAY the nmes of the vriles must e seprted y ommsD semiEolonsD or line reksF ou n hve s mny delrtion loks s you wish in ny order in your model (leX hey ll get omined together when you red the model (le inF ih vrile must e delred @extly oneAF ou n dd desriptors to the vriles @enlosed in single or doule quotesD preeding the nme of the vrileAY these will e stored inD nd essile fromD the model ojetF ou n lso ssign stedyEstte vlues to the vriles stright in the model (le @following n equl sign fter the nme of the vrileAY this isD thoughD rther rre nd unneessry prtie euse you n ssign nd hnge stedyEstte vlues more onveniently in the model ojetF por eh individul vrile in nonEliner modelD you n lso deide if it is to e linerised or logElinerised y listing its nme in the !log_variables P41 setionF

Example
!measurement_variables pie, Real output Y Real exchange rate Z = 1 + 1. 5i;

RS

wodel (le lngugeX !parameters

!parameters
List of parameters
Syntax
!parameters parameter_name, parameter_name, ... ...

Syntax with descriptors


!parameters parameter_name, parameter_name, ... Description of the parameter... parameter_name

Syntax with steady-state values


!parameters parameter_name, parameter_name, ... parameter_name = value

Description
he !parameters keyword strts new delrtion lok for prmetersY the nmes of the prmE eters must e seprted y ommsD semiEolonsD or line reksF ou n hve s mny delrtion loks s you wish in ny order in your model (leX hey ll get omined together when you red the model (le inF ih prmeters must e delred @extly oneAF ou n dd desriptors to the prmeters @enlosed in single or doule quotesD preeding the nme of the prmeterAY these will e stored inD nd essile fromD the model ojetF ou n lso ssign prmeter vlues stright in the model (le @following n equl sign fter the nme of the prmeterAY this isD thoughD rther rre nd unneessry prtie euse you n ssign nd hnge prmeter vlues more onveniently in the model ojetF

RT

wodel (le lngugeX !substitutions

Example
!parameters alpha, Discount factor beta Labour share gamma = .6

!substitutions
Dene text substitutions
Syntax
!substitutions SUBSTITUTION_NAME := TEXT_STRING; SUBSTITUTION_NAME := TEXT_STRING; ...

Description
he !substitutions strts lok with sustitution de(nitionsF he de(nition of eh sustitution must egin with the nme of the sustitutionD followed y olonEequl signD :=D nd text string ended with semiEolonF he semiEolon is not prt of the sustitutionF he sustitutions n e used in ny of the model equtionsD iFeF in trnsition equtions P50 D mesurement equtions P42 D deterministi trend equtions P30 D nd dynmi links P40 F ih ourene of the nme of sustitution enlosed in dollr signsD iFeF $substitution_name$D in model equtions will e repled with the text string from the sustitution9s de(nitionF ustitutions n lso refer to other sustitutionsY mke sureD thoughD tht they re not reursiveF elsoD rememer to prenthesise the de(nitions of the sustitutions @or the referenes to themA in the equtions properly so tht the resulting mthemtil expressions re evluted properlyF

Example
!substitution a := ((omega1+omega2)/(omega1+omega2+omega3));

RU

wodel (le lngugeX !switch...!case...!otherwise...!end


!transition_equations X = $a$^2*Y + (1-$a$^2)*Z;

sn this exmpleD we ssume tht omega1D omega2D nd omega3 re delred s prmetersF he eqution will expnd to
X = ((omega1+omega2)/(omega1+omega2+omega3))^2*Y + ... (1-((omega1+omega2)/(omega1+omega2+omega3))^2)*Z;

xote tht if hd not used the outermost prentheses in the de(nition of the sustitutionD the resulting expression would not hve given us wht we mentX he squre opertor would hve only pplied to the denomintorF

!switch...!case...!otherwise...!end
Switch among several branches of the model code depending on the value of an expression
Syntax with an otherwise clause
!switch Expression !case Balue1 Block1 !case Balue2 Block2 ... !otherwise Otherwise_Block !end

Syntax without an otherwise clause


!switch Expression !case Value1 Block1 !case Value2

RV

wodel (le lngugeX !switch...!case...!otherwise...!end


Block2 ... !end

Description
he !switch...!case...!otherwise...!end ommnd works the sme wy s its ounterprt in the wtl progrmming lngugeF se the !switch...!case...!end ommnd to rete lrger numer of rnhes of the model odeF hih lok of ode is tully red in nd whih loks re disrded depends on whih vlue in the !case luses mthes the vlue of the !switch expressionF his works extly s the switch...case...end ommnd in wtlF he expression fter the !switch prt of the ommnd must must e vlid wtl expressionD nd n refer to the model prmetersD or to other (elds inluded in the prmeter dtse pssed in when you run the model P119 funtionY see the option assign= P119 F sf the expression fils to e mthed y ny vlue in the !case lusesD the rnh in the !otherwise luse is usedF sf it is !switch ommnd without the !otherwise luseD the whole ommnd is disrdedF he wtl funtion isequal is used to mth the !switch expression with the !case vluesF

Example
!switch policy_regime !case IT r = rho*r{-1} + (1-rho)*kappa*pie{4} + epsilon; !case Managed_exchange_rate s = s{-1} + epsilon; !case Constant_money_growth m-m{-1} = m{-1}-m{-2} + epsilon; !end

hen reding the model (le inD rete prmeter dtseD inlude t lest (eld nmed policy_regime in itD nd use the option assign= to pss the dtse inF xote tht you do not need to delre policy_regime s prmeter in the model (leF RW

wodel (le lngugeX !transition_equations


P = struct(); P.policy_regime = Managed_exchange_rate; ... m = model(my.model,assign,P);

sn this seD the mnged exhnge rte poliy ruleD s = s{-1} + epsilon; is red in nd the rest of the !switch ommnd is disrdedF o use nother rnh of the !switch ommnd you need to reEred the model (le gin with di'erent vlue ssigned to the policy_regime (eld of the input dtseF

!transition_equations
Block of transition equations
Syntax
!transition_equations Equation1; Equation2; Equation2; ...

Short-cut syntax
!equations Equation1; Equation2; Equation3; ...

Syntax with equation labels


!transition_equations Equation1; Equation label Equation2; Equation3;

SH

wodel (le lngugeX !transition_shocks


...

Description
he !transition_equations keyword strts new lok of trnsition equtions @iFeF endogenous equtionsAY the equtions n streth over multiple lines nd must e seprted y semiEolonsF ou n hve s mny eqution loks s you wish in ny order in your model (leX hey ll get omined together when you red the model (le inF ou n dd desriptive lels to the equtions @in single or doule quotesD preeding the equtionAY these will e stored inD nd essile fromD the model ojetF

Example
!transition_equations Euler equation C{1}/C = R*beta;

!transition_shocks
List of transition shocks
Syntax
!transition_shocks shock_name, shock_name, ... ...

Short-cut syntax
!shocks shock_name, shock_name, ... ...

SI

wodel (le lngugeX !transition_variables

Syntax with descriptors


!transition_shocks shock_name, shock_name, ... Description of the shock... shock_name

Description
he !transition_shocks keyword strts new delrtion lok for trnsition shoks @iFeF shoks to trnsition equtionAY the nmes of the shoks must e seprted y ommsD semiEolonsD or line reksF ou n hve s mny delrtion loks s you wish in ny order in your model (leX hey ll get omined together when you red the model (le inF ih shok must e delred @extly oneAF ou n dd desriptors to the shoks @enlosed in single or doule quotesD preeding the nme of the shokAY these will e stored inD nd essile fromD the model ojetF

Example
!transition_shocks e1, Aggregate supply shock e2 e3

!transition_variables
List of transition variables
Syntax
!transition_variables Variable_Name, Variable_Name, ... ...

Short-cut syntax
!variables

SP

wodel (le lngugeX !transition_variables


Variable_Name, Variable_Name, ... ...

Syntax with descriptors


!transition_variables Variable_Name, Variable_Name, ... Description of the variable... Variable_Name

Syntax with steady-state values


!transition_variables Variable_Name, Variable_Name, ... Variable_Name = Value

Description
he !transition_variables keyword strts new delrtion lok for trnsition vriles @iFeF enE dogenous vrilesAY the nmes of the vriles must e seprted y ommsD semiEolonsD or line reksF ou n hve s mny delrtion loks s you wish in ny order in your model (leX hey ll get omined together when you red the model (le inF ih vrile must e delred @extly oneAF ou n dd desriptors to the vriles @enlosed in single or doule quotesD preeding the nme of the vrileAY these will e stored inD nd essile fromD the model ojetF ou n lso ssign stedyEstte vlues to the vriles stright in the model (le @following n equl sign fter the nme of the vrileAY this isD thoughD rther rre nd unneessry prtie euse you n ssign nd hnge stedyEstte vlues more onveniently in the model ojetF por eh individul vrile in nonEliner modelD you n lso deide if it is to e linerised or logElinerised y listing its nme in the !log_variables P41 setionF

Example
!transition_variables pie, Real output Y Real exchange rate Z = 1 + 1. 5i;

SQ

wodel (le lngugeX %{...%}

!ttrend
Linear time trend in deterministic trend equations
Syntax
!ttrend

Description Example
!dtrends log(Y) += a*!ttrend;

%
Line comments
Syntax
% Anything between the percent sign and the line break is discarded.

Description Example

%{...%}
Block comments
SR

wodel (le lngugeX &

Syntax
%{ Anything between the opening block comment sign and the closing block comment sign is discarded %}

Description
nlike in wtlD the opening nd losing lok omment signs do not need to stnd lone on otherwise lnk linesF ou n even hve lok omments ontined withing single lineF

Example
!transition_equations x = rho*x{-1} %{ this is a valid block comment %} + epsilon;

&
Reference to the steady-state level of a variable
Syntax
&Variable_Name $Variable_Name

Description
se either & or $ sign in front of vrile nme to rete referene to tht vrile9s stedyEstte level in trnsition or mesurement equtionsF he two signsD & nd $D re interhngeleF he stedyEstte referene will e repled with the vrile itself t the time model9s stedy stte is eing lultedD iFeF when lling the funtion sstate P138 Y SS

wodel (le lngugeX =# with the tully ssigned stedyEstte vlue t the time the model is eing solvedD iFeF when lling the funtion solve9 P134 9F

Example
x = rho*x{-1} + (1-rho)*&x + epsilon_x !! x = 1;

<...>
Regular expression in log-varible list
Syntax
!log_variables <REGEXP>, <REGEXP>, ...

Description
ee help on !log_variables P41 F

=#
Mark an equation for exact non-linear simulation
Syntax
LHS =# RHS;

Description
iqutions tht hve the equl sign mrked with n # n e simulted in n ext nonEliner modeF

ST

wodel (le lngugeX diff hy is it the hnnels signD #D tht is used to mrk the equtions for ext nonEliner simultionsc feuse if you ssoite your model (le extension with the wtl editorD the hnnel signs re displyed red mking it esier to spot themF

di
First dierence pseudofunction
Syntax
diff(EXPR) diff(EXPR,K)

Description
sf the input rgument K is not spei(edD this pseudofuntion expnds to
((EXPR)-(EXPR{-1}))

sf the input rgument K is spei(edD it expnds to


((EXPR)-(EXPR{K}))

he two derived expressionsD EXPR{-1} nd EXPR{K}D re sed on EXPRD nd hve ll its time susripts shifted y !I or y K periodsD respetivelyF

Example
hese two lines
diff(Z) diff(log(X{1})-log(Y{-1}),-2)

will expnd to SU

wodel (le lngugeX difflog


((Z)-(Z{-1})) ((log(X{1})-log(Y{-1}))-(log(X{-1})-log(Y{-3})))

diog
First log-dierence pseudofunction
Syntax
difflog(EXPR) difflog(EXPR,K)

Description
sf the input rgument K is not spei(edD this pseudofuntion expnds to
(log(EXPR)-log(EXPR{-1}))

sf the input rgument K is spei(edD it expnds to


(log(EXPR)-log(EXPR{K}))

he two derived expressionsD EXPR{-1} nd EXPR{K}D re sed on EXPRD nd hve ll its time susripts shifted y !I or y K periodsD respetivelyF

Example
he following two lines of ode
difflog(Z) difflog(X{1}/Y{-1},-2)

will expnd to SV

wodel (le lngugeX dot


(log(Z)-log(Z{-1})) (log(X{1}/Y{-1})-log(X{-1}/Y{-3}))

dot
Gross rate of growth pseudofunction
Syntax
dot(EXPR) dot(EXPR,K)

Description
sf the input rgument k is not spei(edD this pseudofuntion expnds to
((expression)/(expression{-1}))

sf the input rgument k is spei(edD it expnds to


((expression)/(expression{k}))

he two derived expressionsD expression{-1} nd expression{k}D re sed on expressionD nd hve ll its time susripts shifted y !I or y k periodsD respetivelyF

Example
he following two lines
dot(Z) dot(X+Y,-2)

will expnd to SW

wodel (le lngugeX min


((Z)/(Z{-1})) ((X+Y)/(X{-2}+Y{-2}))

min
Dene the loss function in a time-consistent optimal policy model
Syntax
min(DISC) EXPRESSION;

Syntax for exact non-linear simulations


min#(DISC) EXPRESSION;

Description
he loss funtion must e types s one of the trnsition equtionsF he DISC is prmeter or n expression de(ning the disount ftor @pplied to future dtesAD the EXPRESSION de(nes the loss fution properF sf you use the min#(DISC) syntxD ll equtions reted y di'erentiting the lgrngin wFrFtF individul vriles will e ermrked for ext nonEliner simultions provided the respetive derivtive is nonzeroF

Example
his is simple model (le with hillips urve nd qudrti loss funtionF
!transition_variables x, pi !transition_shocks u

TH

wodel (le lngugeX movavg


!parameters alpha, beta, gamma !transition_equations min(beta) pi^2 + lambda*x^2; pi = alpha*pi{-1} + (1-alpha)*pi{1} + gamma*y + u;

movavg
Moving average pseudofunction
Syntax
movavg(EXPR) movavg(EXPR,K)

Description
sf the seond input rgumentD KD is negtiveD this funtion expnds to the moving verge of the lst u periods @inluding the urrent periodAD iFeF
(((EXPR)+(EXPR{-1})+ ... +(EXPR{-(K-1)})/-K)

where EXPR{-N} derives from EXPR nd hs ll its time susripts shifted y -N @if spei(edAF sf the seond input rgumentD KD is positiveD this funtion expnds to the moving verge of the next u periods hed @inluding the urrent periodAD iFeF
(((EXPR)+(EXPR{1})+ ... +(EXPR{K-1})/K)

sf the seond input rgumentD KD is not spei(edD the defult vlue ER is used @sed on the ft tht most of the mroeonomi models re qurterlyAF

TI

wodel (le lngugeX movsum

Example
he following three lines
movavg(Z) movavg(Z,-3) movavg(X+Y{-1},2)

will expnd to
(((Z)+(Z{-1})+(Z{-2})+(Z{-3}))/4) (((Z)+(Z{-1})+(Z{-2}))/3) (((X+Y{-1})+(X{1}+Y))/2)

movsum
Moving sum pseudofunction
Syntax
movsum(EXPR) movsum(EXPR,K)

Description
sf the seond input rgumentD KD is negtiveD this funtion expnds to the moving sum of the lst u periods @inluding the urrent periodAD iFeF
((EXPR)+(EXPR{-1})+ ... +(EXPR{-(K-1)})

where EXPR{-N} derives from EXPR nd hs ll its time susripts shifted y -N @if spei(edAF sf the seond input rgumentD KD is positiveD this funtion expnds to the moving sum of the next u periods hed @inluding the urrent periodAD iFeF TP

wodel (le lngugeX movsum


((EXPR)+(EXPR{1})+ ... +(EXPR{K-1})

sf the seond input rgumentD KD is not spei(edD the defult vlue ER is used @sed on the ft tht most of the mroeonomi models re qurterlyAF

Example
he following three lines
movsum(Z) movsum(Z,-3) movsum(X+Y{-1},2)

will expnd to
((Z)+(Z{-1})+(Z{-2})+(Z{-3})) ((Z)+(Z{-1})+(Z{-2})) ((X+Y{-1})+(X{1}+Y))

movsum
Moving product pseudofunction
Syntax
movprod(Expr) movprod(Expr,K)

Description
sf the seond input rgumentD KD is negtiveD this funtion expnds to the moving produt of the lst u periods @inluding the urrent periodAD iFeF

TQ

wodel (le lngugeX {...}


((Expr)*(Expr{-1})* ... *(Expr{-(K-1)})

where Expr{-N} derives from Expr nd hs ll its time susripts shifted y -N @if spei(edAF sf the seond input rgumentD KD is positiveD this funtion expnds to the moving produt of the next u periods hed @inluding the urrent periodAD iFeF
((Expr)*(Expr{1})* ... *(Expr{K-1})

sf the seond input rgumentD KD is not spei(edD the defult vlue ER is used @sed on the ft tht most of the mroeonomi models re qurterlyAF

Example
he following three lines
movprod(Z) movprod(Z,-3) movprod(X+Y{-1},2)

will expnd to
((Z)*(Z{-1})*(Z{-2})*(Z{-3})) ((Z)*(Z{-1})*(Z{-2})) ((X+Y{-1})*(X{1}+Y))

{...}
Lag or lead
Syntax
VARIABLE_NAME{-lag} VARIABLE_NAME{lead} VARIABLE_NAME{+lead}

TR

wodel (le lngugeX {...}

Description
o rete lg or led of vrileD use pir of urly rketsF

Example
!transition_equations x = rho*x{-1} + epsilon_x; pi = 1/2*pie{-1} + 1/2*pie{1} + gamma*y + epsilon_pi;

TS

wodel ojets nd funtions

5 Model objects and functions


wodel ojets re reted y loding model (le P23 F yne model ojet existsD you n use model funtions nd stndrd wtl funtions to write your own mE(les to perform the desired tsksD suh lirte or estimte the modelD (nd its stedy stteD solve nd simulte itD produe forestsD nlyse its propertiesD nd so onF wodel methodsX

Constructor
model P119 E grete new model ojet sed on model (leF

Getting information about models


addparam P71 E edd model prmeters to dtse @strutAF autocaption @modelGutoptionA E autoexogenise P75 E qet or set vrileGshok pirs for use in utoexogenised simultion plnsF comment P77 E qet or set user omments in n ss ojetF eig P81 E iigenvlues of the model trnsition mtrixF findeqtn P96 E pind equtions y the lelsF findname P97 E pind nmes of vrilesD shoksD or prmeters y their desriptorsF get P100 E uery model ojet propertiesF iscompatible P107 E rue if two models n our together on the vr nd r in n ssignmentF islinear P108 E rue for models delred s linerF islog P109 E rue for logElinerised vrilesF isnan P110 E ghek for xxs in model ojetF isname P110 E rue for vlid nmes of vrilesD prmetersD or shoks in model ojetF issolved P111 E rue if model solution existsF isstationary P112 E rue if model or spei(ed omintion of vriles is sttionryF length P114 E xumer of lterntive prmeteristionsF TT

wodel ojets nd funtions omega P123 E qet or set the ovrine mtrix of shoksF sspace P137 E tteEspe mtries desriing the model solutionF system P145 E ystem mtries efore model is solvedF userdata P147 E qet or set user dt in n ss ojetF

Referencing model objects


subsasgn P143 E usripted ssignment for model nd system(t ojetsF subsref P144 E usripted referene for model nd system(t ojetsF

Changing model objects


alter P72 E ixpnd or redue numer of lterntive prmeteristionsF assign P73 E essign prmetersD stedy sttesD std devitions or rossEorreltionsF export P90 E ve rryEround (les on the diskF horzcat P105 E gomine two omptile model ojets in one ojet with multiple prmeE teristionsF refresh P124 E efresh dynmi linksF stdscale P142 E eEsle ll std devitions y the sme ftorF set P128 E ghnge modi(le model ojet propertyF single P134 E gonvert solution mtries to single preisionF

Steady state
chksstate P76 E ghek if equtions hold for urrently ssigned stedyHstte vluesF sstate P138 E gompute stedy stte or lneEgrowth pth of the modelF sstatefile P141 E grete stedyEstte (le sed on the model ojet9s stedyEstte equE tionsF

TU

wodel ojets nd funtions

Solution, simulation and forecasting


diffsrf P80 E hi'erentite shok response funtions wFrFtF spei(ed prmetersF expand P89 E gompute forwrd expnsion of model solution for ntiipted shoksF jforecast P112 E porest with judgmentl djustments @onditionl forestsAF icrf P106 E snitilEondition response funtionsF lhsmrhs P115 E ivlute the disrepny etween the vr nd r for eh model eqution nd given dtF resample P127 E esmple from the model implied distriutionF reporting P126 E un reporting equtionsF shockplot P130 E hortEut for running nd plotting plin shok simultionF simulate P131 E imulte modelF solve P134 E glulte (rstEorder urte solution of the modelF srf P136 E hok response funtionsF

Model data
data4lhsmrhs P78 E repre dt rry for running lhsmrhsF emptydb P82 E grete modelEspei( dtse with vrilesD shoksD nd prmetersF sstatedb P140 E grete modelEspei( stedyEstte or lnedEgrowthEpth dtseF zerodb P150 E grete modelEspei( zeroEdevition dtseF

Stochastic properties
acf P69 E eutoovrine nd utoorreltion funtions for model vrilesF ifrf P107 E prequeny response funtion to shoksF fevd P90 E porest error vrine deomposition for model vrilesF ffrf P92 E pilter frequeny response funtion of trnsition vriles to mesurement vriE lesF fmse P99 E porest men squre error mtriesF vma P148 E etor moving verge representtion of the modelF xsf P149 E ower spetrum nd spetrl density of model vrilesF TV

wodel ojets nd funtionsX acf

Identication, estimation and ltering


bn P75 E feveridgeExelson trendsF diffloglik P79 E epproximte grdient nd hessin of logElikelihood funtionF estimate P82 E istimte model prmeters y optimising seleted ojetive funtionF evalsystempriors P88 E ivlute minus log of system prior densityF filter P93 E ulmn smoother nd estimtor of outEofElikelihood prmetersF fisher P97 E epproximte pisher informtion mtrix in frequeny dominF lognormal P118 E ghrteristis of logEnorml distriutions returned y (lter of forestF loglik P116 E ivlute minus the logElikelihood funtion in time or frequeny dominF neighbourhood P122 E ivlute the lol ehviour of the ojetive funtion round the estimted prmeter vluesF regress P125 E gentred popultion regression for seleted model vrilesF VAR P147 E opultion e for seleted model vrilesF

Getting on-line help on model functions


help model help model/function_name

acf
Autocovariance and autocorrelation functions for model variables
Syntax
[C,R,List] = acf(M,...)

Input arguments
M model E olved model ojet for whih the egp will e omputedF TW

wodel ojets nd funtionsX acf

Output arguments
C nmedmt | numeri E eutoGrossEovrine mtriesF R nmedmt | numeri E eutoGrossEorreltion mtriesF List ellstr E vist of vriles in rows nd olumns of C nd RF

Options
applyTo= ellstr | hr | Inf E vist of vriles to whih the filter= will e ppliedY Inf mens ll vrilesF contributions= true | false E sf true the ontriutions of individul shoks to egps will e omputed nd stored in the Sth dimension of the C nd R mtriesF filter= hr | empty E viner (lter tht is pplied to vriles spei(ed y pplyto9F nFreq= numeri | 256 E xumer of eqully sped frequenies over whih the (lter in the option filter= is numerilly integrtedF order= numeri | E yrder up to whih egp will e omputedF

output= namedmat | numeric E yutput mtries C nd R will e either nmedmt oE jets or plin numeri rrysY if the option select= is usedD output= is lwys nmedmt ojetF select= ellstr | Inf E eturn egp for seleted vriles onlyY Inf mens ll vrilesF

Description
C nd R re oth xEyExEyE@CIAEyEelt mtriesD where x is the numer of mesurement nd trnsition vriles @inluding uxiliry lgs nd leds in the stte spe vetorAD is the order up to whih the egp is omputed @ontrolled y the option order=AD nd elt is the numer of lterntive prmeteristions in the input model ojetD MF sf contributions= trueD the size of the two mtries is xEyExEyE@CIAEyEiEeltD where i is the numer of mesurement nd trnsition shoks in the modelF

ACF with linear lters


ou n use the option filter= to get the egp for vriles s though they were (ltered through liner (lterF ou n speify the (lter in oth the time domin @suh s (rstEdi'erene (lterD or rodrikEresottA nd the frequny domin @suh s nd of ertin frequnies or periodiitiesAF he (lter is text string in whih you n use the following referenesX

UH

wodel ojets nd funtionsX addparam LD the lg opertorD whih will e repled with exp(-1i*freq)Y perD the periodiityY freqD the frequenyF

Example 1
e (rstEdi'erene (lter @iFeF omputes the egp for the (rst di'erenes of the respetive vrilesAX
[C,R] = acf(m,filter=,1-L)

Example 2
he ylil omponent of the rodrikEresott (lter with the smoothing prmeterD lambdaD IDTHHF he formul for the (lter follows from the lssil ienerEuolmogorov signl extrtion theoryD

w L

@ Aa C

j(1L)(1L)j2
/(16 + 1/abs((1-L)^2)^2))

[C,R] = acf(m,filter,16

Example 3
e ndEpss (lter with userEspei(ed lower nd upper ndsF he ndEpss (lters n e de(ned either in frequenies or periodiitiesY the ltter is usully more onvenientF he following is (lter whih retins periodiities etween R nd RH periods @this would e etween I nd IH yers in qurterly modelAD
[C,R] = acf(m,filter,per >= 4 & per <= 4 )

addparam
Add model parameters to a database (struct)
UI

wodel ojets nd funtionsX alter

Syntax
D = addparam(M,D)

Input arguments
M model E wodel ojet whose prmeters will e dded to dtse @strutA DF D strut E htse to whih the model prmeters will e ddedF

Output arguments
h strut E htse with the model prmeters ddedF

Description
sf there re dtse entries in D whose nmes oninide with the model prmetersD they will e overwrittenF

Example
D = struct(); D = addparam(M,D);

alter
Expand or reduce number of alternative parameterisations
Syntax
M = alter(M,N)

UP

wodel ojets nd funtionsX assign

Input arguments
M model E wodel ojet in whih the numer of premeteristions will e hngedF N numeri E xew numer of prmeteristionsF

Output arguments
M model E wodel ojet with the new numer of prmeteristionsF

Description Example

assign
Assign parameters, steady states, std deviations or cross-correlations
Syntax
[M,Assigned] = assign(M,P) [M,Assigned] = assign(M,Name,Value,Name,Value,...) [M,Assigned] = assign(M,List,Values)

Syntax for fast assign


% Initialise assign(M,List); % Fast assign M = assign(M,Values); ... M = assign(M,Values); ...

UQ

wodel ojets nd funtionsX autoexogenise

Syntax for assigning only steady-state levels


M = assign(M,-level,...)

Syntax for assignin only steady-state growth rates


M = assign(M,-growth,...)

Input arguments
M model E wodel ojetF P strut | model E htse whose (elds refer to prmeter nmesD vrile nmesD std devitionsD or rossEorreltionsY or nother model ojetF Name hr E e prmeter nmeD vrile nmeD std devitionD rossEorreltionD or regulr expression tht will e mthed ginst model nmesF Value numeri E e vlue @or vetor of vlues in se of multiple prmeteristionsA tht will e ssignedF List ellstr E e list of prmeter nmesD vrile nmesD std devitionsD or rossEorreltionsF Values numeri E e vetor of vluesF

Output arguments
M model E wodel ojet with newly ssigned prmeters ndGor stedy sttesF Assigned ellstr | Inf E vist of tully ssigned prmeter nmesD vriles nmes @stedy sttesAD std devitionsD nd rossEorreltionsY Inf indites tht ll vlues hs een ssigned from nother model ojetF

Description Example

UR

wodel ojets nd funtionsX bn

autoexogenise
Get or set variable/shock pairs for use in autoexogenised simulation plans
Syntax fo getting autoexogenised variable/shock pairs
A = autoexogenise(M)

Syntax fo setting autoexogenised variable/shock pairs


M = autoexogenise(M,A)

Input arugments
M model E wodel ojetF A strut | empty E htse with eh (eld representing vrileGshok pirD eFrilexme a hokxme9D tht n e used in uilding simultion plns P152 y the pln funtion autoexogenise P153 F

Output arguments
M model E wodel ojet with updted de(nitions of utoexogenised vrileGshok pirsF

Description
henever you set the utoexogenised vrileGshok pirsD the previously ssigned pirs re reE movedD nd repled with the new ones in AF sn other wordsD the new pirs re not dded to the existing onesD the reple themF

Example

bn
Beveridge-Nelson trends
US

wodel ojets nd funtionsX chksstate

Syntax
Outp = bn(M,Inp,Range,...)

Input arguments
M model E olved model ojetF Inp strut | ell E snput dt on whih the fx trends will e omputedF Range numeri E hte rnge on whih the fx trends will e omputedF

Output arguments
Outp strut | ell E yutput dt with the fx trendsF

Options
deviations= true | false E snput nd output dt re devitions from lnedEgrowth pthsF dtrends= auto | true | false E wesurement vriles in input nd output dt inlude deterministi trends spei(ed in !dtrends P30 equtionsF

Description Example

chksstate
Check if equations hold for currently assigned steady0state values
Syntax
[Flag,List] = chksstate(M,...) [Flag,Discr,List] = chksstate(M,...)

UT

wodel ojets nd funtionsX comment

Input arguments
M model E wodel ojetF

Output arguments
Flag true | false E rue if disrepny etween vr nd r is smller thn tolerance= in eh equtionF Discr numeri E hisrny etween vr nd r evluted for eh eqution t two onseutive timesF List ellstr E vist of equtions in whih the disrepny etween vr nd r is greter thn tolerance=F

Options
error= true | false E hrow n error if one or more equtions do not holdF refresh= true | false E efresh dynmi links efore evluting the equtionsF sstateEqtn= true | false E sf falseD the dynmi model equtions will e hekedY if trueD the stedyEstte versions of the equtions @wherever villeA will e hekedF tolerance= numeri | getrealsmall() E olerneF warning= true | false E hisply wrnings produed y this funtionF

Description Example

comment
Get or set user comments in an IRIS object
Syntax for getting user comments
Cmt = comment(Obj)

UU

wodel ojets nd funtionsX data4lhsmrhs

Syntax for assigning user comments


Obj = comment(Obj,Cmt)

Input arguments
Obj model | tseries | e | e | pee | sstte E yne of the ss ojetsF Cmt hr E ser omment tht will e tthed to the ojetF

Output arguments
Cmt hr E ser omment tht re urrently tthed to the ojetF

Description Example

data4lhsmrhs
Prepare data array for running `lhsmrhs`
Syntax
[YXE,List,XRange] = data4lhsmrhs(M,D,Range)

Input arguments
M model E wodel ojet whose equtions will e lter evluted y lling lhsmrhs P115 F D strut E snput dtse with oservtions on mesurement vrilesD trnsition vrilesD nd shoks on whih lhsmrhs P115 will e evlutedF Range numeri E hte rnge on whih lhsmrhs P115 will e evlutedF

UV

wodel ojets nd funtionsX diffloglik

Output arguments
YXE numeri E xumeri rry with the oservtions on mesurement vrilesD trnsition vrilesD nd shoks orgnised rowEwiseF List ellstr E vist of mesurement vrilesD trnsition vriles nd shoks in order of their pperne in the rows of YXEF XRange numeri E ixtended rnge inluding preEsmple nd postEsmple oservtions needed to evlute lgs nd leds of trnsition vrilesF

Description
he resulting rryD YXED is nVar y nXPer y nDataD where nVar is the totl numer of mesurement vrilesD trnsition vrilesD nd shoksD nXPer is the numer of periods inluding the preEsmple nd postEsmple periods needed to evlute lgs nd ledsD nd nData is the numer of lterntive dt sets @iFeF the numer of olumns in eh input time seriesA in the input dtseD DF

Example
YXE = data4lhsmrhs(M,d,range); D = lhsmrhs(M,YXE);

dioglik
Approximate gradient and hessian of log-likelihood function
Syntax
[MinusLogLik,Grad,Hess,V] = diffloglik(M,D,Range,PList,...)

Input arguments
M model E wodel ojet whose likelihood funtion will e di'erentitedF D ell | strut E snput dt from whih mesurement vriles will e tkenF Range numeri E hte rnge on whih the likelihood funtion will e evlutedF UW

wodel ojets nd funtionsX diffsrf List ellstr E vist of model prmeters with respet to whih the likelihood funtion will e di'erentitedF

Output arguments
MinusLogLik numeri E lue of minus the likelihood funtion t the input dtF Grad numeri E qrdient @or soreA vetorF Hess numeri E ressin @or informtionA mtrixF V numeri E istimted vrine sle ftor if the relative= options is trueY otherwise v is IF

Options
chkSstate= true | false | ell E ghek stedy stte in eh itertionY works only in nonEliner modelsF refresh= true | false E efresh dynmi links for eh hnge in prmeterF solve= true | false E eEompute solution for eh hnge in prmeterF sstate= true | false | ell E eEompute stedy stte in eh di'erentition stepY if the model is nonElinerD you n pss in ell rry with options used in the sstate funtionF ee help on model/filter P93 for other options villeF

Description Example

disrf
Dierentiate shock response functions w.r.t. specied parameters
Syntax
S = diffsrf(M,RANGE,LIST,...) S = diffsrf(M,NPER,LIST,...)

VH

wodel ojets nd funtionsX eig

Input arguments
M model E wodel ojet whose response funtions will e simulted nd di'erentitedF RANGE numeri E imultion dte rnge with the (rst dte eing the shok dteF NPER numeri E xumer of simultion periodsF LIST hr | ellstr E vist of prmeters wFrFtF whih the shok response funtions will e di'erentitedF

Output arguments
S strut E htse with shok reponse derivtives stowed in multivrite time seriesF

Options
ee model/srf P136 for options villeF

Description Example

eig
Eigenvalues of the model transition matrix
Syntax
e = eig(m)

Input arguments
m model E wodel ojet whose eigenvlues will e returnedF

VI

wodel ojets nd funtionsX estimate

Output arguments
e numeri E erry of ll eigenvlues ssoited with the modelD iFeF ll stleD unitD nd unstle roots re inludedF

Description Example

emptydb
Create model-specic database with variables, shocks, and parameters
Syntax
D = emptydb(M)

Input arguments
M model | kwmodel E wodel or kwmodel ojet for whih the empty dtse will e retedF

Output arguments
D strut E htse with n empty tseries ojet for eh vrile nd eh shokD nd n empty rry for eh prmeterF

Description Example

estimate
Estimate model parameters by optimising selected objective function
VP

wodel ojets nd funtionsX estimate

Syntax
[PEst,Pos,Cov,Hess,M,V,Delta,PDelta] = estimate(M,D,Range,Est,...) [PEst,Pos,Cov,Hess,M,V,Delta,PDelta] = estimate(M,D,Range,Est,SPr,...)

Input arguments
M strut E wodel ojetF D strut | ell E snput dtse or dtpk from whih the mesurement vriles will e tkenF Range strut E hte rngeF Est strut E htse with the list of premeters tht will e estimtedD nd the prmeter prior spei(tions @see elowAF SPr empty | systempriors E ystem priors ojetD systempriors P164 F

Output arguments
PEst strut E htse with point estimtes of requested prmetersF Pos poster E osteriorD poster P169 D ojetY this ojet lso gives you ess to the vlue of the ojetive funtion t optimum or t ny point in the prmeter speD see the poster/eval P171 funtionF Cov numeri E epproximte ovrine mtrix for the estimtes of prmeters with slk ounds sed on the symptoti pisher informtion mtrix @not on the ressin returned from the optimistion routineAF Hess ell E Hess{1} is the totl hessin of the ojetive funtionY Hess{2} is the ontriutions of the priors to the hessinF M model E wodel ojet solved with the estimted prmeters @inluding outEofElikelihood prmeters nd ommon vrine ftorAF he remining three output rgumentsD VD DeltaD PDeltaD re the sme s the model/loglik P116 output rguments of the sme nmesF

VQ

wodel ojets nd funtionsX estimate

Options
chkSstate= true | false | ell E ghek stedy stte in eh itertionY works only in nonEliner modelsF evalFrfPriors= true | false E sn eh itertionD evlute frequeny response funtion prior densityD nd inlude it to the overll ojetive funtion to e optimisedF evalLik= true | false E sn eh itertionD evlute likelihood @or nother dt sed riterionAD nd inlude it to the overll ojetive funtion to e optimisedF evalPPriors= true | false E sn eh itertionD evlute prmeter prior densityD nd inlude it to the overll ojetive funtion to e optimisedF evalSPriors= true | false E sn eh itertionD evlute system prior densityD nd inlude it to the overll ojetive funtion to e optimisedF filter= ell | empty E gell rry of options tht will e pssed on to the ulmn (lter inluding the type of ojetive funtionY see help on model/filter P93 for the options villeF initVal= model | struct | strut E sf struct use the vlues in the input strut Est to strt the itertionY if model use the urrently ssigned prmeter vlues in the input modelD MF maxIter= numeri | 5 E wximum numer of itertions llowedF E wximum numer of ojetive funtion lls llowedF

maxFunEvals= numeri | 2

noSolution= error | penalty E pei(es wht hppens if solution or stedy stte fils to solve in n itertionX error= stops the exeution with n error messgeD penalty= returns n extremely low vlue of the likelihoodF optimSet= ell | empty E gell rry used to rete the yptimiztion oolox options strutureY works only with the option optimiser= defaultF refresh= true | false E efresh dynmi links in eh itertionF solve= true | false E eEompute solution in eh itertionF optimiser= default | pso | ell | funtionhndle E winimistion proedureF

 defaultX he yptimiztion oolox funtion fminunc or fmincon will e lled deE


pending on the presene or sene of lower ndGor upper oundsF

 psoX he rtile wrm yptimizer will e lledY use the option pso= to speify

further options to ontrol the optimizer @see yptions for rtile wrm yptimizer elowAF

VR

wodel ojets nd funtionsX estimate

 funtionhndle or ellX inter funtion hndle to your own optimistion proedureD


or ell rry with funtion hndle nd dditionl input rguments @see elowAF sstate= true | false | ell | funtionhndle E eEompute stedy stte in eh itertionF ou n speify ell rry with options for the sstate funtionD or funtion hndle whose ehviour is desried elowF tolFun= numeri | 1e-6 E ermintion tolerne on the ojetive funtionF tolX= numeri | 1e-6 E ermintion tolerne on the estimted prmetersF

Options for Particle Swarm Optimizer


he following options n e spei(ed through the min option optimset= when optimiser=psoF cognitiveAttraction= numeri | .5 E lr etween ttrtion to the est lotion prtile n rememerF nd 1 to ontrol the reltive

constrBoundary= absorb | reflect | soft E gontrols the wy imposed onstrints re hndled when violtedF

 softX rtiles re llowed to trvel outside the ounds ut get d (tness funtion
@likelihoodA vlues when they doY

 reflectX rtile veloity is hnged suh tht when the prtile enounters the ound
its veloity is hnged to e'etively mke it oune o' of the oundryY euse its veloity is set to zeroF

 absorbX rtiles hit the ound nd sty t the ound until ttrted elsewhere
display= off | final | iter E vevel of disply in order of inresing verosityY iter will only produe output t most updateInterval= seondsF fitnessLimit= numeri | -Inf E elgorithm will terminte when funtion vlue this low is enounteredF generations= numeri | 1 evolutionF E ositive integer desriing the mximum length of swrm

hybridFcn= true | false | fmincon | fminunc | ell E un seond stge optimiztion fter y @only ville with the yptimiztion x instlledAX

 falseX xo seond stge optimiztionD run the prtile swrm onlyF  trueX efter yD run either fminunc or fminconD the yptimiztion oolox routinesD

depending on the presene or sene of lower nd upper ounds on estimted prmeE tersF VS

wodel ojets nd funtionsX estimate

 fminuncD fminconX efter yD run the spei(ed yptimiztion oolox routineF  ellX e ell rry in whih the (rst rgument spei(es the funtion s previously nd
the seond rgument ontins the options struture for tht funtionY for instne {@fmincon,optimset(Display,iter)}F

includeInitialValue= true | false E snlude the initil vetor of prmeters in the initil popultionF initialPopulation=9 numeri | empty E en xrEyExop rry ontining the initil distriution of prtilesD where xr is the numer of estimted prmetersD nd xop is the size of popultionF sf emptyD popultion will e reted ontining the initil prmeter vetor nd the rest of the prtiles will e rndomly generted ording to popInitRange=F se the option includeInitialValue= false oo exlude the initil vlue from the initil popultion so tht the entire popultion is rndomly genertedF socialAttraction= numeri | 1.25 E ositive slr to ontrol the reltive ttrtion of eh prtile to the est lotion they hve herd out from other prtilesF plotFcns= ell | empty E gell rry of funtion hndles to funtions whih ept (options,state,flag) vlues s input rgumentsF he only uiltEin generlEpurpose plotting funtion is @optim.scoreDiversityF populationSize= numeri | 4 E ositive integer whih determines the numer of prtiles in the swrmF popInitRange= numeri | empty E e PEyExr rry whih sets the rnge over whih the initil popultion will e distriutedD where xr is the numer of estimted prmetersD or PEyEI rry with the rnge for ll prmetersF sf empty nd PopInitRange= is not setD the upper nd lower ounds will e used if oth re (niteF sf either of the ounds re in(niteD the rnge will e [ ;1]F stallGenLimit= numeri | 1 E wximum numer of swrm itertions whih result in no improvement in the (tness funtion @likelihoodA vlue efore the lgorithm termintesF timeLimit= numeri | Inf E wximum running time in seondsF tolCon= numeri | 1e-6 E vrgest tolerted onstrint violtionF tolFun= numeri | 1e-6 E puntion tolerneY when the hnge in the est (tness funE tion vlue @likelihoodA improvement per genertion flls elow this vlue the lgorithm will terminteF velocityLimit= numeri | Inf E ositive slr to ound prtile interti from oveF updateInterval=B numeri | 5 E winimum length of time in seonds whih must pss efore new ommnd window output will e produedF

VT

wodel ojets nd funtionsX estimate useParallel= true | false E se parfor loop whih requires you lredy hve matlabpool openF yverhed is slightly higher for onstrined prolems thn unonstrined prolemsF

Description
sn the input prmeter dtseD ED you n provide the following four spei(tions for eh prmeterX
E.parameter_name = {start,lower,upper,logprior}

where start is the vlue from whih the numeril optimistion will strtD lower is the lower oundD upper is the upper oundD nd logprior is funtion hndle expeted to return the log of the prior densityF ou n use the logdist P176 pkge to rete funtion hndles for some of the si prior distriutionsF ou n use NaN for start if you wish to use the vlue urrently ssigned in the model ojetF ou n use -Inf nd Inf for the oundsD or leve the ounds empty or not speify them t llF ou n leve the prior distriution empty or not speify it t llF

User-supplied optimisation (minimisation) routine


ou n supply funtion hndle to your own minimistion routine through the option optimiser=F his routine will e used insted of the yptim x9s fminunc or fmincon funtionsF he userE supplied funtion is expeted to tke t lest (ve input rguments nd return three output rguE mentsX
[PEst,ObjEst,Hess] = yourminfunc(F,P ,PLow,PHigh,Opt)

with the following input rgumentsX F is funtion hndle to the funtion minimisedY P is IEyEx vetor of initil prmeter vluesY PLow is IEyEx vetor of lower ounds @with -Inf inditing no lower oundAY PHigh is IEyEx vetor of upper ounds @with Inf inditing no upper oundsAY Opt is n yptim x style strut with the optimistion settings @tolerneD numer of iterE tionsD etAY of ourse you my simply ignore this informtion nd leve the input rgument unusedF VU

wodel ojets nd funtionsX evalsystempriors nd the following output rgumentsX PEst is IEyEx vetor of estimted prmetersY ObjEst is the vlue of the ojetive funtion t optimumY Hess is xEyEx pproximte ressin mtrix t optimumF sf you need to use extr input rguments in your minimistion funtionD enter ell rry insted of plin funtion hndleX
{@yourminfunc,Arg1,Arg2,...}

sn tht seD the optmiser will e lled the following wyX


[PEst,ObjEst,Hess] = yourminfunc(F,P ,PLow,PHigh,Opt,Arg1,Arg2,...)

User-supplied steady-state solver


ou n supply funtion hndle to your own stedy stte solver @iFeF funtion tht (nds the stedy stte for given prmetersA through the sstate= optionF he funtion is expeted to tke one input rgumentD the model ojet with newly ssigned pE rmetersD nd return t lest two output rgumentsD the model ojet with new stedy stte @or lnedEgrowth pthA nd suess )gF he )g is true if the stedy stte hs een suessfully omputedD nd false if notX
[M,Success] = yoursstatesolver(M)

st is your responsiility to dd the growth hrteristis if some of the model vriles drift over timeF sn other wordsD you need to tke re of the imginry prts of the stedy stte vlues in the model ojet returned y the solverF

Example

evalsystempriors
Evaluate minus log of system prior density
VV

wodel ojets nd funtionsX expand

Syntax
[P,C,X] = evalsystempriors(M,S)

Input arguments
M model E wodel ojet on whih urrent prmeteristion the system priors will e evlutedF S systempriors E ystem priors ojetsF

Output arguments
P numeri E winus log of system prior densityF C numeri E gontriutions of individul prios to the overll system prior densityF X numeri E lue of eh system property for whih prior hs een de(ned in the system priors ojetD SF

Description Example

expand
Compute forward expansion of model solution for anticipated shocks
Syntax
m = expand(m,k)

Input arguments
m model E wodel ojet whose solution will e expndedF k numeri E xumer of periods hedD tCkD up to whih the solution for ntiipted shoks will e expndedF VW

wodel ojets nd funtionsX fevd

Output arguments
m model E wodel ojet with the solution expndedF

Description Example

export
Save carry-around les on the disk
Syntax
export(M)

Input arguments
M model E wodel ojet whose rryEround mE(les @written in underlying the model (leA will e sved on the diskF

Description
ee the ss model lnguge keyword !export P32 for help on how to write rryEround mE(les in model (lesF

Example

fevd
Forecast error variance decomposition for model variables

WH

wodel ojets nd funtionsX ffrf

Syntax
[X,Y,List,A,B] = fevd(M,Range,...) [X,Y,List,A,B] = fevd(M,NPer,...)

Input arguments
M model E wodel ojet for whih the deomposition will e omputedF Range numeri E heomposition dte rnge with the (rst dte eign the (rst forest periodF NPer numeri E xumer of periods for whih the deomposition will e omputedF

Output arguments
X nmedmt | numeri E erry with the solute ontriutions of individul shoks to totl vrine of eh vrilesF Y nmedmt | numeri E erry with the reltive ontriutions of individul shoks to totl vrine of eh vrilesF List ellstr E vist of vriles in rows of the X n Y rrysD nd shoks in olumns of the X nd Y rrysF A strut E htse with the solute ontriutions onverted to time seriesF B strut E htse with the reltive ontriutions onverted to time seriesF

Options
output= nmedmt9 | numeri E yutput mtries X nd Y will e either nmedmt ojets or plin numeri rrysY if the option select= is usedD output= is lwys namedmatF select= hr | ellstr E eturn pih for seleted vriles ndGor shoks onlyY Inf mens ll vrilesF his option does not pply to the output dtsesD A nd BF

Description Example

WI

wodel ojets nd funtionsX ffrf

rf
Filter frequency response function of transition variables to measurement variables
Syntax
[F,List] = ffrf(M,Freq,...)

Input arguments
M model E wodel ojet for whih the frequeny response funtion will e omputedF Freq numeri E etor of frequenies for whih the response funtion will e omputedF

Output arguments
F numeri E erry with frequeny responses of trnsition vriles @in rowsA to mesurement vriles @in olumnsAF List ell E vist of trnsition vriles in rows of the F mtrixD nd list of mesurement vriles in olumns of the F mtrixF

Options
include= hr | ellstr | Inf E snlude the e'et of the listed mesurement vriles onlyY Inf mens ll mesurement vrilesF exclude= hr | ellstr | empty E emove the e'et of the listed mesurement vrilesF maxIter= numeri | SHH E wximum numer of itertion when omputing the stedyEstte ulmn (lterF output= nmedmt9 | numeri E yutput mtrix F will e either nmedmt ojet or plin numeri rryY if the option select= is usedD output= is lwys namedmatF select= hr | ellstr | Inf E eturn the frequeny response funtion for seleted vriles onlyY Inf mens ll vrilesF tolerance= numeri | IeEU E gonvergene tolerne when omputing the stedyEstte ulmn (lterF

WP

wodel ojets nd funtionsX filter

Description Example

lter
Kalman smoother and estimator of out-of-likelihood parameters
Syntax
[M,Outp,V,Delta,PE,SCov] = filter(M,Inp,Range,...) [M,Outp,V,Delta,PE,SCov] = filter(M,Inp,Range,J,...)

Input arguments
M model E olved model ojetF Inp strut | ell E snput dtse or dtpk from whih the mesurement vriles will e tkenF Range numeri E pilter dte rngeF J strut E htse with tunes on the men of shoks ndGor timeEvrying std devs of shoksF

Output arguments
M model E wodel ojet with updtes of std devs @if relative= is trueA ndGor updtes of outEofElikelihood prmeters @if outoflik= is nonEemptyAF Outp strut | ell E yutput strut with smoother or predition dtF V numeri E istimted vrine sle ftor if the relative= options is trueY otherwise V is IF Delta strut E htse with estimtes of outEofElikelihood prmetersF PE strut E htse with predition errors for mesurement vrilesF SCov numeri E mple ovrine mtrix of smoothed shoksY the ovrine mtrix is omputed using shok estimtes in periods tht re inluded in the option objrange= ndD t the sme timeD ontin t lest one oservtion of mesurement vrilesF WQ

wodel ojets nd funtionsX filter

Options
ahead= numeri | 1 E reditions will e omputed this numer of period hedF condition= hr | ellstr | empty E vist of onditioning mesurement vrilesF gondition time t|tEI predition errors @tht enter the likelihood funtionA on time t oservtions of these mesurement vrilesF deviation= true | false E ret input nd output dt s devitions from lnedE growth pthF dtrends= uto9 | true | false E wesurement dt ontin deterministi trendsF data= predict | smooth | predict,smooth E eturn smoother dt or predition dt or othF initCond= fixed | optimal | stochastic | strut E wethod or dt to initilise the ulmn (lterY userEsupplied initil ondition must e men dtse or menEwi strutF lastSmooth= numeri | Inf E vst dte up to whih to smooth dt kwrd from the end of the rngeY if Inf smoother will run on the entire rngeF meanOnly= true | false E eturn plin dtse with men dt onlyY this option overrides the return*= optionsD iFeF returnCont=D returnMse=D returnStd=F outOfLik= ellstr | empty E vist of prmeters in deterministi trends tht will e estimted y onentrting them out of the likelihood funtionF objFunc= -loglik | prederr E yjetive funtion omputedY n e either minus the log likelihood funtion or weighted sum of predition errorsF objRange= numeri | Inf E he ojetive funtion will e omputed on this surnge onlyY Inf mens the entire (lter rngeF precision= double | single E xumeri preision to whih output dt will e storedY ll lultions themselves lwys run to doule preisionF rollback= numeri | empty E hte up to whih to roll k individul oservtions on mesurement vriles from the end of the smpleF relative= true | false E td devs of shoks ssigned in the model ojet will e treted s reltive std devsD nd ommon vrine sle ftor will e estimtedF returnCont= true | false E eturn ontriutions of mesurement vriles to the estiE mtes of ll vriles nd shoksF returnMse= true | false E eturn wi mtries for predetermined stte vrilesY these n e used for settin up initil ondition in susequent ll to nother filter or jforecastF WR

wodel ojets nd funtionsX filter returnStd= true | false E eturn dtse with std devs of model vrilesF tolMse= numeri | E olerne under whih two wi mtries in two onseutive periods will e treted s equlD nd the ulmn gin system will e reEusedD not reEomputedF weighting= numeri | empty E eighting vetor or mtrix for predition errors when objective= prederrY empty mens predition errors re weighted equllyF

Options for models with non-linearised equations


nonlinearise= numeri | E sf nonEzero the predition step in the ulmn (lter will e run in n ext nonEliner mode using the sme tehnique s model/simulate P131 F simulate= ell | empty E yptions pssed in to simulate when invoking the nonEliner simultion in the predition stepY only used when nonlinearise= is greter thn F

Description
he ahead= nd rollback= options nnot e omined with one notherD or with multiple dt setsD or with multiple prmeteristionsF

Initial conditions in time domain


fy defult @with initCond= stochasticAD the ulmn (lter strts from the modelEimplied symptoti distriutionF ou n hnge this ehviour y setting the option initCond= to one of the following four di'erent vluesX fixed ! the (lter strts from the modelEimplied symptoti men @stedy stteA ut with no initil unertintyF he initil ondition is treted s vetor of (xedD nonEstohstiD numersF optimal ! the (lter strts from vetor of (xed numers tht is estimted optimlly @likelihood mximisingAF dtse @iFeF strut with (elds for individul model vrilesA ! dtse through whih you supply the men for ll the required initil onditionsD see help on model/get P100 for how to view the list of required initil onditionsF menEmse strut @iFeF strut with (elds .mean nd .mseA ! strut through whih you supplye the men nd wi for ll the required initil onditionsF

WS

wodel ojets nd funtionsX findeqtn

Contributions of measurement variables to the estimates of all variables


se the option returnCont= true to request the deomposition of mesurement vrilesD trnE sition vrilesD nd shoks into the ontriutions of eh individul mesurement vrileF he resulting output dtse will inlude one extr sudtse lled .contF sn the .cont suE dtseD eh time series will hve xy olumns where xy is the numer of mesurement vriles in the modelF he kEth olumn will e the ontriution of the oservtions on the kEth mesurement vrileF he ontriutions re dditive for linerised vrilesD nd multiplitive for logElinerised vriles @logEvrilesAF he di'erene etween the tul pth for prtiulr vrile nd the sum of the ontriutions @or their produt in the se of logEvrilesA is due to the e'et of onstnt terms nd deterministi trendsF

Example

ndeqtn
Find equations by the labels
Syntax
[Eqtn,Eqtn,...] = findeqtn(M,Label,Label,...) [List,List,...] = findeqtn(M,-rexp,Rexp,Rexp,...)

Input arguments
M model E wodel ojet in whih the equtions will e serhed forF Label hr E iqution lel tht will e serhed forF Rexp hr E egulr expressions tht will e mthed ginst eqution lelsF

Output arguments
Eqtn hr E pirst eqution found with the lel LabelF List ellstr E vist of equtions whose lels mth the regulr expression RexpF

WT

wodel ojets nd funtionsX fisher

Description Example

ndname
Find names of variables, shocks, or parameters by their descriptors
Syntax
[Name,Name,...] = findname(M,Desc,Desc,...) [List,List,...] = findname(M,-rexp,Rexp,Rexp,...)

Input arguments
M model E wodel ojet in whih the nmes will e serhed forF Desc hr E rileD shokD or prmeter desriptors tht will e serhed forF Rexp hr E egulr expressions tht will e mthed ginst vrileD shokD nd prmeter desriptorsF

Output arguments
Name hr E pirst nme found with the desriptor DescF List ellstr E vist of nmes whose desriptors mth the regulr expression RexpF

Description Example

sher
Approximate Fisher information matrix in frequency domain
WU

wodel ojets nd funtionsX fisher

Syntax
[F,FF,Delta,Freq] = fisher(M,NPer,List,...)

Input arguments
M model E olved model ojetF NPer numeri E vength of the hypothetil rnge for whih the pisher informtion will e omputedF List ellstr E vist of prmeters with respet to whih the likelihood funtion will e di'erentitedF

Output arguments
F numeri E epproximtion of the pisher informtion mtrixF FF numeri E gontriutions of individul frequenies to the totl pisher informtion mtrixF Delta numeri E uroneker delt y whih the ontriutions in Fi need to e multiplied to sum up to FF Freq numeri E etor of frequenies t whih the pisher informtion mtrix is evlutedF

Options
chkSstate= true | false | ell E ghek stedy stte in eh itertionY works only in nonEliner modelsF deviation= true | false E ixlude the stedy stte e'et t zero frequenyF exclude= hr | ellstr | empty E vist of mesurement vriles tht will e exluded from the likelihood funtionF percent= true | false E eport the overll pisher mtrix F s ressin wFrFtF the log of vrilesY the interprettion for this is tht the pisher mtrix desries the hnges in the logElikelihood funtion in reponse to perentD not soluteD hnges in prmetersF progress= true | false E hisply progress r in the ommnd windowF refresh= true | false E efresh dynmi links in eh di'erentition stepF solve= true | false E eEsolve model in eh di'erentition stepF sstate= true | false | ell E eEompute stedy stte in eh di'erentition stepY if the model is nonElinerD you n pss in ell rry with opt used in the sstate funtionF WV

wodel ojets nd funtionsX fmse

Description Example

fmse
Forecast mean square error matrices
Syntax
[F,List,D] = fmse(M,NPer,...) [F,List,D] = fmse(M,Range,...)

Input arguments
M model E wodel ojet for whih the forest wi mtries will e omputedF NPer numeri E xumer of periodsF Range numeri E hte rngeF

Output arguments
F numeri E porest wi mtriesF List ellstr E vist of vriles in rows nd olumns of MF D dse E htse with the std devitions of individul vrilesD iFeF the squre roots of the digonl elements of FF

Options
output= nmedmt9 | numeri E yutput mtrix M will e either nmedmt ojet or plin numeri rryY if the option select= is usedD output= is lwys namedmatF select= ellstr | Inf E eturn pwi for seleted vriles onlyY Inf mens ll vrilesF he option does not pply to the output dtse DF

WW

wodel ojets nd funtionsX get

Description Example

get
Query model object properties
Syntax
Ans = get(M,Query) [Ans,Ans,...] = get(M,Query,Query,...)

Input arguments
M model E wodel ojetF Query hr E uery to the model ojetF

Output arguments
Ans F F F E enswer to the queryF

Valid queries to model objects


felow is the tegorised list of model properties nd ttriutes tht n e queriedGessed y the get funtionF xote tht letter y is used in vrious ontexts to denote mesurement vriles or equtionsD x trnsition vriles or equtionsD e shoksD p prmetersD g exogenous vrilesD d deterministi trend equtionsD l dynmi linksD nd r reporting equtionsF he property nmes re se insensitiveF

Steady state
sstate ! eturns strut dtse with the stedy sttes for ll model vrilesF he stedy sttes re desried y omplex numers in whih the rel prt is the level nd the imginry prt is the growth rteF sstateLevel ! eturns strut dtse with the stedyEstte levels for ll model vrilesF IHH

wodel ojets nd funtionsX get sstateGrowth ! eturns strut dtse with stedyEstte growth @(rst di'erene for linerised vrilesD gross rte of growth for logElinerised vrilesA for ll model vrilesF dtrends ! eturns strut dtse with the e'et of the deterministi trends on the mesurement vrilesF he e'et is desried y omplex numers the sme wy s the stedy stteF dtrendsLevel ! eturns strut dtse with the e'et of the deterministi trends on the stedyEstte levels of the mesurement vrilesF dtrendsGrowth ! eturns strut dtse with the e'et of deterministi trends on stedyEstte growth of the mesurement vrilesF sstate+dtrends ! eturns strut the sme s sstte9 exept tht the mesurement vriles re orreted for the e'et of the deterministi trendsF sstateLevel+dtrendsLevel ! eturns strut the sme s ssttevevel9 exept tht the mesurement vriles re orreted for the e'et of the deterministi trendsF sstateGrowth+dtrendsGrowth ! eturns strut the sme s sstateGrowth exept tht the mesurement vriles re orreted for the e'et of the deterministi trendsF

Variables, shocks, and parameters


yListD xListD eListD pListD gList E eturn ellstr the lists ofD respetivelyD mesurement vriles @yAD trnsition vriles @xAD shoks @eAD prmeters @pAD nd exogenous vriles @gAD eh in order of pperne of the nmes in delrtion setions of the originl model (leF xote tht the list of prmetersD pListD does not inlude the nmes of std devitions or rossEorreltionsF eyList ! eturns ellstr the list of mesurement shoks in order of their pperne in the model ode delrtionsY only those shoks tht tully our in t lest one mesurement eqution re returnedF exList ! eturns ellstr the list of trnsition shoks in order of their pperne in the model ode delrtionsY only those shoks tht tully our in t lest one trnsition eqution re returnedF stdList ! eturns ellstr the list of the nmes of the stndrd devitions for the shoks in order of the pperne of the orresponding shoks in the model odeF corrList ! eturns ellstr the list of the nmes of rossEorreltion oe0ients for the shoks in order of the pperne of the orresponding shoks in the model odeF stdCorrList ! eturns ellstr the list of the nmes of std devitions nd rossEorreltion oe0ients for the shoks in order of the pperne of the orresponding shoks in the model odeF IHI

wodel ojets nd funtionsX get

Equations
yEqtnD xEqtnD dEqtnD lEqtnD rEqtn E eturn ellstr the lists ofD respetivelyD to mesurement equtions @yAD trnsition equtions @xAD deterministi trends @dAD dynmi links @lAD nd reporting equtions @rAD eh in order of pperne in the originl model (leF links ! eturns strut dtse with the dynmi links with (elds nmes fter the vr nmeF

First-order Taylor expansion of equations


derivatives ! eturns ellstr the symoliGutomti derivtives for eh model equE tionY in eh equtionD the derivtives wFrFtF ll vriles present in tht eqution re evluted t one nd returned s vetor of numersY see lso wrtF wrt E eturns ellstr the list of the vriles @nd their uxiliry lgs or ledsA with respet to whih the orresponding eqution in derivatives is di'erentitedF

Descriptions and aliases of variables, parameters, and shocks


descript ! eturns strut dtse with user desriptions of model vrilesD shoksD nd prmetersF yDescriptD xDescriptD eDescriptD pDescriptD gDescript E eturn ellstr user desriptions ofD respetivelyD mesurement vriles @yAD trnsition vriles @xAD shoks @eAD prmeters @pAD nd exogenous vriles @gAF alias ! eturns strut dtse with ll lises of model vrilesD shoksD nd prmetersF yAliasD xAliasD eAliasD pAliasD gAlias E eturn ellstr the lises ofD respeE tivelyD mesurement vriles @yAD trnsition vriles @xAD shoks @eAD prmeters @pAD nd exogenous vriles @gAF

Equation labels and aliases


labels ! eturns ellstr the list of ll user lels dded to equtionsF yLabelsD xLabelsD dLabelsD lLabelsD rLabels E eturn ellstr user lels ddedD respetivelyD to mesurement equtions @yAD trnsition equtions @xAD deterministi trends @dAD dynmi links @lAD nd reporting equtions @rAF eqtnAlias ! eturns ellstr the list of ll lises dded to equtionsF yEqtnAliasD xEqtnAliasD dEqtnAliasD lEqtnAliasD rEqtnAlias E eturn ellstr the lises ofD respetivelyD mesurement equtions @yAD trnsition equtions @xAD deterministi trends @dAD dynmi links @lAD nd reporting equtions @rAF IHP

wodel ojets nd funtionsX get

Parameter values
corr ! eturns strut dtse with urrent rossEorreltion oe0ients of shoksF nonzeroCorr ! eturns strut dtse with urrent nonzero rossEorreltion oe0E ients of shoksF parameters ! eturns strut dtse with urrent prmeter vluesD inluding the std devs nd nonEzero orr oe0ientsF std ! eturns strut dtse with urrent std devitions of shoksF

Eigenvalues
stableRoots ! eturns ell of numeri vetor of the model eigenvlues tht re smller thn one in mgnitude @llowing for rounding errors round oneAF unitRoots ! eturns ell of numeri vetor of the model eigenvlues tht equl one in mgnitude @llowing for rounding errors round oneAF unstableRoots ell of numeri e vetor of the model eigenvlues tht re greter thn one in mgnitude @llowing for rounding errors round oneAF

Model structure, solution, build


build ! eturns numeri ss version numer under whih the model ojet hs een uiltF log ! eturns strut dtse with true for eh logElinerised vrilesD nd false for eh linerised vrileF maxLag ! eturns numeri the mximum lg in the modelF maxLead ! eturns numeri the mximum led in the modelF stationary ! eturns strut dtse with true for eh sttionry vrilesD nd false for eh unitEroot @nonEsttionryA vriles @under urrent solutionAF nonStationary ! eturns strut dtse with true for eh unitEroot @nonEsttionryA vrileD nd false for eh sttionry vrile @under urrent solutionAF stationaryList ! eturns ellstr the list of sttionry vriles @under urrent solutionAF nonStationaryList ! eturns ellstr ell with the list of unitEroot @nonEsttionryA vriles @under urrent solutionAF initCond ! eturns ellstr the list of the lgged trnsition vriles tht need to e supplied s initil onditions in simultions nd forestsF he list of the initil onditions is solutionEspei( s the stteEspee oe0ients t some of the lgs my evlute to zero depending on the urrent prmetersF IHQ

wodel ojets nd funtionsX get yVector ! eturns ellstr the list of mesurement vriles in order of their pperne in the rows nd olumns of stteEspe mtries @e'etively identil to yListA from the model/sspace P137 funtionF xVector ! eturns ellstr the list of trnsition vrilesD nd their uxiliry lgs nd ledsD in order of their pperne in the rows nd olumns of stteEspe mtries from the model/sspace P137 funtionF xfVector ! eturns ellstr the list of forwrdElooking @iFeF nonEpredeterminedA trnsition vrilesD nd their uxiliry lgs nd ledsD in order of their pperne in the rows nd olumns of stteEspe mtries from the model/sspace P137 funtionF xbVector ! eturns ellstr the list of kwrdElooking @iFeF predeterminedA trnsition vrilesD nd their uxiliry lgs nd ledsD in order of their pperne in the rows nd olumns of stteEspe mtries from the model/sspace P137 funtionF eVector ! eturns ellstr the list of the shoks in order of their pperne in the rows nd olumns of stteEspe mtries @e'etively identil to eListA from the model/sspace P137 funtionF

Description

First-order Taylor expansion of equations


he expressions for symoliGutomti derivtives of individul model equtions returned y derivatives re expressions tht evlute the derivtives with respet to ll vriles present in tht eqution t oneF he list of vriles with respet to whih eh eqution is di'erentited is returned y wrtF he expressions returned y the query derivatives n refer to the nmes of model prmetersD suh s alphaY the nmes of trnsition or mesurement vrilesD suh s XY the lgs or leds of vrilesD suh s X{-1} or X{2}F xote tht the lgs nd leds of vriles must eD in generlD preserved in the derivtives for nonE sttionry @unitErootA modelsF por sttionry modelsD the lgs nd leds n e removed nd eh simply repled with the urrent dte of the respetive vrileF

Example
d = get(m,derivatives);

IHR

wodel ojets nd funtionsX horzcat


w = get(m,wrt);

he IEyEx ell rry d @where x is the totl numer of equtions in the modelA will ontin expressions tht evlute to the vetor of derivtives of the individul equtions wFrFtF to the vriles present in tht equtionX
d{k}

is n expression tht returnsD in generlD vetor of w numersF hese w numers re the derivtives of the kEth eqution wFrFt to w vriles whose list is in
w{k}

horzcat
Combine two compatible model objects in one object with multiple parameterisations
Syntax
M = [M1,M2,...]

Input arguments
M1D M2 model E gomptile model ojets tht will e ominedY the input models must e sed on the sme model (leF

Output arguments
M model E yutput model ojet tht omines the input model ojets s multiple prmE eteristionsF

IHS

wodel ojets nd funtionsX ifrf

Description Example

icrf
Initial-condition response functions
Syntax
S = icrf(M,NPer,...) S = icrf(M,Range,...)

Input arguments
M model E wodel ojet for whih the initil ondition responses will e simultedF Range numeri E hte rnge with the (rst dte eing the shok dteF NPer numeri E xumer of periodsF

Output arguments
S strut E htse with initil ondition response seriesF

Options
delog= true | false E helogrithmise the responses for vriles delred s !variables:logF size= numeri | 1 for liner models | log(1. 1) for nonEliner models E ize of the devition in initil onditionsF

Description Example

IHT

wodel ojets nd funtionsX iscompatible

ifrf
Frequency response function to shocks
Syntax
[W,List] = ifrf(M,Freq,...)

Input arguments
M model E wodel ojet for whih the frequeny response funtion will e omputedF Freq numeri E etor of frequenies for whih the response funtion will e omputedF

Output arguments
W numeri E erry with frequeny responses of trnsition vriles @in rowsA to shoks @in olumnsAF List ell E vist of trnsition vriles in rows of the W mtrixD nd list of shoks in olumns of the W mtrixF

Options
output= nmedmt9 | numeri E yutput mtrix W will e either nmedmt ojet or plin numeri rryY if the option select= is usedD output= is lwys namedmatF select= hr | ellstr | Inf E eturn the frequeny response funtion only for seleted vriles ndGor seleted shoksF

Description Example

iscompatible
True if two models can occur together on the LHS and RHS in an assignment

IHU

wodel ojets nd funtionsX islinear

Syntax
Flag = iscompatible(M1,M2)

Input arguments
M1D M2 model E wo model ojets tht will e tested for omptiilityF

Output arguments
Flag true | false E rue if M1 nd M1 n our in n ssignmentD M1(...) = M2(...) or horziontl ontentionD [M1,M2]F

Description
he funtion ompres the nmes of ll vrilesD shoksD nd prmetersD nd the omposition of the stteEspe vetorsF

Example

islinear
True for models declared as linear
Syntax
Flag = islinear(M)

Input arguments
m model E ueried model ojetF

Output arguments
Flag true | false E rue if the model hs een delred linerF IHV

wodel ojets nd funtionsX isname

Description
he vlue returned dependes on whether the model hs een delred s liner y the user when onstruting the model ojet y lling the model/model P119 funtionF sn other wordsD no hek is performed whether or not the model is tully linerF

Example
m = model(mymodel.file,linear=,true); islinear(m) ans = 1

islog
True for log-linearised variables
Syntax
flag = islog(m,name)

Input arguments
m model E wodel ojetF name hr | ellstr E xme or nmes of model vrile@sAF

Output arguments
flag true | false E rue for vriles delred s logEliner in nonEliner modelF

Description Example

IHW

wodel ojets nd funtionsX isnan

isname
True for valid names of variables, parameters, or shocks in model object
Syntax
Flag = isname(M,Name) [Flag,Flag,...] = isname(M,Name,Name,...)

Input arguments
M model E wodel ojetF Name hr E e text string tht will e mthed ginst the nmes of vrilesD prmeters nd shoks in the model ojet MF

Output arguments
Flag true | false E rue for input strings tht re vlid nmes in the model ojet MF

Description Example

isnan
Check for NaNs in model object
Syntax
[Flag,List] = isnan(M,parameters) [Flag,List] = isnan(M,sstate) [Flag,List] = isnan(M,derivatives)

IIH

wodel ojets nd funtionsX issolved

Input arguments
M model E wodel ojetF

Output arguments
Flag true | false E rue if t lest one NaN vlue exists in the queried tegoryF List ellstr E vist of prmeters @if lled with parametersA or vriles @if lled with variablesA tht re ssigned xx in t lest one prmeteristionD or equtions @if lled with derivativesA tht produe n xx derivtive in t lest one prmeteristionF

Description Example

issolved
True if a model solution exists
Syntax
flag = issolved(m)

Input arguments
m model E wodel ojetF

Output arguments
flag true | false E rue for eh prmeteristion for whih stle unique solution hs een found nd exists urrently in the model ojetF

III

wodel ojets nd funtionsX jforecast

Description Example

isstationary
True if model or specied combination of variables is stationary
Syntax
Flag = isstationary(M) Flag = isstationary(M,Expn)

Input arguments
M model E wodel ojetF Expn hr E ext string with n expression desriing omintion of trnsition vriles to e testedF

Output arguments
flag= true | false E rue if the model @if lled without seond input rgumentA or the spei(ed omintion of vriles @if lled with seond input rgumentA is sttionryF

Description Example

jforecast
Forecast with judgmental adjustments (conditional forecasts)

IIP

wodel ojets nd funtionsX jforecast

Syntax
F = jforecast(M,D,Range,...)

Input arguments
M model E olved model ojetF D strut E snput dt from whih the initil ondition is tkenF Range numeri E porest rngeF

Output arguments
F strut E yutput strut with the judgmentlly djusted forestF

Options
anticipate= true | false E sf trueD rel future shoks re ntiiptedD imginry re unntiiptedY vie vers if flseF currentOnly= true | false E sf trueD wi mtries will e omputed only for urrentE dted vrilesD not for their lgs or ledsF deviation= true | false E ret input nd output dt s devitions from lnedE growth pthF dtrends= auto | true | false E wesurement dt ontin deterministi trendsF initCond= data | fixed E se the wi for the initil onditions if found in the input dt or tret the initil onditions s (xedF meanOnly= true | false E eturn only men dtD iFeF point estimtesF plan= pln E imultion pln speifying the exogenised vriles nd endogenised shoksF vary= strut | empty E htse with timeEvrying std devitions or rossEorreltions of shoksF

IIQ

wodel ojets nd funtionsX lhsmrhs

Description
hen djusting the men ndGor std devs of shoksD you n use rel nd imginry numers ot distinguish etween ntiipted nd unntiipted shoksX ny shok entered s n imginry numer is treted s n ntiipted hnge in the men of the shok distriutionY ny std dev of shok entered s n imginry numer indites tht the shok will e treted s ntiipted when onditioning the forest on the reduedEform tunesF the sme shok or its std dev n hve oth the rel nd the imginry prtF

Description Example

length
Number of alternative parameterisations
Syntax
N = length(M)

Input arguments
M model | esteq E wodel or esteq ojetF

Output arguments
N numeri E xumer of lterntive prmeteristionsF

Description Example

IIR

wodel ojets nd funtionsX lhsmrhs

lhsmrhs
Evaluate the discrepancy between the LHS and RHS for each model equation and given data
Syntax for casual evaluation
Q = lhsmrhs(M,D,Range)

Syntax for fast evaluation


Q = lhsmrhs(M,YXE)

Input arguments
M model E wodel ojet whose equtions nd urrently ssigned prmeters will e evlutedF YXE numeri E xumeri rry reted from n input dtse y lling the funtion data4lhsmrhs P78 Y YXE ontins the oservtions on the mesurement vrilesD trnsition vrilesD nd shoks orE gnised rowEwiseF

D strut E snput dtse with oservtions on mesurement vrilesD trnsition vrilesD nd shoks on whih the disrepnies will e evlutedF Range numeri E hte rnge on whih the disrepnies will e evlutedF

Output arguments
Q numeri E xumeri rry with disrepnies etween the vr nd r for eh model equtionF

Description
he funtion lhsmrhs evlutes the disrepny etween the vr nd the r in eh model equtionY eh led is repled with the tul oservtion supplied in the input dtF he funtion lhsmrhs does not work for models with referenes to stedy stte vlues P55 F he (rst syntxD with the rry YXE preEuilt in ll to data4lhsmrhs P78 is omputtionlly muh more e0ient if you need to evlute the vrEr disrepnies repetedly for di'erent prmeteristionsF IIS

wodel ojets nd funtionsX loglik he output rgument D is n nEqtn y nPer y nAlt rryD where nEqnt is the numer of meE surement nd trnsition equtionsD nPer is the numer of periods used to rete X in prior ll to data4lhsmrhs P78 D nd nAlt is the greter of the numer of lterntive prmeteristions in MD nd the numer of lterntive dtsets in the input dtF

Example
YXE = data4lhsmrhs(M,d,range); Q = lhsmrhs(M,YXE);

loglik
Evaluate minus the log-likelihood function in time or frequency domain
Full syntax
[Obj,V,F,PE,Delta,PDelta] = loglik(M,D,Range,...)

Syntax for fast one-o likelihood evaluation


Obj = loglik(M,D,Range,...)

Syntax for repeated fast likelihood evaluations


% Step #1: Initialise. loglik(M,D,Range,...,persist=,true); % Step #2: Assign/change parameters. M... = ...; % Change parameters. % Step #3: Re-compute steady state and solution if necessary. M = ...; M = ...; % Step #4: Evaluate likelihood.

IIT

wodel ojets nd funtionsX loglik


L = loglik(M); % Repeat steps #2, #3, #4 for different values of parameters. % ...

Input arguments
M model E wodel ojet on whih the likelihood of the input dt will e evlutedF D strut | ell E snput dtse or dtpk from whih the mesurement vriles will e tkenF Range numeri E hte rngeF

Output arguments

Test title
Obj numeri E lue of minus the logElikelihood funtion @or other ojetive funtion if spei(ed in optionsAF V numeri E istimted vrine sle ftor if the relative= options is trueY otherwise V is IF F numeri E equene of forest wi mtries for mesurement vrilesF PE strut E htse with predition errors for mesurement vrilesY exp of predition errors for mesurement vriles delred s logEvrilesF Delta strut E htse with point estimtes of the deterministi trend prmeters spei(ed in the outoflik= optionF PDelta numeri E wi mtrix of the estimtes of the outoflik= prmetersF

Options
persist= true | false ! reEproess nd store the overhed @dt nd optionsA for susequent fst llsF ee help on model/filter P93 for other options villeF

IIU

wodel ojets nd funtionsX lognormal

Description
he numer of output rguments you request when lling loglik 'ets omputtionl e0ienyF unning the funtion with only the (rst output rgumentD iFeF the vlue of the likelihood funtion @minus the log of itD in ftAD results in the fstest performneF he loglik funtion runs n identil ulmn (lter s model/filter P93 D the only di'erene is the types nd order of output rguments returnedF

Fast evaluation of likelihood


ivery time you hnge the prmetersD you need to updte the stedy stte nd solution of the model if neessry y yourselfD efore lling loglikF pollow these rulesX sf you only hnge std devitions nd no other prmetersD you don9t hve to reElulte stedy stte or solutionF sf the model is linerD you only need to ll solve P134 F he only exeption to rules 5P nd 5Q is when the model hs dynamic links P40 with referenes to some stedy stte vluesF sn tht seD you must lso run sstate P138 fter solve P134 in liner models to updte the stedy stteF sf the model is nonElinerD nd you only hnge prmeters tht 'et trnsitory dynmis nd not the stedy stteD you only need to ll solve P134 F sf the model is nonElinerD nd you hnge prmeters tht 'et oth trnsitory dynmis nd stedy stteD you must run (rst sstate P138 nd then solve P134 F

Example

lognormal
Characteristics of log-normal distributions returned by lter of forecast
Syntax
D = lognormal(M,D,...)

IIV

wodel ojets nd funtionsX model

Input arguments
M model E wodel on whih the filter or forecast funtion hs een runF D strut E trut or dtse returned from the filter or forecast funtionF

Output arguments
D strut E trut inluding new suEdtses with requested logEnorml sttistisF

Options
fresh= true | false E yutput struture will inlude only the newly omputed dtsesF mean= true | false E gompute the men of the logEnorml distriutionsF median= true | false E gompute the medin of the logEnorml distriutionsF mode= true | false E gompute the mode of the logEnorml distriutionsF prctile= numeri | SDWS E gompute the seleted perentiles of the logEnorml distriuE tionsF prefix= hr | lognorml9 E re(x used in the nmes of the newly reted dtsesF std= true | false E gompute the std devitions of the logEnorml distriutionsF

Description

model
Create new model object based on model le
Syntax
m = model(fname,...) m = model(m,...)

IIW

wodel ojets nd funtionsX model

Input arguments
fname hr | ellstr E xme@sA of the model (le@sA tht will loded nd onverted to new model ojetF m model E ixisting model ojet tht will e reuilt s if from model (leF

Output arguments
m model E xew model ojet sed on the input model ode (le or (lesF

Options
multiple= true | flse E ellow eh vrileD shokD or prmeter nme to e delred @nd ssignedA more thn one in the model (leF assign= strut | empty E essign model prmeters ndGor stedy sttes from this dtse t the time the model ojets is eing retedF baseYear= numeri | PHHH E fse yer for onstruting deterministi time trendsF comment= hr | empty E ext omment tthed to the model ojetF declareParameters= true | false E sf falseD skip prmeter delrtion in the model (leD nd determine the list of prmeters utomtilly s nmes found in equtions ut not delredF epsilon= numeri | eps@IGRA E he minimum reltive step size for numeril di'erentiE tionF linear= true | false E sndite liner modelsF removeLeads= true | false E emove ll leds from the stteEspe vetorD keep inluded only urrent dtes nd lgsF sstateOnly= true | false E ed in only the stedyEstte versions of equtions @if villeAF std= numeri | I for liner models | HFHI for nonEliner models E hefult stndrd devition for model shoksF userdata= F F F | empty E etth user dt to the model ojetF

IPH

wodel ojets nd funtionsX neighbourhood

Description

Loading a model le


he model funtion n e used to red in model (le P23 nmed fnameD nd rete model ojet m sed on the model (leF ou n then work with the model ojet in your own mE(lesD using using the ss model funtions P66 nd stndrd wtl funtionsF sf fname is ell rry of more thn one (lenmes then ll (les re omined together @in order of pperneAF

Re-building an existing model object


he only instne where you my need to ll model funtion on n existing model ojet is to hnge the removeLeads= optionF yf ourseD you n lwys hieve the sme y loding the originl model (leF

Example 1
ed in model ode (le nmed my.modelD nd delre the model s linerX
m = model(my.model,linear,true);

Example 2
ed in model ode (le nmed my.modelD delre the model s linerD nd ssign some of the model prmetersX
m = model(my.model,linear=,true,assign=,P);

xote tht this is equivlent to


m = model(my.model,linear=,true); m = assign(m,P);

unless some of the prmeters pssed in to the model fution re needed to evlute if P37 or !switch P48 expressionsF

IPI

wodel ojets nd funtionsX neighbourhood

neighbourhood
Evaluate the local behaviour of the objective function around the estimated parameter values
Syntax
[D,FigH,AxH,ObjH,LikH,EstH,BH] = neighbourhood(M,PS,Neigh,...)

Input arguments
M model | kwmodel E wodel or kwmodel ojetF PS poster E osterior simultor @posterA ojet returned y the model/estimate P82 funE tionF Neigh numeri E he neighourhood in whih the ojetive funtion will e evluted de(ned s multiples of the prmeter estimtesF

Output arguments
D strut E trut desriing the lol ehviour of the ojetive funtion nd the dt likelihood @minus log likelihoodA within the spei(ed rnge round the optimum for eh prmeterF he following output rguments re nonEempty only if you hoose plot= trueX FigH numeri E rndles to the (gures retedF AxH numeri E rndles to the xes ojets retedF ObjH numeri E rndles to the ojetive funtion urves plottedF LikH numeri E rndles to the dt likelihood urves plottedF EstH numeri E rndles to the tul estimte mrks plottedF BH numeri E rndles to the ounds plottedF

IPP

wodel ojets nd funtionsX omega

Options
plot= true | false E gll the grfun.plotneigh P433 funtion from within neighbourhood to visulise the resultsF neighbourhood= strut | empty E trut speifying the neighourhood points for some of the prmetersY these points will e used insted of those sed on NeighF

Plotting options
ee help on grfun.plotneigh P433 for options ville when you hoose plot= trueF

Description
sn the output dtseD DD eh prmeter is IEyEQ ell rryF he (rst ell is vetor of prmeter vlues t whih the lol ehviour ws investigtedF he seond ell is mtrix with two olumn vetorsX the vlues of the overll minimised ojetive funtion @s set up in the estimate P82 funtionAD nd the vlues of the dt likelihood omponentF he third ell is vetor of four numersX the prmeter estimteD the vlue of the ojetive funtion t optimumD the lower ound nd the upper oundF

Example

omega
Get or set the covariance matrix of shocks
Syntax for getting covariance matrix
OMG = omega(M)

Syntax for setting covariance matrix


M = omega(M,OMG)

IPQ

wodel ojets nd funtionsX refresh

Input arguments
M model | kwmodel E wodel or kwmodel ojetF OMG numeri E govrine mtrix tht will e onverted to new vlues for std devitions nd rossEorr oe0ientsF

Output arguments
OMG numeri E govrine mtrix of shoks or residuls sed on the urrently ssigned std devitions nd rossEorreltion oe0ientsF M model | kwmodel E wodel or kwmodel ojet with new vlues for std devitions nd rossEorr oe0ients sed on the input ovrine mtrixF

Description Example

refresh
Refresh dynamic links
Syntax
M = refresh(M)

Input arguments
M model E wodel ojet whose dynmi links will e refreshedF

Output arguments
M model E wodel ojet with dynmi links refreshedF

IPR

wodel ojets nd funtionsX regress

Description Example
m = refresh(m);

regress
Centred population regression for selected model variables
Syntax
[B,CovRes,R2] = regress(M,Lhs,Rhs,...)

Input arguments
M model E wodel on whose ovrine mtries the popoltion regression will e sedF Lhs hr | ellstr E vhs vriles in the regressionY eh of the vriles must e prt of the stteEspe vetorF Rhs hr | ellstr E hs vriles in the regressionY eh of the vriles must e prt of the stteEspe vetorD or must refer to lrger lg of trnsition vrile present in the stteEspe vetorF

Output arguments
B nmedmt | numeri E opultion regression oe0ientsF CovRes nmedmt | numeri E govrine mtrix of residuls from the popultion regressionF R2 numeri E goe0ient of determintion @EsquredAF

Options
output= namedmat | numeric E yutput mtries will e either nmedmt ojets or plin numeri rrysF

IPS

wodel ojets nd funtionsX reporting

Description
opultion regressions lulted y this funtion re lwys entredF his mens the regressions re lwys lulted s if estimted on oservtions with their unondionl mens @the stedyEstte levelsA removed from themF he vhs nd hs vriles tht re logEvriles must inlude log(...) expliitly in their nmesF por instneD if X is delred to e log vrileD then you must refer to log(X) or log(X{-1})F

Example
[B,C] = regress(log(R),{log(R{-1}),log(dP)});

reporting
Run reporting equations
Syntax
D = reporting(M,D,Range,...)

Input arguments
M model E wodel ojet with reporting equtionsF D strut E snput dtse tht will e used to evlute the reporting equtionsF Range numeri E hte rnge on whih the reporting equtions will e evlutedF

Output arguments
D strut E yutput dtse with reporting vrilesF

Options
dynamic= true | false E sf trueD equtions will e evluted period y period llowing for own lgsY if flseD equtions will e evluted en lo for ll periodsF IPT

wodel ojets nd funtionsX resample merge= true | false E werge output dtse with input dtseF

Description

resample
Resample from the model implied distribution
Syntax
Outp = resample(M,Inp,Range,NDraw,...) Oupt = resample(M,Inp,Range,NDraw,J,...)

Input arguments
M model E olved model ojetF Inp strut | empty E snput dt @if neededA for the distriutions of initil ondition ndGor empiril shoksY if not ootstrp is invovled Range numeri E esmpling dte rngeF NDraw numeri E xumer of drwsF J strut | empty E htse with userEsupplied @timeEvryingA tunes on std devsD orr oe'sD ndGor mens of shoksF

Output arguments
Outp strut E yutput dtse with resmpled dtF

Options
deviation= true | false E ret input nd output dt s devitions from lnedE growth pthF dtrends= auto | true | false E edd deterministi trends to mesurement vrilesF

IPU

wodel ojets nd funtionsX set method= bootstrap | montecarlo E wethod of rndomising shoks nd initil ondiE tionF progress= true | false E hisply progress r in the ommnd windowF randomInitCond= true | false | numeri E ndomise initil onditionY numer mens the initil ondition will e simulted using the spei(ed numer of extr preEsmple periodsF stateVector= alpha | x E hen resmpling initil onditionD use the trnsformed stte vetorD alphaD or the vetor of originl vrilesD xY this option is ment to gurntee repliility of resultsF svdOnly= true | false E ho not ttempt gholesky nd only use h to ftorize the ovrine mtrix when resmpling initil onditionY only pplies when randomInitCond= trueF wild= true | false E se wild ootstrp insted of ifron ootstrpY only pplies when method= bootstrapF

Description
hen you use wild ootstrp for resmpling the initil onditionD the results re sed on n ssumption tht the men of the initil ondition is the symptoti men implied y the model @iFeF the stedy stteAF

Example

set
Change modiable model object property
Syntax
M = set(M,Request,Value) M = set(M,Request,Value,Request,Value,...)

Input arguments
M model E wodel ojetF IPV

wodel ojets nd funtionsX set Request hr E xme of modi(le model ojet property tht will e hngedF Value F F F E lue to whih the property will e setF

Output arguments
M model E wodel ojet with the requested property or properties modi(edF

Valid requests to model objects

Equation labels and aliases


yLabels=D xLabels=D dLabels=D lLabels= ellstr E ghnge the lels tthed toD respetivelyD mesurement equtions @yAD trnsition equtions @xAD deterministi trends @dAD nd dynmi links @dAF labels= ell E ghnge the lels tthed to ll equtionsY needs to e ellstr mthing the size of get(M,labels)F yeqtnAlias=D xeqtnAlias=D deqtnAlias=D leqtnAlias= ellstr E ghnge the lises ofD respetivelyD mesurement equtions @yAD trnsition equtions @xAD deterministi trends @dAD nd dynmi links @dAF eqtnAlias= ell E ghnge the lises of ll equtionsY needs to e ellstr mthing the size of get(M,eqtnAlias)F

Descriptions and aliases of variables, shocks, and parameters


yDescript=D xDescript=D eDescript=D pDescript= ellstr E ghnge the desripE tions ofD respetivelyD mesurement vriles @yAD trnsition vriles @xAD shoks @eAD nd exogenous vriles @gAF descript= strut E ghnge the desriptions of ll vrilesD prmetersD nd shoksY needs to e strut @dtseA with (elds orresponding to model nmesF yAlias=D xAlias=D eAlias=D pAlias= ellstr E ghnge the lises ofD respetivelyD mesurement vriles @yAD trnsition vriles @xAD shoks @eAD nd exogenous vriles @gAF alias= strut E ghnge the lises of ll vrilesD prmetersD nd shoksY needs to e strut @dtseA with (elds orresponding to model nmesF

IPW

wodel ojets nd funtionsX shockplot

Other requests
nAlt= numeri E ghnge the numer of lterntive prmeteristionsF stdVec= numeri E ghnge the whole vetor of std devitionsF tOrigin= numeri E ghnge the se yer for omputing deterministi time trends in mesurement vrilesF epsilon= numeri E ghnge the reltive di'erentition step when omputing ylor expnsionF

shockplot
Short-cut for running and plotting plain shock simulation
Syntax
[S,FF,AA] = shockplot(M,ShockName,SimRange,PlotList,...)

Input arguments
M model E wodel ojet tht will e simultedF ShockName hr E xme of the shok tht will e simultedF SimRange numeri E hte rnge on whih the shok will e simultedF PlotList ellstr E vist of vriles tht will e reportedY you n use the syntx of dbase/dbplot P365 F

Output arguments
S strut E htse with simultion resultsF FF numeri E rndles of (gure windows retedF AA numeri E rndles of xes ojets retedF

IQH

wodel ojets nd funtionsX simulate

Options aecting the simulation


deviation= true | false E ee the option deviation= in model/simulate P131 F dtrends= true | false E ee the option dtrends= option in model/simulate P131 F shockSize= std | numeri E ize of the shok tht will e simultedY std mens tht one std dev of the shok will e simultedF

Options aecting the graphs


ee help on dbase/dbplot P365 for other options villeF

Description
he simulted shok lwys ours t time t=1F strting the simultion rngeD SimRangeD efore t=1 llows you to simulte ntiipted shoksF he grphs utomtilly inlude one preEsmple periodD iFeF one period prior to the strt of the simultionF

Example

simulate
Simulate model
Syntax
S = simulate(M,D,Range,...) [S,Flag,AddF,Discrep] = simulate(M,D,Range,...)

Input arguments
M model E olved model ojetF D strut | ell E snput dtse or dtpk from whih the initil onditions nd shoks from within the simultion rnge will e redF IQI

wodel ojets nd funtionsX simulate Range numeri E imultion rngeF

Output arguments
S strut | ell E htse with simultion resultsF

Output arguments in non-linear simulations


Flag ell | empty E gell rry with exit )gs for nonElinerised simultionsF AddF ell | empty E gell rry of tseries with (nl ddEftors dded to (rstEorder pproxiE mte equtions to mke nonEliner equtions holdF Discrep ell | empty E gell rry of tseries with (nl disrepnies etween vr nd r in equtions ermrked for nonEliner simultions y douleEequl signF

Options
anticipate= true | false E sf trueD rel future shoks re ntiiptedD imginry re unntiiptedY vie vers if falseF contributions= true | false E heompose the simulted pths into ontriutions of individul shoksF deviation= true | false E ret input nd output dt s devitions from lnedE growth pthF dbOverlay= true | false | strut E se the funtion dboverlay to omine the simulted output dt with the input dtseD or with nother dtseD t the endF dTrends= uto9 | true | false E edd deterministi trends to mesurement vrilesF ignoreShocks= true | false E ed only initil onditions from input dtD nd ignore ny shoks within the simultion rngeF plan= pln E peify simultion pln to swp endogeneity nd exogeneity of some vriE les nd shoks temporrilyD ndGor to simulte some of the nonEliner equtions urtelyF progress= true | false E hisply progress r in the ommnd windowF

IQP

wodel ojets nd funtionsX simulate

Options for models with non-linearised equations


addSstate= true | false E edd stedy stte levels to simulted pths efore evluting nonEliner equtionsY this option is used only if deviation= trueF display= true | false | numeri | snf E eport itertions on the sreenY if display= ND report every N itertionsY if display= InfD report only (nl itertionF error= true | false E hrow n error whenever nonEliner simultion fils onvergeY if falseD only n wrning will displyF lambda= numeri | 1 E tep size @etween equtions in every itertionF nd 1A for dd ftors dded to nonElinerised

reduceLambda= numeri | .5 E ptor @etween nd 1A y whih lambda will e multiplied if the nonEliner simultion gets on n divergene pthF maxIter= numeri | 1 E wximum numer of itertionsF

tolerance= numeri | 1e-5 E gonvergene tolerneF

Description

Output range
ime series in the output dtseD SD re re de(ned on the simultion rngeD RANGED plus inlude ll neessry initil onditionsD iFeF lgs of vriles tht our in the model odeF ou n use the option dboverlay= to omine the output dtse with the input dtse @iFeF to inlude longer history of dt in the simulted seriesAF

Simulations with multilple parameterisations and/or multiple data sets


sf you simulte model with N prmeteristions nd the input dtse ontins K dt sets @iFeF eh vrile is time series with K olumnsAD then the following hppensX he model will e simulted totl of P = max(N,K) numer of timesF his mens tht eh vriles in the output dtse will hve P olumnsF he Ist prmeteristion will e simulted using the Ist dt setD the Pnd prmeteristion will e simulted using the Pnd dt setD etF until you reh either the lst prmeteristion or the lst dt setD iFeF min(N,K)F prom tht point onD the lst prmeteristion or the lst dt set will e simply repeted @reEusedA in the remining simultionsF ut formllyD the IEth olumn in the output dtseD where I = 1, ..., PD is simultion of the min(I,N)Eth model prmeteristion using the min(I,K)Eth input dt set numerF

IQQ

wodel ojets nd funtionsX solve

Example

single
Convert solution matrices to single precision
Syntax
m = single(m)

Input arguments
m model E wodel ojets whose solution mtries will e onverted to single preisionF

Output arguments
m model E wodel ojets singleEpreision solution mtriesF

Description

solve
Calculate rst-order accurate solution of the model
Syntax
M = solve(M,...)

Input arguments
M model E rmterised model ojetF xonEliner models must lso hve stedy stte vlues ssignedF

IQR

wodel ojets nd funtionsX solve

Output arguments
M model E wodel with newly omputed solutionF

Options
expand= numeri | | NaN E xumer of periods hed up to whih the model solution will e expndedY if NaN the mtries needed to support solution expnsion re not lulted nd stored t ll nd the model nnot e used lter in simultions or forests with ntiipted shoks or plnsF error= true | false E hrow n error if no unique stle solution existsY if falseD wrning messge only will e displyedF linear= auto | true | false E olve the model using liner pprohD iFeF di'erentiting round zero nd not the urrently ssigned stedy stteF progress= true | false E hisply progress r in the ommnd windowF refresh= true | false E efresh dynmi links efore omputing the solutionF select= true | false E eutomtilly detet whih equtions need to e reEdi'erentited sed on prmeter hnges from the lst time the system mtries were lultedF warning= true | false E hisply wrnings produed y this funtionF

Description
he ss solver uses n ordered @or generlised hurA deomposition to integrte out future expettionsF he my @very rrelyA fil for numeril resonsF ss inludes two pthes to hndle the some of the filuresX ixP pth @umEofEiigenluesExerEwoAD nd n iPgP pth @iigenvluesEooEgloseEoEwpAF he ixP pthX he model ontins two or more unit rootsD nd the lgorithm inE terprets some of them inorretly s pirs of eigenvlues tht sum up urtely to PD ut with one of them signi(ntly elow I nd the other signi(ntly ove IF ss reples the entries on the digonl of one of the ftor mtries with numers tht evlute to two unit rootsF he iPgP pthX he reEordering of thq mtries fils with wrning Reordering failed because some eigenvalues are too close to swap. ss ttempts to reEorder the equtions until worksF he numer of ttempts is limited to N-1 t most where N is the totl numer of equtionsF

IQS

wodel ojets nd funtionsX sspace

Example

srf
Shock response functions
Syntax
S = srf(M,NPer,...) S = srf(M,Range,...)

Input arguments
M model E wodel ojet whose shok responses will e simultedF Range numeri E imultion dte rnge with the (rst dte eing the shok dteF NPer numeri E xumer of simultion periodsF

Output arguments
S strut E htse with shok response time seriesF

Options
delog= true | false E helogrithmise the responses for vriles delred s !variables:logF select= ellstr | Inf E un the shok response funtion for seletion of shoks onlyY Inf mens ll shoks re simultedF size= std9 | numeri E ize of the shoks tht will e simultedY std9 mens tht eh shok will e set to its std dev urrently ssigned in the model ojet mF

Description Example

IQT

wodel ojets nd funtionsX sspace

sspace
State-space matrices describing the model solution
Syntax
[T,R,K,Z,H,D,U,Omg] = sspace(m,...)

Input arguments
m model E olved model ojetF

Output arguments
T numeri E rnsition mtrixF R numeri E wtrix t the shok vetor in trnsition equtionsF K numeri E gonstnt vetor in trnsition equtionsF Z numeri E wtrix mpping trnsition vriles to mesurement vrilesF H numeri E wtrix t the shok vetor in mesurement equtionsF D numeri E gonstnt vetor in mesurement equtionsF U numeri E rnsformtion mtrix for predetermined vrilesF Omg numeri E govrine mtrix of shoksF

Options
triangular= true | false E sf trueD the stteEspe form returned hs the trnsition mtrix T qusi tringulr nd the vetor of predetermined vriles trnsformed ordinglyF his is the form used in ss lultionsF

Description
he stteEspe representtion hs the following formX

IQU

wodel ojets nd funtionsX sstate


[xf;alpha] = T*alpha(-1) + K + R*e y = Z*alpha + D + H*e xb = U*alpha Cov[e] = Omg

where xb is n nEyEI vetor of predetermined @kwrdElookingA trnsition vriles nd their uxiliry lgsD xf is n nfEyEI vetor of nonEpredetermined @forwrdElookingA vriles nd their uxiliry ledsD alpha is trnsformtion of xbD e is n neEyEI vetor of shoksD nd y is n nyEyEI vetor of mesurement vrilesF purthermoreD we denote the totl numer of trnsition vrilesD nd their uxiliry lgs nd ledsD nx a n C nfF he trnsition mtrixD TD isD in generlD retngulr nxEyEnF purthremoreD the trnsformed stte vetor lph is hosen so tht the lower nEyEn prt of T is qusi upper tringulrF ou n use the get(m,xVector) funtion to lern out the order of pperne of trnsition vriles nd their uxiliry lgs nd leds in the vetors xb nd xfF he (rst nf nmes re the vetor xfD the remining n nmes re the vetor xbF

sstate
Compute steady state or balance-growth path of the model
Syntax
M = sstate(M,...)

Input arguments
M model E rmeterised model ojetF

Output arguments
M model E wodel ojet with newly omputed stedy stte ssignedF

IQV

wodel ojets nd funtionsX sstate

Options
linear= auto | true | false E olve for stedy stte using liner pprohD iFeF sed on the (rstEorder solution mtries nd the vetor of onstntsF warning= true | false E hisply ss wrning produed y this funtionF

Options for non-linear models


blocks= true | false E eErrrnge stedyEstte equtions in reursive loks efore omputing stedy stteF display= iter | final | notify | off E vevel of sreen outputD see yptim xF endogenise= ellstr | hr | empty E vist of prmeters tht will e endogenised when omputing the stedy stteY the numer of endogenised prmeters must mth the numer of trnstion vriles exogenised in the exogenised= optionF exogenise= ellstr | hr | empty E vist of trnsition vriles tht will e exogenised when omputing the stedy stteY the numer of exogenised vriles must mth the numer of prmeters exogenised in the exogenise= optionF fix= ellstr | empty E vist of vriles whose stedy stte will not e omputed nd kept (xed to the urrently ssigned vluesF fixAllBut= ellstr | empty E snverse list of vriles whose stedy stte will not e omputed nd kept (xed to the urrently ssigned vluesF fixGrowth= ellstr | empty E vist of vriles whose stedyEstte growth will not e omputed nd kept (xed to the urrently ssigned vluesF fixGrowthAllBut= ellstr | empty E snverse list of vriles whose stedyEstte growth will not e omputed nd kept (xed to the urrently ssigned vluesF fixLevel= ellstr | empty E vist of vriles whose stedyEstte levels will not e omputed nd kept (xed to the urrently ssigned vluesF fixLevelAllBut= ellstr | empty E snverse list of vriles whose stedyEstte levels will not e omputed nd kept (xed to the urrently ssigned vluesF growth= true | false E sf trueD oth the stedyEstte levels nd growth rtes will e omputedY if falseD only the levels will e omputed ssuming tht the model is either sttionry or tht the orret stedyEstte growth rtes re lredy ssigned in the model ojetF optimSet= ell | empty E xmeEvlue pirs with yptim x settingsY see help optimset for detils on these settingsF IQW

wodel ojets nd funtionsX sstatedb refresh= true | false E efresh dynmi links fter stedy stte is omputedF reuse= true | false E euse the stedyEstte vlues lulted for prmeteristion to initilise the next prmeteristionF solver= fsolve | lsqnonlin E olver funtion used to solve for the stedy stte of nonEliner modelsY it n e either of the two yptimiztion x funtionsD or userEsupplied solverF sstate= true | false | ell E sf true or ell rryD the stedy stte is reEomputed in eh itertionY the ell rry n e used to modify the defult options with whih the sstate funtion is lledF

Options for linear models


refresh= true | false E efresh dynmi links efore stedy stte is omputedF solve= true | false E olve model efore omputing stedy stteF

Description
xote tht for kwrd omptiilityD the option growth= is set to false y defult so tht either the model is ssumed sttionry or the stedyEstte growth rtes hve een lredy preEssigned to the model ojetF o use the sstate funtion for omputing oth the stedyEstte levels nd stedyEstte growth rtes in lnedEgrowth modelD you need to set the option growth= trueF

Example

sstatedb
Create model-specic steady-state or balanced-growth-path database
Syntax
[D,IsDev] = sstatedb(M,Range) [D,IsDev] = sstatedb(M,Range,NCol)

IRH

wodel ojets nd funtionsX sstatefile

Input arguments
M model E wodel ojet for whih the sstte dtse will e retedF Range numeri E sntended simultion rngeY the stedyEstte or lnedEgrowthEpth dtse will e reted on rnge tht lso utomtilly inludes ll the neessry lgsF NCol numeri E xumer of olumns for eh vrileY the input rgument NCol n e only used with singleEprmeteristion modelsF

Output arguments
D strut E htse with stedyEstte or lnedEgrowth pth tseries ojet for eh model vrileD nd slr or vetor of the urrently ssigned vlues for eh model prmE eterF IsDev false E he seond output rgument is lwys falseD nd n e used to set the option deviation= in model/simulate P131 F

Description Example

sstatele
Create a steady-state le based on the model object's steady-state equations
Syntax
sstatefile(m,filename,...)

Input arguments
m model E wodel ojetF file hr E pilenme under whih the stedyEstte (le will e svedF

IRI

wodel ojets nd funtionsX stdscale

Options
endogenise= ellstr | hr | empty E vist of prmeters tht will e endogenised when omputing the stedy stteY the numer of endogenised prmeters must mth the numer of trnstion vriles exogenised in the exogenised= optionF endogenise= ellstr | hr | empty E vist of trnsition vriles tht will e exogenised when omputing the stedy stteY the numer of exogenised vriles must mth the numer of prmeters exogenised in the exogenise= optionF growthNames= hr | d? E emplte for growth nmes used in evluting lgs nd ledsF time= true | false E ueep or remove time susripts @urly resA in the stedyEstte (leF

Description Example

stdscale
Re-scale all std deviations by the same factor
Syntax
m = stdscale(m,factor)

Input arguments
m model E wodel ojet whose std devitions will e reEsledF factor numeri E ptor y whih ll the model std devitions will e reEsledF

Output arguments
m model E wodel ojet with ll of its std devitions reEsledF

IRP

wodel ojets nd funtionsX subsasgn

Description Example

subsasgn
Subscripted assignment for model and systemt objects
Syntax for assigning parameterisations from other object
M(Inx) = N

Syntax for deleting specied parameterisations


M(Inx) = []

Syntax for assigning parameter values or steady-state values


M.Name = X M(Inx).Name = X M.Name(Inx) = X

Syntax for assigning std deviations or cross-correlations of shocks


M.std_Name = X M.corr_Name1__Name2 = X

xote tht doule undersore is used to seprte the xmes of shoks in orreltion oe0ientsF

Input arguments
M model | system(t E wodel or system(t ojet tht will e ssigned new prmeteristions or new prmeter vlues or new stedyEstte vluesF IRQ

wodel ojets nd funtionsX subsref N model | system(t E wodel or system(t ojet omptile with M whose prmeteristions will e ssigned @opiedA into MF Inx numeri E snx of prmeteristions tht will e ssigned or deletedF NameD Name1D Name2 hr E xme of vrileD shokD or prmeterF X numeri E e vlue @or vetor of vluesA tht will e ssigned to prmeter or vrile xmed NameF

Output arguments
M model | system(t E wodel or system(t ojet with newly ssigned or deleted prmeterE istionsD or with newly ssigned prmetersD or stedyEstte vluesF

Description Example
ixpnd the numer of prmeteristions in model or system(t ojet tht hs initilly just one prmeteristionX
m(1:1 ) = m;

he prmeteristion is simply opied ten times within the model or system(t ojetF

subsref
Subscripted reference for model and systemt objects
Syntax for retrieving object with subset of parameterisations
M(Inx)

Syntax for retrieving parameters or steady-state values


M.Name

IRR

wodel ojets nd funtionsX system

Syntax to retrieve a std deviation or a cross-correlation of shocks


M.std_ShockName M.corr_ShockName1__ShockName2

xote tht doule undersore is used to seprte the nmes of shoks in orreltion oe0ientsF

Input arguments
M model | system(t E wodel or system(t ojetF Inx numeri | logil E snx of requested prmeteristionsF Name E xme of vrileD shokD or prmeterF ShockName1D ShockName2 E xme of shokF

Description Example

system
System matrices before model is solved
Syntax
[A,B,C,D,F,G,H,J,List,NF] = system(M)

Input arguments
M model E wodel ojet whose system mtries will e returnedF

Output arguments
A numeri E wtrix t the vetor of expettions in the trnsition equtionF

IRS

wodel ojets nd funtionsX userdata B numeri E wtrix t urrent vetor in the trnsition equtionsF C numeri E gonstnt vetor in the trnsition equtionsF D numeri E wtrix t trnsition shoks in the trnsition equtionsF F numeri E wtrix t mesurement vriles in the mesurement equtionsF G numeri E wtrix t predetermined trnsition vriles in the mesurement vrilesF H numeri E gonstnt vetor in the mesurement equtionsF J numeri E wtrix t mesurement shoks in the mesurement equtionsF List ell E vists of mesurement vrilesD trnsition vriles inludint their uxiliry lgs nd ledsD nd shoks s they pper in the rows nd olumns of the system mtriesF NF numeri E xumer of nonEpredetermined @forwrdElookingA trnsition vrilesF

Options
linear= auto | true | false E gompute the model using liner pprohD iFeF di'erE entiting round zero nd not the urrently ssigned stedy stteF select= true | false E eutomtilly detet whih equtions need to e reEdi'erentited sed on prmeter hnges from the lst time the system mtries were lultedF

Description
he system efore the model is solved hs the following formX
A E[xf;xb] + B [xf(-1);xb(-1)] + C + D e = F y + G xb + H + J e =

where E is onditionl expettions opertorD xf is vetor of nonEpredetermined @forwrdElookingA trnsition vrilesD xb is vetor of predetermined @kwrdElookingA trnsition vrilesD y is vetor of mesurement vrilesD nd e is vetor of trnsition nd mesurement shoksF

Example

IRT

wodel ojets nd funtionsX VAR

userdata
Get or set user data in an IRIS object
Syntax for getting user data
X = userdata(OBJ)

Syntax for assigning user data


OBJ = userdata(OBJ,X)

Input arguments
OBJ model | tseries | e | e | pee | sstte E yne of the ss ojets with ess to user dt funtionsF X F F F E eny kind of dt tht will e tthed toD nd stored withinD the ojet OBJF

Output arguments
X F F F E ser dt tht re urrently tthed to the ojetF OBJ model | tseries | e | e | pee | sstte E he ojet with its user dt updtedF

Description Example

VAR
Population VAR for selected model variables
Syntax
V = VAR(M,Select,Range,...)

IRU

wodel ojets nd funtionsX vma

Input arguments
M model E olved model ojetF Select ellstr | hr E vist of vriles seleted for the eF Range numeri E rypothetil rngeD inluding preEsmple initil onditionD on whih the e would e estimtedF

Output arguments
V e E esymptoti reduedEform e for seleted model vrilesF

Options
order= numeri | I E yrder of the eF constant= true | false E snlude in the e onstnt vetor derived from the stedy stte of the seleted vrilesF

Description Example

vma
Vector moving average representation of the model
Syntax
[Phi,List] = vma(M,P,...)

Input arguments
M model E wodel ojet for whih the we representtion will e omputedF P numeri E yrder up to whih the we will e evlutedF

IRV

wodel ojets nd funtionsX xsf

Output arguments
Phi nmedmt | numeri E we mtriesF List ell E vist of mesurement nd trnsition vriles in the rows of the Phi mtrixD nd list of shoks in the olumns of the Phi mtrixF

Option
output= nmedmt9 | numeri E yutput mtrix Phi will e either nmedmt ojet or plin numeri rryY if the option select= is usedD output= is lwys namedmatF select= ellstr | Inf E eturn the we mtries for seleted vries ndGor shoks onlyY Inf mens ll vrilesF

Description Example

xsf
Power spectrum and spectral density of model variables
Syntax
[S,D,List] = xsf(M,Freq,...) [S,D,List,Freq] = xsf(M,NFreq,...)

Input arguments
M model E wodel ojetF Freq numeri E etor of frequenies t whih the ps will e evlutedF NFreq numeri E otl numer of requested frequeniesY the frequenies will e evenly spred etween H nd piF

IRW

wodel ojets nd funtionsX zerodb

Output arguments
S nmedmt | numeri E ower spetrum mtriesF D nmedmt | numeri E petrl density mtriesF List ellstr E vist of vrile in order of pperne in rows nd olumns of S nd DF Freq numeri E etor of frequenies t whih the ps hs een evlutedF

Options
applyTo= ellstr | hr | Inf E vist of vriles to whih the option filter= will e ppliedY Inf mens ll vrilesF filter= hr | empty E viner (lter tht is pplied to vriles spei(ed y pplyto9F nFreq= numeri | 256 E xumer of eqully sped frequenies over whih the (lter9 is numerilly integrtedF output= namedmat | numeric E yutput mtries S nd F will e either nmedmt oE jets or plin numeri rrysY if the option select= is usedD output= is lwys nmedmt ojetF progress= true | false E hisply progress r on in the ommnd windowF select= ellstr | Inf E eturn p for seleted vriles onlyY Inf mens ll vrilesF

Description Example

zerodb
Create model-specic zero-deviation database
Syntax
[D,IsDev] = zerodb(M,Range) [D,IsDev] = zerodb(M,Range,NCol)

ISH

wodel ojets nd funtionsX zerodb

Input arguments
M model E wodel ojet for whih the zero dtse will e retedF Range numeri E sntended simultion rngeY the zero dtse will e reted on rnge tht lso utomtilly inludes ll the neessry lgsF NCol numeri E xumer of olumns for eh vrileY the input rgument NCol n e only used on models with one prmeteristionF

Output arguments
D strut E htse with tseries ojet (lled with zeros for eh linerised vrileD tseries ojet (lled with ones for eh logElinerised vrilesD nd slr or vetor of the urrently ssigned vlues for eh model prmeterF IsDev true E he seond output rgument is lwys trueD nd n e used to set the option deviation= in model/simulate P131 F

Description Example

ISI

imultion plns

6 Simulation plans
imultion plns omplement the use of the model/simulate P131 or model/jforecast P112 funE tionsF ou need to use simultion pln ojet to set up the following types of more omplex simultions or forests @or omintion of theseAX

simulations or forecasts with some of the model variables temporarily


exogenisedY

simulations with some of the non-linear equations solved in an exact


nonEliner modeY

forecasts conditioned upon some variables;


he pln ojet is pssed to the model/simulate P131 or model/jforecast P112 funtions through the plan= optionF ln methodsX

Constructor
plan P161 E grete new simultion plnF

Getting information about simulation plans


detail P154 E hisply detils of simultion plnF get P157 E uery to pln ojetF nnzcond P158 E xumer of onditioning dt pointsF nnzendog P158 E xumer of endogenised dt pointsF nnzexog P159 E xumer of exogenised dt pointsF nnznonlin P160 E xumer of nonElinerised dt pointsF

ISP

imultion plnsX autoexogenise

Setting up simulation plans


autoexogenise P153 E ixogenise vriles nd utomtilly endogenise orresponding shoksF condition P154 E gondition forest upon the spei(ed vriles t the spei(ed dtesF endogenise P155 E indogenise shoks or reEendogenise vriles t the spei(ed dtesF exogenise P156 E ixogenise vriles or reEexogenise shoks t the spei(ed dtesF nonlinearise P160 E elet equtions for simultion in n ext nonEliner modeF

Referencing plan objects


subsref P162 E usripted referene for pln ojetsF

Getting on-line help on simulation plans


help plan help plan/function_name

autoexogenise
Exogenise variables and automatically endogenise corresponding shocks
Syntax
P = autoexogenise(P,List,Dates) P = autoexogenise(P,List,Dates,Flag)

Input arguments
P pln E imultion plnF List ellstr | hr E vist of vriles tht will e exogenisedY these vriles must hve their orresponding shoks ssignedD see !autoexogenise P29 F Dates numeri E htes t whih the vriles will e exogenisedF Flag I | Ii E elet the shok ntiiption modeY if not spei(edD Flag = 1F ISQ

imultion plnsX detail

Output arguments
P pln E imultion pln with new informtion on exogenised vriles nd endogenised shoks inludedF

Description Example

condition
Condition forecast upon the specied variables at the specied dates
Syntax
P = condition(P,List,Dates)

Input arguments
P pln E imultion plnF List ellstr | hr E vist of vriles upon whih forest will e onditionedF Dates numeri E htes t whih the forest will e onditioned upon the spei(ed vrilesF

Output arguments
P pln E imultion pln with new onditioning informtion inludedF

Description Example

detail
Display details of a simulation plan
ISR

imultion plnsX endogenise

Syntax
detail(P) detail(P,Data)

Input arguments
P pln E imultion plnF Data strut E snput dtseF

Description
sf you supply lso the seond input rgumentD the input dtse DD oth the dtes nd the reE spetive vlues will e reported for exogenised nd onditioning dt pointsD nd the vlues will e heked for the presene of xxs @with wrning should there e found nyAF

Example

endogenise
Endogenise shocks or re-endogenise variables at the specied dates
Syntax
P P P P = = = = endogenise(P,List,Dates) endogenise(P,Dates,List) endogenise(P,List,Dates,Sigma) endogenise(P,Dates,List,Sigma)

Input arguments
P pln E imultion plnF List ellstr | hr E vist of shoks tht will e endogenisedD or list of vriles tht will e reEendogeniseF ISS

imultion plnsX exogenise Dates numeri E htes t whih the shoks or vriles will e endogenisedF Sigma numeri E elet the ntiiption modeD nd ssign weight to the shok in the se of underdetermined simultion plnsY if omittedD Sigma = 1F

Output arguments
P pln E imultion pln with new informtion on endogenised shoks inludedF

Description Example

exogenise
Exogenise variables or re-exogenise shocks at the specied dates
Syntax
P P P P = = = = exogenise(P,List,Dates) exogenise(P,Dates,List) exogenise(P,List,Dates,Mode) exogenise(P,Dates,List,Mode)

Input arguments
P pln E imultion plnF List ellstr | hr E vist of vriles tht will e exogenisedD or list of shoks tht will e reEexogenisedF Dates numeri E htes t whih the vriles will e exogenisedF Flag 1 | 1i E ynly when reEexogenising shoksX elet the ntiiption mode in whih the shok will e reEexogenisedY if omittedD Flag = 1F

Output arguments
P pln E imultion pln with new informtion on exogenised vriles inludedF IST

imultion plnsX get

Description Example

get
Query to plan object
Syntax
Ans = get(P,Query) [Ans,Ans,...] = get(P,Query,Query,...)

Input arguments
P pln E imultion pln ojetF Query hr E xme of the queried propertyF

Output arguments
Ans F F F E enswerF

Valid queries to plan objects


endogenised= ! eturns strut dtse with time series for eh shok with I in eh period where the vrile is endogenisedD nd H in eh period where the vrile is not endogenisedF exogenised= ! eturns strut dtse with time series for eh mesurement nd trnsition vrile with I in eh period where the vrile is exogenisedD nd H in eh period where the vrile is not exogenisedF onlyEndogenised= ! eturns strut the sme dtse s endogenised= ut inluding only those shoks tht re endogenised t lest in one periodF onlyExogenised= ! eturns strut the sme dtse s exogenised= ut inluding only those mesurement nd trnsition vriles tht re endogenised t lest in one periodF range= ! eturns numeri the simultion pln rngeF ISU

imultion plnsX nnzendog

Description Example

nnzcond
Number of conditioning data points
Syntax
N = nnzcond(P)

Input arguments
P pln E imultion plnF

Output arguments
N numeri E xumer of onditioning dt pointsY eh vrile t eh dte ounts s one dt pointF

Description Example

nnzendog
Number of endogenised data points
Syntax
[N,NREAL,NIMAG] = nnzendog(P)

ISV

imultion plnsX nnzexog

Input arguments
P pln E imultion plnF

Output arguments
N numeri E otl numer of endogenised dt pointsY eh shok t eh time ounts s one dt pointF NREAL numeri E xumer of endogenised dt points with ntiiption mode IF NIMAG numeri E xumer of endogenised dt points with ntiiption mode IiF

Description Example

nnzexog
Number of exogenised data points
Syntax
N = nnzexog(P)

Input arguments
P pln E imultion plnF

Output arguments
N numeri E xumer of exogenised dt pointsY eh vrile t eh dte ounts s one dt pointF

ISW

imultion plnsX nonlinearise

Description Example

nnznonlin
Number of non-linearised data points
Syntax
N = nnznonlin(P)

Input arguments
P pln E imultion plnF

Output arguments
N numeri E xumer of nonElinerised equtionsF

Description Example

nonlinearise
Select equations for simulation in an exact non-linear mode
Syntax
P = nonlinearise(P) P = nonlinearise(P,Range) P = nonlinearise(P,List,Range)

ITH

imultion plnsX plan

Input arguments
P pln E imultion pln ojetF List ellstr E vist of lels for equtions tht will e simulted in n ext nonEliner modeY ll seleted equtions must e mrked y n =# P56 mrk in the model (leF sf List is not spei(edD ll equtions mrked in the model (le will e simulted in nonEliner modeF Range numeri E hte rnge on whih the equtions will e simulted in n ext nonEliner modeY urrentlyD the rnge must strt t the strt of the pln rngeF sf Range is not spei(edD the equtions re nonElinerised over the whole simultion rngeF

Output arguments
P pln E imultion pln with informtion on ext nonEliner simultion inludedF

Description Example

plan
Create new simulation plan
Syntax
P = plan(M,Range)

Input arguments
M model E wodel ojet tht will e simulted sujet to this simultion plnF Range numeri E imultion rngeY this rnge must extly orrespond to the rnge on whih the model will e simultedF

Output arguments
P pln E xewD empty simultion plnF ITI

imultion plnsX subsref

Description
ou need to use simultion pln ojet to set up the following types of more omplex simultions or foretsX

simulations or forecasts with some of the model variables temporarily exogenised; simulations with some of the non-linear equations solved exactly. forecasts conditioned upon some variables;
he pln ojet is pssed to the simulte P131 or jforecast P112 funtions through the option plan=F

Example

subsref
Subscripted reference for plan objects
Syntax
P = P(StartDate:EndDate) P = P{Shift}

Input arguments
P pln E imultion plnF

Output aguments
P pln E imultion pln reduedD expndedD or shifted to the new rngeD StartDate numeri E xew strt dte for the simultion plnF EndDate numeri E xew end dte for the simultion plnF Shift numeri E vg or led y whih the simultion pln rnge will e shiftedF ITP

imultion plnsX subsref

Description Example

ITQ

ystem priorsX detail

7 System priors
ystem priors re priors imposed on the system properties of the model s wholeD suh s shok response funtionsD frequeny response funtionsD orreltionsD or spetrl densitiesY moreoverD sysE tempriors ojets lso llow for priors on omintions of prmetersF he system priors n e omined with priors on individul prmetersF ystempriors methodsX

Constructor
systempriors P168 E grete new system priorsF

Setting up priors
prior P166 E grete prior for system propertyF

Getting information about system priors


detail P164 E hisply detils of system priorsF isempty P165 E rue if the system priors ojet is emptyF length P165 E xumer or priors imposed in system priors ojetF

detail
Display details of system priors
Syntax
detail(S)

Input arguments
S systempriors E ystem priorsD systempriors P164 ojetF

ITR

ystem priorsX length

Description Example

isempty
True if the system priors object is empty
Syntax
Flag = isempty(S)

Input arguments
S systempriors E ystem priorsD systempriors P164 D ojetF

Output arugments
Flag true | flse E rue if the system priors ojetD SD is emptyD flse otherwiseF

Description Example

length
Number or priors imposed in system priors object
Syntax
N = length(S)

ITS

ystem priorsX prior

Input arguments
S systempriors E ystem priorsD systempriors P164 ojetF

Output arguments
N numeri E xumer of priors imposed in the system priors ojetD SF

Description Example

prior
Create prior for a system property
Syntax
S = prior(S,Expr,PriorFunc,...) S = prior(S,Expr,[],...)

Input arugments
S systempriors E ystem priors ojetF Expr hr E ixpression tht de(nes vlue for whih prior density will e de(nedY see hesription for system properties tht n e referred to in the expressionF PriorFunc funtionhndle | empty E puntion hndle returning the log of prior densityY emptyD []D mens uniform priorF

Output arguments
S systempriors E he system priors ojet with the new prior ddedF

ITT

ystem priorsX prior

Options
lowerBound= numeri | -Inf E vower ound for the priorF upperBound= numeri | Inf E pper ound for the priorF

Description

System properties that can be used in Expr


srf[VarName,ShockName,T] E lin shok response funtion of vriles VarName to shok ShockName in period TF wind the squre rketsF ffrf[VarName,MVarName,Freq] E pilter frequeny response funtion of trnsition vriles TVarName to mesurement vrile MVarName t frequeny FreqF wind the squre rketsF corr[VarName1,VarName2,Lag] E gorreltion etween vrile VarName1 nd vriles VarName2 lgged y Lag periodsF spd[VarName1,VarName2,Freq] E petrl density etween vriles VarName1 nd VarName2 t frequeny FreqF sf vrile is delred s log-variable P41 D it must e referred to s log(VarName) in the ove expressionsD nd the log of tht vriles is returnedD eFgF srf[log(VarName),ShockName,T]F or ffrf[log(TVarName),MVarName,T]F

Expressions involving combinations or functions of parameters


wodel prmeter nmes n e referred to in Expr preeded y dot @periodAD eFgF .alpha2 + .beta2 de(nes prior on the sum of squres of the two prmeters @alpha nd betaAF

Example
grete newD empty systemprios ojet sed on n existing modelF
s = systempriors(m);

edd prior on minus the shok response funtion of vrile ygap to shok eps_pie in period RF he prior density is lognorml with men HFQ nd std devition HFHSY
s = prior(s,-srf[ygap,eps_pie,4],logdist.lognormal( .3, . 5));

ITU

ystem priorsX systempriors edd prior on the gin of the frequeny response funtion of trnsition vrile ygap to mesureE ment vrile y9 t frequeny 2*pi/4 F he prior density is norml with men HFS nd std devition HFHIF his prior sys tht we wish to keep the utEo' periodiity for trendEyle deomposition lose to RH periodsF
s = prior(s,abs(ffrf[ygap,y,2*pi/4 ]),logdist.normal( .5, . 1));

edd prior on the sum of prmeters alpha1 nd alpha2F he prior is norml with men HFW nd std devition HFID ut the sum is fored to e etween H nd I y imposing lower nd upper oundsF
s = prior(s,alpha1+alpha2,logdist.normal( .9, .1), ... lowerBound=, ,upperBound=,1);

systempriors
Create new system priors
Syntax
S = systempriors(M)

Input arguments
M model E wodel ojet on whose system properties the priors will e imposedF

Output arguments
S systempriors E xewD empty system priors ojetF

Description Example

ITV

osterior ojets nd funtionsX arwm

8 Posterior objects and functions


osterior ojetsD posterD re used to evlute the ehviour of the posterior dsitriutionD nd to drw model prmeters from the posterior distiutionF osterior ojets re set up within the model/estimate P82 funtion nd returned s the seond output rgument E the set up nd initilistion of the posterior ojet is fully utomted in this seF elterntivelyD you n set up posterior ojet mnullyD y setting ll its properties ppropritelyF oster methodsX

Constructor
poster P172 E osterior ojets nd funtionsF

Evaluating posterior density


arwm P169 E edptive rndomEwlk wetropolis posterior simultorF eval P171 E ivlute posterior density t spei(ed pointsF

Chain statistics
stats P173 E ivlute seleted sttistis of ew hinF

Getting on-line help on model functions


help poster help poster/function_name

arwm
Adaptive random-walk Metropolis posterior simulator
Syntax
[Theta,LogPost,AR,Scale,FinalCov] = arwm(Pos,NDraw,...)

ITW

osterior ojets nd funtionsX arwm

Input arguments
Pos poster E snitilised posterior simultor ojetF NDraw numeri E vength of the hin not inluding urnEinF

Output arguments
Theta numeri E wgwg hin with individul prmeters in rowsF LogPost numeri E etor of log posterior density @up to onstntA in eh drwF AR numeri E etor of umultive eptne rtios in eh drwF Scale numeri E etor of proposl sle ftors in eh drwF FinalCov numeri E pinl proposl ovrine mtrixY the (nl ovrine mtrix of the rndom wlk step is le@endAPBpinlgovF

Options
adaptProposalCov= numeri | .5 E peed of dpttion of the gholesky ftor of the proposl ovrine mtrix towrds the trget eptne rtioD targetARY zero mens no dpttionF adaptScale= numeri | 1 E peed of dpttion of the sle ftor to devitions of eptne rtios from the trget rtioD targetARF burnin= numeri | .1 E xumer of urnEin drws entered either s perentge of totl drws @etween H nd IA or diretly s numer @integer greter tht oneAF furnEin drws will e dded to the requested numer of drws ndraw nd disrded fter the posterior simultionF estTime= true | false E hisply nd updte the estimted time to go in the ommnd windowF firstPrefetch= numeri | Inf E pirst drw where prllelised preEfething will e usedY Inf mens no preEfethingF gamma= numeri | .8 E he rte of dey t whih the sle ndGor the proposl ovrine will e dpted with eh new drwF initScale= numeri | 1/3 E snitil sle ftor y whih the initil proposl ovrine will e multipliedY the initil vlue will e dpted to hieve the trget eptne rtioF lastAdapt= numeri | Inf E vst drw in whih proposl ovrine will e dptedY Inf mens dpttion will ontinue until the lst drwF IUH

osterior ojets nd funtionsX eval nStep= numeri | B1 E xumer of preEfethed steps omputed in prllelY only works with firstPrefetch= smller thn NDrawF progress= true | false E hisply progress r in the ommnd windowF saveAs= hr | empty E pile nme where results will e sved when the option saveEvery= is usedF saveEvery= numeri | Inf E ivery x drws will e sved to n rhpS (leD nd removed from workspe immeditelyY no vlues will e returned in the output rguments ThetaD LogPostD ARD ScaleY the option saveAs= must e used to speify the (le nmeY Inf mens norml run with no svingF targetAR= numeri | .234 E rget eptne rtioF

Description
se the poster/stats P173 funtion to proess the simulted hin of prmetersD nd lulte seleted sttistisF

Parallelised ARWM
et nStep= greter thn 1D nd firstPrefetch= smller thn NDraw to strt preEfething prllelised lgorithm @preEfethed will e ll drws strting from firstPrefetch=AY to tht endD pool of prllel workers @using eFgF matlabpool from the rllel gomputing ooloxA must e opened efore lling arwmF ith preEfethingD ll possile pths nStep= steps hed @iFeF ll possile omintions of reE jetGeptA re preEevluted in prllelD nd then the resulting pth is seletedF edption then ours only every nStep= stepsD nd hene the results will lwys somewht di'er from seE ril runF sdentil results n e otined y turning down dpttion efore preEfething strtsD iFeF y setting lastAdapt= smller thn firstPrefetch= @ndD oviouslyD y reEsetting the rndom numer genertorAF

Example

eval
Evaluate posterior density at specied points

IUI

osterior ojets nd funtionsX poster

Syntax
[X,L,PP,SrfP,FrfP] = eval(Pos) [X,L,PP,SrfP,FrfP] = eval(Pos,P)

Input arguments
Pos poster E osterior ojet returned y the model/estimate P82 funtionF P strut E trut with prmeter vlues t whih the posterior density will e evlutedY if P is not spei(edD the posterior density t the point of the estimted mode is returnedF

Output arguments
X numeri E he vlue of log posterior density evluted t PY xFfF the returned vlue is log posteriorD nd not minus log posteriorF L numeri E gontriution of dt likelihood to log posteriorF PP numeri E gontriution of prmeter priors to log posteriorF SrfP numeri E gontriution of shok response funtion priors to log posteriorF FrfP numeri E gontriution of frequeny response funtion priors to log posteriorF

Description
he totl log posterior onsistsD in generlD of the four ontriutions listed oveX
X = L + PP + SrfP + FrfP.

Example

poster
Posterior objects and functions
osterior ojetsD posterD re used to evlute the ehviour of the posterior dsitriutionD nd to drw model prmeters from the posterior distiutionF IUP

osterior ojets nd funtionsX stats osterior ojets re set up within the model/estimate P82 funtion nd returned s the seond output rgument E the set up nd initilistion of the posterior ojet is fully utomted in this seF elterntivelyD you n set up posterior ojet mnullyD y setting ll its properties ppropritelyF oster methodsX

Constructor
poster P172 E osterior ojets nd funtionsF

Evaluating posterior density


arwm P169 E edptive rndomEwlk wetropolis posterior simultorF eval P171 E ivlute posterior density t spei(ed pointsF

Chain statistics
stats P173 E ivlute seleted sttistis of ew hinF

Getting on-line help on model functions


help poster help poster/function_name

stats
Evaluate selected statistics of ARWM chain
Syntax
S = stats(Pos,Theta,...) S = stats(Pos,Theta,LogPost,...) S = stats(Pos,FName,...)

IUQ

osterior ojets nd funtionsX stats

Input arguments
Pos poster E osterior simultor ojet tht hs generted the Theta hinF Theta numeri E wgwg hin generted y the poster/arwm P169 funtionF LogPost numeri E etor of log posterior densities generted y the arwm funtionY LogPost is not neessry if you do not request mddD the mrginl dt densityF FName hr E pile nme under whih the simulted hin ws sved when poster/arwm P169 ws run with options saveEvery=9 nd saveAs=F

Output arguments
S strut E trut with the sttistis requested y the userF

Options
estTime= true | false E hisply nd updte the estimted time to go in the ommnd windowF mddGrid= numeri | .1: .1: .9 E oints etween H nd I over whih the mrginl dt density estimtes will e vergedD see qeweke @IWWWAF progress= true | false E hisply progress r in the ommnd windowF

Options to include/exclude output statistics


bounds= true | false E snlude in S the lower nd upper prmeter ounds set up y the userF chain= true | false E snlude in S the entire simulted hins of prmeter vluesF cov= true | false E snlude in S the smple ovrine mtrixF hist=9 numeri | empty E snlude in S histogrm ins nd ounts with the spei(ed numer of insF hpdi= false | numeri E snlude in S the highest proility density intervls with the spei(ed overgeF ksdensity= true | false | numeri E snlude in S the xE nd yExis points for kernelE smoothed posterior densityY use numeri vlue to ontrol the numer of points over whih the density is omputedF mdd= true | false E snlude in S minus the log mrginl dt densityF IUR

osterior ojets nd funtionsX stats mean= true | false E snlude in S the smple vergesF median= true | false E snlude in S the smple medinsF mode= true | false E snlude in S the smple modes sed on histogrmsF prctile= numeri | empty E snlude in S the spei(ed perentilesF std= true | false E snlude in S the smple std devitionsF

Description Example

IUS

roility distriution pkge

9 Probability distribution package


his pkge gives quik ess to si univrite distriutionsF sts primry use is setting up priors in the model/estimate P82 nd poster/arwm P169 funtionsF he logdist pkge is lled to rete funtion hndles tht hve severl di'erent modes of useF he primry use is to ompute vlues tht re proportionl to the log of the respetive densityF sn dditionD the funtion hndles lso give you ess to extr informtion @suh s the the proper pFdFfFD the nmeD menD std devD modeD nd stuturl prmeters of the distriutionAD nd to rndom numer genertor from the respetive distriutionF vogdist methodsX

Getting function handles for univariate distributions


normal P180 E grete funtion proportionl to log of norml distriutionF lognormal P179 E grete funtion proportionl to log of logEnorml distriutionF beta P177 E grete funtion proportionl to log of et distriutionF gamma P178 E grete funtion proportionl to log of gmm distriutionF invgamma P178 E grete funtion proportionl to log of invEgmm distriutionF uniform P180 E grete funtion proportionl to log of uniform distriutionF

Calling the logdist function handles


he funtion hndles F reted y the logdist pkge funtions n e lled the following wysX qet vlue proportionl to the logEdensity of the respetive distriution t prtiulr pointY this ll is used within the posterior simultor P169 X y a p@xA qet the density of the respetive distriution t prtiulr pointX y a p@xDpdf9A qet the hrteristis of the distriution ! menD std devitionD modeD nd informtion @the inverse of the seond derivtive of the log densityAX m a p@Dmen9A s a p@Dstd9A o a p@Dmode9A i a p@Dinfo9A qet the underlying struturl prmeters of the respetive distriutionX a p@D9A a p@D9A IUT

roility distriution pkgeX beta qet the nme of the distriution @the nmes orrespond to the funtion nmesD iFeF n e either of normalD lognormalD betaD gammaD invgammaD uniformAX nme a p@Dnme9A hrw vetor or mtrix of rndom numers from the distriutionY drwing from etD gmmD nd inverse gmm requires the ttistis ooloxX a p@Ddrw9DIDIHHHAY size@A ns a I IHHHH

Getting on-line help on logdist functions


help logdist help logdist/function_name

beta
Create function proportional to log of beta distribution
Syntax
F = logdist.beta(Mean,Std)

Input arguments
Mean numeri E wen of the et distriutionF Std numeri E td dev of the et distriutionF

Output arguments
F funtionhndle E puntion hndle returning vlue proportionl to the log of the et densityF

Description
ee help on the logdisk pkge P176 for detils on using the funtion hndle FF IUU

roility distriution pkgeX invgamma

Example

gamma
Create function proportional to log of gamma distribution
Syntax
F = logdist.gamma(Mean,Std)

Input arguments
Mean numeri E wen of the gmm distriutionF Std numeri E td dev of the gmm distriutionF

Output arguments
F funtionhndle E puntion hndle returning vlue proportionl to the log of the gmm densityF

Description
ee help on the logdisk pkge P176 for detils on using the funtion hndle FF

Example

invgamma
Create function proportional to log of inv-gamma distribution
Syntax
F = logdist.invgamma(MEAN,STD)

IUV

roility distriution pkgeX lognormal

Input arguments
MEAN numeri E wen of the invEgmm distriutionF STD numeri E td dev of the invEgmm distriutionF

Output arguments
F funtionhndle E puntion hndle returning vlue proportionl to the log of the invEgmm densityF

Description
ee help on the logdisk pkge P176 for detils on using the funtion hndle FF

Example

lognormal
Create function proportional to log of log-normal distribution
Syntax
F = logdist.lognormal(Mean,Std)

Input arguments
Mean numeri E wen of the logEnorml distriutionF Std numeri E td dev of the logEnorml distriutionF

Output arguments
F funtionhndle E puntion hndle returning vlue proportionl to the log of the logEnorml densityF

IUW

roility distriution pkgeX uniform

Description
ee help on the logdisk pkge P176 for detils on using the funtion hndle FF

Example

normal
Create function proportional to log of normal distribution
Syntax
F = logdist.normal(Mean,Std)

Input arguments
Mean numeri E wen of the norml distriutionF Std numeri E td dev of the norml distriutionF

Output arguments
F funtionhndle E puntion hndle returning vlue proportionl to the log of the norml densityF

Description
ee help on the logdisk pkge P176 for detils on using the funtion hndle FF

Example

uniform
Create function proportional to log of uniform distribution
IVH

roility distriution pkgeX uniform

Syntax
F = logdist.uniform(Lo,Hi)

Input arguments
Lo numeri E vower ound of the uniform distriutionF Hi numeri E pper ound of the uniform distriutionF

Output arguments
F funtionhndle E rndle to funtion returning vlue tht is proportionl to the log of the uniform densityF

Description
ee help on the logdisk pkge P176 for detils on using the funtion hndle FF

Example

IVI

tedyEstte (le lngugeX !allbut

10 Steady-state le language


tedyEstte @sstteA (les re omplementry tool to solve nd nlyse the stedy sttes of more omplex modelsF hey llow you to rete stedyEstte (les independent of the originl model (lesD nd write the stedyEstte equtions in di'erent wysD mnipulte their struture or orderD split the prolem into suloksD nd omine numeril nd symoli solutionsF sing then the sstte ojets P182 D you n ompile nd run stndElone stedyEstte mE(le funtions sed on your stedyEstte (lesF

Input parameters
!input P184 E vist of input prmeters or vrilesF !growthnames P184 E ttern for reting growth nmesF

Equations and assignments


!equations P183 E flok of equtions or ssignmentsF !growthnames2imag P184 E ttern for reting growth nmesF !solvefor P185 E vist of vriles for whih the urrent equtions lok will e solvedF !symbolic P186 E ettempt to solve the urrent equtions lok symolilly using the ymE oli wths ooloxF

Variables with steady state restricted to be positive


!log_variables P185 E estrit the stedy ste of some of the vriles to e positiveF !allbut P182 E snverse list of vriles with positive stedy sttesF

Getting on-line help on sstate le language


help sstatelang help sstatelang/keyword

!allbut
Inverse list of variables with positive steady states
IVP

tedyEstte (le lngugeX !equations

Syntax
!log_variables !allbut LIST_OF_VARIABLES

Description
ee help on !log_variables P41 F

!equations
Block of equations or assignments
Syntax for a system of equations to be solved numerically
!equations EQUATION; EQUATION; EQUATION; ... !solvefor LIST_OF_VARIABLES

Syntax for a system of equations to be solved symbolically


!equations EQUATION; EQUATION; EQUATION; ... !symbolic !solvefor LIST_OF_VARIABLES

IVQ

tedyEstte (le lngugeX !input

Syntax for block of assignments


!equations VARIABLE_NAME = EXPRESSION; VARIABLE_NAME = EXPRESSION; VARIABLE_NAME = EXPRESSION; ...

Description Example

!growthnames
Pattern for creating growth names
Syntax
!growthname := string_pattern; !growthname := [function_pattern];

Description
Eixmple

!input
List of input parameters or variables
Syntax
!input parameter_or_variable_name, parameter_or_variable_name, parameter_or_variable_name, ...

IVR

tedyEstte (le lngugeX !solvefor

Description Example

!log_variables
Restrict the steady stae of some of the variables to be positive
Syntax
!log_variables list_of_variables

Inverted syntax
!log_variables !allbut list_of_variables

Description Example

!solvefor
List of variables for which the current equations block will be solved
Syntax
!equations EQUATION;

IVS

tedyEstte (le lngugeX !symbolic


EQUATION; EQUATION; ... !solvefor LIST_OF_VARIABLES

Description Example

!symbolic
Attempt to solve the current equations block symbolically using the Symbolic Maths Toolbox
Syntax
!equations EQUATION; EQUATION; EQUATION; ... !symbolic !solvefor LIST_OF_VARIABLES

Description Example

IVT

tedyEstte ojets nd funtionsX compile

11 Steady-state objects and functions


ou n rete stedyEstte @sstteA ojet y loding stedyEstte @sstteA (leF he sstte ojet n e then sved s stndElone mE(le funtion nd repetedly solved for di'erent pE rmeteristionsF stte methodsX

Constructor
sstate P188 E grete new model ojet sed on sstte (leF

Compiling stand-alone m-le functions


compile P187 E gompile n mE(le funtion sed on stedyEstte (leF

Running stand-alone sstate m-le functions


standalonemfile P189 E un ompiled stndElone sstte mE(le funtionF

Getting on-line help on sstate functions


help sstate help sstate/function_name

compile
Compile an m-le function based on a steady-state le
Syntax
compile(S) compile(S,Fname,...)

IVU

tedyEstte ojets nd funtionsX sstate

Input arguments
S sstte E stte ojet uilt on stedyEstte (leF Fname hr | empty E pilenme of the ompiled mE(le funtionY if not spei(ed or empty the originl stedyEstte (lenme will e used with n 9Fm9 extensionF

Options
excludeZero= true | false E eutomtilly detet nd exlude zero solutions in loks tht result in multiple solutionsF deleteSymbolicMfiles= true | false E helete uxiliry mE(les reted to ll the ymE oli wth tooloxF end= numeri | hr | Inf E gompile the stedyEstte mE(le funtion only up to this lokF simplify= numeri | Inf E he minimum length for symoli expression to e simpli(ed using the simplify funtionY snf mens no expressions will undergo simpli(tionF start= numeri | hr | I E gompile the stedyEstte mE(le funtion strting from this lokF symbolic= true | false E gll the ymoli wth toolox to solve loks mrked with !symbolic P186 keywordY otherwiseD ll loks will e solved numerilly regrdless of their spei(tionF

Description Example

sstate
Create new model object based on sstate le
Syntax
S = sstate(FNAME,...)

IVV

tedyEstte ojets nd funtionsX standalonemfile

Input arguments
FNAME hr E xme of the stedyEstte (le tht will loded nd onverted to new sstte ojetF

Output arguments
S sstte E xew sstte ojet sed on the input stedyEstte (leF

Options
assign= strut | empty E htse tht will used y the preprser to evlute onditions nd expressions in the !if nd !switch struturesF

Description Example

standalonemle
Run a compiled stand-alone sstate m-le function
efter you sstate/compile P187 the stndElone sstte mE(le funtionD type help FNAME to get help on running the (leD where FNAME is the nme of the (le retedF

IVW

wtries with nmed rows nd olumnsX colnames

12 Matrices with named rows and columns


wtries with nmed rows nd olumns re returned y severl ss funtionsD suh s modelGf P69 D modelGxsf P149 D or modelGfmse P99 D to filitte esy seletion of sumtries y referrring to vrile nmes in rows nd olumnsF xmedmt methodsX

Constructor
namedmat P191 E grete new mtrix with nmed rows nd olumnsF

Manipulating named matrices


select P193 E elet sumtrix y referring to row nmes nd olumn nmesF transpose P193 E rnspose eh pge of mtrix with nmes rows nd olumnsF

Getting row and column names


rownames P192 E xmes of rows in nmedmt ojetF colnames P190 E xmes of olumns in nmedmt ojetF

Sample characteristics
cutoff@nmedmtGuto' E ell opertors nd funtions ville for stndrd wtl mtries nd rrys @iFeF doule ojetsA re lso ville for nmedmt ojetsF

colnames
Names of columns in namedmat object
Syntax
NAMES = colnames(X)

IWH

wtries with nmed rows nd olumnsX namedmat

Input arguments
X nmedmt E e nmedmt ojet @n numeri rry with nmed rows nd olumnsA returned y some of the model funtionsF

Output arguments
NAMES ellstr E xmes of olumns in XF

Description Example

namedmat
Create a new matrix with named rows and columns
Syntax
X = namedmat(X,ROWNAMES,COLNAMES)

Input arguments
X numeri E wtrix or multidimensionl rryF ROWNAMES ellstr E xmes for individul rows of XF COLNAMES ellstr E xmes for individul olumns of XF

Output arguments
X nmedmt E wtrix with nmed rows nd olumnsF

Description
xmedmt ojets re used y some of the ss funtions to preserve the nmes of vriles tht relte to individul rows nd olumnsD suh s in IWI

wtries with nmed rows nd olumnsX select acfD the utoovrine nd utoorreltion funtionsD xsfD the power spetrum nd spetrl density funtionsD fmseD the forest men squre error futionsD etF ou n use the funtion select P193 to extrt sumtries y referring to seletion of nmesF xmedmt mtries derives from the uiltEin doule lss of ojetsD nd hene you n use ny opertors nd funtions on them tht re ville for doule ojetsF

Example

rownames
Names of rows in namedmat object
Syntax
NAMES = rownames(X)

Input arguments
X nmedmt E e nmedmt ojet @n numeri rry with nmed rows nd olumnsA returned y some of the model funtionsF

Output arguments
NAMES ellstr E xmes of rows in XF

Description Example

IWP

wtries with nmed rows nd olumnsX transpose

select
Select submatrix by referring to row names and column names
Syntax
[X,Pos] = select(This,RowSelect,ColSelect) [X,Pos] = select(X,Select)

Input arguments
X nmedmt E wtrix or rry with nmed rows nd olumnsF RowSelect hr | ellstr E eletion of row nmesF ColSelect hr | ellstr E eletion of olumn nmesF Select hr | ellstr E eletion of nmes tht will e pplied to oth rows nd olumnsF

Output arguments
X nmedmt E umtrix with nmed rows nd olumnsF Pos ell E Pos{1} is the vetor of rows inluded in the sumtrix XD Pos{2} is the vetor of olumns inluded in the sumtrix XF

Description Example

transpose
Transpose each page of matrix with names rows and columns
Syntax
X = transpose(X) X = X.

IWQ

wtries with nmed rows nd olumnsX transpose

Input arguments
X nmedmt E snput mtrix or rry with nmed rows nd olumnsF

Output arguments
X nmedmt E rnspose of the input mtrixY if it is more thn PEdimensionlD eh pge of the mtrix is trnsposedF

Description Example

IWR

Part III 
Multivariate time series analysis

IWS

etor utoregressionsX e ojets nd funtions

13 Vector autoregressions: VAR objects and functions


e ojets n e onstruted s plin es or simple pnel es @with (xed e'etAD nd estimted without or with prior dummy oservtions @fyesin esAF he e ojets re lso the point of deprture for identifying struturl es @SVAR P231 ojetsAF e methodsX

Constructor
VAR P228 E grete new reduedEform e ojetF

Getting information about VAR objects


addparam P199 E edd e prmeters to dtse @strutAF comment P201 E qet or set user omments in n ss ojetF companion P202 E wtries of (rstEorder ompnion eF eig P203 E iigenvlues of e proessF get P210 E uery e ojet propertiesF iscompatible P215 E rue if two e ojets n our together on the vr nd r in n ssignmentF isexplosive P216 E rue if ny eigenvlue is outside unit irleF ispanel P216 E rue for pnel e sed ojetsF isstationary P217 E rue if ll eigenvlues re within unit irleF length P218 E xumer of lterntive prmeteristions in e ojetF mean P219 E wen of e proessF nfitted P219 E xumer of dt points (tted in e estimtionF rngcmp P222 E rue if two e ojets hve een estimted using the sme dtesF sspace P225 E usiEtringulr stteEspe representtion of eF userdata P227 E qet or set user dt in n ss ojetF

IWT

etor utoregressionsX e ojets nd funtions

Referencing VAR objects


group P211 E etrieve e ojet from pnel e for spei(ed group of dtF subsasgn P225 E usripted ssignment for e ojetsF subsref P226 E usripted referene for e ojetsF

Simulation, forecasting and ltering


ferf P207 E porest error response funtionF filter P207 E pilter dt using e modelF forecast P209 E nonditionl or onditionl e forestsF instrument P213 E he(ne onditioning instruments in e modelsF resample P221 E esmple from e ojetF simulate P223 E imulte e modelF

Manipulating VARs
alter P200 E ixpnd or redue the numer of lterntive prmeteristions within e ojetF backward P201 E fkwrd e proessF demean P203 E emove onstnt from e ojetF horzcat P212 E gomine two omptile e ojets in one ojet with multiple prmeE teristionsF integrate P214 E sntegrte e proess nd dt ssoited with itF

Stochastic properties
acf P198 E eutoovrine nd utoorreltion funtions for e vrilesF fmse P208 E porest men squre error mtriesF vma P229 E wtries desriing the we representtion of e proessF xsf P229 E ower spetrum nd spetrl density funtions for e vrilesF

IWU

etor utoregressionsX e ojets nd funtionsX acf

Estimation, identication, and statistical tests


estimate P204 E istimte reduedEform e or feF infocrit P213 E opulte informtion riteri for prmeterised eF lrtest P218 E vikelihood rtio test for e modelsF portest P220 E ortmnteu test for utoorreltion in e residulsF schur P223 E gompute nd store tringulr representtion of eF

Getting on-line help on VAR functions


help VAR help VAR/function_name

acf
Autocovariance and autocorrelation functions for VAR variables
Syntax
[C,R] = acf(V,...)

Input arguments
V e E e ojet for whih the egp will e omputedF

Output arguments
C numeri E eutoGrossEovrine mtriesF R numeri E eutoGrossEorreltion mtriesF

IWV

etor utoregressionsX e ojets nd funtionsX addparam

Options
applyTo= logil | Inf E vogil index of vriles to whih the filter= will e ppliedY the defult snf mens ll vrilesF filter= hr | empty E viner (lter tht is pplied to vriles spei(ed y pplyto9F nfreq= numeri | 256 E xumer of eqully sped frequenies over whih the (lter9 is numerilly integrtedF order= numeri | E yrder up to whih egp will e omputedF

progress= true | false E hisply progress r in the ommnd windowF

Description Example

addparam
Add VAR parameters to a database (struct)
Syntax
D = addparam(V,D)

Input arguments
V e E e ojet whose prmeter mtries will e dded to dtse @strutA DF D strut E htse to whih the model prmeters will e ddedF

Output arguments
h strut E htse with the e prmeter mtries ddedF

IWW

etor utoregressionsX e ojets nd funtionsX backward

Description
he newly reted dtse entries re nmed A @trnsition mtrixAD K @onstnt termsADnd Omg @ovrine mtrix of shoksAF fe wre tht if there re dtse entries in D whose nmes oninide with these nmesD they will e overwrittenF

Example
D = struct(); D = addparam(V,D);

alter
Expand or reduce the number of alternative parameterisations within a VAR object
Syntax
V = alter(V,N)

Input arguments
V e E e ojet in whih the numer of premeteristions will e hngedF N numeri E xew numer of prmeteristionsF

Output arguments
V e E e ojet with the new numer of prmeteristionsF

Description Example

PHH

etor utoregressionsX e ojets nd funtionsX comment

backward
Backward VAR process
Syntax
B = backward(V)

Input arguments
V e E e ojetF

Output arguments
B e E e ojet with the e proess reversed in timeF

Description Example

comment
Get or set user comments in an IRIS object
Syntax for getting user comments
Cmt = comment(Obj)

Syntax for assigning user comments


Obj = comment(Obj,Cmt)

PHI

etor utoregressionsX e ojets nd funtionsX companion

Input arguments
Obj model | tseries | e | e | pee | sstte E yne of the ss ojetsF Cmt hr E ser omment tht will e tthed to the ojetF

Output arguments
Cmt hr E ser omment tht re urrently tthed to the ojetF

Description Example

companion
Matrices of rst-order companion VAR
Syntax
[A,B,K] = companion(V)

Input arguments
V e E e ojet for whih the ompnion mtries will e returnedF

Output arguments
A numeri E pirstEorder ompnion trnsition mtrixF B numeri E pirstEorder ompnion oe0ient mtrix t reduedEform residulsF K numeri E pirstEorder ompnion onstnt vetorF

PHP

etor utoregressionsX e ojets nd funtionsX eig

Description Example

demean
Remove constant from VAR object
Syntax
V = demean(V)

Input arguments
V e E e ojet in whih the onstnt vetor will e reset to zeroF

Output arguments
V e E e ojet with the onstnt vetor reset to zeroF

Description Example

eig
Eigenvalues of a VAR process
Syntax
E = eig(V)

PHQ

etor utoregressionsX e ojets nd funtionsX estimate

Input arguments
V e E e ojet whose eigenvlues will e returnedF

Output arguments
E numeri E e eigenvluesF

Description
his funtion is equivlent to lling
e = get(v,eig)

Example

estimate
Estimate a reduced-form VAR or BVAR
Syntax
[V,VData,Fitted] = estimate(V,Inp,Range,...)

Input arguments
V e E impty e ojetF Inp strut E snput dtseF Range numeri E istimtion rngeD inluding P preEsmple periodsD where P is the order of the eF

PHR

etor utoregressionsX e ojets nd funtionsX estimate

Output arguments
V e E istimted reduedEform e ojetF VData strut E yutput dtse with the endogenous vriles nd the estimted residulsF Fitted numeri E eriods in whih (tted vlues hve een lultedF

Options
A= numeri | empty E estritions on the individul vlues in the trnsition mtrixD AF BVAR= numeri E rior dummy oservtions for estimting feY onstrut the dummy oservtions using the one of the BVAR funtionsF C= numeri | empty E estritions on the individul vlues in the onstnt vetorD CF diff= true | false E hi'erene the series efore estimting the eY integrte the series k fterwrdsF G= numeri | empty E estritions on the individul vlues in the mtrix t the oE integrting vetorD GF cointeg= numeri | empty E goEintegrting vetors @in rowsA tht will e imposed on the estimted eF comment= hr | Inf E essign omment to the estimted e ojetY Inf mens the existing omment will e preservedF constraints= hr E qenerl liner onstrints on the e prmetersF constant= true | false E snlude onstnt vetor in the eF covParameters= true | false E glulte the ovrine mtrix of estimted prmetersF eqtnByEqtn= true | false E istimte the e eqution y equtionF maxIter= numeri | 1 E wximum numer of itertions when generlised lest squres lgorithm is involvedF mean= numeri | empty E smpose prtiulr symptoti men on the e proessF order= numeri | 1 E yrder of the eF progress= true | false E hisply progress r in the ommnd windowF schur= true | false E glulte tringulr @hurA representtion of the estimted e stright wyF

PHS

etor utoregressionsX e ojets nd funtionsX estimate stdize= true | false E edjust the prior dummy oservtions y the std dev of the oservtionsF timeWeights=9 tseries | empty E ime series of weights pplied to individul periods in the estimtion rngeF tolerance= numeri | 1e-5 E gonvergene tolerne when generlised lest squres lgoE rithm is involvedF yNames= ellstr | funtionhndle | @(n) sprintf(y%g,n) E se these nmes for the e vrilesF eNames= ellstr | funtionhndle | @(yname,n) [res_,yname] E se these nmes for the e residulsF warning= true | false E hisply wrnings produed y this funtionF

Options for panel VAR


fixedEffect= true | false E snlude onstnt dummies for (xed e'et in pnel estimtionY pplies only if constant= trueF groupWeights= numeri | empty E e IEyExqrp vetor of weights pplied to groups in pnel estimtionD where xqrp is the numer of groupsY the weights will e resled so s to sum up to 1F

Description

Estimating a panel VAR


nel e ojets re reted y lling the funtion VAR P228 with two input rgumentsX the list of vrilesD nd the list of group nmesF o estimte pnel eD the input dtD InpD must e orgnised superEdtse with suEdtses for eh groupD nd time series for eh vriles within eh groupX
d.Group1_Name.Var1_Name d.Group1_Name.Var2_Name ... d.Group2_Name.Var1_Name d.Group2_Name.Var2_Name ...

PHT

etor utoregressionsX e ojets nd funtionsX filter

Example

ferf
Forecast error response function
Syntax
[Phi,Psi,s,c] = ferf(V,NPer) [Phi,Psi,s,c] = ferf(V,Range)

Input arguments
V e E e ojet for whih the forest error response funtion will e omputedF NPer numeri E xumer of periodsF Range numeri E hte rngeF

Output arguments
Phi numeri E esponse funtion mtriesF Psi numeri E gumultive response funtion mtriesF S tseries E esponse funtion time seriesF C tseries E gumultive response funtion time seriesF

Description Example

lter
Filter data using a VAR model
PHU

etor utoregressionsX e ojets nd funtionsX fmse

Syntax
[V,Outp] = filter(V,Inp,Range,...)

Input arguments
V e E snput e ojetF Inp strut E snput dtse from whih initil ondition will e redF Range numeri E porest rngeF

Output arguments
V e E yutput e ojetF Outp strut E yutput dtse with predition ndGor smoothed dtF

Options
cross= numeri | 1 E wultiply the o'Edigonl elements of the ovrine mtrix @rossE ovrinesA y this ftorY cross= must e equl to or smller thn 1F deviation= true | false E foth input nd output dt re devitions from the unonE ditionl menF meanOnly= true | false E eturn plin dtse with men forests onlyF omega= numeri | empty E wodify the ovrine mtrix of residuls for this run of the (lterF

Description Example

fmse
Forecast mean square error matrices

PHV

etor utoregressionsX e ojets nd funtionsX forecast

Syntax
[M,X] = fmse(V,NPer) [M,X] = fmse(V,Range)

Input arguments
C e E e ojet for whih the forest wi mtries will e omputedF NPer numeri E xumer of periodsF Range numeri E hte rngeF

Output arguments
M numeri E porest wi mtriesF X dse | tseries E htse or tseries with the std devitions of individul vrilesD iFeF the squre roots of the digonl elements of MF

Options
output= dse9 | tseries9 E pormt of output dtF

Description Example
}

forecast
Unconditional or conditional VAR forecasts
Syntax
Outp = forecast(V,Inp,Range,...) Outp = forecast(V,Inp,Range,Cond,...)

PHW

etor utoregressionsX e ojets nd funtionsX get

Input arguments
V e E e ojetF Inp strut E snput dtse from whih initil ondition will e redF Range numeri E porest rngeY must not refer to InfF Cond strut | tseries E gonditioning dtse with the men vlues of residulsD reduedEform onditions on endogenous vrilesD nd onditioning instrumentsF

Output arguments
Outp strut E yutput dtse with forests of endogenous vrilesD residulsD nd onE ditioning instrumentsF

Options
cross= numeri | 1 E wultiply the o'Edigonl elements of the ovrine mtrix @rossE ovrinesA y this ftorY cross= must e equl to or smller thn 1F dbOverlay= true | false E gomine the output dt with the input dtY works only if the input dt is dtseF deviation= true | false E foth input nd output dt re devitions from the unonE ditionl menF meanOnly= true | false E eturn plin dtse with men forests onlyF omega= numeri | empty E wodify the ovrine mtrix of residuls for this forestF

Description Example

get
Query VAR object properties

PIH

etor utoregressionsX e ojets nd funtionsX group

Syntax
Ans = get(V,Query) [Ans,Ans,...] = get(V,Query,Query,...)

Input arguments
V e E e ojetF Query hr E uery to the e ojetF

Output arguments
Ans F F F E enswer to the queryF

Valid queries to VAR objects Description Example

group
Retrieve VAR object from panel VAR for specied group of data
Syntax
V = group(V,Grp)

Input arguments
V e E nel e ojet estimted on multiple groups of dtF Grp hr E equested group nmeY must e one of the nmes spei(ed when the pnel e ojet ws onstruted using the funtion VAR P228 F

PII

etor utoregressionsX e ojets nd funtionsX horzcat

Output arguments
V e E e ojet for the KEth group of dtF

Description Example
grete nd estimte pnel e for three vrilesD xD yD zD nd three ountriesD USD EUD JAF henD retrieve plin e for n individul ountryF
v = VAR({x,y,z},{US,EU,JA}); v = estimate(v,d,range,fixedEffect=,true); vi_us = group(v,US);

horzcat
Combine two compatible VAR objects in one object with multiple parameterisations
Syntax
V = [V1,V2,...]

Input arguments
V1D V2 e E gomptile e ojets tht will e ominedF

Output arguments
V e E yutput e ojet tht omines the input e ojets s multiple prmeterE istionsF

PIP

etor utoregressionsX e ojets nd funtionsX instrument

Description Example

infocrit
Populate information criteria for a parameterised VAR
Syntax
V = infocrit(V)

Input arguments
V e E e ojetF

Output arguments
V e E e ojet with the esg nd fg informtion riteri reElultedF

Description
sn most sesD you don9t hve to run the funtion infocrit s it is lled from within estimate immeditely fter new prmeteristion is retedF

Example

instrument
Dene conditioning instruments in VAR models

PIQ

etor utoregressionsX e ojets nd funtionsX integrate

Syntax to add forecast instruments


V = instrument(V,Def) V = instrument(V,Name,Exprn) V = instrument(V,Name,Vec)

Syntax to remove all forecast instruments


V = instrument(V)

Input arguments
V e E e ojet to whih forest instruments will e ddedF Def hr | ellstr E he(nition string for the new onditioning instrumentsF Name hr E xme of the new onditiong instrumentF Exprn hr E ixpression de(ning the new onditiong instrumentF Vec numeri E etor of oe0ents to omine the e vriles to rete the new ondiE tioning instrumentF

Output arguments

integrate
Integrate VAR process and data associated with it
Syntax
V = integrate(V,...)

Input arguments
V e E e ojet whose vriles will e integrted y one orderF PIR

etor utoregressionsX e ojets nd funtionsX iscompatible

Output arguments
V e E e ojet with the spei(ed vriles integrted y one orderF

Options
applyTo= logil | numeri | Inf E sndex of vriles to integrteY snf mens ll vriles will e integrtedF

Description Example

iscompatible
True if two VAR objects can occur together on the LHS and RHS in an assignment
Syntax
Flag = iscompatible(V1,V2)

Input arguments
V1D V2 model E wo e ojets tht will e tested for omptiilityF

Output arguments
Flag true | false E rue if V1 nd V2 n our in n ssignmentD V1(...) = V2(...)D or horizontl ontentionD [V1,V2]F

Description
he funtion ompres the nmes of ll vrilesD shoksD nd prmetersD nd the omposition of the stteEspe vetorsF

PIS

etor utoregressionsX e ojets nd funtionsX ispanel

Example

isexplosive
True if any eigenvalue is outside unit circle
Syntax
Flag = isexplosive(V)

Input arguments
V e E e ojet whose eigenvlues will e tested for explosivenessF

Output arguments
Flag true | false E rue if t lest one eigenvlue is outside unit irleF

Options
tolerance= numeri | getrealsmall() E olerne for the eigenvlue testF

Description Example

ispanel
True for panel VAR based objects
Syntax
Flag = ispanel(X)

PIT

etor utoregressionsX e ojets nd funtionsX length

Input arguments
X e | e | pee E e sed ojetF

Output arguments
Flag true | false E rue if the e sed ojetD XD is sed on pnel of dtF

Description
linD iFeF nonEpnelD e sed ojets re reted y lling the onstrutor with one input rgumentX the list of vrilesF nel e sed ojets re reted y lling the onstrutor with two input rgumentsX the list of vrilesD nd the nmes of groups of dtF

Example

isstationary
True if all eigenvalues are within unit circle
Syntax
Flag = isstationary(V)

Input arguments
V e E e ojet whose eigenvlues will e tested for sttionrityF

Output arguments
Flag true | false E rue if ll eigenvlues re within unit irleF

Options
tolerance= numeri | getrealsmall() E olerne for the eigenvlue testF

PIU

etor utoregressionsX e ojets nd funtionsX lrtest

length
Number of alternative parameterisations in VAR object
Syntax
N = length(V)

Input arguments
V e E e ojetF yutput rguments N numeri E xumer of lterntive prmeteristionsF

Description Example

lrtest
Likelihood ratio test for VAR models
Syntax
[Stat,Crit] = lrtest(V1,V2,Level)

Input arguments
V1 e E nrestrited e modelF V2 e E estrited e modelF Level numeri E igni(ne levelY if not spei(edD HFHS is usedF

PIV

etor utoregressionsX e ojets nd funtionsX nfitted

Output arguments
Stat numeri E v test ststiF Crit numeri E v test ritil vlue sed on hiEsqure distriutionF

Description Example

mean
Mean of VAR process
Syntax
X = mean(V)

Input arguments
V e E e ojetF

Output arguments
X numeri E wen vetorF

Description Example

ntted
Number of data points tted in VAR estimation

PIW

etor utoregressionsX e ojets nd funtionsX portest

Syntax
N = nfitted(V)

Input arguments
V e E istimted e ojetF

Output arguments
N numeri E xumer of dt points @periodsA (tted when estimting the e ojetF

Description Example

portest
Portmanteau test for autocorrelation in VAR residuals
Syntax
[Stat,Crit] = portest(V,Data,H)

Input arguments
V e | swr E istimted e from whih the tested residuls were otinedF Data tseries E e residulsD or e output dt inluding residulsD to e tested for utoorreltionF H numeri E est horizonY must e greter thn the order of the tested eF

PPH

etor utoregressionsX e ojets nd funtionsX resample

Output arguments
Stat numeri E ortmnteu test sttistiF Crit numeri E ortmnteu test ritil vlue sed on hiEsqure distriutionF

Options
level= numeri | . 5 E equested signi(ne level for omputing the riterion CritF

Description Example

resample
Resample from a VAR object
Syntax
Outp = resample(V,Inp,Range,NDraw,...) Outp = resample(V,[],Range,NDraw,...)

Input arguments
V e E e ojet to resmple fromF Inp strut | tseries E snput dtse or tseries used in ootstrpY not needed when method= montecarloF Range numeri E nge for whih dt will e returnedF

Output arguments
Outp strut | tseries E esmpled output dtse or tseriesF

PPI

etor utoregressionsX e ojets nd funtionsX rngcmp

Options
deviation= true | false E ho not inlude the onstnt term in simultionsF group= numeri | NaN E ghoose group whose prmeters will e used in resmplingY required in e ojets with multiple groups when deviation= falseF method= ootstrp9 | monterlo9 | funtionhndle E footstrp from estimted residE ulsD resmple from norml distriutionD or use userEsupplied smplerF progress= true | false E hisply progress r in the ommnd windowF randomise= true | false E ndomise or (x preEsmple initil onditionF wild= true | false E se wild ootstrp insted of stndrd ifron ootstrp when method= bootstrapF

Description Example

rngcmp
True if two VAR objects have been estimated using the same dates

Syntax

Flag = rngcmp(V1,V2)

Input arguments
V1D V2 e E wo estimted e ojetsF

Output arguments
Flag true | false E rue if the two e ojetsD V1 nd V2D hve een estimted using oservtions t the sme dtesF

PPP

etor utoregressionsX e ojets nd funtionsX simulate

Description Example

schur
Compute and store triangular representation of VAR
Syntax
V = schur(V)

Input arguments
V e E e ojetF

Output arguments
V e E e ojet with the tringulr representtion mtries reElultedF

Description
sn most sesD you don9t hve to run the funtion schur s it is lled from within estimate immeditely fter new prmeteristion is retedF

Example

simulate
Simulate VAR model

PPQ

etor utoregressionsX e ojets nd funtionsX sspace

Syntax
Outp = simulate(V,Inp,Range,...)

Input arguments
V e E e ojet tht will e simultedF Inp tseries | strut E snput dt from whih the initil ondtions nd residuls will e tkenF Range numeri E imultion rngeY must not refer to InfF

Output arguments
Outp tseries E imulted output dtF

Options
contributions= true | false E heompose the simulted pths into ontriutions of individul residulsF deviation= true | false E ret input nd output dt s devitions from unonditionl menF output= auto | dbase | tseries E pormt of output dtF

Description

Backward simulation (backcast)


sf the Range is vetor of deresing dtesD the simultion is performed kwrdF he e ojet is (rst onverted to its kwrd representtion using the funtion backward P201 D nd then the dt re simulted from the ltest dte to the erliest dteF

Example

PPR

etor utoregressionsX e ojets nd funtionsX subsasgn

sspace
Quasi-triangular state-space representation of VAR
Syntax
[T,R,K,Z,H,D,Omg] = sspace(V,...)

Input arguments
V e E e ojetF

Output arguments
T numeri E rnsition mtrixF R numeri E wtrix t the shok vetor in trnsition equtionsF K numeri E gonstnt vetor in trnsition equtionsF Z numeri E wtrix mpping trnsition vriles to mesurement vrilesF H numeri E wtrix t the shok vetor in mesurement equtionsF D numeri E gonstnt vetor in mesurement equtionsF U numeri E rnsformtion mtrix for predetermined vrilesF Omega numeri E govrine mtrix of shoksF

Description Example

subsasgn
Subscripted assignment for VAR objects

PPS

etor utoregressionsX e ojets nd funtionsX subsref

Syntax to assign parameterisations from other VAR object


V(inx) = W

Syntax to delete specied parameterisations


V(Inx) = []

Input arguments
V e E e ojetF inx numeri E sndex of prmeteristions tht will e ssigned or deletedF W e E e ojet omptile with V whose prmeteristions will e ssigned @opiedA into VF

Output arguments
V model E e ojet with newly ssigned or deleted prmeteristionsD

Description Example
ixpnd the numer of prmeteristions in e ojet tht hs initilly just one prmeterisE tionX
V(1:1 ) = V;

he prmeteristion is simply opied ten times within the e ojetF

subsref
Subscripted reference for VAR objects
PPT

etor utoregressionsX e ojets nd funtionsX userdata

Syntax to retrieve VAR object with subset of parameterisations


V(Inx)

Input arguments
V e E e ojetF Inx numeri | logil E sndex of requested prmeteristionsF

Description Example

userdata
Get or set user data in an IRIS object
Syntax for getting user data
X = userdata(OBJ)

Syntax for assigning user data


OBJ = userdata(OBJ,X)

Input arguments
OBJ model | tseries | e | e | pee | sstte E yne of the ss ojets with ess to user dt funtionsF X F F F E eny kind of dt tht will e tthed toD nd stored withinD the ojet OBJF

PPU

etor utoregressionsX e ojets nd funtionsX VAR

Output arguments
X F F F E ser dt tht re urrently tthed to the ojetF OBJ model | tseries | e | e | pee | sstte E he ojet with its user dt updtedF

Description Example

VAR
Create new reduced-form VAR object
Syntax for plain VAR
V = VAR(YNames)

Syntax for panel VAR


V = VAR(YNames,GroupNames)

Output arguments
V e E xew empty e ojetF YNames ellstr | hr | funtionhndle E xmes of e vrilesF GroupNames ellstr | hr | funtionhndle E xmes of groups of dt for pnel estimtionF

Description
his funtion retes new empty e ojetF st is usully followed y the estimate P204 funtion to estimte the e prmeters on dtF

PPV

etor utoregressionsX e ojets nd funtionsX xsf

Example
o estimte eD you (rst need to rete n empty e ojet speifying the vrile nmesD nd then run the eGestimte P204 funtion on itD eFgF
v = VAR({x,y,z}); [v,d] = estimate(v,d,range);

where the input dtse d ought to ontin time series d.xD d.yD d.zF

vma
Matrices describing the VMA representation of a VAR process
Syntax
Phi = vma(V,N)

Input arguments
V e E e ojet for whih the we mtries will e omputedF N numeri E yrder up to whih the we mtries will e omputedF

Output arguments
Phi numeri E we mtriesF

Description Example

xsf
Power spectrum and spectral density functions for VAR variables
PPW

etor utoregressionsX e ojets nd funtionsX xsf

Syntax
[S,D] = xsf(V,Freq,...)

Input arguments
V e E e ojetF Freq numeri E etor of prequenies t whih the ps will e evlutedF

Output arguments
S numeri E ower spetrum mtriesF D numeri E petrl density mtriesF

Options
applyTo= ellstr | hr | : E vist of vriles to whih the filter= will e ppliedY : mens ll vrilesF filter= hr | empty E viner (lter tht is pplied to vriles spei(ed y pplyto9F nFreq= numeri | PST E xumer of eqully sped frequenies over whih the (lter9 is numerilly integrtedF progress= true | false E hisply progress r in the ommnd windowF

Description
he output mtriesD S nd DD re NEyENEyEKD where N is the numer of e vriles nd K is the numer of frequenies @iFeF the length of the vetor freqAF he kEth pge is the S mtrixD iFeF S(:,:,k)D is the rossEspetrum mtrix for the e vriles t the kEth frequenyF imilrlyD the kEth pge in DD iFeF D(:,:,k)D is the rossEdensity mtrixF

Example

PQH

truturl vetor utoregressionsX e ojets nd funtions

14 Structural vector autoregressions: SVAR objects and functions


e methodsX

Constructor
SVAR P238 E gonvert reduedEform e to struturl eF e ojets n ll ny of the e P196 funtionsF sn dditionD the following funtions re ville for e ojetsF

Getting information about SVAR objects


fprintf P233 E pormt e s model ode nd write to text (leF get P233 E uery e ojet propertiesF sprintf P236 E pormt e s model ode nd write to text stringF

Simulation
srf P237 E hok @impulseA response funtionF

Stochastic properties
fevd P232 E porest error vrine deomposition for e vrilesF

Manipulating SVAR objects


sort P234 E ort e prmeteristions y squred distne of shok reponses to medinF ee help on e P196 ojets for other funtions villeF

Getting on-line help on SVAR functions


help SVAR help SVAR/function_name

PQI

truturl vetor utoregressionsX e ojets nd funtionsX fprintf

Getting on-line help on SVAR functions that are inherited from VARs
help VAR help VAR/function_name

fevd
Forecast error variance decomposition for SVAR variables
Syntax
[X,Y,XX,YY] = fevd(V,NPer) [X,Y,XX,YY] = fevd(V,Range)

Input arguments
V e E truturl e modelF NPer numeri E xumer of periodsF Range numeri E hte rngeF

Output arguments
X numeri E porest error vrine deomposition into solute ontriutions of residulsY solute ontriutions sum up to the totl vrineF Y numeri E porest error vrine deomposition into reltive ontriutions of residulsY reltive ontriutions sum up to 1F XX tseries E X onverted to tseries ojetF YY tseries E Y onverted to tseries ojetF

Description Example

PQP

truturl vetor utoregressionsX e ojets nd funtionsX get

fprintf
Format SVAR as a model code and write to text le
Syntax
[C,D] = fprintf(S,FName,...)

Input arguments
S e E e ojet tht will e printed to model (leF FName hr | ellstr E pilenmeD or (lenme formt stringD under whih the model ode will e svedF yutput rguments C ellstr E ext string with the model ode for eh prmeteristionF D ell E rmeter dtses for eh prmeteristionY if hardParameters= trueD the dtse will e emptyF

Options
ee help on sprintf P236 for options villeF

Description Example

get
Query SVAR object properties
Syntax
value = get(v,query) [value,value,...] = get(v,query,query,...)

PQQ

truturl vetor utoregressionsX e ojets nd funtionsX sort

Input arguments
v e E e ojetF query hr E xme of the queried propertyF

Output arguments
value F F F E lue of the queried propertyF ell properties essile through the get funtion in e ojets re lso essile in e ojetsF

Valid queries on SVAR objects Description Example

sort
Sort SVAR parameterisations by squared distance of shock reponses to median
Syntax
[B,~,Inx,Crit] = sort(A,[],SortBy,...) [B,Data,Inx,Crit] = sort(A,Data,SortBy,...)

Input arguments
A e E e ojet with multiple prmeteristions tht will e sortedF Data tseries | strut | empty E e dt @endogenous vriles nd struturl shoksAY the struturl shoks will e reEordered ording to the e prmeteristionsF ou n leve the input rgument Data emptyF SortBy hr E ext string tht will e evluted to ompute the riterion y whih the prmeteristions will e sortedY see hesription for how to write SortByF PQR

truturl vetor utoregressionsX e ojets nd funtionsX sort

Output arguments
B e E e ojet with prmeteristions sorted y the spei(ed riterionF Data tseries | strut | empty E e dt with the struturl shoks reEordered to orrespond to the order of prmeteristionsF Inx numeri E etor of indies so tht B = A(Inx)F Crit numeri E he vlue of the riterion sed on the string SortBy for eh prmeteriE stionF

Options
progress= true | false E hisply progress r in the ommnd windowF

Description
he individul prmeteristions within the e ojet A re sorted y the sum squred distnes of seleted shok responses to the respetive medin reponsesF pormllyD the following riterion is evluted for eh prmeteristion

X
iPI;j PJ;kPK

Si;j @kA Mi;j @kA2 @A

where Si;j k denotes the response of the iEth vrile to the jEth shok in period kD nd Mi;j k is the medin responsesF he sets of vrilesD shoks nd periodsD iFeF ID JD KD respetivelyD over whih the summtion runs re determined y the user in the SortBy stringF

@A

row do you selet the shok responses tht enter the riterion in SortByc he input rgument SortBy is text string tht refers to rry SD whose element S(i,j,k) is the response of the iEth vrile to the jEth shok in period kF xote tht when you pss in e dt nd request them to e sorted the sme wy s the e prmeteristions @the seond line in yntxAD the numer of prmeteristions in A must mth the numer of dt sets in DataF

Example
ort the prmeteristions y squred distne to medin of shok responses of ll vriles to the (rst shok in the (rst four periodsF he prmeteristion tht is losest to the medin responses

PQS

truturl vetor utoregressionsX e ojets nd funtionsX sprintf


S2 = sort(S1,[],S(:,1,1:4))

sprintf
Format SVAR as a model code and write to text string
Syntax
[C,D] = sprintf(S,...)

Input arguments
S e E e ojet tht will e written s model odeF yutput rguments C ellstr E ext string with the model ode for eh prmeteristionF D ell E rmeter dtse for eh prmeteristionY if hardParameters= is trueD the dtses will e emptyF

Options
decimal= numeri | empty E reision @numer of deimlsA t whih the oe0ients will e written if hardParameters= is trueY if emptyD the format= options is usedF declare= true | false E edd delrtion loks nd keywords for e vrilesD shoksD nd equtionsF eNames= ellstr | hr | empty E xmes tht will e given to the e residulsY if emptyD the nmes from the e ojet will e usedF format= hr | 7CFITe9 E xumeri formt for prmeter vluesY it will e used only if decimal= is emptyF hardParameters= true | false E rint oe0ients s hrd numersY otherwiseD rete prmeter nmes nd return prmeter dtseF yNames= ellstr | hr | empty E xmes tht will e given to the vrilesY if emptyD the nmes from the e ojet will e usedF PQT

truturl vetor utoregressionsX e ojets nd funtionsX srf tolerance= numeri | getrelsmll@A E ret e oe0ients smller thn tolerance= in solute vlue s zerosY zero oe0ients will e dropped from the model odeF

Description Example

srf
Shock (impulse) response function
Syntax
[R,Cum] = srf(V,NPer) [R,Cum] = srf(V,Range)

Input arguments
V e E e ojet for whih the impulse response funtion will e omputedF NPer numeri E xumer of periodsF Range numeri E hte rngeF

Output arguments
R tseries | strut E hok response funtionsF Cum tseries | strut E gumultive shok response funtionsF

Options
presample= true | false E snlude zeros for preEsmple initil onditions in the output dtF select= ellstr | hr | logil | numeri | Inf E eletion of shoks to whih the responses will e simultedF

PQU

truturl vetor utoregressionsX e ojets nd funtionsX SVAR

Description
por kwrd omptiilityD the following lls into the srf funtion is lso possileX
[~,~,s,c] = srf(this,nper) [~,~,s,c] = srf(this,range)

Example

SVAR
Convert reduced-form VAR to structural VAR
Syntax
[S,DATA,B,COUNT] = SVAR(V,DATA,...)

Input arguments
V e E eduedEform e ojetF DATA strut | tseries E ht ssoited with the input e ojetF

Output arguments
S e E truturl e ojetF DATA strut | tseries E ht with trnsformed struturl residulsF B numeri E smpt mtrix of struturl residulsF COUNT numeri E xumer of drws tully performed @oth suessful nd unsuessfulA when method=drawY otherwise COUNT=1F

PQV

truturl vetor utoregressionsX e ojets nd funtionsX SVAR

Options
maxIter= numeri | E wximum numer of ttempts when method=drawF

method= chol | draw | qr | svd E wethod tht will e used to identify struturl residulsF nDraw= numeri | E rget numer of suessful drws when method=drawF

reorder= numeri | empty E eEorder e vriles efore identifying struturl residuE lsD nd ring the vriles k in originl order fterwrdsF se the option 9backorderResiduals= to ontrol if lso the struturl residuls re rought k in originl orderF output= auto | dbase | tseries E pormt of output dtF progress= true | false E hisply progress r in the ommnd windowF rank= numeri | Inf E edued rnk of the ovrine mtrix of struturl residuls when method= svdY Inf mens full rnk is preservedF backorderResiduals= true | false E fring the identi(ed struturl residuls k in originl orderF std= numeri | 1 E td devition of struturl residulsY the resulting struturl ovrine mtrix will e reEsled @dividedA y this ftorF test= hr E orks with method=draw onlyY string tht will e evluted for eh rndom drw of the impt mtrix BF he evlution must result in true or falseY only the mtries B tht evlute to true will e keptF ee hesription for more on how to write the option test=F

Description

Identication random Householder transformations


he struturl impt mtries B re rndomly generted using rouseholder trnsformtion lgorithmF ih mtrix is tested y evluting the test string supplied y the userF sf it evlutes to true the mtrix is kept nd one more e prmeteristion is retedD if it is flse the mtrix is disrdedF he test string n refer to the following hrteristisX S ! the impulse @or shokA response funtionY the S(i,j,k) element is the response of the iEth vrile to the jEth shok in period kF Y ! the symptoti umultive response funtionY the Y(i,j) element is the sumptoti @longE runA umultive response of the iEth vrile to the jEth shokF PQW

truturl vetor utoregressionsX e ojets nd funtionsX SVAR

Example

PRH

fyesin e prior dummiesX fe pkgeX covmat

15 Bayesian VAR prior dummies: BVAR package


he fe pkge n e used to rete the si types of prior dummy oservtions when estimting fyesin e modelsF he dummy oservtions re pssed in the VAR/estimate P204 funtion through the BVAR= optionF

Constructing dummy observations


covmat P241 E govrine mtrix prior dummy oservtions for fesF litterman P242 E vittermn9s prior dummy oservtions for fesF sumofcoeff P243 E hon et l sumEofEoe0ient prior dummy oservtions for fesF uncmean P243 E nonditionlEmen dummy @or ims9 initil dummyA oservtions for fesF user P244 E serEsupplied prior dummy oservtions for fesF

Weights on prior dummy observations


he prior dummies produed y litterman P242 D uncmean P243 D sumofcoeff P243 n e weighted up or down using the input rgument MuF o give the weight ler interprettionD use the option stdize= true when estimting the eF sn tht seD setting Mu to sqrt(N) mens the prior dummies re worth totl of extr N rti(l oservtionsY the weight n e relted to the tul numer of oservtions used in estimtionF

Getting help on BVAR functions


help BVAR help BVAR/function_name

covmat
Covariance matrix prior dummy observations for BVARs
Syntax
O = BVAR.covmat(C,Rep)

PRI

fyesin e prior dummiesX fe pkgeX litterman

Input arguments
C numeri E rior ovrine mtrix of residulsY if C is vetor it will e onverted to digonl mtrixF Rep numeri E he numer of times the dummy oservtions will e repetedF

Output arguments
O vroj E fe ojet tht n e pssed into the VAR/estimate P204 funtionF

Description Example

litterman
Litterman's prior dummy observations for BVARs
Syntax
O = BVAR.litterman(Rho,Sgm,Lmb)

Input arguments
Rho numeri E hiteEnoise priors @Rho = A or rndomEwlk priors @Rho = 1AF Mu numeri E eight on the dummy oservtionsF Lmb numeri E ixponentil inrese in weight depending on the lgY Lmb = re weighted equllyF mens ll lgs

Output arguments
O vroj E fe ojet tht n e pssed into the VAR/estimate P204 funtionF

PRP

fyesin e prior dummiesX fe pkgeX uncmean

Description
ee the setion explining the weights on prior dummies P241 D iFeF the input rgument MuF

Example

sumofcoe
Doan et al sum-of-coecient prior dummy observations for BVARs
Syntax
O = BVAR.sumofcoeff(Mu)

Input arguments
Mu numeri E eight on the dummy oservtionsF

Output arguments
O vroj E fe ojet tht n e pssed into the VAR/estimate P204 funtionF

Description
ee the setion explining the weights on prior dummies P241 D iFeF the input rgument MuF

Example

uncmean
Unconditional-mean dummy (or Sims' initial dummy) observations for BVARs

PRQ

fyesin e prior dummiesX fe pkgeX user

Syntax
O = BVAR.uncmean(YBar,Mu)

Input arguments
YBar numeri E etor of unonditionl mens imposed s priorsF Mu numeri E eight on the dummy oservtionsF

Output arguments
X numeri E erry with prior dummy oservtions tht n e used in the BVAR= option of the VAR/estimate P204 funtionF O vroj E fe ojet tht n e pssed into the VAR/estimate P204 funtionF

Description
ee the setion explining the weights on prior dummies P241 D iFeF the input rgument MuF

Example

user
User-supplied prior dummy observations for BVARs
Syntax
O = BVAR.user(Y ,K ,Y1,G1)

Input arguments
Y numeri E golumnEwise prior dummy oservtions on the vrF K numeri E golumnEwise prior dummy oservtions on the r onstntF PRR

fyesin e prior dummiesX fe pkgeX user Y1 numeri E golumnEwise prior dummy oservtions on the r lgged vrilesF G1 numeri E golumnEwise prior dummy oservtions on the r oe0ients on the oE integrting vetorF

Output arguments
O vroj E fe ojet tht n e pssed into the VAR/estimate P204 funtionF

Description Example

PRS

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX comment

16 Factor-augmented vector autoregressions: FAVAR objects and functions


Constructor
FAVAR P249 E grete new pee ojetF

Getting information about FAVAR objects


comment P246 E qet or set user omments in n ss ojetF get P252 E uery model ojet propertiesF isempty P253 E rue if e sed ojet is emptyF userdata P254 E qet or set user dt in n ss ojetF VAR P255 E eturn e ojet desriing the ftor dynmisF

Estimation
estimate P247 E istimte pee using stti prinipl omponentsF

Filtering and forecasting


filter P249 E eEestimte the ftors y ulmn (ltering the dt tking pee oe0ients s givenF forecast P251 E porest pee ftors nd oservlesF

Getting on-line help on FAVAR functions


help FAVAR help FAVAR/function_name

comment
Get or set user comments in an IRIS object
PRT

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX estimate

Syntax for getting user comments


Cmt = comment(Obj)

Syntax for assigning user comments


Obj = comment(Obj,Cmt)

Input arguments
Obj model | tseries | e | e | pee | sstte E yne of the ss ojetsF Cmt hr E ser omment tht will e tthed to the ojetF

Output arguments
Cmt hr E ser omment tht re urrently tthed to the ojetF

Description Example

estimate
Estimate FAVAR using static principal components
Syntax
[A,D,CC,F,U,E,CTF] = estimate(A,D,List,Range,[R,Q],...) [A,X,CC,F,U,E,CTF] = estimate(A,X,Range,[R,Q],...)

Input arguments
A pee E impty pee ojetF

PRU

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX FAVAR D strut E snput dtseF List ellstr E vist of series from the dtse on whih the e will e estimtedF X tseries E series ojets with input dtF Range numeri E istimtion rngeF R numeri E eletion riterion for the numer of ftorsX winimum requested proportion of input dt voltility explined y the ftorsF Q numeri E eletion riterion for the numer of ftorsX wximum numer of ftorsF

Output arguments
A pee E istimted pee ojetF D strut E yutput dtseF X tseries E yutput tseries ojetF CC tseries E istimtes of ommon omponents in the pee oservlesF F tseries E istimtes of ftorsF U strut | tseries E sdiosynrti residulsF E tseries E ptor e residulsF CTF tseries E gontriutions of individul input series to the estimted ftorsF

Options
cross= true | flse | numeri E ueep o'Edigonl elements in the ovrine mtrix of idiosynrti residulsY if flse ll rossEovrines re reset to zeroY if numer etween zero nd oneD ll rossEovrines re multiplied y tht numerF order= numeri | I E yrder of the e for ftorsF output= uto9 | dse9 | tseries9 E pormt of output dtF rank= numeri | Inf E estrition on the rnk of the ftor e residulsF

Description Example

PRV

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX filter

FAVAR
Create new FAVAR object
Syntax
F = FAVAR(YNames)

Input arguments
YNames ellstr | hr E xmes of oserved vriles in the pee modelF

Output arguments
F pee E xew pee ojetF

Description
his funtion retes new empty pee ojetF st is usully followed y the estimte P247 funtion to estimte the pee prmeters on dtF

Example
o estimte peeD you (rst need to rete n empty e ojetD nd then run the pee P247 funtion on itD eFgF
list = {DLCPI,DLGDP,R}; f = FAVAR(list); f = estimate(f,d,range);

lter
Re-estimate the factors by Kalman ltering the data taking FAVAR coecients as given

PRW

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX filter

Syntax
[A,D,CC,F,U,E] = filter(A,D,Range,...)

Input arguments
A pee E istimted pee ojetF D strut | tseries E snput dtse or tseries ojet with the pee oservlesF Range numeri E pilter dte rngeF

Output arguments
A pee E pee ojetF D strut E yutput dtse or tseries ojet with the pee oservlesF CC strut | tseries E eEestimted ommon omponents in the oservlesF F tseries E eEestimted ommon ftorsF U tseries E eEestimted idiosynrti residulsF E tseries E eEestimted struturl residulsF

Options
cross= true | flse | numeri E un the (lter with the o'Edigonl elements in the ovrine mtrix of idiosynrti residulsY if flse ll rossEovrines re reset to zeroY if numer etween zero nd oneD ll rossEovrines re multiplied y tht numerF invFunc= uto9 | funtionhndle E snversion method for the pwi mtriesF meanOnly= true | false E eturn only men dtD iFeF point estimtesF persist= true | false E sf filter or forecast is used with persist= set to true for the (rst timeD the forest wi mtries nd their inverses will e storedY susequent lls of the filter or forecast funtions will reEuse these mtries until filter or forecast is lledF output= uto9 | dse9 | tseries9 E pormt of output dtF tolerance= numeri | H E xumeril tolerne under whih two pwi mtries omputed in two onseutive periods will e treted s equl nd their inversions will e reEusedD not reEomputedF PSH

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX forecast

Description
st is the user9s responsiility to mke sure tht filter nd forecast lled with persist= set to true re vlidD iFeF tht the previously omputed pwi mtries n e relly reEused in the urrent runF

Example

forecast
Forecast FAVAR factors and observables
Syntax
[D,CC,F,U,E] = forecast(A,D,RANGE,J,...)

Input arguments
A pee E pee ojetF D strut | tseries E snput dt with initil ondition for the pee ftorsF RANGE numeri E porest rngeF J strut | tseries E gonditioning dt with hrd tunes on the pee oservlesF

Output arguments
D strut E yutput dtse or tseries ojet with the pee oservlesF CC strut | tseries E rojetion of ommon omponents in the oservlesF F tseries E rojetion of ommon ftorsF U tseries E gonditionl idiosynrti residulsF E tseries E gonditionl struturl residulsF

PSI

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX get

Options
ee help on FAVAR/filter P249 for options villeF

Description Example

get
Query model object properties
Syntax
Ans = get(A,Query) [Ans,Ans,...] = get(A,Query,Query,...)

Input arguments
A pee E pee ojetF Query hr E uery to the pee ojetF

Output arguments
Ans F F F E enswer to the queryF

Valid queries to FAVAR objects

System matrices
A* eturns numeri the trnsition mtrix of the underlying e system on ftorsF B eturns numeri tne mtrix mpping the impt of struturl residuls on the ftors in the underlying eF C eturns numeri the mtrix mpping the ftors into the oservlesF

PSP

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX isempty Omega eturns numeri the reduedEform ovrine mtrix of the residuls in the unE derlying eF Sigma eturns numeri the ovrine mtrix of idiosynrti shoksF

Underlying VAR
VAR eturns e e ojet desriing the ftor dynmisF

Eigenvalues and singular values


eig eturns numeri the vetor of eigenvlues of the underlying eF sing eturns numeri the vetor of singulr vlues from the prinipl omponent estiE mtion stepF

Observables and factors


mean eturns numeri the estimted men of the oservles used to stndrdise the input dtF std eturns numeri the estimted std devitions of the oservles used to stndrdise the input dtF ny eturns numeri the numer of oservlesF nx eturns numeri the numer of ftorsF yList eturns ellstr the list of the nmes of oservlesF

Description Example

isempty
True if VAR based object is empty
Syntax
Flag = isempty(X)

PSQ

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX userdata

Input arguments
X e | e | pee E e sed ojetF

Output argument
Flag true | false E rue if the e sed ojetD XD is emptyF

Description Example

userdata
Get or set user data in an IRIS object
Syntax for getting user data
X = userdata(OBJ)

Syntax for assigning user data


OBJ = userdata(OBJ,X)

Input arguments
OBJ model | tseries | e | e | pee | sstte E yne of the ss ojets with ess to user dt funtionsF X F F F E eny kind of dt tht will e tthed toD nd stored withinD the ojet OBJF

Output arguments
X F F F E ser dt tht re urrently tthed to the ojetF OBJ model | tseries | e | e | pee | sstte E he ojet with its user dt updtedF PSR

ptorEugmented vetor utoregressionsX pee ojets nd funtionsX VAR

Description Example

VAR
Return a VAR object describing the factor dynamics
Syntax
v = VAR(a)

Input arguments
a pee E pee ojetF

Output arguments
v e E e ojet desriing the dynmi system of the pee ftorsF

Description Example

PSS

Part IV 
Time series and database management

PST

htes nd dte rnges

17 Dates and date ranges


Creating IRIS serial date numbers
bb P258 E ss seril dte numers for dtes with iEmonthly frequenyF bbtoday P259 E ss seril dte numer for urrent iEmonthF hh P273 E ss seril dte numers for dtes with hlfEyerly frequenyF hhtoday P274 E ss seril dte numer for urrent hlfEyerF mm P274 E ss seril dte numers for dtes with monthly frequenyF mmtoday P275 E ss seril dte numer for urrent monthF qq P275 E ss seril dte numers for dtes with qurterly frequenyF qqtoday P276 E ss seril dte numer for urrent qurterF yy P278 E ss seril dte numers for dtes with yerly frequenyF yytoday P279 E ss seril dte numer for urrent yerF

Computing special dates (daily dates only)


datbom P265 E feginning of month for the spei(ed dily dteF datboq P266 E feginning of qurter for the spei(ed dily dteF datboy P266 E feginning of yer for the spei(ed dily dteF dateom P269 E ind of month for the spei(ed dily dteF dateoq P270 E ind of qurter for the spei(ed dily dteF dateoy P270 E ind of yer for the spei(ed dily dteF

Creating date ranges


daterange P271 E se the olon opertor to rete dte rngesF datxtick P271 E ghnge tiksD lels ndGor dte frequeny on xExis in existing tseries grphsF

PSU

htes nd dte rngesX bb

Converting dates
clp2dat P259 E gonvert text in system lipord to dtesF dat2char P260 E gonvert dtes to hrter rryF dat2charlist P261 E gonvert dtes to ommEseprted listF dat2clp P262 E gonvert dtes to text nd pste to system lipordF dat2dec P263 E gonvert dtes to their deiml representtionsF dat2str P263 E gonvert ss dtes to ell rry of stringsF dat2ypf P265 E gonvert ss seril dte numer to yerD period nd frequenyF dec2dat P272 E gonvert deiml numers to ss seril dte numersF str2dat P277 E gonvert strings to ss seril dte numersF

Date comparison
datcmp P267 E gompre two ss seril dte numersF datdiff P268 E xumer of periods etween two dtes with hek for dte frequenyF rngcmp P276 E gompre two ss dte rngesF

Getting on-line help on date functions


help dates help dates/function_name

bb
IRIS serial date numbers for dates with bi-monthly frequency
Syntax
d = bb(y) d = bb(y,b)

PSV

htes nd dte rngesX clp2dat

Input arguments
y numeri E ersF q numeri E fEmonthsY if missingD (rst iEmonth is ssumedF

Output arguments
d numeri E ss seril dte numers representing the input iEmonthsF

Description Example

bbtoday
IRIS serial date number for current bi-month
Syntax
Dat = bbtoday()

Output arguments
Dat numeri E ss seril dte numer for urrent iEmonthF

Description Example

clp2dat
Convert text in system clipboard to dates

PSW

htes nd dte rngesX dat2char

Syntax
D = clp2dat(...)

Output arguments
D numeri E ss seril dte numers sed on the urrent ontent of the system lipord onverted y the str2dat P277 funtionF

Options
ee help on str2dat P277 for options villeF

Description Example

dat2char
Convert dates to character array
Syntax
C = dat2char(D,...)

Input arguments
D numeri E ss seril dte numers tht will e onverted to hrter rryF

Output arguments
C hr E ghrter rry representing the input dtesY eh line of the rry represents one dte from DF

PTH

htes nd dte rngesX dat2charlist

Options
ee help on dat2str P263 for options villeF

Description Example
e rete qurterly dte using the funtion qqY this funtion returns n ss seril dte numerF e then use dat2char to print humnEredle text representtion of tht dteF
d = qq(2 15,3) d = 8. 62 e+ 3 dat2char(d) ans = 2 15Q3

dat2charlist
Convert dates to a comma-separated list
Syntax
C = dat2charlist(D,...)

Input arguments
D numeri E ss seril dte numers tht will e onverted to ommEseprted listF

Output arguments
C hr E ext string with ommEseprted list of dtesF

PTI

htes nd dte rngesX dat2dec

Options
ee help on dat2str P263 for options villeF

Description Example

dat2clp
Convert dates to text and paste to system clipboard
Syntax
C = dat2clp(D,...)

Input arguments
D numeri E ss seril dte numers tht will e onverted to hrter rry nd psted to the system lipordF

Output arguments
C hr E ghrter rry representing the input dtes psted to the system lipordY eh line of the rry represents one dte from DF

Options
ee help on dat2str P263 for options villeF

Description Example

PTP

htes nd dte rngesX dat2str

dat2dec
Convert dates to their decimal representations
Syntax
DEC = dat2dec(DAT)

Input arguments
DAT numeri E ss seril dte numerF

Output arguments
DEC numeri E heiml numer representing the input dtesD omputed s year + (per-1)/freqF

Description Example

dat2str
Convert IRIS dates to cell array of strings
Syntax
S = dat2str(DAT,...)

Input arguments
DAT numeri E ss seril dte numer@sAF

Output arguments
S ellstr E gellstr with strings representing the input dtesF PTQ

htes nd dte rngesX dat2ypf

Options
dateFormat= hr | p9 E hte formt stringF freqLetters= hr | rfw9 E vetters representing the (ve possile frequenies @nnulDsemiEnnulDqurterlyDimontlyDmonthlyAF months= ellstr | inglish nmes of months E gell rry of twelve strings representing the nmes of monthsF standinMonth= numeri | lst9 | I E hih month will represent lowerEthnEmonthlyE frequeny dte if month is prt of the dte formt stringF

Description
he dte formt string n inlude ny omintion of the following (eldsX Y= E erF YYYY= E pourEdigit yerF YY= E woEdigit yerF P= E eriod within the yer @hlfEyerD qurterD iEmonthD monthAF PP= E woEdigit period within the yerF R= E pperEse romn numerl for the period within the yerF r= E vowerEse romn numerl for the period within the yerF M= E wonth numerlF MM= E woEdigit month numerlF MMMM=D MmmmD mmmm E gseEsensitive nme of monthF MMM=D MmmD mmm E gseEsensitive threeEletter revition of monthF F= E pperEse letter representing the dte frequenyF f= E vowerEse letter representing the dte frequenyF o get some of the ove letters printed literlly in the dte stringD use perent sign s n espe hrterD iFeF 79D etF

PTR

htes nd dte rngesX datbom

Example

dat2ypf
Convert IRIS serial date number to year, period and frequency
Syntax
[y,p,f] = dat2ypf(dat)

Input arguments
dat numeri E ss seril dte numersF

Output arguments
y numeri E ersF p numeri E eriods within yerF f numeri E hte frequeniesF

Description Example

datbom
Beginning of month for the specied daily date
Syntax
Bom = datebom(D)

PTS

htes nd dte rngesX datboy

Input arguments
D numeri E hily seril dte numerF

Output arguments
Bom numeri E hily seril dte numer for the (rst dy of the sme month s DF

Description Example

datboq
Beginning of quarter for the specied daily date
Syntax
Boq = datboq(D)

Input arguments
D numeri E hily seril dte numerF

Output arguments
Boq numeri E hily seril dte numer for the (rst dy of the sme qurter s DF

Description Example

datboy
Beginning of year for the specied daily date
PTT

htes nd dte rngesX datcmp

Syntax
Boy = dateboy(D)

Input arguments
D numeri E hily seril dte numerF

Output arguments
Boy numeri E hily seril dte numer for the (rst dy of the sme yer s DF

Description Example

datcmp
Compare two IRIS serial date numbers
Syntax
Flag = datcmp(Dat1,Dat2)

Input arguments
Dat1D Dat2 numeri E ss seril dte numers or vetorsF

Output arguments
Flag true | false E rue for numers tht represent the sme dteF

PTU

htes nd dte rngesX datdiff

Description
he two dte vetors must either e the sme lengthsD or one of them must e slrF se this funtion insted of the plin omprison opertorD ==D to ompre dtesF he plin omprision n sometimes give flse results euse of roundEo' errorsF

Example
d1 = qq(2 1 ,1); d2 = qq(2 9,1):qq(2 1 ,4); datcmp(d1,d2) ans = 1

datdi
Number of periods between two dates with check for date frequency
Syntax
D = datdiff(D1,D2)

Input arguments
D1D D2 numeri E ss dtes of vetors of ss dtesF

Output arguments
D numeri E xumer of periods etween D1 nd D2D positive for D1 greter thn D2D negtive for D1 smller thn D2D or xx for dtes of di'erent frequeniesF

Description Example
d1 = mm(2 1 ,12);

PTV

htes nd dte rngesX dateoq


d2 = mm(2 11,12); datdiff(d1,d2) ans = -12 datdiff(d2,d1) ans = 12 d3 = yy(2 11); datdiff(d1,d3) ans = NaN

dateom
End of month for the specied daily date
Syntax
Eom = dateom(D)

Input arguments
D numeri E hily seril dte numerF

Output arguments
Eom numeri E hily seril dte numer for the lst dy of the sme month s DF

Description Example

PTW

htes nd dte rngesX dateoy

dateoq
End of quarter for the specied daily date
Syntax
Eoq = dateoq(D)

Input arguments
D numeri E hily seril dte numerF

Output arguments
Eoq numeri E hily seril dte numer for the lst dy of the sme qurter s DF

Description Example

dateoy
End of year for the specied daily date
Syntax
Eoy = dateoy(D)

Input arguments
D numeri E hily seril dte numerF

Output arguments
Eoy numeri E hily seril dte numer for the lst dy of the sme yer s DF PUH

htes nd dte rngesX datxtick

Description Example

daterange
Use the colon operator to create date ranges
Syntax
startdate : enddate startdate : increment : enddate

Input arguments
startdate numeri E ss seril dte numer representing the strtdteF enddate numeri E ss seril dte numer representing the enddteY startdate nd enddate must e the sme frequenyF increment numeri E xumer of periods @spei( to eh frequenyA etween the dtes in the dte vetorF

Description
ou n use the olon opertor to rete ontinuous dte rnges euse the ss seril dte numers re designed so tht whtever the frequeny two onseutive dtes re represented y numers tht di'er extly y oneF

Example

datxtick
Change ticks, labels and/or date frequency on x-axis in existing tseries graphs

PUI

htes nd dte rngesX dec2dat

Syntax
datxtick(Range,...) datxtick(Ax,Range,...)

Input arguments
Ax numeri E rndle to the xes ojet where the hnges will e mdeY if not spei(edD the urrent xes ojetD gca()D is hngedF Range numeri E xew dte rnge to whih the xExis will e hngedF

Options
datePosition= start | centre | end E here within eh given period the dte tik will e pled @t the eginning of the periodD in the middle of the periodD or t the end of the periodAF dateTicks= numeri | Inf E sndividul dte tiksY if InfD the tiks will e determined utomtilly using the stndrd wtl lgorithmF ee dat2str P263 for dte formtting options villeF Ess ooloxF Egopyright @A PHHUEPHIQ ss olutions emF

Description Example
grete grph plotting qurterly seriesD nd then hnge the tiks nd lels on the xExis to monthlyX
x = tseries(qq(2 1 ,1):qq(2 11,4),@rand); plot(x); datxtick(mm(2 1 ,1):mm(2 11,12),dateFormat=,Mmm YYYY);

dec2dat
Convert decimal numbers to IRIS serial date numbers
PUP

htes nd dte rngesX hh

Syntax
dat = dec2dat(dec,freq)

Input arguments
dec numeri E heiml numers representing dtesF freq freq E hte frequenyF

Output arguments
dt numeri E ss seril dt numers orresponding to the input deimlsF

hh
IRIS serial date numbers for dates with half-yearly frequency
Syntax
d = hh(y) d = hh(y,h)

Input arguments
y numeri E ersF h numeri E rlfEyersY if missingD (rst hlfEyer is usedF

Output arguments
d numeri E ss seril dte numers representing the input hlfEyersF

PUQ

htes nd dte rngesX mm

Description Example

hhtoday
IRIS serial date number for current half-year
Syntax
Dat = hhtoday()

Output arguments
Dat numeri E ss seril dte numer for urrent hlfEyerF

Description Example

mm
IRIS serial date numbers for dates with monthly frequency
Syntax
d = mm(y) d = mm(y,m)

Input arguments
y numeri E ersF m numeri E wonthsY if missingD (rst month @tnuryA is ssumedF PUR

htes nd dte rngesX qq

Output arguments
d numeri E ss seril dte numers representing the input monthsF

Description Example

mmtoday
IRIS serial date number for current month
Syntax
Dat = mmtoday()

Output arguments
Dat numeri E ss seril dte numer for urrent monthF

Description Example

qq
IRIS serial date numbers for dates with quarterly frequency
Syntax
d = qq(y) d = qq(y,q)

PUS

htes nd dte rngesX rngcmp

Input arguments
y numeri E ersF q numeri E urtersY if missingD (rst qurter is ssumedF

Output arguments
d numeri E ss seril dte numers representing the input qurterly dtesF

Description Example

qqtoday
IRIS serial date number for current quarter
Syntax
Dat = qqtoday()

Output arguments
Dat numeri E ss seril dte numer for urrent qurterF

Description Example

rngcmp
Compare two IRIS date ranges

PUT

htes nd dte rngesX str2dat

Syntax
Flag = rngcmp(R1,R2)

Input arguments
R1D R2 numeri E wo ss dte rnges tht will e ompredF

Output arguments
Flag true | false E rue if the two dte rnges re the smeF

Description
en ss dte rnge is distint from vetor of dtes in tht only the (rst nd the lst dtes mtterF yftenD dte rnges re ontext sensitiveF sn tht seD you n use -Inf for the strt dte @mening the erliest possile dte in the given ontextA nd Inf for the end dte @mening the ltest possile dte in the given ontextAD or simply Inf for the whole rnge @mening from the erliest possile dte to the ltest possile dte in the given ontextAF

Example
r1 = qq(2 1 ,1):qq(2 2 ,4); r2 = [qq(2 1 ,1),qq(2 2 ,4)]; rngcmp(r1,r2) ans = 1

str2dat
Convert strings to IRIS serial date numbers
Syntax
Dat = str2dat(S,...)

PUU

htes nd dte rngesX yy

Input arguments
S hr | ellstr E trings representing dtesF

Output arguments
Dat numeri E ss seril dte numersF

Options
freq= 1 | 2 | 4 | 6 | 12 | empty E infore frequenyF ee help on dat2str P263 for other options villeF

Description Example
d = str2dat( 4-2 1 ,dateformat,MM-YYYY); dat2str(d) ans = 2 1 M 4 d = str2dat( 4-2 1 ,dateformat,MM-YYYY,freq,4); dat2str(d) ans = 2 1 Q2

yy
IRIS serial date numbers for dates with yearly frequency

PUV

htes nd dte rngesX yytoday

Syntax
d = yy(y)

Input arguments
y numeri E ersF

Output arguments
d numeri E ss seril dte numers representing the input yersF

Description Example

yytoday
IRIS serial date number for current year
Syntax
Dat = yytoday()

Output arguments
Dat numeri E ss seril dte numer for urrent yerF

Description Example

PUW

ime series ojets nd funtions

18 Time series objects and functions


series methodsX

Constructor
tseries P341 E grete new time series @tseriesA ojetF

Getting information about tseries objects


daily P298 E glendr view of dily tseries ojetF enddate P302 E hte of the lst ville oservtion in tseries ojetF freq P306 E prequeny of tseries ojetF get P307 E uery tseries ojet propertyF length P313 E vength of tseries ojetF ndims P318 E xumer of dimensions in tseries ojet dtF size P333 E ize of tseries ojet dtF startdate P336 E hte of the (rst ville oservtion in tseries ojetF yearly P347 E hisply tseries ojet one full yer per rowF

Referencing tseries objects


subsasgn P338 E usripted ssignment for tseries ojetsF subsref P339 E usripted referene funtion for tseries ojetsF

Maths and statistics functions and operators


ome of the following funtions require the ttistis ooloxF
+D -D *D \D /D D &D |D ~D ==D ~=D >=D >D <D <=D absD acosD asinD atanD atan2D ceilD cosD expD fixD floorDimagD isinfD isnanD logD log1 D realD roundD sinD sqrtD tanD normpdfD normcdfD prctileD lognpdfD logncdf

he ehviour of the following funtions depend on the dimension long whih they re performedF ome of the following funtions require the ttistis ooloxF PVH

ime series ojets nd funtions


allD anyD cumprodD cumsumD findD geomeanD maxD meanD medianD minD modeD nanmeanD nanstdD nansumD nanvarD prodD stdD sumD var

Filters
arf P286 E un utoregressive funtion on tseries ojetF bpass P289 E fndEpss (lterF bwf P292 E futterworth (lter with tunesF bwf2 P292 E wp output rguments of the futterworth (lter with tunesF detrend P299 E emove liner time trendF expsmooth P304 E ixponentil smoothingF hpf P308 E rodrikEresott (lter with tunes @k v (lterAF hpf2 P312 E wp output rguments of the rodrikEresott (lter with tunesF fft P305 E hisrete pourier trnsform of tseries ojetF llf P314 E vol level (lter @k rndom wlk plus white noiseA with tunesF llf2 P317 E wp output rguments of the lol liner trend (lter with tunesF moving P318 E epply funtion to moving window of oservtionsF trend P340 E istimte time trendF x12 P343 E eess to IP sesonl djustment progrmF

Estimation and sample characteristics


xote tht most of the smple hrteristis re listed ove in the wths nd sttistis funtions nd opertiors setionF acf P283 E mple utoovrine nd utoorreltion funtionsF hpdi P308 E righest proility density intervlF chowlin P293 E ghowEvin distriution of lowEfrequeny oservtions over higherEfrequeny periodsF regress P327 E yrdinry or weighted lestEsqure regressionF

PVI

ime series ojets nd funtions

Visualising tseries objects


area P285 E ere grph for tseries ojetsF bar P287 E fr grph for tseries ojetsF barcon P288 E gontriution r grph for tseries ojetsF errorbar P303 E vine plot with error rsF plot P321 E vine grph for tseries ojetsF plotcmp P323 E gomprison grph for two time seriesF plotpred P324 E lot ulmn (lter preditionsF plotyy P325 E vine plot funtion with vr nd r xes for time seriesF scatter P331 E tter grph for tseries ojetsF spy P335 E isulise tseries oservtions tht pss testF stem P337 E lot tseries s disrete sequene dtF

Manipulating tseries objects


empty P302 E impty tseries ojet preserving its size in Pnd nd higher dimensionsF permute P321 E ermute dimensions of tseries ojetF redate P326 E ghnge time dimension of tseries ojetF reshape P328 E eshpe size of time series in Pnd nd higher dimensionsF resize P329 E glip tseries ojet down to spei(ed dte rngeF sort P334 E ort tseries olumns y spei(ed riterionF

Converting tseries objects


convert P295 E gonvert tseries ojet to di'erent frequenyF double P301 E eturn tseries oservtions s douleEpreision numeri rryF doubledata P301 E gonvert tseries oservtions to doule preisionF single P332 E eturn tseries oservtions s singleEpreision numeri rryF singledata P333 E gonvert tseries oservtions to single preisionF PVP

ime series ojets nd funtionsX acf

Other tseries functions


apct P284 E ennulised perent rte of hngeF bsxfun P291 E tndrd fpx implemented for tseries ojetsF cumsumk P296 E gumultive sum with kEperiod lepF destdise P298 E hestndrdise tseries ojet y pplying spei(ed stndrd devition nd men to itF diff P300 E pirst di'ereneF interp P312 E snterpolte missing oservtionsF normalise P319 E xormlise @or reseA dt to prtiulr dteF pct P320 E erent rte of hngeF round P330 E ound tseries dt to spei(ed numer of deimlsF rmse P329 E gompute wi for given oservtions nd preditionsF stdise P336 E tndrdise tseries dt y sutrting men nd dividing y std devitionF windex P342 E imple weighted or hivisi indexF wmean P342 E eighted verge of time series oservtionsF

Getting on-line help on tseries functions


help tseries help tseries/function_name

acf
Sample autocovariance and autocorrelation functions
Syntax
[C,R] = acf(X) [C,R] = acf(X,DATES,...)

PVQ

ime series ojets nd funtionsX apct

Input arguments
X tseries E series ojetF DATES numeri | snf E htes or dte rnge on whih tseries dt will e usedF

Output arguments
C numeri E eutoEGrossEovrine mtriesF R numeri E eutoEGrossEorreltion mtriesF

Options
demean= true | false E emove men from the dt efore omputing the egpF order= numeri | E yrder up to whih the egp will e omputedF

smallSample= true | false E edjust degrees of freedom for smll smplesF

Description Example

apct
Annualised percent rate of change
Syntax
X = apct(X)

Input arguments
X tseries E snput tseries ojetF

Output arguments
X tseries E ennulised perentge rte of hnge in the input dtF PVR

ime series ojets nd funtionsX area

Description Example

area
Area graph for tseries objects
Syntax
[h,range] = area(x,...) [h,range] = area(range,x,...) [h,range] = area(a,range,x,...)

Input arguments
a numeri E rndle to xes in whih the grph will e plottedY if not spei(edD the urrent xes will usedF range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF x tseries E snput tseries ojet whose olumns will e ploted s n re grphF

Output arguments
h numeri E rndle@sA to the re@sA plottedF range numeri E etully plotted dte rngeF

Options
dateformat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF datetick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF tight= true | false E wke the yExis tightF PVS

ime series ojets nd funtionsX arf ee help on uiltEin area funtion for other options villeF

Description Example

arf
Run autoregressive function on a tseries object
Syntax
X = arf(X,A,Z,RANGE,...)

Input arguments
X tseries E snput dt from whih initil ondition will e tkenF A numeri E etor of oe0ients of the utoregressive polynomilF Z numeri | tseries E ixogenous input or onstntn in the utoregressive proessF RANGE numeri | snf E hte rnge on whih the new time series oservtions will e omputedY RANGE does not inlude preEsmple initil onditionF Inf mens the entire possile rnge will e used @tking into ount the length of preEsmple initil ondition neededAF

Output arguments
X tseries E yutput dt with new oservtions reted y running n utoregressive proess desried y A nd ZF

Description
he utoregressive proess hs one of the following formsX
a1*x + a2*x(-1) + ... + an*x(-n) = z,

PVT

ime series ojets nd funtionsX bar or


a1*x + a2*x(+1) + ... + an*x(+n) = z,

depending on whether the rnge is inresing @running forwrd in timeAD or deresing @running kwrd in timeAF he oe0ients a1DF F F an re gthered in the A vetorD
A = [a1,a2,...,an].

Example
he following two lines rete n utoregressive proess onstruted from normlly distriuted residulsD

xt

a xt1 C t

rho = .8; X = tseries(1:2 ,@randn); X = arf(X,[1,-rho],X,2:2 );

bar
Bar graph for tseries objects
Syntax
[h,range] = bar(x,...) [h,range] = bar(range,x,...) [h,range] = bar(a,range,x,...)

Input arguments
a numeri E rndle to xes in whih the grph will e plottedY if not spei(edD the urrent xes will usedF PVU

ime series ojets nd funtionsX barcon range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF x tseries E snput tseries ojet whose olumns will e ploted s r grphF

Output arguments
h numeri E rndles to the rs plottedF range numeri E etully plotted dte rngeF

Options
dateformat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF datetick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF tight= true | false E wke the yExis tightF ee help on uiltEin bar funtion for other options villeF

Description Example

barcon
Contribution bar graph for tseries objects
Syntax
[H,Range] = barcon(X,...) [H,Range] = barcon(Range,X,...) [H,Range] = barcon(Ax,Range,X,...)

PVV

ime series ojets nd funtionsX bpass

Input arguments
Ax numeri E rndle to xes in whih the grph will e plottedY if not spei(edD the urrent xes will usedF Range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF X tseries E snput tseries ojet whose olumns will e ploted s ontriution r grphF

Output arguments
H numeri E rndle@sA to the rs plottedF Range numeri E etully plotted dte rngeF

Options
barWidth= numeri | HFV E idth of rs s perentge of the spe eh period oupies on the xExisF colorMap= numeri | get@gf@ADolorwp9A E golor mp used to (ll the ontriution rsF dateFormat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF dateTick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF evenlySpread= true | false E golors piked for the ontriution rs re evenly spred ross the olor mpF ordering= send9 | desend9 | preserve9 | numeri E yrdering of ontriutions with the sme sign withinin eh periodY preserve mens the originl order will e preservedF

Description Example

bpass
Band-pass lter
PVW

ime series ojets nd funtionsX bpass

Syntax
[X,T] = bpass(X,Band,Range,...)

Output arguments
X tseries E fndEpss (ltered tseries ojetF T tseries E istimted trend tseries ojetF

Input arguments
X tseries E snput tseries ojet tht will e (lteredF Range numeri | snf hte rnge on whih the dt will e (lteredF Band numeri E fnd of periodiities to e retined in the output dtD Band = [LOW,HIGH]F

Options
addTrend= true | false E edd the estimted liner time trend k to (ltered output series if band inludes snfF detrend= true | false E emove n estimted time trend from the dt efore (lteringF log= true | false E vogrithmise the dt efore (lteringD deElogrithmise fterwrdsF method= cf | hwfsf E ype of ndEpss (lterX ghristinoEpitzgerldD or hEwindowed frequenyEseletive (lterF unitRoot= true | false E essume unit root in the input dtF ee help on tseries/trend P340 for other options ville when detrend= is set to trueF

Description
ghristinoD vFtF nd FtFpitzgerld @PHHQAF he fnd ss pilterF snterntionl ionomi eviewD RR@PAD RQS!RTSF souiD eF 8 eF xoullez @PHHSAF e prequeny eletive pilter for hortEvength ime eriesF gomputtionl ionomisD PSD US!IHPF

PWH

ime series ojets nd funtionsX bwf

Example

bsxfunc
Standard BSXFUN implemented for tseries objects
Syntax
Z = bsxfun(Func,X,Y)

Input arguments
Func funtionhndle E puntion tht will e pplied to the input seriesD FUN(X,Y)F X tseries | numeri E snput time series or numeri rryF Y tseries | numeri E snput time series or numeri rryF

Output arguments
Z tseries E esult of Func(X,Y) with X ndGor Y expnded properly in singleton dimensionsF

Description
ee help on uiltEin bsxfun for more helpF

Example
e rete multivrite time series nd sutrt men from its individul olumnsF
x = tseries(1:1 ,rand(1 ,4)); xx = bsxfun(@minus,x,mean(x));

PWI

ime series ojets nd funtionsX bwf

bwf
Swap output arguments of the Butterworth lter with tunes
ee help on tseries/bwf P292 F

bwf
Butterworth lter with tunes
Syntax
[T,C,CutOff,Lambda] = bwf(X,Order) [T,C,CutOff,Lambda] = bwf(X,Order,Range,...)

Syntax with output arguments swapped


[T,C,CutOff,Lambda] = bwf2(X,Order) [T,C,CutOff,Lambda] = bwf2(X,Order,Range,...)

Input arguments
X tseries E snput tseries ojet tht will e (lteredF Order numeri E yrder of the futterworth (lterY note tht Order=2 reprodues the rodrikE resott (lter @hpfA nd Order=1 reprodues the lol liner (lter @llfAF Range numeri E hte nge on whih the input dt will e (lteredY Range n e InfD [startdata,Inf]D or [-Inf,enddate]Y if not spei(redD Inf @iFeF the entire ville nge of the input seriesA is usedF

Output arguments
T tseries E vowerEfrequeny @trendA omponentF C tseries E righerEfrequeny @ylilA omponentF CutOff numeri E gutEo' periodiityY periodiities ove the utEo' re ttriuted to trendsD periodiities elow the utEo' re ttriuted to gpsF PWP

ime series ojets nd funtionsX chowlin Lambda numeri E moothing prmeter tully usedY this output rgument is useful when the option CutOff= is used insted of Lambda=F

Options
CutOff= numeri | empty E gutEo' periodiity in periods @depending on the time series frequenyAY this option n e spei(ed insted of Lambda=Y the smoothing prmeter will e then determined sed on the utEo' periodiityF CutOffYear= numeri | empty E gutEo' periodiity in yersY this option n e spei(ed insted of Lambda=Y the smoothing prmeter will e then determined sed on the utEo' periodiityF
infoSet= 1 | 2 E snformtion set ssumption used in the (lterX 1 runs oneEsided (lterD 2 runs twoEsided (lterF

Lambda= numeri | (1 freq)Order E moothing prmeterY needs to e spei(ed for tseries ojets with indeterminte frequenyF level= tseries E ime series with soft nd hrd tunes on the level of the trendF change= tseries E ime series with soft nd hrd tunes on the hnge in the trendF log= true | false E vogrithmise the dt efore (lteringD deElogrithmise fterwrdsF

Description Example

chowlin
Chow-Lin distribution of low-frequency observations over higher-frequency periods
Syntax
[Y2,B,RHO,U1,U2] = chowlin(Y1,X2) [Y2,B,RHO,U1,U2] = chowlin(Y1,X2,range,...)

PWQ

ime series ojets nd funtionsX convert

Input arguments
Y1 tseries E vowEfrequeny input tseries ojet tht will e distriuted over higherEfrequeny oservtionsF X2 tseries E series ojet with regressors used to distriute the input dtF range numeri E vowEfrequeny dte rnge on whih the distriution will e omputedF

Output arguments
Y2 tseries E yutput dt distriuted with higher frequenyF B numeri E etor of regression oe0ientsF RHO numeri E etully used utoorreltion oe0ient in the residulsF U1 tseries E vowEfrequeny regression residulsF U2 tseries E righerEfrequeny regression residulsF

Options
constant= true | false E snlude onstnt term in the regressionF log= true | false E vogrithmise the dt efore distriutionD deElogrithmise fterwrdsF ngrid= numeri | 2 E xumer of grid serh points for (nding utoorreltion oe0ient for higherEfrequeny residulsF rho= estimate | positive | negative | numeri E row to determine the utoorE reltion oe0ient for higherEfrequeny residulsF timeTrend= true | false E snlude time trend in the regressionF

Description
ghowDqFgFD nd eFvin @IWUIAF fest viner nised snterpoltionD histriution nd ixtrpoltion of ime eries y elted imes eriesF eview of ionomis nd ttistisD SQD ppF QUPEUSF ee lso eppendix P in oertsonD tFgFD nd iFFllmn @IWWWAF etor eutoregressionsX poreE sting nd elityF pf etlnt ionomi eviewD Ist urter IWWWD ppFREIUF

Example

PWR

ime series ojets nd funtionsX convert

convert
Convert tseries object to a dierent frequency
Syntax
Y = convert(X,NewFreq) Y = convert(X,NewFreq,Range,...)

Input arguments
X tseries E snput tseries ojet tht will e onverted to new frequenyD freqD ggregting or intrpolting the dtF NewFreq numeri | hr E xew frequeny to whih the input dt will e onvertedX 1 or A for nnulD 2 or H for hlfEyerlyD 4 or Q for qurterlyD 6 or B for iEmonthlyD nd 12 or M for monthlyF Range numeri E hte rnge on whih the input dt will e onvertedF

Output arguments
Y tseries E yutput tseries reted y onverting X to the new frequenyF

Options
ignoreNaN= true | false E ixlude xxs from greggtionF missing= numeri | NaN | last E eple missing oservtions with this vlueF

Options for high- to low-frequency conversion (aggregation)


method= funtionhndle | first | last | @mean E wethod tht will e used to ggregte the high frequeny dtF select= numeri | Inf E elet only these highEfrequeny oservtions within eh lowE frequeny periodY snf mens ll oservtions will e usedF

PWS

ime series ojets nd funtionsX cumsumk

Options for low- to high-frequency conversion (interpolation)


method= hr | cubic | quadsum | quadavg E snterpoltion methodY ny option ville in the uiltEin interp1 funtion n e usedF position= centre | start | end E osition of the lowEfrequeny dte gridF

Description
he funtion hndle tht you pss in through the method9 option when you ggregte the dt @onvert higher frequeny to lower frequenyA should ehve like the uiltEin funtions meanD sum etF sn other wordsD it is expeted to ept two input rgumentsX the dt to e ggregtedD the dimension long whih the ggregtion is lultedF he funtion will e lled with the seond input rgument set to ID s the dt re proessed en lok olumnwiseF sf this ll filsD convert will ttempt to ll the funtion with just one input rgumentD the dtD ut this is not sfe option under some irumstnes sine dimension mismth my ourF

Example

cumsumk
Cumulative sum with a k-period leap
Syntax
Y Y Y Y = = = = cumsumk(X,K,RHO,RANGE) cumsumk(X,K,RHO) cumsumk(X,K) cumsumk(X)

Input arguments
X tseries E snput dtF PWT

ime series ojets nd funtionsX cumsumk K numeri E xumer of periods tht will e lept the umultive sum will e tkenY if not spei(edD K is hosen to mth the frequeny of the input dt @eFgF K = -4 for qurterly dtAD or K = -1 for indeterminte frequenyF RHO numeri E eutoregressive oe0ientY if not spei(edD RHO = 1F RANGE numeri E nge on whih the umultive sum will e omputed nd the output series returnedF

Output arguments
Y tseries E yutput dt onstruted s desried elowF

Options
log= true | false E vogrithmise the input dt eforeD nd deElogrithmise the output dt k fterD running x12F

Description
sf K < D the (rst K oservtions in the output series Y re opied from XD nd the new oservtions re given reursively y
Y{t} = RHO*Y{t-K} + X{t}.

sf K > D the lst K oservtions in the output series Y re opied from XD nd the new oservtions re given reursively y
Y{t} = RHO*Y{t+K} + X{t},

going kwrds in timeF sf K == D the input dt re returnedF

Example
gonstrut rndom dt with sesonl ptternD nd run IP to sesonlly djust these seriesF

PWU

ime series ojets nd funtionsX destdise


x = tseries(qq(199 ,1):qq(2 2 ,4),@randn); x1 = cumsumk(x,-4,1); x2 = cumsumk(x,-4, .7); x1sa = x12(x1); x2sa = x12(x2);

he new series x1 will e unitEroot proess while x2 will e sttionryF xote tht the ommnd on the seond line ould e repled with x1 = cumsumk(x)F

DAILY
Calendar view of a daily tseries object
Syntax
daily(X)

Input arguments
X tseries E series ojet with indeterminte frequeny whose dte tiks will e interpreted s wtl seril dte numersF

Description Example

destdise
Destandardise tseries object by applying specied standard deviation and mean to it
Syntax
X = destdise(X,XMean,XStd)

PWV

ime series ojets nd funtionsX detrend

Input arguments
X tseries E snput tseries ojetF XMean numeri E wen tht will e dded the dtF XStd numeri E tndrd devition tht will e dded to the dtF

Output arguments
X tseries E hestndrdised output dtF

Description Example

detrend
Remove a linear time trend
Syntax
X = detrend(X) X = detrend(X,Range)

Input arguments
X tseries E snput time seriesF Range numeri | Inf E he dte rnge on whih the trend will e omputedY Inf mens the entire rnge ville will e usedF

Output arguments
x tseries E yutput time series with trend removedF

PWW

ime series ojets nd funtionsX double

Options
ee tseries/trend P340 for options villeF

Description Example

di
First dierence
Syntax
X = diff(X) X = diff(X,K)

Input arguments
X tseries E snput tseries ojetF K numeri E xumer of periods over whih the (rst di'erene will e omputedY Y = X X{K}F xote tht K must e negtive numer for the usul kwrd di'ereningF sf not spei(edD K will e set to -1F

Output arguments
X tseries E pirst di'erene of the input dtF

Description Example

QHH

ime series ojets nd funtionsX doubledata

double
Return tseries observations as double-precision numeric array
Syntax
y = double(x)

Input arguments
x tseries E series ojet whose oservtions will e returned s douleEpreision numeri rryF

Output arguments
y numeri E houleEpreision numeri rry with the input tseries oservtions in olumnsF

Description Example

doubledata
Convert tseries observations to double precision
Syntax
x = doubledata(x)

Input arguments
x tseries E series ojet whose oservtions will e e onverted to doule preisionF

Output arguments
y numeri E series ojet with douleEpreision oservtionsF QHI

ime series ojets nd funtionsX enddate

Description Example

empty
Empty tseries object preserving its size in 2nd and higher dimensions
Syntax
x = empty(x)

Input arguments
x tseries E series ojet tht will e emptiedF

Output arguments
x tseries E impty tseries ojet with the Pnd nd higher dimensions the sme size s the input tseries ojetD nd omments preservedF

Description Example

enddate
Date of the last available observation in a tseries object
Syntax
d = enddate(x)

QHP

ime series ojets nd funtionsX errorbar

Input arguments
x tseries E series ojetF

Output arguments
d numeri E ss seril dte numer representing the dte of the lst oservtion ville in the input tseriesF

Description
he startdate funtion is equivlent to lling
get(x,endDate)

Example

errorbar
Line plot with error bars
Syntax
[LL,EE,Range] [LL,EE,Range] [LL,EE,Range] [LL,EE,Range] [LL,EE,Range] [LL,EE,Range] = = = = = = errorbar(X,B,...) errorbar(Range,X,B,...) errorbar(AA,Range,X,B,...) errorbar(X,Lo,Hi,...) errorbar(Range,X,Lo,Hi,...) errorbar(AA,Range,X,Lo,Hi,...)

Input arguments
AA numeri E rndle to xes in whih the grph will e plottedY if not spei(edD the urrent xes will usedF

QHQ

ime series ojets nd funtionsX ews Range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF X tseries E series ojet whose dt will e plotted s line grphF B tseries E idth of the nds tht will e plotted round the linesF Lo tseries E idth of the nd elow the lineF Hi tseries E idth of the nd ove the lineF

Output arguments
LL numeri E rndles to lines plottedF EE numeri E rndles to error rs plottedF Range numeri E etully plotted dte rngeF

Options
dateformat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF datetick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF relative= true | false E sf trueD the dt for the lower nd upper ounds re reltive to the entreD iFeF the ounds will e dded to the entre @in this seD Lo must e negtive numers nd Hi must e positive numersAF sf falseD the ounds re solute dt @in this se Lo must e lower thn XD nd Hi must e higher thn XAF ee help on uiltEin plot funtion for other options villeF

ews
Exponential smoothing
Syntax
X = expsmooth(X,BETA,...)

QHR

ime series ojets nd funtionsX fft

Input arguments
X tseries E snput time seriesF Beta numeri E ixponentil ftorF

Output arguments
X tseries E ixponentilly smoothed seriesF

Options
init= numeri | NaN E edd this vlue efore the (rst oservtion to initilise the smoothE ingF log= true | false E vogrithmise the dt efore (lteringD deElogrithmise fterwrdsF

Description Examples

t
Discrete Fourier transform of tseries object
Syntax
[y,range,freq,per] = fft(x) [y,range,freq,per] = fft(x,range,...)

Input arguments
x tseries E snput tseries ojet tht will e trnsformedF range numeri | snf E hte rngeF

QHS

ime series ojets nd funtionsX freq

Output arguments
y numeri E pourier trnsform with dt orgnised in olumnsF range numeri E etully used dte rngeF freq numeri E prequenies orresponding to pp vetor elementsF per numeri E eriodiities orresponding to pp vetor elementsF

Options
full= true | false E eturn pourier trnsform on the whole intervl HDPBpiY if flse only the intervl HDpi is returnedF

Description Example
}

freq
Frequency of a tseries object
Syntax
f = freq(x)

Input arguments
x tseries E series ojetF

Output arguments
f H | I | P | R | T | IP E prequeny of oservtions in the input tseries ojet @f is the numer of periods within yerAF

QHT

ime series ojets nd funtionsX get

Description
he freq funtion is equivlent to lling
get(x,freq)

Example

get
Query tseries object property
Syntax
Value = get(x,Query) [Value,Value,...] = get(x,Query,Query,...)

Input arguments
x model E series ojetF Query hr E xme of the queried propertyF

Output arguments
Value F F F E lue of the queried propertyF

Valid queries on tseries objects


end= eturns numeri the dte of the lst oservtionF freq= eturns numeri the frequeny @periodiityA of the time seriesF nanEnd= eturns numeri the lst dte t whih oservtions re ville in ll olumnsY for slr tseriesD this query lwys returns the sme s endF nanRange= eturns numeri the dte rnge from nanstart to nanendY for slr time seriesD this query lwys returns the sme s rangeF QHU

ime series ojets nd funtionsX hpf nanStart= eturns numeri the (rst dte t whih oservtions re ville in ll olumnsY for slr tseriesD this query lwys returns the sme s startF range= eturns numeri the dte rnge from the (rst oservtion to the lst oservtionF start= eturns numeri the dte of the (rst oservtionF

Description

hpdi
Highest probability density interval
Syntax
int = hpdi(x,prob)

Input arguments
x tseries E snput dt with rndom drws in eh periodF prob numeri E erent overge of the omputed intervlD etween H nd IHHF

Output arguments
int tseries E yutput tseries ojet with two olumnsD iFeF lower ounds nd upper ounds for eh periodF

Description Example

hpf
Hodrick-Prescott lter with tunes (aka LRX lter)
QHV

ime series ojets nd funtionsX hpf

Syntax
[T,C,CutOff,Lambda] = hpf(X) [T,C,CutOff,Lambda] = hpf(X,Range,...)

Syntax with output arguments swapped


[C,T,CutOff,Lambda] = hpf2(X) [C,T,CutOff,Lambda] = hpf2(X,Range,...)

Input arguments
X tseries E snput tseries ojet tht will e (lteredF Range numeri E hte nge on whih the input dt will e (lteredY Range n e InfD [startdata,Inf]D or [-Inf,enddate]Y if not spei(redD Inf @iFeF the entire ville nge of the input seriesA is usedF

Output arguments
T tseries E vowEfrequeny @trendA omponentF C tseries E righEfrequeny @ylil or gpA omponentF CutOff numeri E gutEo' periodiityY periodiities ove the utEo' re ttriuted to trendsD periodiities elow the utEo' re ttriuted to gpsF Lambda numeri E moothing prmeter tully usedY this output rgument is useful when the option cutoff= is used insted of lambda=F

Options
cutoff= numeri | empty E gutEo' periodiity in periods @depending on the time series frequenyAY this option n e spei(ed insted of lambda=Y the smoothing prmeter will e then determined sed on the utEo' periodiityF cutoffYear= numeri | empty E gutEo' periodiity in yersY this option n e spei(ed insted of lambda=Y the smoothing prmeter will e then determined sed on the utEo' periodiityF

QHW

ime series ojets nd funtionsX hpf gamma= numeri | tseries | I E eight or weights on the devitions of the trend from oservtionsY it only mkes sense to use this option to mke the signlEtoEnoise rtio timeE vryingY see the optimistion prolem elowF
infoSet= 1 | 2 E snformtion set ssumption used in the (lterX 1 runs oneEsided (lterD 2 runs twoEsided (lterF

lambda= numeri | 1 freq2 E moothing prmeterY needs to e spei(ed for tseries ojets with indeterminte frequenyF level= tseries E ime series with hrd tunes nd soft tunes on the level of the trendF change= tseries E ime series with hrd tunes nd soft tunes on the hnge in the trendF log= true | false E vogrithmise the dt efore (lteringD deElogrithmise fterwrdsF

Description

The underlying optimisation problem


he funtion hpf solves onstrined optimistion prolem desried y the following vgrngin

P  @" P yt ytA C yt " yt A C t @" | {z } Plain HP with time-varying signal-to-noise ratio P ut @" P yt btA C P !t @" P y t dt A ; C | yt at A C vt @" yt ct A C t @" {z } |Soft growth {z tunes} |Hard level {z tunes} |Hard growth {z tunes} Soft level tunes
min y  ;! ;
t t t

where

is the (rstEdi'erene opertorY

 is @slrA smoothing prmeterY yt re userEsupplied oservtionsY yt is the (tted trendY t re userEsupplied weights to modify the si signlEtoEnoise rtio over time @the defult setting is t AD entered in the option gamma=Y

"

aI

at nd ut re soft tunes on the level of the trend nd the weights ssoited with these soft level tunesD respetivelyD entered together s omplex numers in the option level=Y QIH

ime series ojets nd funtionsX hpf bt nd vt re soft tunes on the hnge in the level of the trend nd the weights ssoited with these soft growth tunesD respetivelyD entered together s omplex numers in the option growth=Y ct re hrd tunes on the level of the trendD entered s rel numers in the option level=Y dt re hrd tunes on the hnge in the level of the trendD entered s rel numers in the option growth=Y !t re lgnge multipliers on the hrd level tunes @note tht these re omputed s prt of the optimistion prolemD not entered y the userAY t re lgnge multipliers on the hrd growth tunes @note tht these re omputed s prt of the optimistion prolemD not entered y the userAF ih of the summtions in the ove vgrngin goes over those periods in whih the respetive rketed terms re de(ned @oservtions or tunes existAF ou n omine ny numer of ny tunes in one run of hpfD inluding outEofEsmple tunes @see elowAF

How to enter the tunes


he hrd tunes nd soft tunes on the level of the trend re entered s time series through the option level=F he hrd tunes nd soft tunes on the hnge in the trend re entered s time series through the option change=F sn the tseries ojets entered through level= ndGor change=D you n omine ny numer of hrd nd soft tuneF sn eh prtiulr periodD you n oviously speify only hrd tune or only soft tuneF ou n think of hrd tunes s speil se of soft tunes with in(nitely lrge weightsF e hrd tune is spei(ed s plin rel numer @iFeF numer with zero omplex prtAF e soft tune must e entered s omplex numer whose rel prt spei(es the tune itselfD nd the imginry prt spei(es the inverse of the weightD iFeF =vt or =ut D on tht tune in tht periodF xote tht if the weight goes to in(nityD the imginry prt eomes zero nd the tune eomes hrd tuneF

Out-of-sample tunes
unes n e imposed lso t dtes efore the (rst oservtion of the input seriesD or fter the lst oservtionF sn other wordsD the time series in level= ndGor growth= n hve more extended nge @t either sideA thn the (ltered input seriesF

QII

ime series ojets nd funtionsX interp

Default smoothing parameters


sf the user does not speify the smoothing prmeter using the lambda= optionD defult vlue is usedF he defult vlue is sed on ommon prtie nd n e lulted using the dte frequeny of the input time series s  f 2 D where f is the frequeny @yerlyaID hlfEyerlyaPD qurterlyaRD iEmonthlyaTD monthlyaIPAF his gives the following defult vluesX

a IHH

IHH for yerly time series @utEo' periodiity of IWFUW yersAY RHH for hlfEyerly time series @utEo' periodiity of IRFHP yersAY IDTHH for qurterly time series @utEo' periodiity of WFWP yersAY QDTHH for iEmonthly time series @utEo' periodiity of VFII yersAY IRDRHH for monthly time series @utEo' periodiity of SFUQ yersAF xote tht there is no defult vlue for dt with indeterminte or dily frequenyX for these types of time seriesD you must lwys use the option lmdaF

Example

hpf2
Swap output arguments of the Hodrick-Prescott lter with tunes
ee help on tseries/hpf P308 F

interp
Interpolate missing observations
Syntax
X = interp(X,RANGE,...)

QIP

ime series ojets nd funtionsX length

Input arguments
X tseries E snput time seriesF RANGE tseries E hte rnge on whih ny missingD iFeF xxD oservtions will e interpoltedF

Output arguments
x tseries E series ojet with the missing oservtions interpoltedF

Options
method= hr | cubic E eny vlid method epted y the uiltEin interp1 funtionF

Description Example

length
Length of tseries object
Syntax
n = length(x)

Input arguments
x tseries series ojetF

Output arguments
n numeri E xumer of periods from the (rst to the lst ville oservtion in the input tseries ojetF

QIQ

ime series ojets nd funtionsX llf

Description Example

llf
Local level lter (aka random walk plus white noise) with tunes
Syntax
[T,C,CutOff,Lambda] = llf(X) [T,C,CutOff,Lambda] = llf(X,Range,...)

Syntax with output arguments swapped


[C,T,CutOff,Lambda] = llf2(X) [C,T,CutOff,Lambda] = llf2(X,Range,...)

Input arguments
X tseries E snput tseries ojet tht will e (lteredF Range numeri E hte rnge on whih the input dt will e (lteredY Range n e InfD [startdata,Inf]D or [-Inf,enddate]Y if not spei(redD Inf @iFeF the entire ville rnge of the input seriesA is usedF

Output arguments
T tseries E vowEfrequeny @trendA omponentF C tseries E righEfrequeny @ylil or gpA omponentF CutOff numeri E gutEo' periodiityY periodiities ove the utEo' re ttriuted to trendsD periodiities elow the utEo' re ttriuted to gpsF Lambda numeri E moothing prmeter tully usedY this output rgument is useful when the option cutoff= is used insted of lambda=F

QIR

ime series ojets nd funtionsX llf

Options
cutoff= numeri | empty E gutEo' periodiity in periods @depending on the time series frequenyAY this option n e spei(ed insted of lambda=Y the smoothing prmeter will e then determined sed on the utEo' periodiityF cutoffYear= numeri | empty E gutEo' periodiity in yersY this option n e spei(ed insted of lambda=Y the smoothing prmeter will e then determined sed on the utEo' periodiityF gamma= numeri | tseries | I E eight or weights on the devitions of the trend from oservtionsY it only mkes sense to use this option to mke the signlEtoEnoise rtio timeE vryingY see the optimistion prolem elowF drift= numeri | tseries | E heterministi drift in the trendF

infoSet= 1 | 2 E snformtion set ssumption used in the (lterX 1 runs oneEsided (lterD 2 runs twoEsided (lterF

lambda= numeri | 1 freq E moothing prmeterY needs to e spei(ed for tseries ojets with indeterminte frequenyF level= tseries E ime series with soft nd hrd tunes on the level of the trendF change= tseries E ime series with soft nd hrd tunes on the hnge in the trendF log= true | false E vogrithmise the dt efore (lteringD deElogrithmise fterwrdsF

Description

The underlying optimisation problem


he funtion llf solves onstrined optimistion prolem desried y the following vgrngin

P  @" P yt ytA yt t A C t @" C | {z } Plain local level lter with time-varying signal-to-noise ratio P ut @" P yt btA C P !t @" P y t dt A ; C | yt at A C vt @" yt ct A C t @" {z } |Soft growth {z tunes} |Hard level {z tunes} |Hard growth {z tunes} Soft level tunes
min y  ;! ;
t t

where

is the (rstEdi'erene opertorY


QIS

ime series ojets nd funtionsX llf  is @slrA smoothing prmeterY yt re userEsupplied oservtionsY yt is the (tted trendY t is userEsupplied driftD either onstnt or timeEvryingD enetered in the option drift=Y t re userEsupplied weights to modify the si signlEtoEnoise rtio over time @the defult setting is t AD entered in the option gamma=Y

"

aI

at nd ut re soft tunes on the level of the trend nd the weights ssoited with these soft level tunesD respetivelyD entered together s omplex numers in the option level=Y bt nd vt re soft tunes on the hnge in the level of the trend nd the weights ssoited with these soft growth tunesD respetivelyD entered together s omplex numers in the option growth=Y ct re hrd tunes on the level of the trendD entered s rel numers in the option level=Y dt re hrd tunes on the hnge in the level of the trendD entered s rel numers in the option growth=Y !t re lgrnge multipliers on the hrd level tunes @note tht these re omputed s prt of the optimistion prolemD not entered y the userAY t re lgrnge multipliers on the hrd growth tunes @note tht these re omputed s prt of the optimistion prolemD not entered y the userAF ih of the summtions in the ove vgrngin goes over those periods in whih the respetive rketed terms re de(ned @oservtions or tunes existAF ou n omine ny numer of ny tunes in one run of llfD inluding outEofEsmple tunes @see elowAF

How to enter the tunes


he soft nd hrd tunes on the level of the trend re entered s time series through the option level=F he soft nd hrd tunes on the hnge in the trend re entered s time series through the option change=F sn the tseries ojets entered through level= ndGor change=D you n omine ny numer of hrd nd soft tuneF sn eh prtiulr periodD you n oviously speify only hrd tune or only soft tuneF ou n think of hrd tunes s speil se of soft tunes with in(nitely lrge weightsF e hrd tune is spei(ed s plin rel numer @iFeF numer with zero omplex prtAF

QIT

ime series ojets nd funtionsX moving e soft tune must e entered s omplex numer whose rel prt spei(es the tune itselfD nd the imginry prt spei(es the inverse of the weightD iFeF =vt or =ut D on tht tune in tht periodF xote tht if the weight goes to in(nityD the imginry prt eomes zero nd the tune eomes hrd tuneF

Out-of-sample tunes
unes n e imposed lso t dtes efore the (rst oservtion of the input seriesD or fter the lst oservtionF sn other wordsD the time series in level= ndGor growth= n hve more extended rnge @t either sideA thn the (ltered input seriesF

Default smoothing parameters


sf the user does not speify the smoothing prmeter using the lambda= optionD defult vlue is usedF he defult vlue is sed on ommon prtie nd n e lulted using the dte frequeny of the input time series s \lambda = 1 \cdot fD where f is the frequeny @yerlyaID hlfEyerlyaPD qurterlyaRD iEmonthlyaTD monthlyaIPAF his gives the following defult vluesX IH for yerly time series @utEo' periodiity of IWFUW yersAY PH for hlfEyerly time series @utEo' periodiity of IRFHP yersAY RH for qurterly time series @utEo' periodiity of WFWP yersAY TH for iEmonthly time series @utEo' periodiity of VFII yersAY IPH for monthly time series @utEo' periodiity of SFUQ yersAF xote tht there is no defult vlue for dt with indeterminte or dily frequenyX for these types of time seriesD you must lwys use the option lmdaF

Example

llf2
Swap output arguments of the local linear trend lter with tunes
ee help on tseries/llf P314 F

QIU

ime series ojets nd funtionsX ndims

moving
Apply function to moving window of observations
Syntax
X = moving(X) X = moving(X,Range,...)

Input arguments
X tseries E series ojet on whose oservtions the funtion will e ppliedF Range numeri | snf E nge on whih the moving funtion will e ppliedY Inf mens the entire rnge on whih the time series is de(nedF

Output arguments
X tseries E yutput time seriesF

Options
function= funtionhndle | @mean E puntion to e pplied to moving window of oservtionsF window= numeri | Inf E he window of oservtions where H mens the urrent dteD EI mens one period lgD etF snf mens tht the lst n oservtions @inluding the urrent oneA re usedD where n is the frequeny of the input dtF

Description Example

ndims
Number of dimensions in tseries object data

QIV

ime series ojets nd funtionsX normalise

Syntax
N = ndims(X)

Input arguments
X tseries E snput tseries ojetF

Output arguments
N numeri E xumer of dimensions in the input ojetF

Description Example

normalise
Normalise (or rebase) data to particular date
Syntax
x = normalise(x) x = normalise(x,normdate,...)

Input arguments
x tseries E snput tseries ojet tht will e normlisedF normdate numeri | strt9 | end9 | nnstrt9 | nnend9 E hte reltive to whih the input dt will e normlisedY if not spei(edD nnstrt9 @the (rst dte for whih ll olumns hve n oservtionA will e usedF

Output arguments
x tseries E xormlised tseries ojetF QIW

ime series ojets nd funtionsX pct

Options
mode= dd9 | mult9 E edditive or multiplitive normlistionF hesription aaaaaaaaaaaa

Example

pct
Percent rate of change
Syntax
X = pct(X) X = pct(X,K,...)

Input arguments
X tseries E snput tseries ojetF K numeri E ime shift over whih the rte of hnge will e omputedD iFeF etween time t nd tCkY if not spei(ed K will e set to -1F

Output arguments
X tseries E erentge rte of hnge in the input dtF

Options
outputFreq= 1 | 2 | 4 | 6 | 12 | Inf E gonvert the rte of hnge to the requested dte frequenyY Inf mens plin rte of hnge with no onversionF

Description Example
sn this exmpleD x is monthly time seriesF he following ommnd omputes the nnulised rte of hnge etween month t nd tEIX QPH

ime series ojets nd funtionsX plot


pct(x,-1,outputfreq=,1)

while the following line omputes the nnulised rte of hnge etween month t nd tEQX
pct(x,-3,outputFreq=,1)

permute
Permute dimensions of a tseries object
Syntax
X = permute(X,Order)

Input arguments
X tseries E series ojet whose dimensionsD exept the (rst @timeA dimensionD will e rerrnged in the order spei(ed y the vetor orderF Order numeri E xew order of dimensionsY euse the time dimension nnot e permutedD order(1) must e lwys 1F

Output arguments
X tseries E yutput tseries ojet with its dimensions permutedF

Description Example

plot
Line graph for tseries objects
QPI

ime series ojets nd funtionsX plotcmp

Syntax
[h,range] = plot(x,...) [h,range] = plot(range,x,...) [h,range] = plot(a,range,x,...)

Input arguments
a numeri E rndle to xes in whih the grph will e plottedY if not spei(edD the urrent xes will usedF range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF x tseries E snput tseries ojet whose olumns will e ploted s line grphF

Output arguments
h numeri E rndles to the lines plottedF range numeri E etully plotted dte rngeF

Options
dateFormat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF datePosition= entre9 | end9 | strt9 E osition of eh dte point within given period spnF datetick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF tight= true | false E wke the yExis tightF ee help on uiltEin plot funtion for other options villeF

Description Example

QPP

ime series ojets nd funtionsX plotcmp

plotcmp
Comparison graph for two time series
Syntax
[Ax,Lhs,Rhs] = plotcmp(X,...) [Ax,Lhs,Rhs] = plotcmp(Range,X,...)

Input arguments
Range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF X tseries E series ojet with two or more olumnsY the di'erene @etween the seond nd the (rst olumn @or ny other liner omintion of its olumns spei(ed through the option compare=A will e displyed s n r re or r grphF

Output arguments
Ax numeri E rndles to the vr nd r xesF Lhs numeri E rndles to the two originl linesF Rhs numeri E rndles to the re or r di'erene grphF

Options
compare= numeri | [-1;1] E viner omintion of the oservtions tht will e plotted in the r grphY [-1;1] means a difference between the second series and the first series,{XDP}E{XDI}F cmpColor= numeri | [1, .75, .75] E golor tht will e used to plot the re or r di'erene @omprisonA grphF cmpPlotFunc= @area | @bar E puntion tht will e used to plot the di'erene @ompriE sionA dt on the rF ee help on tseries/plotyy P325 for other options villeF

QPQ

ime series ojets nd funtionsX plotpred

Description Example

plotpred
Plot Kalman lter predictions
Syntax
[H1,H2,H3] = plotpred(X,Y,...) [H1,H2,H3] = plotpred(Ax,X,Y,...) [H1,H2,H3] = plotpred(Ax,Range,X,Y,...)

Input arguments
X tseries E snput dt with time series oservtionsF Y tseries E snput dt with preditions lulted in ulmn (lter run with n ahead= optionF Ax numeri E rndle to xes ojet in whih the dt will e plottedF Range numeri | snf E hte rnge on whih the input dt will e plottedF

Output arguments
H1 numeri E rndles to line ojet showing the time series oservtions @the (rst olumnD XD in the input dtAF H2 numeri E rndles to line ojets showing the ulmn (lter preditions @the seond nd further olumnsD YD in the input dtAF H3 numeri E rndles to oneEpoint line ojets displying mrker t the strt of eh lineF

Options
connect= true | false E gonnet the predition linesD YD with the orresponding oserE vtion in XF QPR

ime series ojets nd funtionsX plotyy firstMarker= none | hr E ype of mrker displyed t the strt of eh predition lineF showNaNLines= true | false E how or remove lines with whose strting points re xx @missing oservtionsAF ee help on plot P321 nd on the uiltEin funtion plot for options villeF

Description Example

plotyy
Line plot function with LHS and RHS axes for time series
Syntax
[Ax,Lhs,Rhs,Range] = plotyy(X,Y,...) [Ax,Lhs,Rhs,Range] = plotyy(Range,X,Y,...)

Input arguments
Range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF X tseries E snput tseries ojet whose olumns will e plotted nd lelled on the vrF Y tseries E snput tseries ojet whose olumns will e plotted nd lelled on the rF

Output arguments
Ax numeri E rndles to the vr nd r xesF Lhs numeri E rndles to series plotted on the vr xisF Rhs numeri E rndles to series plotted on the r xisF Range numeri E etully plotted dte rngeF QPS

ime series ojets nd funtionsX redate

Options
conincident= true | false E wke the vr nd r yExis grids oinidentF dateFormat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF dateTick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF freqLetters= hr | rfw9 E pive letters to represent the (ve dte frequenies @yerlyD hlfEyerlyD qurterlyD iEmonthlyD nd monthlyAF lhsPlotFunc= dre | dr | dplot | dstem E puntion tht will e used to plot the vr dtF lhsTight= true | false E wke the vr yExis tightF rhsPlotFunc= dre | dr | dplot | dstem E puntion tht will e used to plot the r dtF rhsTight= true | false E wke the r yExis tightF

Description Example

redate
Change time dimension of a tseries object
Syntax
X = redate(X,oldDate,newDate)

Input arguments
X tseries E snput tseries ojetF OldDate numeri E fse dte tht will e onverted to new dteF NewDate numeri E e new dte to whih the se dte oldDate will e hngedY NewDate need not e the sme frequeny s OldDateF QPT

ime series ojets nd funtionsX regress

Output arguments
X tseries E yutput tseries ojet with identil dt s the input tseries ojetD ut with its time dimension hngedF

Description Example

regress
Ordinary or weighted least-square regression
Syntax
[B,BStd,E,EStd,YFit,Range,BCov] = regress(Y,X) [B,BStd,E,EStd,YFit,Range,BCov] = regress(Y,X,Range,...)

Input arguments
Y tseries E series ojet with independent @vrA vrilesF X tseries E series ojet with regressors @rA vrilesF Range numeri E hte rnge on whih the regression will e runY if not spei(edD the entire rnge ville will e usedF

Output arguments
B numeri E etor of estimted regression oe0ientsF BStd numeri E etor of std errors of the estimtesF E tseries E series ojet with the regression residulsF EStd numeri E istimte of the std devition of the regression residulsF YFit tseries E series ojet with (tted vr vrilesF Range numeri E he tully used dte rngeF bBCov numeri E govrine mtrix of the oe0ient estimtesF QPU

ime series ojets nd funtionsX reshape

Options
constant= true | false E snlude onstnt vetor in the regressionY if true the onstnt will e pled lst in the mtrix of regressorsF weighting= tseries | empty E series ojet with weights on the oservtions in the individul periodsF

Description
his funtion lls the uiltEin lscov funtionF

Example

reshape
Reshape size of time series in 2nd and higher dimensions
Syntax
x = reshape(x,newsize)

Input arguments
x tseries E series ojet whose dt will e reshped in Pnd ndGor higher dimensionsF newsize numeri E xew size of the tseries ojet dtY the (rst dimension @timeA must e preservedF

Output arguments
x tseries E eshped tseries ojetF

QPV

ime series ojets nd funtionsX rmse

Description Example
}

resize
Clip tseries object down to a specied date range
Syntax
X = resize(X,Range)

Input arguments
X tseries E snput tseries ojet whose dte rnge will e lipped downF Range numeri E xew dte rnge to whih the input tseries ojet will e resizedY the rnge n e spei(ed s [startDate,endDate] vetor where -Inf nd Inf n e used for the dtesF

Output arguments
X tseries E yutput tseries ojet with its dte rnge lipped down to RangeF

Description Example

rmse
Compute RMSE for given observations and predictions

QPW

ime series ojets nd funtionsX round

Syntax
[Rmse,Pe] = rmse(Obs,Pred) [Rmse,Pe] = rmse(Obs,Pred,Range,...)

Input arguments
Obs tseries E snput dt with oservtionsF Pred tseries E snput dt with preditions @ di'erent predition horizon in eh olumnAY Pred is typilly the outome of the ulmn (lterD model/filter P93 or VAR/filter P207 D lled with the option ahead=F Range numeri | Inf E hte rnge on whih the wis will e evlutedY Inf mens the entire possile rnge villeF

Output arguments
Rmse numeri E xumeri rry with wis for eh olumn of PredF Pe tseries E redition errorsD iFeF the di'erene Obs - Pred evluted within RangeF

Description Example

round
Round tseries data to specied number of decimals
Syntax
X = round(X) X = round(X,Dec)

QQH

ime series ojets nd funtionsX scatter

Input arguments
X tseries E series ojet whose dt will e roundedF Dec numeri E xumer of deimls to whih the tseries dt will e roundedY if not spei(edD the dt re rounded to nerest integerF

Output arguments
X tseries E ounded tseries ojetF

Description
he numer of deimlsD to whih the tseries dt will e roundedD n e positiveD zeroD or negtiveF

Example

scatter
Scatter graph for tseries objects
Syntax
[H,Range] = scatter([X,Y],...) [H,Range] = scatter(Range,[X,Y],...) [H,Range] = scatter(Ax,Range,[X,Y],...)

Input arguments
ax numeri E rndle to xes in whih the grph will e plottedY if not spei(edD the urrent xes will usedF Range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF XD Y tseries E wo slr tseries ojets plotted on the xExis nd the yExisD respetivelyF

QQI

ime series ojets nd funtionsX single

Output arguments
H numeri E rndles to the lines plottedF Range numeri E etully plotted dte rngeF

Options
dateformat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF datetick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF ee help on uiltEin plot funtion for other options villeF

Description Example

single
Return tseries observations as single-precision numeric array
Syntax
y = single(x)

Input arguments
x tseries E series ojet whose oservtions will e returned s singleEpreision numeri rryF

Output arguments
y numeri E ingleEpreision numeri rry with the input tseries oservtions in olumnsF

QQP

ime series ojets nd funtionsX size

Description Example

singledata
Convert tseries observations to single precision
Syntax
x = singledata(x)

Input arguments
x tseries E series ojet whose oservtions will e e onverted to single preisionF

Output arguments
y numeri E series ojet with singleEpreision oservtionsF

Description Example

size
Size of tseries object data
Syntax
S = size(X) [S1,S2,...,Sn] = size(X)

QQQ

ime series ojets nd funtionsX sort

Input arguments
X tseries E series ojet whose size will e returnedF

Output arguments
S numeri E etor of sizes of the tseries ojet dt in eh dimensionD S = [S1,S2,...,Sn]F S1D S2D F F F D Sn numeri E izes of the tseries ojet dt in eh dimensionF

Description Example

sort
Sort tseries columns by specied criterion
Syntax
[Y,INDEX] = sort(X,CRIT)

Input arguments
X tseries E snput tseries ojet whose olumns will e sorted in order determined y the riterion critF CRIT sumsq9 | sums9 | mx9 | mxs9 | min9 | mins9 E griterion used to sort the input tseries ojet olumnsF

Output arguments
Y tseries E yutput tseries ojet with olumns sorted in order determined y the input riterionD CRITF INDEX numeri E etor of indiesD y = x{:,index}F

QQR

ime series ojets nd funtionsX spy

Description Example

spy
Visualise tseries observations that pass a test
Syntax
[AA,LL] = spy(X,...) [AA,LL] = spy(RANGE,X,...)

Input arguments
X tseries E snput tseries ojet whose nonExx oservtions will e plotted s mrkersF RANGE tseries E hte rnge on whih the tseries oservtions will e visulisedY if not spei(ed the entire ville rnge will e usedF

Output arguments
AA tseries E rndle to the xes retedF LL tseries E rndle to the mrks plottedF

Options
dateformat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF datetick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF names= ellstr E xmes tht will e used to nnotte individul olumns of the input tseries ojetF test= funtionhndle | d@xA~isnn@xA E est pplied to eh oservtionsY only the vlues returning true will e displyedF QQS

ime series ojets nd funtionsX stdise

Description Example

startdate
Date of the rst available observation in a tseries object
Syntax
d = startdate(x)

Input arguments
x tseries E series ojetF

Output arguments
d numeri E ss seril dte numer representing the dte of the (rst oservtion ville in the input tseriesF

Description
he startdate funtion is equivlent to lling
get(x,startDate)

Example

stdise
Standardise tseries data by subtracting mean and dividing by std deviation
QQT

ime series ojets nd funtionsX stem

Syntax
[X,M,S] = stdise(X) [X,M,S] = stdise(X,Flag)

Input arguments
X tseries E snput tseries ojet whose dt will e normlisedF Flag H | I E flag== normlises y xEID flag==1 normlises y ND where N is the smple lengthF

Output arguments
X tseries E yutput tseries ojet with stndrdised dtF XMeam numeri E istimted men sutrted from the input tseries oservtionsF XStd numeri E istimted std devition y whih the input tseries oservtions hve een dividedF

Description Example

stem
Plot tseries as discrete sequence data
Syntax
[h,range] = stem(x,...) [h,range] = stem(range,x,...) [h,range] = stem(a,range,x,...)

QQU

ime series ojets nd funtionsX subsasgn

Input arguments
a numeri E rndle to xes in whih the grph will e plottedY if not spei(edD the urrent xes will usedF range numeri E hte rngeY if not spei(ed the entire rnge of the input tseries ojet will e plottedF x tseries E snput tseries ojet whose olumns will e ploted s stem grphF

Output arguments
h numeri E etor of hndles to the stems plottedF range numeri E etully plotted dte rngeF

Options
dateformat= hr | irisget@plotdteformt9A E hte formt for the tik mrks on the xExisF datetick= numeri | Inf E etor of dtes loting tik mrks on the xExisY snf mens they will e reted utomtillyF tight= true | false E wke the yExis tightF ee help on uiltEin stem funtion for other options villeF

Description Example

subsasgn
Subscripted assignment for tseries objects
Syntax
x(dates) = values; x(dates,i,j,k,...) = values;

QQV

ime series ojets nd funtionsX subsref

Input arguments
x tseries E series ojet tht will e ssigned new oservtionsF dates numeri E htes for whih the new oservtions will e ssignedF iD jD kD F F F numeri E eferenes to Pnd nd higher dimensions of the tseries ojetF values numeri E xew oservtions tht will ssigned t spei(ed dtesF

Output arguments
x tseries E series ojet with newly ssigned oservtionsF

Description Example

subsref
Subscripted reference function for tseries objects
Syntax returning numeric array
... = X(Dates) ... = X(Dates,...)

Syntax returning tseries object


... = X{Dates} ... = X{Dates,...}

Input arguments
X tseries E series ojetF Dates numeri E htes for whih the time series oservtions will e returnedD either s numeri rry or s nother tseries ojetF QQW

ime series ojets nd funtionsX trend

Description Example

trend
Estimate a time trend
Syntax
X = trend(X,range)

Input arguments
X tseries E snput time seriesF Range tseries E nge for whih the trend will e omputedF

Output arguments
X tseries E yutput trend time seriesF

Options
break= numeri | empty E etor of reking points t whih the trend my hnge its slopeF connect= true | false E glulte the trend y onneting the (rst nd the lst oserE vtionsF diff= true | false E istimte the trend on di'erened dtF log= true | false E vogrithmise the input dtD deElogrithmise the output dtF season= true | false | 2 | 4 | 6 | 12 E snlude deterministi sesonl ftors in the trendF

QRH

ime series ojets nd funtionsX windex

Description Example

tseries
Create new time series (tseries) object
Syntax
X = tseries() X = tseries(DATES,VALUES) X = tseries(DATES,VALUES,COMMENTS)

Input arguments
DATES numeri E htes for whih oservtions will e suppliedY dates do not hve to e sorted in sending orderF sf dates is slr nd values hve multiple rowsD then the dte in dates is interpreted s strtdte for the time seriesF VALUES numeri | funtionhndle E xumeril vlues @oservtionsA rrnged olumnwiseD or funtion tht will e used to rete n xEyEI rry of vluesD where x is the numer of datesF COMMENTS hr | ellstr E gomment or omments tthed to eh olumn of oservtionsF

Output arguments
X tseries E xew tseries ojetF

Description Example

QRI

ime series ojets nd funtionsX wmean

windex
Simple weighted or Divisia index
Syntax
Y = windex(X,W,Range)

Input arguments
X tseries E snput times seriesF W tseries | numeri E pixed or timeEvrying weights on the input time seriesF Range numeri E nge on whih the hivisi index is omputedF

Output arguments
Y tseries E eighted index sed on XF

Options
method= divisi9 | simple9 E eighting methodF log= true | false E vogrithmise the input dt efore omputing the indexD delogrithE mise the output dtF

Description Example

wmean
Weighted average of time series observations
Syntax
Y = wmean(X,RANGE,BETA)

QRP

ime series ojets nd funtionsX x12

Input arguments
X tseries E snput tseries ojet whose dt will e verged olumn y olumnF RANGE numeri E hte rnge on whih the weighted verge will e omputedF BETA numeri E hisount ftorY the lst oservtion gets weight of of ID the xEminusEIst oservtion gets weight of BETAD the xEminusEPnd gets weight of BETA2D nd so onF

Output arguments
Y numeri E erry with weighted verge of individul olumnsY the sizes of Y re identil to those of the input tseries ojet in Pnd nd higher dimensionsF

Description Example

x12
Access to X12 seasonal adjustment program
Syntax with a single type of output requested
[Y,OutpFile,ErrFile,Model,X] = x12(X) [Y,OutpFile,ErrFile,Model,X] = x12(X,Range,...)

Syntax with mutliple types of output requested


[Y1,Y2,...,OutpFile,ErrFile,Model,X] = x12(X,Range,...)

ee the option output= for the types of output dt ville from IPF

Input arguments
X tseries E snput dt tht will sesonlly djusted or (ltered y the gensus IP erimF QRQ

ime series ojets nd funtionsX x12 Range numeri E hte rnge on whih the IP will e runY if not spei(ed or snf the entire ville rnge will e usedF

Output arguments
YD Y1D Y2D F F F tseries E equested output dtD y defult only one type of output is returnedD the sesonlly djusted dtY see the option output=F OutpFile ellstr E gontents of the output log (les produed y IPY eh ell ontins the log (le for one type of output requestedF ErrFile ellstr E gontents of the error (les produed y IPY eh ell ontins the error (le for one type of output requestedF Model strut E trut rry with model spei(tions nd prmeter estimtes for eh of the eswe models (ttedY Model mthes the size of X is Pnd nd higher dimensionsF X tseries E yriginl input dt with forests ndGor ksts ppended if the options forecast= ndGor backcast= re usedF

Options
backcast= numeri | E un kst sed on the (tted eswe model for this numer of periods k to improve on the sesonl djustmentY see help on the x11 spes in the IPEeswe mnulF he kst is inluded in the output rgument XF cleanup= true | false E helete temporry IP (les when doneY the temporry (les re nmed iris_x12a.*F log= true | false E vogrithmise the input dt eforeD nd deElogrithmise the output dt k fterD running x12F forecast= numeri | E un forest sed on the (tted eswe model for this numer of periods hed to improve on the sesonl djustmentY see help on the x11 spes in the IPEeswe mnulF he forest is inluded in the output rgument XF display= true | false E hisply IP output messges in ommnd windowY if flse the messges will e sved in (leF dummy= tseries | empty E hummy vrile or vriles @in se of multivrite tseries ojetA used in IPEeswe regressionY the dummy vriles n lso inlude vlues for forests nd ksts if you request themF dummyType= ao | holiday | td E ype of dummyY see the IPEeswe doumenE ttionF QRR

ime series ojets nd funtionsX x12 mode= auto | add | logadd | mult | pseudoadd | sign E esonl djustment mode @see help on the x11 spes in the IPEeswe mnulAY auto mens tht series with only positive or only negtive numers will e djusted in the mult @multiplitiveA modeD while series with omined positive nd negtive numers in the add @dditiveA modeF maxIter= numeri | 15 E wximum numer of itertions for the IP estimtion proE edureF ee help on the estimation spes in the IPEeswe mnulF maxOrder= numeri | [2,1] E e IEyEP vetor with mximum order for the regulr ewe model @n e 1D 2D 3D or 4A nd mximum order for the sesonl ewe model @n e 1 or 2AF ee help on the automdl spes in the IPEeswe mnulF missinga9 true | false E ellow for inEsmple missing oservtionsD nd (ll in vlues predited y n estimted eswe proessY if falseD the sesonl djustment will not run nd wrning will e thrownF output= hr | ellstr | SA E vist of requested output dtY the ellstr or ommE seprted list n omine IR for the irregulr omponentD SA for the (nl sesonlly djusted seriesD SF for sesonl ftorsD TC for the trendEyleD nd MV for the originl series with missing oservtions repled with eswe estimtesF ee lso help on the x11 spes in the IPEeswe mnulF saveAs= hr | empty E xme @or whole pthA under whih IPEeswe output (les will e svedF specFile= hr | default E xme of the IPEeswe spe (leY if default the ss defult spe (le will e usedD see desriptionF tdays= true | false E gorret for the numer of trding dysF x11regression spes in the IPEeswe mnulF ee help on the

tolerance= numeri | 1e-5 E gonvergene tolerne for the IP estimtion proedureF ee help on the estimation spes in the IPEeswe mnulF

Description

Missing observations
sf you keep missing= false @this is the defult for kwrd omptiilityAD x12 will not run on series with inEsmple missing oservtionsD nd wrning will e thrownF sf you set missing= trueD you llow for inEsmple missing oservtionsF he IPEeswe proE grm hndles missing oservtions y (lling in vlues predited y the estimted eswe proessF ou n request the series with missing vlues (lled in y inluding MV in the option output=F

QRS

ime series ojets nd funtionsX x12

Spec le
he defult IPEeswe spe (le is +thirdparty/x12/default.spcF ou n rete your own spe (le to inlude options tht re not ville through the ss interfeF ou n use the following preEde(ned pleholders letting ss (ll in some of the informtion needed @hek out the defult (leAX $series_data$ is repled with olumn vetor of input oservtionsY $series_freq$ is repled with numer representing the dte frequenyX either R for qurE terlyD or IP for monthly @other frequenies re urrenlty not supported y IPEesweAY $series_startyear$ is repled with the strt yer of the input seriesY $series_startper$ is repled with the strt qurter or month of the input seriesY $transform_function$ is repled with log or none depending on the mode seleted y the userY $forecast_maxlead$ is repled with the requested numer of eswe forest periods used to extend the series efore sesonl djustmentF $forecast_maxlead$ is repled with the requested numer of eswe forest periods used to extend the series efore sesonl djustmentF $tolerance$ is repled with the requested onvergene tolerne in the estimation speF $maxiter$ is repled with the requested mximum numer of itertions in the estimation speF $maxorder$ is repled with two numers seprted y lnk speX mximum order of regulr esweD nd mximum order of sesonl esweF $x11_mode$ is repled with the requested modeX add for dditiveD mult for multiplitiveD pseudoadd for pseudoEdditiveD or logadd for logEdditiveY $x12_save$ is repled with the list of the requested output seriesX d1 for sesonlsD d11 for (nl sesonlly djusted seriesD d12 for trendEyleD d13 for irregulr omponentF wo of the pleholdersD $series_data$ nd $x12_output$D re requiredY if they re not found in the spe (leD ss throws n errorF

Estimates of ARIMA model parameters


he eswe model spei(tionD ModelD is strut with three (eldsX

QRT

ime series ojets nd funtionsX yearly .spec E ell rry with the (rst ell giving the struture of the nonEsesonl esweD nd the seond ell giving the struture of the sesonl esweY oth spei(tions follow the usul foxEtenkins nottionD eFgF [ 1 1]F .ar E numeri rry with the point estimtes of the e oe0ients @nonEsesonl nd sesonlAF .ma E numeri rry with the point estimtes of the we oe0ients @nonEsesonl nd sesonlAF

Example 1
sf you wish to run x12 on the entire rnge on whih the input time series is de(nedD nd do not use ny optionsD you n omit the seond input rgument @the dte rngeAF hese following three lls to x12 do extly the smeX
xsa = x12(x); xsa = x12(x,Inf); xsa = x12(x,get(x,range));

Example 2
sf you wish to speify some of the optionsD you hve to enter dte rnge or use InfX
xsa = x12(x,Inf,mode=,add);

yearly
Display tseries object one full year per row
Syntax
yearly(X)

QRU

ime series ojets nd funtionsX yearly

Input arguments
X tseries E series ojet tht will e displyed one full yer of oservtions per rowF

Description Example

QRV

fsi dtse mngement

19 Basic database management


Loading and saving databases
dbload P358 E grete dtse y loding g (leF dbsave P369 E ve dtse s g (leF xls2csv P373 E gonvert v (le to g (leF

Getting information about databases


dbnames P364 E vist of dtse entries (ltered y nme ndGor lssF dbprintuserdata P366 E rint nmes of dtse tseries long with spei(ed (elds of their userdtF dbrange P367 E pind rnge tht enompsses the rnges of the listed tseries ojetsF dbsearchuserdata P371 E erh dtse to (nd tseries y mthing the ontent of their userdt (eldsF dbuserdatalov P372 E vist of vlues found in spei(ed user dt (eld in tseries ojetsF

Converting databases
array2db P350 E gonvert numeri rry to dtseF db2array P351 E gonvert tseries dtse entries to numeri rryF db2tseries P352 E gomine tseries dtse entries in one multivrite tseries ojetF

Batch processing
dbbatch P352 E un th jo to rete new dtse (eldsF dbclip P354 E glip ll tseries entries in dtse down to the spei(ed dte rngeF dbcol P356 E etrieve the spei(ed olumn or olumns from dtse entriesF dbfun P357 E epply funtion to dtse (eldsF dbplot P365 E lot from dtseF dbredate P368 E edte ll tseries ojets in dtseF

QRW

fsi dtse mngementX db2array

Combining databases
dbextend P356 E gomine tseries oservtions from two or more dtsesF dbmerge P362 E werge two or more dtsesF dbminuscontrol P362 E grete simultionEminusEontrol dtseF

Getting on-line help on database functions


help dbase help dbase/function_name

array2db
Convert numeric array to database
Syntax
D = array2db(X,RANGE,LIST)

Input arguments
X numeri E xumeri rry with individul time series orgnised rowEwiseF RANGE numeri E hte rnge for the olumns in XF LIST ellstr | hr E vist of nmes for the time series in individul rows of XF

Output arguments
D strut E yutput dtseF

Description Example

QSH

fsi dtse mngementX db2array

db2array
Convert tseries database entries to numeric array
Syntax
[X,Incl,Range] = db2array(D) [X,Incl,Range] = db2array(D,List) [X,Incl,Range] = db2array(D,List,Range)

Input arguments
D strut E snput dtse with tseries ojets tht will e onverted to numeri rryF List hr | ellstr E vist of tseries nmes tht will e onverted to numeri rryY if not spei(edD ll tseries entries found in the input dtseD DD will e inluded in the output rrysD XF Range numeri | Inf E hte rngeY Inf mens rnge from the very (rst nonExx oserE vtion to the very lst nonExx oservtionF

Output arguments
X numeri E xumeri rry with oservtions from individul tseries ojets in olumnsF Incl ellstr E vist of tseries nmes tht hve een tully found in the dtseF Range numeri E hte rnge tully usedY this output rgument is useful when the input rgument Range is missing or InfF

Description
he output rryD XD is lwys xerEyExvistEyExeltD where xer is the length of the Range @the numer of periodsAD xvist is the numer of tseries inluded in the ListD nd xelt is the mximum numer of olumns tht ny of the tseries inluded in the List hveF ell tseries with more thn one dimension @iFeF with more thn one olumnA re lwys expnded long Qrd dimension onlyF por instneD IHEyEPEyEQ tseries will oupy IHEyEIEyET spe in X t its respetive lotionF

QSI

fsi dtse mngementX dbbatch

Example

db2tseries
Combine tseries database entries in one multivariate tseries object
Syntax
[X,INCL,RANGE] = db2tseries(D,LIST,RANGE)

Input arguments
D strut E snput dtse with tseries ojets tht will e omined in one multivrite tseries ojetF LIST hr | ellstr E vist of tseries nmes tht will e ominedF RANGE numeri | snf E hte rngeF

Output arguments
X numeri E gomined multivrite tseries ojetF INCL ellstr E vist of tseries nmes tht hve een tully found in the dtseF RANGE numeri E he dte rnge tully usedF

dbbatch
Run a batch job to create new database elds
Syntax
[D,Processed,Added] = dbbatch(D,NewName,Expr,...)

QSP

fsi dtse mngementX dbbatch

Input arguments
D strut E snput dtseF NewName hr E ttern tht will e used to rete nmes for new dtse (elds sed on the existing onesY use $ to refer to the nme of the urrently proessed dtse (eldY use $1D $2D etF to refer to tokens ptured in regulr expression spei(ed in the namefilter= optionF Expr hr E ixpression tht will e evluted on seletion of existing dtse entries to rete new dtse entriesY the expression n inlude $ D $1D etF

Output arguments
D strut E yutput dtseF Processed ellstr E vist of dtse (elds tht hve een used to rete new (eldsF Added ellstr E vist of new dtse (elds reted y evluting Expr on the orresponding (eld in ProcessedF

Options
classFilter= hr | Inf E prom the existing dtse entriesD selet only those tht re ojets of the spei(ed lss or lssesD nd evlute the expression Expr on theseF fresh= true | false E sf trueD the output dtse will only ontin the newly reted entriesY if flse the output dtse will lso inlude ll the entries from the input dtseF nameFilter= hr | empty E prom the existing dtse entriesD selet only those tht mth this regulr expressionD nd evlute the expression Expr on theseF nameList= ellstr | Inf E ivlute the COMMAND on this list of existing dtse entriesF stringList= ellstr | empty E ivlute the expression Expr on this list of stringsY the strings do not need to e nmes existing in the dtseY this options n e omined with nameFilter=D nameList=D ndGor classFilter= to nrrow the seletionF

Description
his funtion is primrily ment to rete new dtse (eldsD eh sed on n existing oneF sf youD on the otherhndD only wish to modify numer of existing (elds without dding ny new onesD use dbfun P357 instedF

QSQ

fsi dtse mngementX dbclip he expression Expr is evluted in the ller workspeD nd hene my refer to ny vriles existing in the workspeD not only to the dtse nd its (eldsF o onvert the strings $ D $1D $2D etF to lower se or upper seD use the dot or olon syntxX $. D $.1D $.2 for ower seD nd $: D $:1D $:2 for upper seF

Example 1
por eh (eld @ll ssumed to e tseriesA rete (rst di'ereneD nd nme the new series DX where X is the nme of the originl seriesF
d = dbbatch(d,D$ ,diff(d.$ ));

xote tht the originl series will e presered in the dtseD together with the newly reted onesF

Example 2
uppose tht in dtse D you wnt to sesonlly djust ll time series whose nmes end with _uD nd give these sesonlly djusted series nmes without the uF
d = dbbatch(d,$1,x12(d.$ ),nameFilter,(.*)u);

orD if you wnt to mke sure only tseries ojets will e seleted @in se there re dtse entries ending with u other thn tseries ojetsA
d = dbbatch(d,$1,x12(d.$ ), ... nameFilter=,(.*)u,classFilter=,tseries);

dbclip
Clip all tseries entries in a database down to the specied date range
Syntax
D = dbclip(D,Range)

QSR

fsi dtse mngementX dbcol

Input arguments
D strut E htse or nested dtses with tseries ojetsF Range numeri | ell E nge or ell rry of rnges to whih ll tseries ojets will e lippedY multiple rnges n e spei(edD eh for di'erent dte frequenyGperiodiityF

Output arguments
D strut E htse with tseries ojets ut down to rangeF

Description
his funtions looks up ll tseries ojets within the dtse dD inluding tseries ojets nested in suEdtsesD nd uts o' ny vlues preeding the strt dte of Range or following the end dte of rangeF he tseries ojet ommentsD if nyD re preserved in the new dtseF sf tseries entry does not mth the dte frequeny of the input rngeD wrning is thrownF wultiple rnges n e spei(ed in Range @s ell rryAD eh for di'erent dte frequenyGperiodiity @iFeF one or more of the followingX monthlyD iEmonthlyD qurterlyD hlfEyerlyD yerlyD indetermiE nteAF ih tseries entry will e lipped to the rnge tht mthes its dte frequenyF

Example
d = struct(); d.x = tseries(qq(2 d.y = tseries(qq(2 d = x: [24x1 tseries] y: [24x1 tseries] dbclip(d,qq(2 7,1):qq(2 7,4)) 5,1):qq(2 1 ,4),@rand); 5,1):qq(2 1 ,4),@rand)

ans = x: [4x1 tseries] y: [4x1 tseries]

QSS

fsi dtse mngementX dbextend

dbcol
Retrieve the specied column or columns from database entries
Syntax
D = dbcol(D,K)

Input arguments
D strut E snput dtse with @possilyA multivrite tseries ojets nd numeri rrysF K numeri | logil | end9 E golumn or olumns tht will e retrieved from eh tseries ojet or numeri rry in in the intput dtseD DD nd returned in the output dtseF

Output arguments
D strut E yutput dtse with tseries ojets nd numeri rrys redued to the spei(ed olumnF

Description Example

dbextend
Combine tseries observations from two or more databases
Syntax
D = dbextend(D,D1,D2,...)

Input arguments
D strut E rimry input dtseF

QST

fsi dtse mngementX dbfun D1D D2D F F F strut E htses whose tseries oservtions will e used to extend or overwrite oservtions in the tseries ojets of the sme nme in the primry dtseF

Output arguments
D strut E yutput dtseF

Description
sf more thn two dtses re omined then they re proessed oneEyEoneX the (rst is omined with the seondD then the result is omined with the thirdD nd so onD using the following rulesX sf two nonEempty tseries ojets with the sme frequeny re ominedD the oservtions re splied togetherF sf some of the oservtions overlp the oservtions from the seond tseries re usedF sf two empty tseries ojets re omined the (rst is usedF sf nonEempty tseries is omined with n empty tseriesD the nonEempty one is usedF sf two ojets re omined of whih t lest one is nonEtseries ojetD the seond input ojet is usedF

Example

dbfun
Apply a function to database elds
Syntax
[D,Flag,ErrList,WarnList] = dbfun(Func,D1,...) [D,Flag,ErrList,WarnList] = dbfun(Func,D1,D2,...)

Input arguments
Func funtionhndle | hr E puntion tht will e pplied to eh (eldF

QSU

fsi dtse mngementX dbload D1 strut E pirst input dtseF D2D D3D F F F strut E eond nd further input dtses @when Func epts two input rgumentsAF

Output arguments
D strut E yutput dtse whose (elds will e reted y pplying Func to eh (eld of the input dtse or dtsesF Flag true | false E rue if no error ours when evluting the funtionF ErrList ellstr E vist of (elds on whih the funtion hs thrown n errorF WarnList ellstr E vist of (elds on whih the funtion hs thrown wrningF

Options
cascade= true | false E gsde through sudtses pplying the funtion Func to their (eldsD tooF classList= ell | ellstr | Inf E epply Func only to the (elds of spei(ed lssesF fresh= true | false E ueep uproessed (elds in the output dtseF nameList= ell | ellstr | Inf E epply Func only to the spei(ed (eld nmesY n e still omined with the option classList=F onError= keep | NaN | remove

Description Example

dbload
Create database by loading CSV le
Syntax
D = dbload(FName, ...) D = dbload(D,FName, ...)

QSV

fsi dtse mngementX dbload

Input arguments
FName hr | ellstr E xme of the snput g dt (le or ell rry of g (le nmes tht will e ominedF D strut E en existing dtse @strutA to whih the new entries from the input g dt (le entries will e ddedF

Output arguments
D strut E htse reted from the input g (le@sAF

Options
case= lower | upper | empty E ghnge se of vrile nmesF commentRow= hr | ellstr | {comment,comments} E vel t the strt of row tht will e used to rete tseries ojet ommentsF convert= numeri | ellstr | empty E sf nonEemptyD frequeny onversion will e run on ll time series lodedY speify the trget frequeny @numeriA or ell rry of input rguments nd options in ll to the funtion convertF dateFormat= hr | YYYYFP E pormt of dtes in (rst olumnF delimiter= hr | , E helimiter seprting the individul vlues @ellsA in the g (leY if di'erent from ommD ll ourenes of the delimiter will repled with omms ! note tht this will lso 'et text in ommentsF firstDateOnly= true | false E ed nd prse only the (rst dte stringD nd (ll in the remining dtes ssuming rnge of onseutive dtesF freq= | 1 | 2 | 4 | 6 | 12 | 365 | daily | empty E edvise frequeny of dtesY if emptyD frequeny will e utomtilly reognisedF freqLetters= hr | YHQBM E vetters representing frequeny of dtes in dte olumnF inputFormat= auto | csv | xls E pormt of input dt (leY auto mens the formt will e determined y the (le extensionF nameRow= hr | numeri | empty E tring t the eginning of the row with vrile nmesD or the line numer t whih the row with vrile nmes ppers @(rst row is numered IAF nameFunc= ell | funtionhndle | empty E puntion used to hnge or trnsform the vrile nmesF sf ell rry of funtion hndlesD eh funtion will e pplied in the given orderF QSW

fsi dtse mngementX dbload nan= hr | NaN E tring representing missing oservtions @se insensitiveAF preProcess= funtionhndle | ell | empty E epply this funtionD or ell rry of funtionsD to the rw text (le efore prsing the dtF skipRows= hr | ellstr | numeri | empty E kip rows whose (rst ell mthes the string or strings @regulr expressionsAY orD skip vetor of row numersF userData= hr | Inf E pield nme under whih the dtse userdt loded from the g (le @if they existA will e stored in the output dtseY if userData=Inf the (eld nme will e red from the g (le @nd will e thus identil to the originlly sved dtseAF userDataField= hr | . E e leding hrter denoting userdt (elds for individul time seriesF sf emptyD no userdt (elds will e redF userDataFieldList= ellstr | numeri | empty E vist of row hedersD or vetor of row numersD tht will e inluded s user dt in eh time seriesF

Description
se the freq= option whenever there is miguity in intepreting the dte stringsD nd ss is not le to determine the frequeny orretly @see ixmple IAF

Structure of CSV database les


he minimlist struture of g dtse (le hs leding row with vriles nmesD leding olumn with dtes in the si ss formtD nd individul olumns with numeri dtX
+---------+---------+---------+-| | Y | P | +---------+---------+---------+-| 2 1 Q1 | 1 | 1 | +---------+---------+---------+-| 2 1 Q2 | 2 | 2 | +---------+---------+---------+-| | | |

ou n dd omment row @must e pled efore the dt prtD nd strt with lel gomment9 in the (rst ellA tht will lso e red in nd ssigned s omments to the individul tseries ojets reted in the output dtseF
+---------+---------+---------+-| | Y | P |

QTH

fsi dtse mngementX dbload


+---------+---------+---------+-| Comment | Output | Prices | +---------+---------+---------+-| 2 1 Q1 | 1 | 1 | +---------+---------+---------+-| 2 1 Q2 | 2 | 2 | +---------+---------+---------+-| | | |

ou n use di'erent lel in the (rst ell to denote omment rowY in tht se you need to set the option commentRow= ordinglyF ell g rows whose nmes strt with hrter spei(ed in the option userdataField= @ dot y defultA will e dded to output tseries ojets s (elds of their userdtF
+---------+---------+---------+-| | Y | P | +---------+---------+---------+-| Comment | Output | Prices | +---------+---------+---------+-| .Source | Stat | IMFIFS | +---------+---------+---------+-| .Update | 17Feb11 | 1Feb11 | +---------+---------+---------+-| .Units | Bil USD | 2 1 =1 | +---------+---------+---------+-| 2 1 Q1 | 1 | 1 | +---------+---------+---------+-| 2 1 Q2 | 2 | 2 | +---------+---------+---------+-| | | |

Example 1
ypil exmple of using the freq= option is qurterly dtse with dtes represented y the orresponding monthsD suh s sequene PHHHEHIEHID PHHHEHREHID PHHHEHUEHID PHHHEIHEHID etF sn this seD you n use the following optionsX
d = dbload(filename.csv,dateFormat,YYYY-MM- 1,freq,4);

QTI

fsi dtse mngementX dbminuscontrol

dbmerge
Merge two or more databases
Syntax
D = dbmerge(D1,D2,...)

Input arguments
D1D D2D F F F strut E snput dtses whose entries will e omined in the output dtseF

Output arguments
D strut E yutput dtse tht omines entries from ll input dtseY if some entries re found in more thn one input dtsesD the lst ourene is usedF

Description Example
d1 = struct(a,1,b,2); d2 = struct(a,1 ,c,2 ); d = dbmerge(d1,d2) d = a: 1 b: 2 c: 2

dbminuscontrol
Create simulation-minus-control database

QTP

fsi dtse mngementX dbminuscontrol

Syntax
[D,C] = dbminuscontrol(M,D) [D,C] = dbminuscontrol(M,D,C)

Input arguments
M model E wodel ojet on whih the dtses D nd C re sedF D strut E imultion dtseF C strut E gontrol dtseY if the input rgument C is not spei(edD the stedyEstte dtse of the model M is used for the ontrol dtseF

Output arguments
D strut E imultionEminusEontrol dtseD in whih ll logEvriles re d.x/c.xD nd ll other vriles re d.x-c.xF C strut E gontrol dtseF

Description Example
e run shok simultion in full levels using stedyEstte @or lnedEgrowthEpthA dtse s inputD nd then ompute the devitions from the stedy stteF
d = ... s = s = s = sstatedb(m,1:4 ); % Set up a shock or shocks here. simulate(m,d,1:4 ); dbextend(d,s); dbminuscontrol(m,s,d);

xote tht this is equivlent to running


d = ... s = s = zerodb(m,1:4 ); % Set up a shock or shocks here. simulate(m,d,1:4 ,deviation,true); dbextend(d,s);

QTQ

fsi dtse mngementX dbnames

dbnames
List of database entries ltered by name and/or class
Syntax
List = dbnames(D,...)

Input arguments
D strut E snput dtseF

Output arguments
List ellstr E vist of input dtse entries tht pss the nme or lss testF

Options
nameFilter= hr | Inf E egulr expression ginst whih the dtse entry nmes will e mthedY Inf mens ll nmes will e mthedF classFilter= hr | Inf E egulr expression ginst whih the dtse entry lss nmes will e mthedY Inf mens ll lsses will e mthedF

Description Example
xotie the di'erenes in the following lls to dbnamesX
dbnames(d,nameFilter=,L_)

mthes ll nmes tht ontin L_ @t the eginningD in the middleD or t the end of the stringAD suh s L_AD DL_AD XL_D or just L_F

QTR

fsi dtse mngementX dbplot


dbnames(d,nameFilter=,^L_)

mthes ll nmes tht strt with L_D su s L_A or L_F


dbnames(d,nameFilter=,^L_.)

mthes ll nmes tht strt with L_ nd hve t lest one more hrter fter thtD suh s L_A @ut not L_AF

dbplot
Plot from database
Syntax
[FF,AA,PDb] = dbplot(D,List,Range,...) [FF,AA,PDb] = dbplot(D,Range,List,...)

Input arguments
D strut E htse with input dtF List ellstr E vist of expressions @or lelled expressionsA tht will e evluted nd plotted in seprte grphsF Range numeri E hte rngeF

Output arguments
FF numeri E rndles to (gures reted y qplotF AA ell E rndles to xes reted y qplotF PDB strut E htse with tully plotted seriesF

QTS

fsi dtse mngementX dbprintuserdata

Options
plotFunc= dr | dhist | dplot | dplotpred | dstem E lot funtion used to rete the grphsF ee help on qreport/qplot P421 for other options villeF

Description
he funtion dbplot opens new (gure window @s mny s needed to ommodte ll grphs given the option subplot=AD nd retes grph for eh entry in the ell rry ListF
List n ontin the nmes of the dtse time seriesD expression referring to the dtse (elds evluting to time seriesF ou n lso dd lels @tht will e displyed s grph titlesA enlosed in doule quotes nd preeding the expressionsF sf you strt the expression with @htA symolD the funtion spei(ed in the transform= option will not e pplied to tht expressionF

Example
dbplot(d,qq(2 1 ,1):qq(2 15,4),{x,"Series Y" y,^"Series z", ... transform=,@(x) 1 *(x-1));

dbprintuserdata
Print names of database tseries along with specied elds of their userdata
Syntax
dbprintuserdata(D,Field,...)

Input arguments
D strut E htse whose tseries ojets will e reportedF Field hr | ellstr E xmes of the userdt (elds whose ontent will printed @if hr or numeri slrAF

QTT

fsi dtse mngementX dbrange

Options
output= html | prompt E here to disply the informtionF

Description Example

dbrange
Find a range that encompasses the ranges of the listed tseries objects
Syntax
[Range,FreqList] = dbrange(D) [Range,FreqList] = dbrange(D,List,...) [Range,FreqList] = dbrange(D,Inf,...)

Input arguments
D strut E snput dtseF List hr | ellstr | Inf E vist of tseries ojets tht will e inluded in the rnge serhY Inf mens ll tseries ojets existing in the input dtses will e inludedF

Output arguments
Range numeri | ell E nge tht enompsses the oservtions of the tseries ojets in the input dtseY if tseries ojets with di'erent frequenies existD the rnges re returned in ell rryF FreqList numeri E etor of dte frequenies oresponding to the returned rngesF

Options
startDate= maxRange | minRange E maxRange mens the range will strt t the erliest strt dte of ll tseries inluded in the serhY minRange mens the range will strt t the ltest strt dte foundF QTU

fsi dtse mngementX dbsave endDate= maxRange | minRange E maxRange mens the range will end t the ltest end dte of ll tseries inluded in the serhY minRange mens the range will end t the erliest end dteF

Description Example

dbredate
Redate all tseries objects in a database
Syntax
D = redate(D,OldDate,NewDate)

Input arguments
D strut E snput dtse with tseries ojetsF OldDate numeri E fse dte tht will e onverted to new dte in ll tseries ojetsF NewDate numeri E e new dte to whih the se dte OldDate will e hnged in ll tseries ojetsY newDate need not e the sme frequeny s OldDateF

Output arguments
d strut E yutput dtse where ll tseries ojets hve identil dt s in the input dtseD ut with their time dimension hngedF

Description Example

QTV

fsi dtse mngementX dbsave

dbsave
Save database as CSV le
Syntax
List = dbsave(D,FName) List = dbsave(D,FName,Dates,...)

Output arguments
List ellstr E E vist of tully sved dtse entriesF

Input arguments
D strut E htse whose tseries nd numeri entries will e svedF FName hr E pilenme under whih the g will e svedD inluding its extensionF Dates numeri | Inf htes or dte rnge on whih the tseries ojets will e svedF

Options
class= true | flse E snlude row with lss nd size spei(tionsF comment= true | false E snlude row with omments for tseries ojetsF decimal= numeri | empty E xumer of deimls up to whih the dt will e svedY if empty the format option is usedF format= hr | %.8e xumeri formt tht will e used to represent the dtD see sprintf for detils on formttingD he formt must strt with %D nd must not inlude identi(ers speifying order of proessingD iFeF the $ signsD or leftEjustify )gsD the - signsF freqLetters= hr | YHQBM E pive letters to represent the (ve possile dte frequenies @nnulD semiEnnulD qurterlyD imonthlyD monthlyAF nan= hr | NaN E tring tht will e used to represent xxsF saveSubdb= true | false E ve suEdtses @struts found within the strut DAY the suEdtses will e sved to seprte gp (lesF userData= hr | userdt9 E pield nme from whih ny kind of userdt will e red nd sved in the g (leF QTW

fsi dtse mngementX dbsave

Description
he dt sved inlude lso imginry prts of omplex numersF

Saving user data with the database

sf your dtse ontins (eld nmed userdata=D this will e sved in the g (le on seprte rowF he userdata= (eld n e ny omintion of numeriD hrD nd ell rrys nd IEyEI strutsF ou n use the userdata= (eld to desrie the dtse or preserve ny sort of metdtF o hnge the nme of the (eld tht is treted s user dtD use the userData= optionF

Example 1
grete simple dtse with two time seriesF
d = struct(); d.x = tseries(qq(2 1 ,1):qq(2 1 ,4),@rand); d.y = tseries(qq(2 1 ,1):qq(2 1 ,4),@rand);

edd your own desription of the dtseD eFgF


d.userdata = {My database,datestr(now())};

ve the dtse s g using dbsaveD


dbsave(d,mydatabase.csv);

hen you lter lod the dtseD


d = dbload(mydatabase.csv) d = userdata: {My database x: [4x1 tseries] y: [4x1 tseries] 23-Sep-2 11 14:1 :17}

the dtse will preserve the userdata= (eldF QUH

fsi dtse mngementX dbsearchuserdata

Example 2
o hnge the (eld nme under whih you store your own user dtD use the userdata= option when running dbsaveD
d = struct(); d.x = tseries(qq(2 1 ,1):qq(2 1 ,4),@rand); d.y = tseries(qq(2 1 ,1):qq(2 1 ,4),@rand); d.MYUSERDATA = {My database,datestr(now())}; dbsave(d,mydatabase.csv,Inf,userData=,MYUSERDATA);

he nme of the user dt (eld is lso kept in the g (le so tht dbload works (ne in this seD tooD nd returns dtse identil to the sved oneD
d = dbload(mydatabase.csv) d = MYUSERDATA: {My database x: [4x1 tseries] y: [4x1 tseries] 23-Sep-2 11 14:1 :17}

dbsearchuserdata
Search database to nd tseries by matching the content of their userdata elds
Syntax
[List,SubD] = dbsearchuserdata(D,Field1,Regexp1,Field2,Regexp2,...) [List,SubD] = dbsearchuserdata(D,Flag,Field1,Regexp1,Field2,Regexp2,...)

Input arguments
D strut E snput dtse whose tseries (elds will e serhedF Flag -all | -any E pei(es if ll onditions or ny ondition must e met for the series to pss the testY if not spei(edD -all is ssumedF QUI

fsi dtse mngementX dbuserdatalov Field1D Field2D F F F hr E xmes of (elds in the userdt strutF Regexp1D Regexp2D F F F hr E egulr expressions ginst whih the respetive userdt (elds will e mthedF

Output arguments
List ellstr E xmes of tseries tht pss the testF Subd strut E uEdtse with only those tseries tht pss the testF

Description
por suessful mthD the userdt must e strutD nd the tested (elds must e text stringsF se n equl signD =D fter the nme of the userdt (elds in Field1D Field2D etF to request seEinsensitive mthD nd n equlEshrt signD =#D to indiite seEsensitive mthF

Example
[list,dd] = dbsearchuserdata(d,.DESC=,Exchange rate,.SOURCE=#,IMF);

ih individul tseries ojet in the dtse D will e tested for two onditionsX whether its user dt is strut inluding (eld nmed DESCD nd the (eld ontins string Exchange rate in it @se insensitiveD eFgF eXcHaNgE rAtE will lso e mthedAY whether its user dt is strut inluding (eld nmed SOURCED nd the (eld ontins string IMF in it @se sensitiveD eFgF Imf will not e mthedAF ell tseries ojet tht pss oth of these onditions re returned in the List nd the output dtse DF

dbuserdatalov
List of values found in a specied user data eld in tseries objects

QUP

fsi dtse mngementX xls2csv

Syntax
LOV = dbuserdatalov(D,FIELD)

Input arguments
D strut E snput dtse whose tseries ojets will e serhedF FIELD hr E xme of userdt (eld whose vlues will e olleted ross ll tseries ojetsF

Output arguments
LOV ellstr E vist of vlues found in the (eld FIELD of ll tseries ojetsY only hr vlues @text stringsA re inludedY eh vlue is inluded only one in LOVF

Description Example

xls2csv
Convert XLS le to CSV le
Syntax
xls2csv(InpFile) xls2csv(InpFile,OutpFile,...)

Input arguments
InpFile hr E xme of n v input (le tht will e onverted to gF OutpFile empty | hr E xme of the g output (leY if not supplied or emptyD the g (le nme will e derived from the v input (le nmeF

QUQ

fsi dtse mngementX xls2csv

Options
sheet= numeri | hr | 1 E orksheet in the v (le tht will e svedY n e either the sheet numer or the sheet nmeF

Description
his funtion lls thirdEprty tvript @ourtesy of ghristopher estAF he sript uses n w ixel pplition on the kgroundD nd hene w ixel must e instlled on the omputerF ynly one worksheet t time n e sved to gF fy defultD it is the (rst worksheet found in the input v (leY use the option sheet= to ontrol whih worksheet will e svedF ee lso 6irisrootGCthirdprtyGxlsPsvFjs for opyright informtionF

Example 1
ve the (rst worksheets of the following v (les to g (lesF
xls2csv(myDataFile.xls); xls2csv(C:\Data\myDataFile.xls);

Example 2
ve the worksheet nmed heetQ9 to g (leY the nme of the g (le will e myDataFile.csvF
xls2csv(myDataFile.xls,[],sheet=,Sheet3);

Example 3
ve the seond worksheet to g (le under the nme myDataFile_2.csvF
xls2csv(myDataFile.xls,myDataFile_2.csv,sheet=,2);

QUR

Part V 
Reporting and publishing

QUS

eport funtions

20 Report functions
New report
new P398 E grete newD empty report ojetF copy P383 E grete opy of report ojetF

Compiling PDF report


publish P399 E gompile hp from report ojetF

Top-level objects
table P407 E trt new tleF figure P386 E trt new (gureF usefigure P412 E snsert existing (gure windowF matrix P393 E snsert mtrix or numeri rryF modelfile P397 E rite formtted model (leF array P379 E snsert rry with user dtF
Ai ode or vertim text input in reportF tex P410 E snlude v

Inspecting and maninpulating report objects


disp P384 E hisply the struture of report ojetF display P384 E hisply the struture of report ojetF findall P388 E pind ll ojets of given type within report ojetF

Figure objects
graph P389 E edd grph to (gureF

QUT

eport funtionsX align

Table and graph objects


band P381 E edd new dt with lower nd upper ounds to grph or tleF fanchart P385 E edd fnhrt to grphF series P402 E edd new dt to grph or tleF subheading P406 E inter suheding in tleF vline P413 E edd vertil line to grphF highlight P391 E righlight rnge in grphF

Structuring reports
align P378 E ertilly lign the following u ojetsF empty P385 E impty report ojetF include P392 E snlude text or ve input (le in the reportF merge P396 E werge the ontent of two or more report ojetsF pagebreak P399 E pore pge rekF section P402 E trt new setion in reportF

Getting on-line help on report functions


help report help report/function_name

Generic options
he following generi options n e used on ny of the report ojetsF saveAs= hr | empty E @xot inheritle from prent ojetsA ve the ve ode generted for the respetive report element in text (le under the spei(ed nmeF

QUU

eport funtionsX align

align
Vertically align the following K objects
Syntax
P.align(Caption,K,NCol,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr E gption displyed only when desriing the struture of the report on the sreenD ut not in the tul hp reportF K numeri E xumer of ojets following this align tht will e vertilly lignedF NCol numeri E xumer of olumns in whih the ojets will vertilly lignedF

Options
hspace= numeri | 2 E rorizontl spe @in em unitsA inserted etween two neighouring ojetsF
Ai ommnds separator= hr | \medskip\par E @snheritle from prent ojetsA v tht will e inserted fter the ligned ojetsF

shareCaption= auto | true | flse E @snheritle from prent ojetsA le shred ption @title nd sutitleA over eh row of ojetsY the title of the (rst ojet in eh row is usedY auto mens tht the ption will e shred if they re identil for ll ojets in rowF
Ai ode speifying typeface= hr | empty E @xot inheritle from prent ojetsA v the typefe for the lign element s wholeY it must use the delrtive forms @suh s \itshapeA nd not the ommnd forms @suh s \textit{...}AF

Description
ertilly ligned n e the following types of ojetsX figure P386

QUV

eport funtionsX array table P407 matrix P393 array P379 xote tht the align ojet itself hs no ption @even if you speify one it will not e usedAF ynly the ojets within align will e given ptionsF sf the ojets ligned on one row hve identil ptions @iFeF oth titles nd sutitlesAD only one ption will e displyed entred ove the ojetsF feuse empty P385 ojets ount in the totl numer of ojets inluded in alignD you n use empty P385 in to rete lnk spe in prtiulr positionF

Example

array
Insert array with user data
Syntax
P.array(Caption,Data)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr | ellstr E itle or ell rry with title nd sutitle displyed t the top of the rryY see hesription for splitting the title or sutitle into multiple linesF Data ell E gell rry with input dtY numeri nd text entries re llowedF

Options
arrayStretch= numeri | 1.15 E @snheritedA treth etween lines in the rry @in ptsAF
Ai formt omE captionTypeface= ellstr | hr | \large\bfseries E @snheritedA v mnds for typesetting the rry ptionY the suption formt n e entered s the seond ell in ell rryF

QUW

eport funtionsX array colWidth= numeri | NaN E @snheritle from prent ojetsA idthD or vetor of widhtsD of the rry olumns in emunitsY NaN mens the width of the olumn will djust utomtillyF format= hr | %.2f E @snheritedA xumeri formt stringY see help on the uiltEin sprintf funtionF footnote= hr | empty E @snheritedA pootnote t the rry titleY only shows if the title is nonEemptyF heading= hr | ellstr | empty E @snheritedA serEsupplied hedingD iFeF n extr row or Ai odeD or ell rry whose rows t the top of the rryF he heding n e either v size is onsistent with DataF he heding is repeted t the top of eh new pge when used with long= trueF
Ai string tht will e used to typeset InfsF inf= hr | $\infty$ E @snheritedA v

long= true | false E @snheritedA sf trueD the rry my streth over more thn one pgeF longFoot= hr | empty E @snheritedA pootnote tht ppers t the ottom of the rry @if it is longer thn one pgeA on eh pge exept the lst oneY works only with long= trueF longFootPosition= centre | left | right E @snheritedA rorizontl lignment of the footnote in long rrysY works only with long= trueF
Ai string tht will e used to typeset NaNsF nan= hr | $\cdots$ E @snheritedA v Ai string tht will e used to typeset pure zero pureZero= hr | empty E @snheritedA v entriesY if empty the zeros will e printed using the urrent numeri formtF Ai string tht will e used to typeset the printedZero= hr | empty E @snheritedA v entries tht would pper s zero under the urrent numeri formt usedY if empty these numers will e printed using the urrent numeri formtF Ai separator= hr | \medskip\par E @snheritedA v ommnds tht will e inserted fter the rryF

sideways= true | false E @snheritedA rint the rry rotted y WH degreesF tabcolsep= NaN | numeri E @snheritedA pe etween olumns in the rryD mesured Ai defultF in em unitsY NaN mens the v
Ai ode speifying the typefe for the typeface= hr | empty E @xot inheritedA v rry s wholeY it must use the delrtive forms @suh s \itshapeA nd not the ommnd forms @suh s \textit{...}AF

Generic options
ee help on generi options P376 in report ojetsF QVH

eport funtionsX band

Description
he input ell rry Data n ontin either strings or numeri vluesD or horizontl rulesF xumeri vlues re printed using the stndrd sprintf funtion nd formtted using the format= optionF rorizontl rules must e entered s string of (ve @or moreA dshesD -----D in the (rst ell of Ai ommnd the respetive rowD with ll other ells empty in tht rowF sf you wish to inlude v Ai odeD you must enlose it in urly rketsF or piee of v

Titles and subtitles

he input rgument Caption n e either text stringD or IEyEP ell rry of stringsF sn the ltter seD the (rst ell will e printed s titleD nd the seond ell will e printed s sutitleF o split the title or sutitle into multiple linesD use the following ve ommnds wrpped in urly rketsX {\\} or {\\[Xpt]}D where X is the width of n extr vertil spe @in pointsA dded etween the respetive linesF

Example
hese ommnds rete tle with two rows seprted y horizontl ruleD nd three olumns Ai mth modeF in eh of themF he middle olumns will hve qreek letters printed in v
A = { ... First row,{\$\textbackslash alpha\$},1 -----,,; ... Second row,{\$\textbackslash beta\$},2 }; P.array(My table,A);

; ... ; ...

band
Add new data with lower and upper bounds to graph or table
Syntax
P.series(Caption,X,Low,High,...)

QVI

eport funtionsX band

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr E gption used s defult legend entry in grphD or in the leding olumn in tleF X tseries E snput dt with the entre of the ndF Low tseries E snput dt with lower oundsY n e spei(ed either reltive to the entre or soluteD see the option relative=F High tseries E snput dt with upper oundsY n e spei(ed either reltive to the entre or soluteD see the option relative=F

Options for table and graph bands


low= hr | vow9 E @snheritle from prent ojetsA wrk used to denote the lower oundF high= hr | righ9 E @snheritle from prent ojetsA wrk used to denote the upper oundF relative= true | false E @snheritle from prent ojetsA sf trueD the dt for the lower nd upper ounds re reltive to the entreD iFeF the ounds will e dded to the entre @in this seD LOW must e negtive numers nd HIGH must e positive numersAF sf flseD the ounds re solute dt @in this se LOW must e lower thn XD nd HIGH must e higher thn XAF

Options for table bands


bandTypeface= hr | \footnotesize E @snheritle from prent ojetsA ve formt string used to typeset the lower nd upper oundsF7

Options for graph bands


plotType= errorbar | patch E ype of plot used to drw the ndF relative= true | false E @snheritle from prent ojetsA sf true the lower nd upper ounds will eD respetivelyD sutrted from nd dded to to the middle lineF white= numeri | .8 E @snheritle from prent ojetsA roportion of white olour mixed with the line olour nd used to (ll the re tht depits the ndF ee help on report/series P402 for other options villeF QVP

eport funtionsX disp

Generic options
ee help on generi options P376 in report ojetsF

Description Example

copy
Create a copy of a report object
Syntax
Q = copy(P)

Input arguments
P report E eport ojet whose opy will e retedF

Output arguments
Q report E gopy of the input report ojetF

Description
feuse report is hndle lss ojetD plin ssignment
Q = P;

retes hndle to the sme opy of report ojetF sn other wordsD hnges in Q will lso hnge P nd vie versF o mke newD independent opy of n existing report ojetD you need to run
Q = copy(P);

QVQ

eport funtionsX empty

disp
Display the structure of report object
Syntax
X

Input arguments
X report E eport ojetF

Description Example

disp
Display the structure of report object
Syntax
disp(X)

Input arguments
X report E eport ojetF

Description Example

QVR

eport funtionsX fanchart

empty
Empty report object
Syntax
P.empty() P.empty(Caption,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr E gption for the empty ojetY the ption is only displyed in the onEsreen report strutureF

Generic options
ee help on generi options P376 in report ojetsF

Description
he empty ojet does not produe ny visile output in the reportF st n e used in align P378 or figure P386 to rete lnk speF

Example

fanchart
Add fanchart to graph
Syntax
P.fanchart(Cap,X,Std,Prob,...)

QVS

eport funtionsX figure

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Cap hr E gption used s legend entry for the line @men of fnhrtA X tseries E series ojet with input dt to e displyedF Std tseries E series ojet with stndrd devitions of input dtF Prob numeri E gon(dene porilities of intervls to e displyedF

Options for fancharts


asym= numeri | tseries | 1 E tio of symmetry @re of upper prt to one of lower prtAF exclude= numeri | true | false E ixlude some of the on(dene intervlsF factor= numeri | 1 E ftor to inrese or derese input stndrd devitions fanLegend= ell | NaN | Inf E vegend entries used insted of on(dene intervl vluesY snf mens ll on(dene intervls vlues will e used to onstrut legend entriesY xx mens the intervls will e exluded from legendY NaN in ellstr mens the intervls of respetive fnhrts will e exluded from legendF ee help on report/series P402 for other options villeF

Description
he on(dene intervls re sed on norml distriutions with stndrd devitions supplied y the userF yptionllyD the user n lso speify ssumptions out symmetry ndGor ommon orretion ftorsF

Example

gure
Start new gure

QVT

eport funtionsX figure

Syntax
P.figure(Caption,...)

Syntax to capture an existing gure window


his is n osolete syntxD nd will e removed from ss in future releseF se report/userfigure P412 instedF
P.figure(Caption,H,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr | ellstr E itle or ell rry with title nd sutitle displyed t the top of the (gureY see hesription for splitting the title or sutitle into multiple linesF H numeri E ee help on report/userfigure P412 F

Options
captionTypeface= ellstr | hr | \large\bfseries E ve formt ommnds for typesetting the (gure ptionY the suption formt n e entered s the seond ell in ell rryF close= true | false E @snheritle from prent ojetsA glose wtl the underlying (gure window when (nishedF separator= hr | \medskip\par E @snheritle from prent ojetsA ve ommnds tht will e inserted fter the (gureF figureOptions= ell | empty E pigure options tht will e pplied to the (gure hndle fter ll grphs re drwnF figureScale= numeri | .85 E @snheritle from prent ojetsA le of the (gure in the ve doumentF footnote= hr | empty E pootnote t the (gure titleY only shows if the title is nonEemptyF sideways= true | false E @snheritle from prent ojetsA rint the tle rotted y WH degreesF QVU

eport funtionsX findall style= strut | empty E epply this sding style struture to the (gureY see qstyle P423 F subplot= numeri | auto E @snheritle from prent ojetsA uplot division of the (gureF typeface= hr | empty E @xot inheritle from prent ojetsA ve ode speifying the typefe for the (gure s wholeY it must use the delrtive forms @suh s \itshapeA nd not the ommnd forms @suh s \textit{...}AF visible= true | false E @snheritle from prent ojetsA isiility of the underlying wtl (gure windowF

Generic options
ee help on generi options P376 in report ojetsF

Description
pigures re topElevel report ojets nd nnot e nested within other report ojetsD exept align P378 F pigure ojets n hve the following types of hildrenX graph P389 Y empty P385 F

Titles and subtitles


he input rgument Caption n e either text stringD or IEyEP ell rry of stringsF sn the ltter seD the (rst ell will e printed s titleD nd the seond ell will e printed s sutitleF o split the title or sutitle into multiple linesD use the following ve ommnds wrpped in urly rketsX {\\} or {\\[Xpt]}D where X is the width of n extr vertil spe @in pointsA dded etween the respetive linesF

Example

ndall
Find all objects of a given type within report object

QVV

eport funtionsX graph

Syntax
Obj = findall(X,Type1,Type2,...)

Input arguments
X report E eport ojetF Type1D Type2 hr E xmes of report ojets tht will e looked for in report XF

Output arguments
Obj ell E gell rry of ll ojets of the give type@sA found in report XF

Description Example

graph
Add graph to gure
Syntax
P.graph(Caption,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr | ellstr E itleD or ell rry with title nd sutitleD displyed t the top of the grphF

QVW

eport funtionsX graph

Options
axesOptions= ell | empty E @snheritleA yptions exeuted y lling set on the xes hndle efore running postProcess=F dateFormat= hr | YYYY:P E @snheritleA hte formt stringD see help on dat2str P263 F dateTick= numeri | Inf E @snheritleA hte tik spingF legend= false | true E @snheritleA edd legend to the grphF legendLocation= hr | best | bottom E @snheritleA votion of the legend oxY see help on legend for vlues villeF postProcess= hr | empty E @snheritleA tring with wtl ommnds exeuted fter the grph hs een drwn nd styledY the ommnds hve ess to vrile HD hndle to the urrent xes ojetF preProcess= hr | empty E @snheritleA tring with wtl ommnds exeuted efore the grph hs een drwn nd styledY the ommnds hve ess to vrile HD hndle to the urrent xes ojetF range= numeri | Inf E @snheritleA qrph rngeF rhsAxesOptions= ell | empty E @snheritleA yptions exeuted y lling set on the r xes hndle efore running postProcess=F style= strut | empty E @snheritleA epply this style struture to the grph nd its hildrenY see help on qstyle P423 F tight= true | false E @snheritleA et the yExis limits to the minimum nd mximum of displyed dtF xLabel= hr | empty E vel the xExisF yLabel= hr | empty E vel the yExisF zeroLine= true | false E @snheritleA edd horizontl zero line if zero is inluded on the yExisF

Generic options
ee help on generi options P376 in report ojetsF

QWH

eport funtionsX include

Description Example

highlight
Highlight range in graph
Syntax
P.highlight(Caption,Range,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr E gption used to nnotte the highlighted reF Range ell | numeri E hte rngeD or ell rry of rngesD tht will e highlightedF

Options
hPosition= bottom | middle | top E @snheritle from prent ojetsA rorizontl position of the ptionF vPosition= centre | left | right E @snheritle from prent ojetsA ertil position of the ption reltive to the edges of the highlighted reF

Generic options
ee help on generi options P376 in report ojetsF

Description Example

QWI

eport funtionsX matrix

include
Include text or LaTeX input le in the report
Syntax
P.include(Caption,FileName,...)

Input arguments
P strut E eport ojet reted y the funtion report.new P398 F Caption hr E gption displyed t the top of the (le inludedF FileName hr E pile nme tht will e inluded hereF

Options
centering= true | false E @snheritle from prent ojetsA gentre the ontent of the (le on the pgeF
Ai ommnds tht separator= hr | empty E @xot inheritle from prent ojetsA v will e inserted fter the tleF Ai ode speifying typeface= hr | empty E @xot inheritle from prent ojetsA v the typefe for the inlude element s wholeY it must use the delrtive forms @suh s \itshapeA nd not the ommnd forms @suh s \textit{...}AF

verbatim= true | false E @xot inheritle from prent ojetsA inlose the ontent of the (le in vertim environmentF

Generic options
ee help on generi options P376 in report ojetsF

Description Example

QWP

eport funtionsX matrix

matrix
Insert matrix or numeric array
Syntax
P.matrix(Caption,Data,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr | ellstr E itle or ell rry with title nd sutitle displyed t the top of the mtrixY see hesription for splitting the title or sutitle into multiple linesF Data numeri E xumeri rry with input dtF

Options
arrayStretch= numeri | 1.15 E @snheritle from prent ojetsA treth etween lines in the mtrix @in ptsAF
A

'* ] - LTEX format commands for typesetting the matrix caption; the subcaption format can be entered as the second cell in a cell array. colNames= [ cellstr | empty ] - (Inheritable from parent objects) Names for individual matrix columns, displayed at the top of the matrix. colWidth= [ numeric | NaN ] - (Inheritable from parent objects) Width, or a vector of widhts, of the matrix columns in emunits; NaN means the width of the column will adjust automatically. condFormat= [ struct | empty ] - (Inheritable from parent objects) Structure with .test and .format elds describing conditional formatting of individual matrix entries. footnote= [ char | empty ] - Footnote at the matrix title; only shows if the title is non-empty.
captionTypeface= ellstr | hr | B9 QWQ

eport funtionsX matrix

[ char | %.2f ] - (Inheritable from parent objects) Numeric format string; see help on the built-in sprintf function. heading= [ char | empty ] - (Inheritable from parent objects) Usersupplied heading, i.e. an extra row or rows at the top of the matrix. inf= [ char | $\infty$ ] - (Inheritable from parent objects) L TEX string that will be used to typeset Infs. long= [ true | false ] - (Inheritable from parent objects) If true, the matrix may stretch over more than one page. longFoot= [ char | empty ] - (Inheritable from parent objects) Works only with long= true: Footnote that appears at the bottom of the matrix (if it is longer than one page) on each page except the last one. longFootPosition= [ centre | left | right ] - (Inheritable from parent objects) Works only with long= true: Horizontal alignment of the footnote in long matrices. nan= [ char | $\cdots$ ] - (Inheritable from parent objects) L TEX string that will be used to typeset NaNs. pureZero= [ char | empty ] - (Inheritable from parent objects) L TEX string that will be used to typeset pure zero entries; if empty the zeros will be printed using the current numeric format. printedZero= [ char | empty ] - (Inheritable from parent objects) LTEX string that will be used to typeset the entries that would appear as zero under the current numeric format used; if empty these numbers will be printed using the current numeric format. rotateColNames= [ true | false | numeric ] - Rotate the names of columns by the specied number of degrees; true means rotate by 90 degrees. rowNames= [ cellstr | empty ] - (Inheritable from parent objects) Names fr individual matrix rows, displayed left of the matrix. separator= [ char | \medskip\par ] - (Inheritable from parent objects) LTEX commands that will be inserted after the matrix.
format=
A A A A A

QWR

eport funtionsX matrix

[ true | false ] - (Inheritable from parent objects) Print the matrix rotated by 90 degrees. tabcolsep= [ NaN | numeric ] - (Inheritable from parent objects) Space between columns in the matrix, measured in em units; NaN means the LTEX default. typeface= [ char | empty ] - (Not inheritable from parent objects) LTEX code specifying the typeface for the matrix as a whole; it must use the declarative forms (such as \itshape) and not the command forms (such as \textit{...}).
sideways=
A A

Generic options
ee help on generi options P376 in report ojetsF

Description

Conditional formatting
he onditionl formt strut @or n rry of strutsA spei(ed through the condFormat= option must hve two (eldsD .test nd .formatF he .test (eld is text string with wtl expressionF he expression must evlute to slr true or falseD nd n refer to the following ttriutes ssoited with eh entry in the dt prt of the mtrixX value E the numeril vlue of the entryY row E the row numer within the dt prt of the mtrixY col E the olumn numer within the dt prt of the mtrixY rowname E the row nme right of whih the entry ppersY colname E the olumn nme under whih the entry ppersY rowvalues E row vetor of ll vlues in the urrent rowY colvalues E olumn vetor of ll vlues in the urrent olumnY allvalues E mtrix of ll vluesF ou n omine numer of ttriues within one testD using the logil opertorsD eFgF QWS

eport funtionsX merge


value > && row > 3 value == max(rowvalues) && strcmp(rowname,x)

he .format (elds of the onditionl formt struture onsist of ve ommnds tht will e use to typeset the orresponding entryF he referene to the entry itself is through question mrkF he entries re typeset in mth modeY this for instne mense tht for old or itli typfeD you must use the \mathbf{...} nd \mathit{...} ommndsF sn ddition to stndrd ve ommndsD you n use the following ss ommnds in the formt stringsX \sprintf{FFFF} E to modify the wy eh numeri entry tht psses the test is printed y the sprintf funtionY FFFF is one of the stndrd sprintf formttting stringsF ou n omine multiple tests nd their orreponding formts in one strutureY they will e ll pplied to eh entry in the spei(ed orderF

Titles and subtitles


he input rgument Caption n e either text stringD or IEyEP ell rry of stringsF sn the ltter seD the (rst ell will e printed s titleD nd the seond ell will e printed s sutitleF o split the title or sutitle into multiple linesD use the following ve ommnds wrpped in urly rketsX {\\} or {\\[Xpt]}D where X is the width of n extr vertil spe @in pointsA dded etween the respetive linesF

Example

merge
Merge the content of two or more report objects
Syntax
P.merge(P1,P2,...)

QWT

eport funtionsX modelfile

Input arguments
P report E eport ojet reted y the report.new P398 funtionF P1D P2 report E yther report ojets whose ontents will e dded to P in order of pperneF

Description Example

modelle
Write formatted model le
Syntax
P.modelfile(Caption,FileName,...) P.modelfile(Caption,FileName,M,...)

Input arguments
P report E eport ojet reted y the report.new P398 funtionF Caption hr | ellstr E itle nd sutitle displyed t the top of the tleF FileName hr E wodel (le nmeF M model E wodel ojet from whih the vlues of prmeters nd std devs of shoks will e redY if missing no prmeter vlues or std devs will e printedF

Options
latexAlias true | false E ret lis in lels s ve ode nd typeset it tht wyF lines= numeri | Inf E rint only seleted lines of the model (le FileNameY Inf mens ll lines will e printedF lineNumbers= true | false E hisply line numersF

QWU

eport funtionsX new footnote= hr | empty E pootnote t the model (le titleY only shows if the title is nonEemptyF paramValues= true | false E hisply the vlues of prmeters nd std devs of shoks next to eh ourene of prmeter or shokY this option works only if model ojet M is entered s the Qrd input rgumentF syntax= true | false E righlight model (le syntxY this inludes model lnguge keyE wordsD desriptions of vrilesD shoks nd prmetersD nd eqution lelsF typeface= hr | empty E @xot inheritle from prent ojetsA ve ode speifying the typefe for the model (le s wholeY it must use the delrtive forms @suh s \itshapeA nd not the ommnd forms @suh s \textit{...}AF

Description
sf you enter model ojet with multiple prmeteristionsD only the (rst prmeteristion will get reportedF et the momentD the syntx highlighting in model (le reports does not hndle orretly omment loksD iFeF %{ ... %}F

Example

new
Create new, empty report object
Syntax
P = report.new(Caption,...)

Output arguments
P strut E eport ojet with funtion hndles through wih the individul report elements n e retedF Caption hr E eport ptionY the ption will lso e printed on the title pge of the report if pulished with the option makeTitle= trueF QWV

eport funtionsX publish

Options
centering= true | false E ell report elementsD exept tex P410 D will e entered on the pgeF orientation= landscape | portrait9 E per orienttion of the pulished reportF eport options re sdingF ou n speify ny of n ojet9s options in ny of his prent @or sendntA ojetsF

pagebreak
Force page break
Syntax
P.pagebreak(Caption,...)

Input arguments
P report E eport ojet reted y the report.new P398 funtionF Caption hr E gption for the pgerek ojetY the ption only displys in the onEsreen report strutureF

Generic options
ee help on generi options P376 in report ojetsF

Description Example

publish
Compile PDF from report object
QWW

eport funtionsX publish

Syntax
[OutpFile,Rerun] = P.publish(InpFile,...)

Input arguments
P strut E eport ojet reted y the report.new funtionF InpFile hr E pile nme under whih the ompiled hp will e svedF

Output arguments
OutpFile hr E xme of the resulting hpF Rerun numeri E xumer of times the ve ompiler ws run to ompile the hpF

Options
abstract= hr | empty E estrt tht will displyed on the title pgeF abstractWidth= numeri | 1 E idth of the strt on the pge s perentge of the full defult width @etween nd 1AF author= hr | empty E vist of uthors on the title pge seprted with \and or \\F cd= true | false E sf true do not use the pdflatex option -include-directory nd insted hnge the diretory @cdA temporrily to the lotion of the input (leY this is workround for systems where pdflatex does not support the option -include-directoryF cleanup= true | false E helete ll temporry (les reted when ompiling the reportF compile= true | false E gompile the soure (les to n tul hpY if false only the soure (les re retedF date= hr | \today E hte on the title pgeF
Aiompiler report on the (nl itertionF display= true | false E hisply the v

echo= true | false E sf trueD the optionl )g -echo will e used in the wtl funtion system when ompiling the hpY this uses the sreen output nd ll prompts to e displyed for eh run of the ompilerF epsToPdf= hr | Inf E gommnd line rguments for iyhpY Inf mens yEspei( rguments re usedF RHH

eport funtionsX section


Ai font enodingF fontEnc= hr | T1 E v

makeTitle= true | false E rodue title pge @with titleD uthorD dteD nd strtAF package= hr | ellstr | empty E kge or list of pkges tht will e imported in the premle of the ve (leF paperSize= a4paper | letterpaper E per sizeF orientation= landscape | portrait E per orienttionF
Ai ommnds tht will e pled in the v Ai (le premleF preamble= hr | empty E v

timeStamp= hr | datestr(now()) E tring printed in the topEleft orner of eh pgeF tempDir= hr | tempname(cd()) E hiretory for storing temporry (lesY the diretory is deleted t the end of the exeution if it9s emptyF
Ai maxRerun= numeri | 5 E wximum numer of times the v ompiler will e run to resolve rossEreferenesD etF Ai minRerun= numeri | 1 E winimum numer of times the v ompiler will e run to resolve rossEreferenesD etF

textScale= numeri | .8 E erentge of the totl pge re tht will e usedF

Description

Dierence between display= and echo=


here re two di'erenes etween these otherwise similr optionsX hen pulishing the (nl hpD the hpve ompiler my e lled more thn one to resolve rossEreferenesD the tle of ontentsD nd so onF etting display= true only displys the sreen output from the (nl itertion onlyD while echo= true displys the sreen outputs from ll itertionsF
Ai odeD the ompiler my stop nd prompt sn the se of ompiler error unrelted to the v the user to respondF he prompt only ppers on the sreen when echo= trueF ytherwiseD wtl my remin in usy stte with no onEsreen informtionD nd Ctrl+C my e needed to regin ontrolF

Example

RHI

eport funtionsX series

section
Start new section in report
Syntax
P.section(CAP,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF CAP hr E etion titleF

Options
numbered= true | false E @snheritedA xumered setionF
Ai ommnds tht will e inserted fter separator= hr | empty E @xot inheritedA v the tleF

Generic options
ee help on generi options P376 in report ojetsF

Description Example

series
Add new data to graph or table
Syntax
P.series(Cap,X,...)

RHP

eport funtionsX series

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Cap hr E gption used s defult legend entry in grphD or in the leding olumn in tleF X tseries E snput dt tht will e dded to the urrent tle or grphF

Options for both table series and graph series


marks= ellstr | empty E @snheritle from prent ojetsA wrks tht will e dded to the legend entries in grphsD or printed in third olumn in tlesD to distinguish the individul olumns of possily multivrite input tseries ojetsF showMarks= true | false E @snheritle from prent ojetsA se the mrks de(ned in the marks= option to lel the individul rows when input dt is multivrite tseries ojetF

Options for table series


autoData= funtionhndle | ell | empty E puntionD or ell rry of funtionsD tht will e used to produe new olumns in the input tseries ojet @iFeF new rows of ouput in the reportAF condFormat= strut | empty E @snheritle from prent ojetsA truture with Ftest nd Fformt (elds desriing onditionl formtting of individul tle entriesF decimal= numeri | NaN E @snheritle from prent ojetsA xumer of deimls tht will e displyedY if xx the format= option is used instedF format= hr | %.2f E @snheritle from prent ojetsA xumeri formt stringY see help on the uiltEin sprintf funtionF footnote= hr | empty E pootnote t the series textF highlight= numeri | empty E @snheritle from prent ojetsA eriods tht will get highlighted in tlesY to highlight dte rnges in grphsD use the highlight= option in the prent grph ojetF inf= hr | \ensuremath{\infty} E @snheritle from prent ojetsA ve string tht will e used to typeset snf entriesF nan= hr | \ensuremath{\cdot} E @snheritle from prent ojetsA ve string tht will e used to typeset xx entriesF

RHQ

eport funtionsX series pureZero= hr | empty E @snheritle from prent ojetsA ve string tht will e used to typeset pure zero entriesY if empty the zeros will e printed using the urrent numeri formtF printedZero= hr | empty E @snheritle from prent ojetsA ve string tht will e used to typeset the entries tht would pper s zero under the urrent numeri formt usedY if empty these numers will e printed using the urrent numeri formtF separator= hr | empty E @xot inheritle from prent ojetsA ve ommnds tht will e inserted immeditely fter the end of the tle rowD iFeF ppended to D within tulr modeF units= hr E @snheritle from prent ojetsA hesription of input dt units tht will e displyed in the seond olumn of tlesF

Options for graph series


legend= hr | ellstr | NaN | Inf E @xot inheritle from prent ojetsA vegend entries used insted of the series ption nd mrksY snf mens the ption nd mrks will e used to onstrut legend entriesY xx mens the series will e exluded from legendF plotFunc= @area | @bar | @barcon | @plot | @plotcmp | @plotpred | @stem E @snheritle from prent ojetsA lot funtion tht will e used to rete grphsF plotOptions= ell | empty E yptions pssed s the lst input rguments to the plot funtionF yAxis= left | Bright E ghoose the vr or r xis to plot this seriesY see lso omments on vrEr plots in hesriptionF

Generic options
ee help on generi options P376 in report ojetsF

Description

Using the nan=, inf=, pureZero= and printedZero= options


hen speifying the ve string for these optionsD er in mind tht the tle entries re printed in the mth modelF his mens tht whenever you wish to print norml textD you need to use n pproprite text formtting ommnd llowed within mth modeF wost frequentlyD it would e \textnormal{...}F

RHR

eport funtionsX series

Using the plotFunc= option


hen you set the option to plotpredD the input dt X @seond input rgumentA must e multiolumn tseries ojet where the (rst olumn is the time series oservtionsD nd the seond nd further olumns re its ulmn (lter preditions s returned y the filter funtionF

Conditional formatting
he onditionl formt strut @or n rry of strutsA spei(ed through the condFormat= option must hve two (eldsD .test nd .formatF he .test (eld is text string with wtl expressionF he expression must evlute to slr true or flseD nd n refer to the following ttriutes ssoited with eh entry in the dt prt of the tleX value E the numeril vlue of the entryD date E the dte under whih the entry ppersD year E the yer under whih the entry ppersD period E the period within the yer @eFgF month or qurterA under whih the entry ppersD freq E the frequeny of the dte under whih the entry ppersD text E the text lel on the leftD mark E the text mrk on the left used to desrie the individul rows reported for multivrite seriesD row E the row numer within multivrite seriesF rowvalues E row vetor of ll vlues on the urrent rowF sf the tle is sed on userEde(ned struture of olumns @option colstruct= in table P407 AD the following dditionl ttriutes re ville colname E desriptor of the olumn @text in the hedlineAF ou n omine numer of ttriues within one testD using the logil opertorsD eFgF
value > && year > 2 1

RHS

eport funtionsX subheading he .format (elds of the onditionl formt struture onsist of ve ommnds tht will e use to typeset the orresponding entryF he referene to the entry itself is through question mrkF he entries re typeset in mth modeY this for instne mense tht for old or itli typfeD you must use the \mathbf{...} nd \mathit{...} ommndsF sn ddition to stndrd ve ommndsD you n use the following ssEspei( ommnds in the formt stringsX \sprintf{FFFF} E to modify the wy eh numeri entry tht psses the test is printed y the sprintf funtionY FFFF is one of the stndrd sprintf formttting stringsF \hide{?} E to hide the tul entry when it is supposed to e repled with something elseF ou n omine multiple tests nd their orreponding formts in one strutureY they will e ll pplied to eh entry in the spei(ed orderF

LHS-RHS plots
he vrEr report grphs re still n experimentl fetureF hen the option yAxis= is used to plot on oth the vr nd the r yExisD the plot funtions re restrited to @plotD @barD @area nd @stemF elsoD euse of ug in wtlD lwys ontrol the olor of the linesD rs nd res in ll vrEr grphsX use either the option plotOptions= in this ommndD or style= in the respetive graph P389 ommndF

Example of a conditional format structure


cf = struct(); cf(1).test = value < ; cf(1).format = \mathit{?}; cf(2).test = date < qq(2 1 ,1); cf(2).format = \color{blue};

subheading
Enter subheading in table
Syntax
P.subheading(CAP,...)

RHT

eport funtionsX table

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF CAP hr E ext displyed s suheding on seprte line in the tleF

Options
justify= c | l | r E @snheritle from prent ojetsA rorizontl lignment of the suheding @entreD leftD rightAF separator= hr | empty E @xot inheritle from prent ojetsA ve ommnds tht will e inserted immeditely fter the end of the tle rowD iFeF ppended to D within tulr modeF stretch= true | false E @snheritle from prent ojetsA treth the suheding text lso ross the dt prt of the tleY if not the text will e ontined within the initil desriptive olumnsF typeface= hr | \itshape\bfseries E @xot inheritle from prent ojetsA ve ode speifying the typefe for the suhedingY it must use the delrtive forms @suh s \itshapeA nd not the ommnd forms @suh s \textit{...}AF

Generic options
ee help on generi options P376 in report ojetsF

Description Example

table
Start new table

RHU

eport funtionsX table

Syntax
P.table(Caption,...)

Input arguments
P report E eport ojet reted y the report.new P398 funtionF Caption hr | ellstr E itle or ell rry with title nd sutitle displyed t the top of the tleY see hesription for splitting the title or sutitle into multiple linesF

Options
arrayStretch= numeri | 1.15 E @snheritle from prent ojetsA treth etween lines in the tle @in ptsAF captionTypeface= ell | \large\bfseries E ve formt ommnds for typesetting the tle ption nd suptionY you n use snf for either to indite the defult formtF colStruct= strut | empty E @xot inheritle from prent ojetsA serEde(ned struture of the tle olumnsY use of this option disles range=F colWidth= numeri | NaN E @snheritle from prent ojetsA idthD or vetor of widhtsD of the tle olumns in emunitsY NaN mens the width of the olumn will djust utomtillyF headlineJustify= c | l | r E rorizontl lignment of the hedline entries @indiE vidul dtes or userEde(ned textAX gentreD veftD ightF dateFormat= hr | ellstr | irisget(dateformat) E @snheritle from prent ojetsA pormt string for the dte rowF footnote= hr | empty E pootnote t the tle titleY only shows if the title is nonEemptyF long= true | false E @snheritle from prent ojetsA sf trueD the tle my streth over more thn one pgeF longFoot= hr | empty E @snheritle from prent ojetsA orks only with long=atrueX pootnote tht ppers t the ottom of the tle @if it is longer thn one pgeA on eh pge exept the lst oneF longFootPosition= centre | left | right E @snheritle from prent ojetsA orks only with long= trueX rorizontl lignment of the footnote in long tlesF range= numeri | empty E @snheritle from prent ojetsA hte rnge or vetor of dtes tht will pper s olumns of the tleF RHV

eport funtionsX table


Ai ommnds separator= hr | \medskip\par E @snheritle from prent ojetsA v tht will e inserted fter the tleF

sideways= true | false E @snheritle from prent ojetsA rint the tle rotted y WH degreesF tabcolsep= NaN | numeri E @snheritle from prent ojetsA pe etween olumns in Ai defultF the tleD mesured in em unitsY xx mens the v
Ai ode speifying typeface= hr | empty E @xot inheritle from prent ojetsA v the typefe for the tle s wholeY it must use the delrtive forms @suh s \itshapeA nd not the ommnd forms @suh s \textit{...}AF

vline= numeri | empty E @snheritle from prent ojetsA etor of dtes fter whih vertil line @dividerA will e pledF

Generic options
ee help on generi options P376 in report ojetsF

Description
les re topElevel report ojets nd nnot e nested within other report ojetsD exept align P378 F le ojets n hve the following hildrenX series P402 Y subheading P406 F fy defultD the dte row is printed s leding row with dtes formted using the option dateFormat=F elterntivelyD you n speify this option s ell rry of two stringsF sn tht seD the dtes will e printed in two rowsF he (rst row will hve dte string displyed nd entred for every yerD nd the (rst ell of the dateFormat= option will e used for formttingF he seond row will hve dte displyed for every period @iFeF every olumnAD nd the seond ell of the dateFormat= option will e used for formttingF

User-dened structure of the table columns


se n use the columnStruct= option to de(ne your own tle olumnsF his gives you more )exiility thn when using the range= option in de(ning the ontent of the tleF he option columnStruct= must e IEyEx strutD where x is the numer of olumns you wnt in the tleD with the following (eldsX

RHW

eport funtionsX tex name= E spei(es the desriptor of the olumn tht will e displyed in the hedlineY func= E spei(es funtion tht will e pplied to the input seriesY if func= is emptyD no funtion will e ppliedF he funtion must evlute to tseries or numeri slrF date= E spei(es the dte t whih numer will e tken from the series unless the funtion func= pplied efore resulted in numeri slrF

Titles and subtitles


he input rgument Caption n e either text stringD or IEyEP ell rry of stringsF sn the ltter seD the (rst ell will e printed s titleD nd the seond ell will e printed s sutitleF o split the title or sutitle into multiple linesD use the following ve ommnds wrpped in urly rketsX {\\} or {\\[Xpt]}D where X is the width of n extr vertil spe @in pointsA dded etween the respetive linesF

Example
gompre the heders of these two tlesX
x = report.new(); x.table(First table, ... range,qq(2 1 ,1):qq(2 12,4), ... dateformat,YYYYFP); % You can add series or subheadings here. x.table(Second table, ... range,qq(2 1 ,1):qq(2 12,4), ... dateformat,{YYYY,FP}); % You can add series or subheadings here. x.publish(myreport.pdf);

tex
A Include L TEX code or verbatim text input in report

RIH

eport funtionsX tex

Syntax with input specied in comment block


P.tex(Cap,...) %{ Write text or \LaTeX\ code as a block comment right after the P.tex(...) command. %}

Syntax with input specied as char argument


P.tex(Cap,Code,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Cap hr E gption displyed t the top of the textF
Ai ode or text input tht will e inluded in the reportF Code hr E v

Options
Ai ode or centering= true | false E @snheritle from prent ojetsA gentre the v text input on the pgeF

footnote= hr | empty E pootnote t the tex lok titleY only shows if the title is nonEemptyF separator= hr | \medskip\par E @snheritle from prent ojetsA ve ommnds tht will e inserted fter the textF verbatim= true | false E sf true the text will e typeset vertim in monosped fontY Ai if flse the text will e treted s v ode inluded in the reportF

Generic options
ee help on generi options P376 in report ojetsF

RII

eport funtionsX userfigure

Description Example

usergure
Insert existing gure window
Syntax
P.userfigure(Caption,H,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr | ellstr E itle or ell rry with title nd sutitle displyed t the top of the (gureY see hesription for splitting the title or sutitle into multiple linesF H numeri E rndle to grphis (gure reted y the user tht will e ptured nd inserted in the reportF

Options
ee help on report/figure P386 for options villeF

Generic options
ee help on generi options P376 in report ojetsF

Description
he funtion report/userfigure inserts n existing (gure window @reted y the user y stndrd wtl ommndsD nd referened y its hndleD HA into reportX he (gure nd the grphs in it must e reted efore you ll report/figureX ny hnges or dditions to the (gure or its grphs mde fter you ll the funtion will not show in the reportF RIP

eport funtionsX vline he report (gure nnot hve ny hildrenY in other wordsD you nnot ll report/graph P389 fter ll to report/figure with grphis hndleD HF

Titles and subtitles


he input rgument Caption n e either text stringD or IEyEP ell rry of stringsF sn the ltter seD the (rst ell will e printed s titleD nd the seond ell will e printed s sutitleF o split the title or sutitle into multiple linesD use the following ve ommnds wrpped in urly rketsX {\\} or {\\[Xpt]}D where X is the width of n extr vertil spe @in pointsA dded etween the respetive linesF

Example

vline
Add vertical line to graph
Syntax
P.vline(Caption,Date,...)

Input arguments
P strut E eport ojet reted y the report.new P398 funtionF Caption hr E gption used to nnotte the vertil lineF Date numeri E hte t whih the vertil line will e plottedF

Options
hPosition= bottom | middle | top E @snheritle from prent ojetsA rorizontl position of the ptionF vPosition= centre | left | right E @snheritle from prent ojetsA ertil position of the ption reltive to the lineF

RIQ

eport funtionsX vline timePosition= after | before | middle E lement of the vertil line on the time xisX in the middle of the spei(ed periodD immeditely efore it @etween the spei(ed period nd the previous oneAD or immeditely fter it @etween the spei(ed period nd the next oneAF

Generic options
ee help on generi options P376 in report ojetsF

Description Example

RIR

uikEreport (le lngugeX !++

21 Quick-report le language


Figures
!++ P415 E grete new (gure windowF #MxN P418 E peify the suplot division of the (gure windowsF (gure windowsF

Graphs
!-- P416 E grete new line grphF !:: P416 E grete new r grphF !ii P418 E grete new stem grphF !II P417 E grete new errorr grphF ! P417 E grete new histogrmF !.. P416 E kip the urrent suplot position leving it lnkF

Formatting graph titles


// P419 E vine rek in grph titleF __ P419 E utitle in grph titleF

Getting on-line help on qreport le language


help qreportlang help qreportlang/keyword

!++
Create new gure window
Syntax
!++ figure_caption

RIS

uikEreport (le lngugeX !::

Description Example

!
Create new line graph
Syntax
!-- graph_caption expression1, expression2, ...

Description Example

!..
Skip the current subplot position leaving it blank
Syntax
!..

Description Example

!::
Create new bar graph
RIT

uikEreport (le lngugeX !II

Syntax
!:: graph_caption expression1, expression2, ...

Description Example

!^^
Create new histogram
Syntax
!^^ graph_caption expression1, expression2, ...

Description Example

!II
Create new errorbar graph
Syntax
!II TITLE EXPRESSION1, EXPRESSION2, ...

RIU

uikEreport (le lngugeX #MxN

Description Example

!ii
Create new stem graph
Syntax
!ii TITLE EXPRESSION1, EXPRESSION2, ...

Description Example

#MxN
Specify the subplot division of the gure windows
Syntax with user-suplied subdivision
#MxN

Syntax for automatic subdivision


#auto

Input arguments
M numeri E xumer of rows of grphs in eh (gure window from this point onF RIV

uikEreport (le lngugeX __ N numeri E xumer of olumns of grphs in eh (gure window from this point onF

Description Example
his ommnd produes (gure windows with QxP grphs in ehF
#3x2

//
Line break in graph title
Syntax
!-- FIRST LINE // SECOND LINE // ...

Description Example

__
Subtitle in graph title
Syntax
!-- TITLE __ SUBTITLE

RIW

uikEreport (le lngugeX __

Description Example

RPH

uikEreport funtionsX qplot

22 Quick-report functions
Quick-report functions
qplot P421 E uik reportF qstyle P423 E epply styles to grphis ojet nd its desndntsF

Getting on-line help on qreport functions


help qreport help qreport/function_name

qplot
Quick report
Syntax
[FF,AA,PDb] = qplot(QFile,D,Range,...)

Input arguments
QFile hr E xme of the qE(le tht de(nes the ontents of the individul grphsF D strut E htse with input dtF Range numeri E hte rngeF

Output arguments
FF numeri E rndles to (gures reted y qplotF AA ell E rndles to xes reted y qplotF PDb strut E htse with tully plotted seriesF

RPI

uikEreport funtionsX qplot

Options
addClick= true | false E wke xes expnd in new grphis (gure upon mouse likF caption= ellstr | domment | empty E trings tht will e used for titles in the grphs tht hve no title in the qE(leF clear= numeri | empty E eril numers of grphs @xes ojetsA tht will not e displyedF dbsave= ellstr | empty E yptions pssed to dbsave when saveAs= is usedF drawNow= true | false E gll wtl drawnow funtion upon ompletion of ll (guresF grid= true | false E edd grid lines to ll grphsF highlight= numeri | ell | empty E hte rnge or rnges tht will e highlightedF interpreter= latex | none9 E snterpreter used in grph titlesF mark= ellstr | empty E wrks tht will e dded to eh legend entry to distinguish individul olumns of multivrited tseries ojets plottedF overflow= true | false E ypen utomtilly new (gure window if the numer of suplots exeeds the ville totlY overflow = false mens n error will our instedF prefix= hr | P%g_ E re(x @ sprintf formt stringA tht will e used to preede the nme of eh entry in the PDb dtseF round= numeri | Inf E ound the input dt to this numer of deimls efore plottingF saveAs= hr | empty E pile nme under whih the plotted dt will e sved either in g dt (le or hpY you n use the dbsave= option to ontrol the options used when sving gF style= strut | empty E tyle struture tht will e pplied to ll (gures nd their hildren reted y the qplot funtionF subplot= uto9 | numeri E hefult suplot division of (guresD n e modi(ed in the qE(leF sstate= strut | model | empty E htse or model ojet from whih the stedyEstte vlues referened to in the quikEreport (le will e tkenF style= strut | empty E tyle struture tht will e pplied to ll reted (gures upon ompletionF transform= funtionhndle | empty E puntion tht will e used to trns tight= true | false E wke the yExis in eh grph tightF RPP

uikEreport funtionsX qstyle vLine= numeri | empty E htes t whih vertil lines will e plottedF zeroLine= true | false E edd horizontl zero line to grphs whose yExis inludes zeroF

Description Example

qstyle
Apply styles to graphics object and its descandants
Syntax
qstyle(H,S,...)

Input arguments
H numeri E rndle to (gure or xes ojet tht will e styled together with its desndnts @unless cascade= is flseAF S strut E trut eh (eld of whih refers to n ojetEdotEpropertyY the vlue of the (eld will e pplied to the the respetive property of the respetive ojetY see elow the list of grphis ojets llowedF

Options
cascade= true | false E gsde through ll desendnts of the ojet HY if flse only the ojet H itself will e styledF warning= true | false E hisply wrnings produed y this funtionF

Description
he style strutureD SD is onstruted of ny numer of nested ojetEproperty (eldsX
S.object.property = value;

RPQ

uikEreport funtionsX qstyle he following is the list of stndrd wtl grhis ojets the topElevel (elds n refer toX figureY axesY titleY xlabelY ylabelY zlabelY lineY barY patchY textF sn dditionD you n lso refer to the following speil instnes of ojets reted y ss funtionsX rhsaxes @n r xes ojet reted y plotyyA legend @represented y n xes ojetAY plotpred @line ojets with predition dt reted y plotpredAY highlight @ pth ojet reted y highlightAY highlightcaption @ text ojet reted y highlightAY vline @ line ojet reted y vlineAY vlinecaption @ text ojet reted y vlineAY zeroline @ line ojet reted y zerolineAF he property used s the seondElevel (eld is simply ny regulr wtl property of the respetive ojet @see wtl help on grphisAF he vlue ssigned to prtiulr property n e either of the followingX single proper vlid vlue @iFeF vlue you would e le to ssign using the stndrd wtl set funtionAY

RPR

uikEreport funtionsX qstyle ell rry of multiple di'erent vlues tht will e ssigned to the ojets of the sme type in order of their retionY text string strting with doule exlmtion pointD !!D followed y wtl ommndsF he ommnds re expeted to eventully rete vrile nmed SET whose vlue will then ssigned to the respetive propertyF he ommnds hve ess to vrile HD hndle to the urrent ojetF

Example

RPS

qrphis funtionsX bottomlegend

23 Graphics functions
Graphics functions
bottomlegend P426 E rorizontl grph legend displyed t the ottom of the (gure windowF ftitle P427 E edd title to (gure windowF highlight P428 E righlight spei(ed rnge or dte rnge in grphF hline P438 E edd vertil line with text ption t the spei(ed positionF maxfigure P429 E grete grphis window mximised ross the entire sreenF movetobkg P429 E wove grphis ojets to the kgroundF movetosubplot P430 E wove n existing xes ojet or legend to spei(ed suplot positionF plotcircle P431 E hrw irle or disF plotpp P434 E lot prior ndGor posterior distriutions ndGor posterior modeF plotmat P431 E isulise Ph mtrixF plotneigh P433 E lot lol ehviour of ojetive funtion fter estimtionF vline P436 E edd vertil line with text ption t the spei(ed positionF zeroline P437 E edd zero line if Exis limits inlude zeroF

Getting on-line help on qreport functions


help grfun help grfun/function_name

bottomlegend
Horizontal graph legend displayed at the bottom of the gure window
Syntax
Le = grfun.bottomlegend(Entry,Entry,...)

RPT

qrphis funtionsX ftitle

Input arguments
Entry hr | ellstr E vegend entriesY sme s in the stndrd legend funtionF

Output arguments
AX numeri E rndle to the legend xes ojet retedF

Description Example

ftitle
Add title to gure window
Syntax
AA = grfun.ftitle(Titles,...) AA = grfun.ftitle(FF,Titles,...)

Input arguments
FF numeri | strut E rndle to (gure window or windowsY or strut tht inludes (eld nme figureF Titles ellstr | hr E ext string to e entredD or ell rry of strings to e pled on the vrD entredD nd on the r of the (gureF

Output arguments
AA numeri E rndle or hndles to nnottion ojetsF

Options
location= north | west | east | south E votion of the (gure titleX topD left edge sidewysD right edge sidewysD ottomF RPU

qrphis funtionsX highlight

Description Example

highlight
Highlight specied range or date range in a graph
Syntax
[Pt,Cp] = highlight(Range,...) [Pt,Cp] = highlight(Ax,Range,...)

Input arguments
Range numeri E Exis rnge or dte rnge tht will e highlightedF Ax numeri E rndle@sA to xes ojet@sA in whih the highlight will e mdeF

Output arguments
Pt numeri E rndle to the highlighted re @pth ojetAF Cp numeri E rndle to the ption @text ojetAF

Options
caption= hr E ennotte the highlighted re with this text stringF color= numeri | HFWDHFWDHFW E en qf olor ode or wtl olor nmeF excludeFromLegend= true | false E ixlude the highlighted re from legendF hPosition= enter9 | left9 | right9 E rorizontl position of the ptionF vPosition= ottom9 | middle9 | top9 | numeri E ertil position of the ptionF

RPV

qrphis funtionsX movetobkg

Description Example

maxgure
Create graphics window maximised across the entire screen
Syntax
Fig = maxfigure(...)

Output arguments
Fig numeri E rndle to the (gure retedF

Options
ee help on stndr figure for the options villeF

Description
he funtion maxfigure uses get( ,screenSize) to determine the size of the sreenD nd sets the (gure property outerPosition ordinglyF

Example

movetobkg
Move graphics objects to the background

RPW

qrphis funtionsX plotcircle

Syntax
grfun.movetobkg(Parent,Children)

Input arguments
Parent numeri E qrphis hndle to prent ojetF Children numeri E qrphis hndle to hildren tht will e moved to the kgroundF

Description Example

movetosubplot
Move an existing axes object or legend to specied subplot position
Syntax
Ax = movetosubplot(Ax,M,N,P)

Input arguments
Ax numeri E rndle to n existing xes ojet or legendF MD ND P numeri E pei(tion of the new positionY see help on stndrd subplotF

Output arguments
AX numeri E rndle to the xes or legend moved to the new positionF

Description Example

RQH

qrphis funtionsX plotmat

plotcircle
Draw a circle or disc
Syntax
H = grfun.plotcircle(X,Y,RAD,...)

Input arguments
X numeri E Exis lotion of the entre of the irleF Y numeri E Exis lotion of the entre of the irleF RAD numeri E dius of the irleF

Output arguments
H numeri E rndle to the line or the (lled reF

Options
fill= true | false E with etween irle @fill= falseA nd dis @fill= trueAF eny property nmeEvlue pir vlid for line grphsF

Description Example

plotmat
Visualise 2D matrix
Syntax
[HPos,HNeg,HNanInf,HMax] = grfun.plotmat(X,...)

RQI

qrphis funtionsX plotneigh

Short-cut syntax
[HPos,HNeg,HNanInf,HMax] = plotmat(X,...)

Input arguments
X numeri E Ph mtrix tht will e visulisedY xh mtries will e unfolded in Pnd dimension efore plottingF

Output arguments
HPos numeri E rndles to diss displying nonEnegtive entriesF HNeg numeri E rndles to diss displeying negtive entriesF HNanInf numeri E rndles to xx or snf mrksF HMax numeri E rndles to irles displying mximum vlueF

Options
colNames= hr | ellstr | empty | auto E xmes tht will e given to the olumns of the mtrixF rowNames= hr | ellstr | empty | auto E xmes tht will e give to the row of the mtrixF maxCircle= true | false E sf trueDdisply irle denoting the mximum vlue round eh entryF nanInf= hr | X E epperne of NaN nd Inf entriesF showDiag= true | false E sf falseD hide the entries on the min digonl y setting them to NaNF scale= numeri | auto E wximum vlue @positiveA reltive to whih ll mtrix entries will e sledY y defult the sle is the mximum entry in the input mtrixD max(max(abs(X(isfinite(X))))F

Description Example

RQP

qrphis funtionsX plotneigh

plotneigh
Plot local behaviour of objective function after estimation
Syntax
H = grfun.plotneigh(D,...)

Input arguments
D strut E truture desriing the lol ehviour of the ojetive funtion returned y the neighbourhood P122 funtionF

Output arguments
H strut E trut with hndles to the grphis ojets plotted y plotppY the strut hs the following (elds with vetors of hndlesX figureD axesD objD estD likD boundsF

Options
caption= empty | ellstr E serEsupplied grph titlesY if emptyD defult ptions will e utomtilly retedF model= model | empty E wodel ojet used to rete grph ptions if the option caption= is descript or aliasF plotObj= true | false E lot the lol ehviour of the overll ojetive funtionY ell rry n e spei(ed to ontrol grphis optionsF plotLik= true | false | ell E lot the lol ehviour of the dt likelihood omponentY ell rry n e spei(ed to ontrol grphis optionsF plotEst= true | false | ell E wrk the tul prmeter estimteY ell rry n e spei(ed to ontrol grphis optionsF plotBounds= true | false | ell E hrw the lower ndGor upper ounds if they fll within the grph rngeY ell rry n e spei(ed to ontrol grphis optionsF subplot= auto | numeri E uplot division of the (gure when plotting the resultsF title= {interpreter=,none} | ell E hisply grph titlesD nd speify grphis options for the titlesF linkAxes= true | false E wke the vertil xes identil for ll grphsF RQQ

qrphis funtionsX plotpp

Description
he dt logElikelihood urves re shifted up or down y n ritrry onstnt to mke them (t in the grphY their urvture is preservedF

Example

plotpp
Plot prior and/or posterior distributions and/or posterior mode
Syntax
[PrG,PoG,H] [PrG,PoG,H] [PrG,PoG,H] [PrG,PoG,H] [PrG,PoG,H] [PrG,PoG,H] = = = = = = grfun.plotpp(E,[],[],...) grfun.plotpp(E,Est,[],...) grfun.plotpp(E,[],Theta,...) grfun.plotpp(E,[],Stats,...) grfun.plotpp(E,Est,Theta,...) grfun.plotpp(E,Est,Stats,...)

Input arguments
E strut E istimtion input strutD see estimate P82 D with prior funtion hndles from the logdist P176 pkgeF Est strut | empty E yutput strut returned y the model/estimate P82 funtionY Est will e used to plot the mximised posterior modesF Theta numeri | empty E erry with the hin of drws from the posterior simultor arwm P169 F Stats strut | empty E yutput strut returned y the posterior simultor sttistis funtion stats P173 F

Output arguments
PrG strut E trut with xE nd yExis oordintes to plot the prior distriution for eh prmeterF RQR

qrphis funtionsX plotpp PoG strut E trut with xE nd yExis oordintes to plot the posterior distriution for eh prmeterF H strut E trut with hndles to the grphis ojets plotted y plotppY the strut hs the following (elds with vetors of hndlesX figureD axesD priorD posterD boundsD initD modeD titleF

Options
caption= empty | ellstr E serEsupplied grph titlesY if emptyD defult ptions will e utomtilly retedF describe= uto9 | true | flse E snlude informtion on prior distriutionsD strting vluesD nd mximised posterior modes in the grph titlesY auto mens the desriptions will e shown only if plotPrior= is trueF ksdensity= numeri | empty E xumer of points over whih the density will e lultedY if emptyD defult numer will e used depending on the kend funtion villeF plotInit= true | false | ell E lot strting vlues @initil onsition used in posterior mode mximistionA s vertil stemsF plotPrior= true | false | ell E lot prior distriutionsF plotMode= true | false | ell E lot mximised posterior modes s vertil stemsY the modes re tken from Est @nd not from Stats or ThetaAF plotPoster= true | false | ell E lot posterior distriutionsF plotBounds= true | false | ell E lot lower ndGor upper ounds s vertil linesY if falseD the ounds will e plotted only dded if within the grph xElimitsF sigma= numeri | Q E xumer of std devs from the men or the mode @whihever overs lrger reA to the left nd to right tht will e plotted unless running out of oundsF tight= true | false E wke grph xes tightF title=9 true | false | ell E hisply grph titlesD nd speify grphis options for the titlesF xLims= strut | empty E gontrol the xElimits of the prior nd posterior grphsF

RQS

qrphis funtionsX vline

Description
he options tht ontrol wht will e plotted in the grphs @iFeF plotInit=D plotPrior=D plotMode=D plotPoster=D plotBounds=Dtitle=A n e set to one of the following three vluesX trueD falseD ell rry with suEoptions to ontrol the pperne of the respetive lineY these will e pssed into the respetive plotting funtionF

Example

vline
Add vertical line with text caption at the specied position
Syntax
[Ln,Cp] = grfun.vline(Xpos,...) [Ln,Cp] = grfun.vline(H,XPos,...)

Input arguments
XPos9 numeri E rorizontl position or vetor of positions t whih the vertil line or lines will e drwnF H numeri E rndle to n xes ojet @grphA or to (gure window in whih the the line will e ddedY if not spei(ed the line will e dded to the urrent xesF

Output arguments
Ln numeri E rndle to the vline@sA plotted @line ojetsAF Cp numeri E rndle to the ption@sA reted @text ojetsAF

RQT

qrphis funtionsX zeroline

Options
caption= hr E ennotte the vline with this text stringF excludeFromLegend= true | false E ixlude the line from legendF hPosition= center | left | right E rorizontl position of the ptionF vPosition= bottom | middle | top | numeri E ertil position of the ptionF timePosition= after | before | middle E lement of the vertil line on the time xisX in the middle of the spei(ed periodD immeditely efore it @etween the spei(ed period nd the previous oneAD or immeditely fter it @etween the spei(ed period nd the next oneAF

Description Example

zeroline
Add zero line if Y-axis limits include zero
Syntax
Ln = zeroline(...) Ln = zeroline(H,...)

Input arguments
H numeri E rndle to n xes ojet @grphA or to (gure window in whih the the line will e ddedY if not spei(ed the line will e dded to the urrent xesF

Output arguments
Ln numeri E rndle to the line ploted @line ojetAF

RQU

qrphis funtionsX zeroline

Options
eny options vlid for the stndrd plot funtionF

Description Example

zeroline
Add vertical line with text caption at the specied position
Syntax
Ln = hline(YPos,...) Ln = hline(H,YPos,...)

Input arguments
YPos9 numeri E ertil position or vetor of positions t whih the horizontl line or lines will e drwnF H numeri E rndle to n xes ojet @grphA or to (gure window in whih the the horizontl line will e ddedY if not spei(ed the line will e dded to the urrent xesF

Output arguments
Ln numeri E rndle to the line ploted @line ojetAF

Options
excludeFromLegend= true | false E ixlude the line from legendF eny options vlid for the stndrd plot funtionF

RQV

qrphis funtionsX zeroline

Description Example

RQW

También podría gustarte