台湾清华大学 DSGE模型讲义 lecture5

合集下载

清华大学电路原理课件--电路原理_skja_05

清华大学电路原理课件--电路原理_skja_05

+
u
_
+
Req
u
_
10.0R 3.2e02q1u i iuk Rk 课件
串联电路的总电阻 等于各分电阻之和。
3
2. 电压的分配公式
i +
R1 + u u_k Rk
_
Rn
uk Rki Rk u Rki Rk
uk
Rk Rk
u
Rk u Req
电压与电阻成正比
例 两个电阻分压 i
10.03.2021
G 31
G2
G 12
G 23 G 12 G 23 G 31
G3
G 12
G 31 G 23 G 23 G 31
10.03.2021
课件
G12 G1 G2
G31 G3
G23
Y相邻电导乘积
G
GY
17
同理可得由 Y 电阻关系:
R1
R 12
R 12 R 31 R 23
R 31
R2
R 12
R 23 R 12 R 23 R 31
课件
8
三、电阻的串并联
例1
4
2 3
R
6
R = 4∥(2+(3∥6) )= 2
40 例2
R
30
40 40
R
30 30
30 R = (40∥40)+(30∥30∥30) = 30
10.03.2021
课件
9
四、计算举例
例1
I1 I2 R I3 R
+ 12V_
+
+
2R U_1 2R U_2 2R

简析DSGE模型

简析DSGE模型

• 价格刚性是指价格确定后就不易变动的现象,即价格缺乏 弹性。
• 将价格刚性引入DSGE模型方式有两种。一是 Calvo(1983) 采用“调整信号”的方式引入黏性,即经济中接收到随机 的调整信号”的经济主体(企业和或家庭)会将其价格和 (或)工资调整到最优,而没有接收到该信号的那部分经 济主体则不最优化其价格(工资)。Yun (1996),Gali &Gertler(1999),CGG(2002),Horvath(2009)等运 用该方式将价格粘性引入其DSGE模型;而Erceg et al. (2000),Kollman(2001),CEE(2003),Smets & Wouters(2003),李松华(2009a,b)等不仅将价格黏 性,还将工资黏性引入其DSGE 模型中。
2、卢卡斯批评
理性预期
又称合理预期,是在有效地利用一切信 息的前提下,对经济变量作出的在长期中平 均说来最为准确的,而又与所使用的经济理 论、模型相一致的预期。
理性预期的理论前提:
1、预期是合乎理性——消费者、生产者 2、均衡——供求均衡、充分就业 作用:
货币政策要把最理想的物价水平作为 其唯一的政策目标。
基本假设
1.经济中存在三类行为主体——家庭、垄断 竞争的厂商以及中央银行
2.理性预期 3.垄断竞争 4.价格和工资刚性(黏性)
家庭
目标:最大化其一生的预期总效用。 实现方式:消费一定量商品的支出最小化 以及一定预算约束条件下的效用最大化。 效用函数:
假设家庭消费一定量的消费品Ct ,代表
性家庭的问题是通过选择差异性消费品来 实现支出最小化。最后将家庭选择消费品 的支出最小化决策与其预算约束相结合就 能得出解这个最优化问题所需要的欧拉方 程:

DSGE模型讨论之三——线形理性预期模型

DSGE模型讨论之三——线形理性预期模型

Naturally we have its counterpart-backward-looking solution. We start again from yt = xt + bEt yt+1 which can be written as yt = xt + byt+1 + bεt+1 We seperate the stochastic component of Et yt+1 out as εt+1 . Move one period backward, yt−1 = xt−1 + byt + bεt Rearrange to seperate yt on the left-hand side, byt = yt−1 − xt−1 − bεt yt = b−1 yt−1 − b−1 xt−1 − εt (4) is our starting point, move one period backward, yt−1 = b−1 yt−2 − b−1 xt−2 − εt−1 And substitute back to (4), yt = b−1 [b−1 yt−2 − b−1 xt−2 − εt−1 ] − b−1 xt−1 − εt = b−2 yt−2 − b−2 xt−2 − b−1 εt−1 − b−1 xt−1 − εt Following this pattern, we get
m m
(4)
yt = −
k=0
b−k εt−k −
k=1
b−k xt−k + b−m yt−m
3
Again, transversality condition, lim b−m yt−m = 0

清华大学模式识别讲义06-2

清华大学模式识别讲义06-2

n
1 n ∑αiα j yi y j (xi ⋅ x j ) 2 i , j =1
n f ( x ) = sgn ∑ α i* y i ( x i ⋅ x ) + b * i =1
K ( x i , x j ) = (Φ ( x i ) ⋅ Φ ( x j ))
只要一个核函数 K (xi , x j ) 满足Mercer条 件,它就是某个空间的内积, 如: 得到优化问题:
2
Xuegong Zhang Tsinghua University
3
Xuegong Zhang Tsinghua University
4
最优分类面(Optimal Hyperplane)
假定训练数据 ( x1 , y1 ), L , ( xl , y l ) , x ∈ R n , y ∈ {+1,−1} 可以被一个超平面 ( w ⋅ x ) − b = 0 分开。 如果这个向量集合被超平面没有错误地分开,并且 离超平面最近的向量与超平面之间的距离 (称作间隔 margin ) 是最大的,则我们说这个向量集合被这个 最 优超平面(或最大间隔超平面)分开。 决策函数为
min R( w) = ∫ L(y , f (x, w))dF (x, y )
23
Xuegong Zhang Tsinghua University
经验风险最小化(ERM - Empirical Risk Minimization)
1 n min Remp ( w) = ∑ L(y i , f (x i , w)) n i =1
Xuegong Zhang Tsinghua University
f ( x) = sgn{( w ⋅ x) − b}

dsge模型均衡条件

dsge模型均衡条件

dsge模型均衡条件DSGE模型是动态随机一般均衡模型(Dynamic Stochastic General Equilibrium Model)的简称,是宏观经济学中常用的一种模型框架。

它通过描述经济主体的行为规则和市场机制,来分析经济系统的均衡状况和宏观经济变量的波动。

DSGE模型的均衡条件包括家庭部门的消费和储蓄决策、企业部门的投资和生产决策、中央银行的货币政策以及市场的供求关系等方面。

通过这些均衡条件,DSGE模型可以研究经济系统在外部冲击下的反应和调整过程,进而预测宏观经济变量的走势。

家庭部门的均衡条件是消费和储蓄之间的关系。

家庭部门在面对收入变化时,会根据自身的消费倾向来决定消费和储蓄的比例。

消费倾向越高,家庭会更倾向于消费而不是储蓄。

而储蓄则可以用于投资或者用作未来的消费。

因此,家庭部门的均衡条件可以表达为消费和储蓄之间的平衡关系。

企业部门的均衡条件是投资和生产之间的关系。

企业在决定投资决策时,会考虑到投资回报率和融资成本等因素。

投资回报率高和融资成本低的情况下,企业更倾向于增加投资,从而扩大生产规模。

而生产规模的扩大则会带动经济增长和就业的增加。

因此,企业部门的均衡条件可以表达为投资和生产之间的平衡关系。

第三,中央银行的货币政策是DSGE模型中的一个重要均衡条件。

中央银行通过调整货币供给量和利率等手段,来影响经济的运行状况。

在DSGE模型中,中央银行的货币政策可以通过设定利率水平来实现。

当利率水平较低时,企业和家庭更倾向于借贷和消费,从而刺激经济增长。

而当利率水平较高时,企业和家庭则更倾向于储蓄和投资回报率较高的项目,从而抑制经济增长。

因此,中央银行的货币政策是DSGE模型中的一个重要均衡条件。

市场的供求关系是DSGE模型中的另一个重要均衡条件。

市场的供求关系决定了商品和劳动市场的均衡价格和数量。

在DSGE模型中,供求关系可以通过供给曲线和需求曲线来表示。

供给曲线表示企业和家庭愿意提供的商品或劳动的数量,而需求曲线表示企业和家庭愿意购买的商品或劳动的数量。

清华大学断裂力学讲义Ch5_1

清华大学断裂力学讲义Ch5_1

1
III
U固 t U I t U II t U固 t t U I t t U II t t U固 U II t t U II t U I t U I t t U 移 t U I t U II t U移 t t U II t t U III t t U移 U II t t U II t U I t U III t t
由虚功原理知(怎么来的?) (推导过程中要用到无体力条件) , x2 , t ij x1 u t t x ,x d A移 ij t dA 0 1 2 若材料沿 x1 和 x2 方向均不均匀, w w ij , x1, x2


A移 t wx1, x2 , t dA A移 t w ij x1, x2 , t , x1 at , x2 dA 上述推导不成立!
u a wn1 t x1
u d t t x 2 ,t
d d wdA dt A移 , x2 x1
J 积分 0 流入围道的能通量 1) 定常裂纹扩展 2 1/ 2 与 Griffith 能量释放率在 r rd 0 ) 2 ) 无限小围道(第一项 0 满足右列条件之一时相等 第二项如何? 已将能量释放率变成一条线 3) 超弹性材料(或形变塑性不卸载) ,且 上的积分! ! ! 材料沿 x1 方向均匀(见下页证明)
J 积分 0 流入围道的能通量 1) 定常裂纹扩展 2 1/ 2 与 Griffith 能量释放率在 r rd 0 ) 2 ) 无限小围道(第一项 0 满足右列条件之一时相等 第二项如何? 已将能量释放率变成一条线 3) 超弹性材料(或形变塑性不卸载) ,且 上的积分! ! ! 材料沿 x1 方向均匀(见下页证明)

清华大学计量经济学课件

清华大学计量经济学课件
• 应用举例
二、经济预测
• 计量经济学模型作为一类经济数学模型,是从 用于经济预测,特别是短期预测而发展起来的。
• 计量经济学模型是以模拟历史、从已经发生的 经济活动中找出变化规律为主要技术手段。
• 对于非稳定发展的经济过程,对于缺乏规范行 为理论的经济活动,计量经济学模型预测功能 失效。
• 模型理论方法的发展以适应预测的需要。
ln(人均食品需求量)=-2.0+0.5ln(人均收 入)-0.8ln(食品价格) +0.8ln(其它商品价格)
⑵ 统计检验 由数理统计理论决定 包括拟合优度检验 总体显著性检验 变量显著性检验
⑶ 计量经济学检验 由计量经济学理论决定 包括异方差性检验 序列相关性检验 共线性检验
⑷ 模型预测检验 由模型的应用要求决定 包括实际
例如:ln(人均食品需求量)=α+βln(人均收入) +γln(食品价格) +δln(其它商品价格)+ε
其中α 、β、γ、δ的符号、大小、 关系
二、样本数据的收集
⑴ 几类常用的样本数据 时间序列数据 截面数据 虚变量离散数据 联合应用
⑵ 数据质量 完整性 准确性 可比性 一致性
三、模型参数的估计
微观计量:

选择性样本模型


微观计量:

离散选择模型


济 学
时间序列:
协整理论—现代宏观计量
时间序列:
ARCH—现代金融计量
Heckman McFadden
Granger Engle
五、计量经济学在经济学科中的地位
△ 从现代西方经济学的特征看 △ 从西方经济学的发展历史看 △ 从世界一流大学经济学课程表看 △ 从国际经济学刊物论文看 △ 从经济学的“世界先进水平”看

Mathematical Modeling of Impinging Gas Jets on Liquid Surfaces

Mathematical Modeling of Impinging Gas Jets on Liquid Surfaces

Mathematical Modeling of Impinging Gas Jetson Liquid SurfacesHO YONG HWANG and GORDON A.IRONSIn top-blowing operations,the gas jet is a major source of momentum,so to model themomentum exchange properly with the liquid,the full-stress boundary conditions must beapplied.A new mathematical method for better representation of the surface boundary conditionwas developed by combining the Cartesian cut cell method and volume offluid method.Thecomputational code was validated with the broken dam problem and reported critical phe-nomena in wave generation.The model was applied to impinging jets on liquid surfaces in twodimensions.The cavity depth was in good agreement with experimental measurements.Theprocess of ligament and droplet formation was reproduced.The extent of momentum transfer tothe liquid was investigated,and the trends with lance height and gasflow rate were similar toexperimental evidence.The following important aspects of momentum transfer were identified:surface roughness as well as the development of local pressure gradients around wave crests.Kelvin–Helmholtz instability theory was used to interpret the results with respect to criticalvelocity for the onset of droplet formation.These principles were extended to conditions relevantto basic oxygen furnace(BOF)steelmaking.The critical velocities for droplets were calculated asfunctions of the physical properties for the gas–steel,gas–slag,slag–steel interfaces.The impli-cations for BOF steelmaking were discussed.The mathematical model was applied to a simplifiedconfiguration of full-scale BOF steelmaking,and the local force balance was well described.DOI:10.1007/s11663-011-9493-6ÓThe Minerals,Metals&Materials Society and ASM International2011I.INTRODUCTIONA N enduring problem in process metallurgy is the mathematical description of impinging gas jets on liquid surfaces.The most prominent application is the top lancing of oxygen in the basic oxygen steelmaking process.The momentum of the oxygen jet destabilizes the slag and metal phases to create what is known as the slag–metal emulsion.At the same time,the oxygen reacts with the slag and the metal at extremely high rates and generates a large amount of heat.Therefore,a complex interplay takes place betweenfluidflow,heat transfer,and mass transfer that has not been captured in a detailed mathematical model of the process.The present work is a contribution to thefluid mechanical aspects of the impinging jet with liquid surfaces, focusing on aspects of surface instability and droplet formation.Several approaches have been developed to solve this problem analytically and numerically.Conformal map-ping techniques,[1]local force balances,[2,3]and solving the Bernoulli equation for the surface wave[4–6]provide analytical solutions for the surface shape but cannot account for the momentum transfer to the liquid.Progress also has been made in the application of some computationalfluid dynamics techniques for free surface representation.Qian et al.[7,8]constructed the surface with the impinging gas pressurefield and solved the momentum equation according to the constructed surface. Olivares et al.[9]used the volume offluid(VOF)method with a renormalization group k–e turbulence model. Some computations have used commercial software[10,11]; most recently,Odenthal et al.[12]used FLUENT(ANSYS, Canonsburg,PA)to solvefluidflow,heat transfer,and mass transfer for the basic oxygen steelmaking and the argon-oxygen decarburization processes.In most free surface problems,theflow of the denser fluid is more important and the source of momentum is in the denserfluid;stirring of liquids in vessels is an example.In these circumstances,it is a reasonable approximation to neglect the shear stress to the less dense phase.However,in the case of an impinging gas jet on a liquid surface,the gas phase is the source of momentum,so it is necessary to apply the full stress boundary condition to represent the physical situation properly.[13]Height function methods or unstructured grid adaptation[14–16]can handle this boundary condi-tion,but these methods are not as capable of dealing with multiple interfaces when droplets are generated. For the current study,the VOF[17]method and the Piecewise Line Interface Construction(PLIC)[18]scheme were used to separate the phase domains.Each separated computational domain was treated with the Cartesian cut cell[19–21]technique.This technique is an appropri-ate choice for thefluid computation with stationary or moving boundaries.It provides a computationalHO YONG HWANG,formerly Graduate Student with Steel Research Centre,McMaster University,Hamilton,Ontario L8S4L7, Canada,is now with Esser Steel Algoma Inc.,Sault Ste.Marie, Ontario P6A7B4,Canada.GORDON A.IRONS,Dofasco Professor of Ferrous Metallurgy and Director,is with the Steel Research Centre, McMaster University.Contact e-mail:ironsga@mcmaster.ca Manuscript submitted January8,2011.Article published online February19,2011.framework for arbitrarily shaped domains and has an accuracy level comparable with body-fitted coordinate schemes.[22]This new combined modeling technique is validated with existing physical evidence and computation and applied to the impinging jet problem in a basic oxygen furnace with simplified geometry.This work explores the effect thatflow conditions and the physical proper-ties of thefluids have on momentum transfer to the liquid as well as the onset of instability.II.MODELING METHODerning EquationsTheflow system is limited to two-dimensional(2-D), incompressible,immiscible,laminar,isothermal,and nonreacting two-phaseflow.The following governing equations are continuity,the Navier–Stokes equation, and the volume advection equation(volume fraction conservation for the VOF method):rÁu i¼0½1q i@u i@tþrÁu i u i¼Àr pþrÁs iþF B½2@F@tþuÁr F¼0½3where q is the density offluid,p is the pressure,s is the stress tensor,u is the velocity vector,F is the volume fraction function,i is the i th phase of the system,and F B is the body force.B.Separation of Domains and DiscretizationIt is absolutely essential to describe the interface position accurately and shape to compute the shear stress properly at the interface for each phase.Thefirst step was to use the volume fraction function to construct the assumed surface lines.The surface lines generally did not match their neighbors at cell boundaries,so the surface shapes were represented by the PLIC scheme[23] and was improved with a least-square method.[24–26]This line construction of the interface cuts the calcula-tion cells as illustrated in Figure1(a)and often results in small or thin cut cells,with certainflow conditions and aspect ratios Courant number instability develops.[27]A cell-merging technique[19,28,29]was used to reduce the computational instability;the cells were classified as major(F‡0.5)and minor(F<0.5)cells,and the minor cells were merged with their neighbor cells according to the cell orientation,as shown in Figures1(c)and(d). The discretization procedure followed the general finite volume methods with collocated variables,[30]but special care was taken with merged cells.A merged cell contained extra faces with its neighbors,as illustrated in Figure1(d).The contributions of mass and momentum through extra faces were added explicitly as source terms for the mass and momentum equations.The Navier–Stokes equation was discretized with afirst-order Eulerian time-marching scheme andfirst-order spatial neighbors.In the viscous stress tensor,the transpose terms usually cancel out in rectangular grids, but because of the irregular shape of merged cells,the terms did not cancel and were specifically calculated. Because incompressibleflow was assumed for the computation,the surface movement must satisfy the volume or space conservation law.[31]The mass conti-nuity equation was reformulated from the Reynolds transport theorem as follows:qZA fsnÁv cv dA¼qZAðtÞnÁv cvÀuðÞdA½4where A fs is the free surface,v cv is the velocity of con-trol volume,u is thefluid velocity,and n is a normal vector.The boundary movement follows thefluid movement and the cell control volumes are stationary, so the Eq.[4]can be simplified as follows:qZA fsnÁv cv dA¼qZAðtÞ6¼A fsÀnÁu dA½5This simplification makes the discretization procedure straight forward:Æq A fs v fsnþ_m eþ_m x eÀ_m wÀ_m x wþ_m nþ_m x nÀ_m sÀ_m x s¼0½6and simple merging procedure:surface configuration,(b)assignmentwhere v fsn is surface normal velocity;_m is massflux for each cell face(q Au);_m x is massflux contribution from the extra cell face;and e,w,n,and s are indexes for the each neighbor cell faces.The±sign depends on the computational phase and the definition of surface orientation.Using Eq.[6],the SIMPLE pressure correction equation was applied in the usual manner for nonsur-face cells.[30]For the surface cells,the velocity was corrected according to the following:vÃfsn ¼vÃnÀD VA Pf sdpdnfsÀdpdnfs"#½7v0fsn¼ÀD VA Pfsp0f sÀp0ph i½8where vÃfsn is the approximate surface normal velocity tobe corrected with v0fsn ,prime is the correction of eachflow variables and the over bar means linear interpola-tion.The surface pressure correction term must be modeled,so it was approximated as a constant pressure boundary for denserfluid(p¢=0),and the pressure correction was extrapolated for the lighter phase as in a solid boundary case.This scheme is similar to that used by Muzaferija and Peric[14]but is generalized by the present authors.Many variables needed to be computed in irregular computational nodes such as cell faces,extra faces of merged cells,and the surface points.For accurate representation of the irregular interface and to reduce computational time,a proper interpolation method, which can deal with irregularly distributed variables, was required.Renka[32]compared many different methods,and from them,the Quadratic Shepard method,[33,34]which is simple but accurate,was chosen. The method computes a least-squarefit of a2-D quadratic polynomial for each computation node and the interpolation coefficients are weighted with the Shepard scheme.C.Surface Boundary ConditionsThe surface boundary condition in two dimensions has the following variables:u1,v1,u2,v2,p1,and p2, with only four equations—two kinematic and two momentum conditions.Assuming the same surface velocities for each phase,u1=u2,v1=v2,reduces the number of variables to four.However,one can use normal and tangential equations consistently with the flowfield away from the interface with appropriate extrapolations.The normal and tangential boundary conditions neglecting surface tension gradients are expressed as follows:p1Àp2þrj¼s nn1Às nn2½90¼s nt1Às nt2½10 where s nn is the normal stress tensor component and s nt is the tangential component.A direct solution with extrapolated pressures from the bulk of each phase is extremely unstable;a smallfluctuation in pressure prevents a valid velocity computation,so an iterative approach was applied,which iterates with extrapolated gas pressure and u and v from the previous iteration.D.Solution ProceduresTo accelerate computation,the linearized equations were solved with a multigrid scheme.[30]A simple zero-th order,algebraic,and V-cycle multigrid method was applied with a Point Gauss–Seidel internal solver.To account for the separation of the computation domains, two coarse-grid computation storages were used for each phase.If only the coarse grid had the correspond-ing phase in theirfiner grid cells,then that part of coarse grid was included in that level of the multigrid compu-tation.During the construction of coarse grid coeffi-cients,cells from the other phase were excluded so that the smearing error across the boundary was prevented. Once the momentum equations converged,liquid movement was permitted to update the volume fraction ing the basic idea from Young’s[18]method, geometric volumefluxes[35,36]were used for the volume fraction balance.This was required because of the unstable nature of Eq.[3]and to minimize false diffusion of the volume fraction function.The balance equation for the volume fraction is expressed as follows:F nþ1ÀF nÀÁV¼Àd FðÞwþd FðÞeÀd FðÞnþd FðÞs½11 where superscripts n and n+1refer to the time steps and d F is the volume fractionflux through each computational cell face.The following is the summary of the computation procedure:(a)Set the base grid system for the whole domain;thiswas used for the general geometrical variables (b)Construct the line representation of the surfacebased on the volume fraction function(F)(c)The line construction cuts cells,so determine themerging partner cells and their geometrical infor-mation(d)Apply interpolation to obtain newly generated cellinformation(e)Obtain the coefficients for the nonsurface cells usingthe following techniques:(i)Collocated arrangement;Rhie–Chow typemomentum interpolation(ii)First order upwind(iii)SIMPLE pressure correction(f)For the surface cells,apply the same scheme as(e),but the surface geometry must be considered and contributions from irregular parts added to the mass and momentum equations with source terms(g)Momentum computation was performed as follows:(i)Apply boundary condition Eq.[9]and obtain p2(liquid phase)along the surface with extrapo-lated gas pressure p1(ii)Solve liquid velocity(iii)Obtain surface normal velocity with momen-tum interpolation(iv)Update tangential surface velocity(v)Correct pressure assuming the surface as afixed pressure boundary(vi)Correct liquid velocity(vii)Update tangential surface velocity(viii)Solve gas velocity assuming the surface normal velocity isfixed(ix)Update tangential surface velocity(x)Correct gas velocity(xi)Update tangential surface velocity(xii)Repeat until convergence is achieved(h)Determine the velocity for VOF advection(i)Advect volume fraction with the modified Young’smethod(j)Advance timeE.Validation of the Computational CodeNo standard tests are available for free surface codes, but the broken dam problem[37]is often used.The broken dam problem starts with a stationary liquid block of specified initial width-to-height ratio that suddenly collapses by gravity on one side.[17,38–41] Wind-generated waves also were used to see how well the shear stress transfer represents physical phenomena, but unfortunately,no well-controlled experiments have been done for quantitative comparison.For the broken dam problem,the height(12cm)and width(6cm)were similar to Martin and Moyce’s experiment.[37]The computational domain was restricted horizontally to twice the column width as others have done.[17,38–41]A closed box with80960uniform cells was used for the whole domain.Initially,20940cells werefilled with water and the gas phase was air.A1-ms time step was used.Physical properties at1atm and 293K(20°C)were used for the computation(Table I). Figure2shows an example of surface profile and velocityfields.The dimensionless wetted distance(z/a) and the remaining height(h/a)were compared with Martin and Moyce’s experimental results and other computational results in Figure3.All computational results show a faster movement of the leading edge than in the experiments.However,the overall slope of the wetted distance(the speed of the liquid front advance)matches well with experiments.The remaining height changes more slowly than the leading edge movement and the computational and experimental results match well. Physical observations of wind-generated waves on still water were summarized by Munk.[42]For wind speeds between 1.1and 6.6m/s,the surface is smooth but wavy.When the wind speed exceeds the critical value, the Kelvin–Helmholtz instability criterion(6.5m/s) waves grow rapidly.The wave initiation,which occurs at1m/s,far below the critical velocity,is caused by the turbulent gas pressurefluctuations as well as by the res-onance between the pressurefluctuations and the surface waves.[43,44]Surface roughness and friction velocity relationships also affect wave growth.[45]As shown in Figure4,the computational test was designed to pass gas horizontally over a long,thin water dish.A uniform cell size of2.5mm92.5mm was used, and the front2.5cm and rear2.5cm were covered by a thin imaginary solid surface for pressure stabilization. The wind speed was varied from2m/s to8m/s.A1-ms time step was used up to6-m/s cases and a250-l s time step was used for7-and8-m/s cases.Table I.The List of Physical Properties at1atm and293K(20°C)and ConstantsPhysical Properties Values UnitsAir Density(q g) 1.20kg/m3Water Density(q l)998.0kg/m3Air Viscosity(l g) 1.80910À5PaÆsWater Viscosity(l l) 1.003910À3PaÆsSurface Tension(r)7.28910À2N/mContact angle90degAcceleration of gravity(g)9.81m/s2(a)Figure5shows the surface profiles at different wind speeds.For2-m/s wind,the surface shows slight undulation but could not effectively generate waves. From4m/s to5m/s,the surface has small waves with a typical wavelength of1.5cm.For6m/s,some wave amplitudes increase sharply,and droplet detachment was observed at the8-m/s case.Generally,the wave behavior in this test matches with the physical observation from the intermediate to the critical wind speed.III.RESULTS AND DISCUSSIONputational Domain and Boundary Conditions for the Impinging JetThe computational domain,as shown in Figure6,is similar to that of the water-model experiments.[46]A 45cm926cm Cartesian box with a5mm95mm uniform grid around the liquid interface and a 5mm91cm grid below were used.Gas outlets were placed at each side of the top boundary,and their width was1.5cm to prevent backflow of the gases;a constant pressure boundary condition was applied.Initially,the water was20-cm deep.Because the gas jet behavior away from the surface was not the main concern of this study and because high gas velocity requires short time steps for numerical stability,the top boundary was set close to the liquid interface,and Go tler’s[47,48]analytical solution for gas velocity distribution was used for the gas-inlet conditions.Go tler’s solution employs Prandlt’s mixing length hypothesis,so the distribution represents turbulent conditions.Because gas jet expansion over the jet length is similar for plane and circular jets,[48]the nozzle exit velocities in the2-D plane jet simulation were converted from the gasflow rates in the water model.[46] Table II shows simulated lance height and nozzle exit velocities.To simulate the gas side shear stress accurately, boundary layer information is required,but the gas side boundary layer adjacent to a moving liquid has not been well studied.Direct numerical simulation[49]results show that the gas side boundary layer is similar to that close to a solid wall;they follow Nicuradze’s log law function.Therefore,the following wall function for-mula[50]was applied:uþ¼yþ;0yþ55ln yþÀ3:05;5yþ302:5ln yþ;30yþ8<:½12 where uþ¼"u=u s,y+=q u s/l and u s¼ffiffiffiffiffiffiffiffiffiffis w=qp.The apparent viscosity was obtained from the following:l t¼q"uuÃ2,@"ut@nwhere u s computation requires a tangential shear stress term,and the previous iteration’s viscosity were used for this point.B.Grid Size DependenceThe current setup of the grid was refined and coarsened to investigate the effect of the number of grids in the calculation domain.The coarsened grid had uniform cells,and thefiner grid was produced by dividing the current setup by half in x and y directions, four times greater in number.Figure7shows the change in momentum trans-ferred to the liquid phase change with time for each grid setup.As expected,thefiner grid shows more momentum transfer,but the difference was diminished as the grid refinement is greater.Table III compares thedistance andsteady-state momentum levels by setting the finest grid as a reference.The coarse-grid setup showed 60pct of momentum transfer and the medium-grid setup showed more than 90pct momentum transfer.Considering the computation time and convergence behavior,the medium-size grid was used for this study.C.Surface ProfilesIn the computations,the jet cavity was formed within 1to 2seconds after the start of the gas.The depression depth was more stable than the cavity width;the width fluctuated because of the wave formation andpropagation.Figure 8shows a time series of the surface profiles for two flow rates.At the lower flow rate,gentle waves propagated from the impingement point.At the higher flow rate,small waves were initiated inside the cavity and grew to the lip.The waves formed long extensions or ligaments;in some instances,theendsdiagram of numerical Table II.The Lance Height and Nozzle Exit Velocityin the SimulationLance Height (cm)Flow Rate (SLPM)u 0(m/s)122019.33029.04038.35048.46058.07067.7182015.83023.94031.65039.57055.28063.2242013.93020.54034.25041.07047.98054.7SLPM:Standard liter per minute.detached from the main part to form droplets.The code was successful in depicting the detachment of the droplets;however,it should be noted that because of restrictions in computer capacity,an adequate resolu-tion of the droplets was not obtained (usually less than 10grid volumes in each droplet).Therefore,at this stage of development,the droplet size may have some grid size dependence.Other examples of surface profiles with different blowing conditions are shown in Figure 9.Figure 10shows the influence of lance height and gas flow rate on the cavity depth.Figure 11shows that these computed cavity depths agree well with the depths measured in the classical work of Banks and Chandr-asekhara.[51]In this respect,the present 2-D code is a good representation of the physical situation.D.Velocity DistributionsExamples of velocity fields from simulations are plotted in Figure 12.Because the gas and liquid veloc-ities are so different,different scales were used.As expected,the gas jets spread to the side and the shear stress produced liquid flow in the same direction.The liquid flow was directed downward at the wall,produc-ing a circulating flow in the liquid.For the highest lance height (Figure 12(a)),the shear stress initiated small waves no higher than 1.5cm.Even such small defor-mations increased the pressure on the windward side of the waves,producing some gas acceleration.When the lance was moved closer to the surface (Figures 12(b)and (c)),larger waves were generated,and the gas flow separated on the leeward side of the wave crest,causinga pressure gradient increase as Figure 13shows.Because of a large pressure gradient operating across the rather narrow liquid wave,droplets are sheared from the surface.E.Momentum Transfer to the LiquidThe extent of liquid stirring produced by the top jet is important in steelmaking operations.The amount of momentum transfer to the liquid was assessed by simply summing the momentum in the liquid cells.Figure 14shows the results of the calculation.At each flow rate,more momentum was transferred as the lance was lowered.To assess the efficiency of the transferofTable III.The Grid Size Conditions and the Comparisonof the Effect on the Momentum TransferGrid Size Around the SurfaceNumber of Grid Ratio Coarse 1cm 269450.597Medium 0.5cm 359920.913Fine0.25cm7091841.0Fig.8—Surface profile change with time variation:(a )12cm 20SLPM D t =0.04s and (b )12cm 50SLPM D t =0.02s.energy,an energy transfer index I,was defined as follows [46]:I ¼R q u 2dV_E in ½13 It is the ratio between the kinetic energy in a sum overall fluid elements and the input kinetic energy flux input rate at the lance exit.The index is plotted for the same computational results in Figure 15.At a low flow rate,the index increases as the lance is lowered,whereas the reverse is true at a higher flow rate.The same trends were observed in the water model experiments.[46]The following hypothesis is proposed to explain the findings.At a low flow rate,only a small cavity is present,as Figure 8shows,so bringing the lance closer increases the ripples in the interface,which enhances momentum transfer.At a higher flow rate,a cavity is found with ripples on the surface,so increasing the lance height widens the cavity,which in turn increases the contact area for the rippled region and enhances the momentum transfer.The significance of the surface roughness to the momentum transfer is shown in Figure 16,which depicts oscillation of the momentum transfer.At ‘‘A,’’time ripples were present,but by time ‘‘B,’’the waves were dampened.The first maximum occurred when the center plume of the liquid returned to the impingement point;the increased liquid velocity stabilizes the surface shape,and consequently,the momentum transfer was diminished after point A.The surface roughness and the shear stress have a mutual interaction in that an increase in the roughness provides more area to transfer the shear stress,which in turn disturbs the interface.The importance of surface roughness has some precedents.Increased tangential stress and friction velocity accelerate wave growth;the wave growth factor is proportional to the square of the friction velocity.[45]At higher flow rates,the local pressure gradient generated by waves is an important factor.Munk [42]suggested that the accelerated gas from the windward impinges the next crest and the pressure increases.Figure 13quantitatively shows that his suggestion was correct for the case of a wave generated in the test shown in Figure 5for 7-m/s wind speed.The windward side experienced higher pressure than the leeward side,so the wave crest was accelerated by this pressure gradient and,consequently,increased the momentum transfer efficiency from the gas to liquid.F.Effect of Physical PropertiesTo understand the factors that influence the interface shape and momentum transfer to the liquid,the physical properties in the system were varied systematically.The base case was taken as the air–water system,and gravitational acceleration,surface tension,liquid den-sity,and liquid viscosity were individually increased by a factor of 10.Figure 17shows the effect on the surface profile for two flow rates.The increase of liquid density andgravityandhad equivalent effects in damping cavity formation and wave generation.The increase in surface tension did not reduce the cavity depth but did have a remarkable effect in smoothing the waves and preventing droplet forma-tion.The increased liquid viscosity did not change the cavity depth but did have a much less pronounced effect in smoothing the waves than did the increase in surface tension.The effects that the physical properties had on the momentum transferred to the liquid are shown inFigure 18.The density increase made the liquid heavier and liquid velocities were small compared with other cases,so it could not reach equilibrium within paring the effect of the viscosity and surface tension,the contribution of surface tension was much greater in reducing momentum transfer from the gas to liquid,which can be explained with the same reasoning in the Section III–D .G.Interfacial InstabilitiesThe previous section demonstrated that surface ten-sion is most pronounced on the roughness of the interface and droplet formation.Increased roughness of the surface in turn promoted the exchange of momentum to the liquid.Furthermore,Figure 16shows that the increased contact area of a rough interface also increases the momentum transfer.The viscosity of the liquid had a much less pronounced effect.In this configuration of moving stratified fluids,one would expect that the instability of the surface would be governed by the Kelvin–Helmholtz instability theory (i.e.,the critical velocity for instability from the theory would give an indication of how easy it is to promote surface roughness).The theory originally was developed for inviscid conditions.[52]The viscous potential the-ory [53]provides the means to include viscous effects,forFig.12—Examples of velocity profile at 10s.Gas and liquid are scaled with different factor:(a )24cm 50SLPM,(b )18cm 50SLPM,and (c )12cm 50SLPM.。

台湾清华大学 DSGE模型讲义 lecture5

台湾清华大学 DSGE模型讲义 lecture5

Bayesian Estimation of Linearized DSGE ModelsDr.Tai-kuang HoAssociate Professor.Department of Quantitative Finance,National Tsing Hua University,No. 101,Section2,Kuang-Fu Road,Hsinchu,Taiwan30013,Tel:+886-3-571-5131,ext.62136,Fax: +886-3-562-1823,E-mail:tkho@.tw.1Posterior distributionChapter12of Tsay(2005)provides an elegant introduction to Markov Chain Monte Carlo Methods with applications.Greenberg(2008)provides a very good introduction to fundamentals of Bayesian inference and simulation.Geweke(2005)provides a more advanced treatment of Bayesian econometrics.Bayesian inference combines prior belief(knowledge)with empirical data to form posterior distribution,which is the basis for statistical inference.:the parameters of a DSGE modelY:the empirical dataP( ):prior distribution for the parametersThe prior distribution P( )incorporates the prior belief and knowledge of the parameters.f(Y j ):the likelihood function of the data for given parametersBy the de…nition of conditional probability:f( j Y)=f( ;Y)f(Y)=f(Y j )P( )f(Y)(1)The marginal distribution f(Y)is de…ned as:f(Y)=Z f(Y; )d =Z f(Y j )P( )d f( j Y)is called the posterior distribution of .It is the probability density function(PDF)of given the observed empirical data Y.Omit the scale factor and equation(1)can be expressed as:f( j Y)/f(Y j )P( )Bayes theoremposterior P DF/(likelihood function) (prior P DF)Expressed in logarithm:log(posterior P DF)/log(likelihood function)+log(prior P DF)2Markov Chain Monte Carlo(MCMC)methodsThis section draws from Chapter7of Greenberg(2008).An advanced textbook is Carlin and Louis(2009),Bayesian Methods for Data Analysis,CRC Press.The basis of an MCMC algorithm is the construction of a transition kernel, denoted by p(x;y),that has an invariant density equal to the target density.Given such a kernel,we can start the process at x0to yield a draw x1from p(x0;x1),x2from p(x1;x2),x3from p(x2;x3),...,and x g from p x g 1;x g .The distribution of x g is approximately equal to the target distribution after a transient period.Therefore,MCMC algorithms provide an approximation to the exact posterior distribution of a parameter.How to…nd a kernel that has the target density as its invariant distribution? Metropolis-Hasting algorithm provides a general principle to…nd such kernels. Gibbs sampler is a special case of the Metropolis-Hasting algorithm.2.1Gibbs algorithmThe Gibbs algorithm is applicable when it is possible to sample from each con-ditional distribution.Suppose we want to sample from the joint distribution f(x1;x2).Further suppose that we are able to sample from the two conditional distributions f(x1j x2)and f(x2j x1).Gibbs algorithm1.Choose x(0)2(you can also start from x(0)1)2.The…rst iterationdraw x(1)1from f x1j x(0)2draw x(1)2from f x2j x(1)1 3.The g-th iterationdraw x(g)from f x1j x(g 1)21draw x(g)from f x2j x(g)124.Draw until the desired number of iterations is obtained. We discard some portion of the initial sample.This portion is the transient or burn-in sample.Let n be the number of total iterations and m be the number of burn-in sample. The point estimate of x1(similarly for x2)and its variance are:^x1=1n mnX j=m+1x(j)1^ 21=1n m 1nX j=m+1 x(j)1 ^x1 2The invariant distribution of the Gibbs kernel is the target distribution. Proof:x=(x1;x2)y=(y1;y2)p(x;y):x!y,x1!y1;x2!y2The Gibbs kernel is:p(x;y)=f(y1j x2) f(y2j y1)f(y1j x2):draw x(g)1from f x1j x(g 1)2f(y2j y1):draw x(g)2from f x2j x(g)1 It follows that:Z p(x;y)f(x)dx=Z f(y1j x2) f(y2j y1)f(x1;x2)dx1dx2=f(y2j y1)Z f(y1j x2)f(x1;x2)dx1dx2=f(y2j y1)Z f(y1j x2)f(x2)dx2=f(y2j y1)f(y1)=f(y1;y2)=f(y)This proves that f(y)is the invariant distribution for the Gibbs kernel p(x;y).The invariant distribution of the Gibbs kernel is the target distribution is a nec-essary,but not a su¢cient condition for the kernel to converge to the target distribution.Please refer to Tierney(1994)for a further discussion of such conditions.The Gibbs sampler can be easily extended to more than two blocks.In practice,convergence of Gibbs sampler is an important issue.I will use Brooks and Gelman(1998)’s method for convergence check.2.2Metropolis-Hasting algorithmMetropolis-Hasting algorithm is more general than the Gibbs sampler because it does not require the availability of the full set of conditional distribution forsampling.Suppose that we want to draw a random sample from the distribution f(X). The distribution f(X)contains a complicated normalization constant so that a direct draw is either too time-consuming or infeasible.However,there exists an approximate distribution(jumping distribution,proposal distribution)for which random draws are easy to obtain.The Metropolis-Hasting algorithm generates a sequence of random draws from the approximate distribution whose distributions converge to f(X).MH algorithm1.Given x,draw Y from q(x;y).2.Draw U from U(0;1).3.Return Y if:U (x;Y)=min(f(Y)q(Y;x);1)f(x)q(x;Y)4.Otherwise,return x and go to step1.5.Draw until the desired number of iterations is obtained.q(x;y)is the proposal distribution.The normalization constant of f(X)is not needed because only a ratio is used in the computation.How to choose the proposal density q(x;y)?The proposal density should generate proposals that have a reasonably good probability of acceptance.The sampling should be able to explore a large part of the support.Two well-known proposal kernels are the random walk kernel and the independent kernel.A.Random walk kernel:y=x+uh(u)=h( u)!q(x;y)=q(y;x)! (x;y)=f(y)f(x) B.Independent kernel:q(x;y)=q(y)q(x;y)=q(y)! (x;y)=f(y)=q(y)f(x)=q(x)2.2.1Metropolis algorithmThe algorithm uses a symmetric proposal function,namely q(Y;x)=q(x;Y). Metropolis algorithm1.Given x,draw Y from q(x;y).2.Draw U from U(0;1).3.Return Y if:U (x;Y)=min(f(Y)f(x);1)4.Otherwise,return x and go to step1.5.Draw until the desired number of iterations is obtained.2.2.2Properties of MH algorithmThis part draws from Chib and Greenberg(1995),“Understanding the Metropolis-Hasting Algorithm,”The American Statistician,49(4),pp.327-335.A kernel q(x;y)is reversible if:f(x)q(x;y)=f(y)q(y;x)It can be shown that f is the invariant distribution for the reversible kernel q de…ned above.Now we begin with a kernel that is not reversible:f(x)q(x;y)>f(y)q(y;x)We make the irreversible kernel into a reversible kernel by multiplying both sides by a function .f(x) (x;y)q(x;y)|{z}|{z}=f(y) (y;x)q(y;x)p(x;y) (x;y)q(x;y)f(x)p(x;y)=f(y)p(y;x)This turns the irreversible kernel q(x;y)into the reversible kernel p(x;y). Now set (y;x)=1.f(x) (x;y)q(x;y)=f(y)q(y;x)(x;y)=f(y)q(y;x)f(x)q(x;y)<1By letting (x;y)< (y;x),we equalize the probability that the kernel goes from x to y with the probability that the kernel goes from y to x.Similar consideration for the general case implies that:;1)(x;y)=min(f(y)q(y;x)f(x)q(x;y)2.2.3Metropolis-Hasting algorithm with two blocksSuppose we are at the(g 1)-th iteration x=(x1;x2)and want to move to the g-th iteration y=(y1;y2).MH algorithm1.Draw Z1from q1(x1;Z j x2).2.Draw U1from U(0;1).3.Return y1=Z1if:U1 (x1;Z1j x2)=f(Z1;x2)q1(Z1;x1j x2)f(x1;x2)q1(x1;Z1j x2) 4.Otherwise,return y1=x1.5.Draw Z2from q2(x2;Z j y1).6.Draw U2from U(0;1).7.Return y2=Z2if:U2 (x2;Z2j y1)=f(y1;Z2)q(Z2;x2j y1)f(y1;x2)q(x2;Z2j y1) 8.Otherwise,return y2=x2.3Estimation algorithmKaragedikli et al.(2010)provide an overview of the Bayesian estimation of a simple RBC model.This paper provides internet linkages of several sources of useful computation code.The program appendix includes a whole set of DYNARE programs to estimate, simulate the simple RBC model by using the U.S.output data,as well as to diagnose the convergence of MCMC.The references include a rich and most updated literature on estimation of DSGE models.However,the paper is con…ned to Bayesian estimation,and it is not useful for researchers who want to understand the computational details and to build their own programs.An and Schorfheide(2007)review Bayesian estimation and evaluation techniques that have been developed in recent years for empirical work with DSGE models.Why using Bayesian method to estimate DSGE models?Bayesian estimation of DSGE models has3characteristics(An and Schorfheide, 2007).First,compared to GMM estimation,Bayesian estimation is system-based.(This is also true for maximum likelihood estimation)Second,the estimation is based on likelihood function generated by the DSGE model,rather than the discrepancy between model-implied impulse responses and VAR impulse responses.Third,prior distributions can be used to incorporate additional information into the parameter estimation.Counter-argument:Fukaµc and Pagan(2010)show that DSGE models should be not estimated and evaluated only with full information methods.If the assumption that the complete system of equations is speci…ed properly seems dubious,limited information estimation,which focuses on speci…c equa-tions,can provide useful complementary information about the adequacy of the model equations in matching the data.3.1Draw from the posterior by Random Walk Metropolis algo-rithmRemember that posterior is proportional to likelihood function times prior.f( j Y)/f(Y j )P( )How to compute posterior moments?Random Walk Metropolis(RWM)algorithm allows us to draw from the posterior f( j Y).RWM algorithm belongs to the more general class of Metropolis-Hasting algo-rithm.RWM algorithm1.Initialize the algorithm with an arbitrary value 0and set j=1.2.Draw j from j= j 1+" N j 1; " .3.Draw u from U(0;1).4.Return j= j ifu j 1; j 1 =min 8<:fY j j P j f Y j j 1 P j 1 ;19=;5.Otherwise,return j= j 1.6.If j N then j!j+1and go to step2.Kalman…lter is used to evaluate the above likelihood values f Y j j and f Y j j 1 .3.2Computational algorithmSchorfheide(2000)and An and Schorfheide(2007).e a numerical optimization routine to maximize log f(Y j )+log P( ).2.Denote the posterior model by~ .3.Denote by~ the inverse of the Hessian computed at the posterior mode~ .4.Specify an initial value for 0,or draw 0from N ~ ;c20 ~ .5.Set j=1and set the number of MCMC N.6.Evaluate f(Y j 0)and P( 0)A evaluate P( 0)for given 0B use Paul Klein’s method to solve the model for given 0C use Kalman…lter to evaluate f(Y j 0)7.Draw j from j= j 1+" N j 1;c2 ~ .8.Draw u from U(0;1).9.Evaluate f Y j j and P jA evaluate P j for given jB use Paul Klein’s method to solve the model for given jC use Kalman…lter to evaluate f Y j j10.Return j= j ifu j 1; j 1 =min 8<:fY j j P j f Y j j 1 P j 1 ;19=;11.Otherwise,return j= j 1.12.If j N then j!j+1and go to step7.13.Approximate the posterior expected value of a function h( )by:E[h( )j Y]=1N simN simX j=1h jN sim=N N burn inIt is recommended to adjust the scale factor c so that the acceptance rate is roughly25percent in WRM algorithm.4An example:business cycle accountingThis example illustrates Bayesian estimation of the wedges process in Chari, Kehoe and McGrattan(2007)’s business cycle accounting.The wedges process is s t= ^A t;^ lt;^ xt;^g t .s t+1=P s t+Q"t+1P=26664p11p12p13p14 p21p22p23p24p31p32p33p34p41p42p43p4437775Q=26664q11000 q21q2200q31q32q330q41q42q43q4437775"t+1 N(04 1;I4 4)We estimate the lower triangular matrix Q to ensure that the estimate of V= QQ0is positive semide…nite.The matrix Q has no structural interpretation.Given the wedges,which are functionally similar to shocks,the next step is to solve the log-linearized model.We use Paul Klein’s MATLAB code to solve the log-linearized model.The state variables of the model are: ^k t;s t = ^k t;^A t;^ lt;^ xt;^g tThe control variables of the model are: ^c t;^x t;^y t;^l t The observed variables of the model are: ^y t;^x t;^l t;^g t Here again the log-linearized model:~c ~y ^c t+~x~y^x t+~g~y^g t=^y t(1.c)^y t=^A t+ ^k t+(1 )^l t(2.c)^c t=^A t+ ^k t " +l(1 l)#^l t 1(1 l)^ lt(3.c)^ xt (1+ )+(1+ x)(1+ )E t^c t+1 (1+ x)(1+ )^c t(4.c)=E t ~y~k ^y t+1 ^k t+1 +(1 )^ xt+1(1+ n)(1+ )^k t+1=(1 )^k t+~x~k^x t(5.c)In Lecture4,I have shown the maximum likelihood estimation of the wedges process.Going from MLE to Bayesian estimation is straightforward.The…rst step is to set the priors.The choice of the priors follows Saijo,Hikaru(2008),"The Japanese Depres-sion in the Interwar Period:A General Equilibrium Analysis,"B.E.Journal of Macroeconomics.The prior for diagonal terms of matrix P is assumed to follow a beta distribution with mean0:7and standard deviation0:2.The prior for non-diagonal terms of matrix P is assumed to follow a normal distribution with mean0and standard deviation0:3.The prior for diagonal terms of matrix Q is assumed to follow an uniform distri-bution between0and0:5.The prior for non-diagonal terms of matrix Q is assumed to follow an uniform distribution between 0:5and0:5.The table below summarizes the priors.PriorName Domain Density Parameter1Parameter2 p11;p22;p33;p44[0;1)Beta0:0350:015p12;p13;p14R Normal00:3p21;p23;p24R Normal00:3p31;p32;p34R Normal00:3p41;p42;p43R Normal00:3q11;q22;q33;q44[0;0:5]Uniform00:5q21;q31;q32;q41;q42;q43[ 0:5;0:5]Uniform 0:50:5If the sequence obtained from MCMC were i.i.d.,we could use a central limit theorem to derive the standard error(known as the numerical standard error) associate with the estimate.Koop,Gary,Dale J.Poirier,and Justin L.Tobias(2007),Bayesian Econometric Methods,page119.E[ j y]=^ =1RR X r=1 (r)V ar( j y)=^ 2=1RRX r=1 (r) ^ 2p R ^ N 0;^ 2。

DSGE的学习

DSGE的学习

接下来,讨论DSGE的学习。

在教材上,DSGE模型的学习是三板斧。

第一个是DSGE的思想和技巧:Cooley,1995,Frontiers of Business Cycle Research。

推荐这本书,而不是其他,是有原因的。

在RBC中,竞争性均衡模型的构建语言是递归竞争性均衡,换言之,就是Sargent等所说的用“大K、小k技巧”来表述理性预期思想。

而在其他教材中,更多的是直接定义竞争性均衡:消费者最优、厂商最优、两者最优的结构构成所有市场的供给与需求、市场出清要求供求相等(价格随之决定)——如果竞争性均衡搞不明白,可以看看Williamson的宏观经济学这本教材,再加Varian的中微做补充。

这本书里面的重要知识是:RBC模型、社会计划者问题、竞争性均衡角度构建的非最优经济环境、校准。

不需要看的是模型的求解,因为选取的一些求解方法有些老旧了,现在不怎么常用。

第二个是动态规划:Stokey,Lucas with Prescott,1989,名字就不写了,大家都知道。

主要目的是三个:其一是用来做参考书,以便什么时候需要证明解的存在和唯一性时拿出来翻阅;其二是了解动态规划的术语;第三个是拿来提高数学(尤其是代数)功底。

第三个是动态规划的一系列应用:Ljungqvist and Sargent,2000,名字就不写了,大家都知道。

这本书不好啃,而且啃了未必有所裨益,因为里面的专题实在太多了,而且,一些详细介绍的研究方法存在严重的过时,而一些重要的研究方法又只有只言片语。

举例来说,线性二次型动态规划,现在用得很少,书上很多地方都是用它来求解;再者,Blanchard and Kahn 求解、King-Plosser-Rebelo求解(或Uhlig的tookit)、状态空间、极大似然、GMM 等等重要方法,都是只言片语。

以上三本书实际上有个良好的替代品:Dirk Kreuger的Macroeconomic Theory。

清华大学电路原理于版课件5

清华大学电路原理于版课件5

i11 R1 i + a1 – R2 ib1 R3
i12 R1 ia2 R2 + ib2 – R3
i13 R1 ia3 R2 R3 ib3 + –
uS1和uS2不作用
us1
uS2和uS3不作用
us2
us3
uS1和uS3不作用
R11ia1+R12ib1=us1 R21ia1+R22ib1=0
us 1 R12 0 R22 ia 1 R11 R12 R21 R22 R22 us 1 Δ
10V

Us'= -10 I1'+U1' = -101+41= -6V
Principles of Electric Circuits Lecture 5 Tsinghua University 2012
I1 6 + 10V – I1' + 10V – 6 4
+
10 I1
– + 4A
I1''
i
i '=1A
2
13A
1
5A
1
2A
+ 2V –
设 i'= 1A
i us ' i ' us
us 51 i ' i ' 1 1. 5 A us 34
Principles of Electric Circuits Lecture 5 Tsinghua University 2012
讨论
i a
+ 负电阻
u 开路
正电阻 电压源
N
i
b-

0 电流源 电流源

清华大学《运筹学》教材相应的授课文档.第五章

清华大学《运筹学》教材相应的授课文档.第五章

= opt v k ( s k , u k ) + opt V k +1, n ( s k +1 , p k +1, n ) uk p k +1, n = opt {v k ( s k , u k ) + f k +1 ( s k +1 ) }
uk
* p k , n 表示 s k → s n的最优策略 , 则最优值函数
4.策略 策略:决策按顺序构成的序列,用p表示.
p k ,n ( sk ) : 第 k阶段起至第 n阶段止的策略 p k ,n ( s k ) = {u k ( sk ), u k +1 ( sk +1 )... , u n ( sn )} Pk ,n ( sk ) : 第 k阶段起至第 n阶段止的策略 p k ,n ( s k ) ∈ Pk ,n ( sk ) 当 k = 1时. p1,n ( s1 )为全过程策略 . p1,n ( s1 ) ∈ P ,n ( s1 ) 1
解:阶段n = 3, k = 1,2,3 s1 = A, s 2 = {B1 , B2 , B3}, s3 = {C1 , C2 }s4 = E u k = uk ( sk ) vk = vk ( sk , uk ) → 阶段运费 f k ( sk ) = min {vk ( sk , uk ) + f k +1 ( sk +1 )} k = 1,2,3 u ( k )∈Dk f 3+1 ( s3+1 ) = f 4 ( E ) = 0
4.2基本方程 设指标函数为 n
Vk ,n =
∑ v j ( s j , u j ) = v k ( s k , u k ) + V k + 1, n

动态随机一般均衡模型及其应用DSGEPPT课件

动态随机一般均衡模型及其应用DSGEPPT课件
• 国债问题(Aiyagari and McGrattan(1998))
• 国际经济周期(Mendoza (1991), Backus et al. (1992), Stockman andTesar (1995))
• 能源价格与波动:Kim(1992)
2020/1/122013-12-02
DSGE
summary measure such as a neutral real
interest 2020/1/122013-12-02 rate would be DSGE unwise...
25
模型调校
• Kydland and Prescott (1982) 建立了一种崭新 的数量化研究方法——模型调校(Calibration)
– 卢卡斯批判 – 外生结构冲击的结构性不足 – 模型的实证表现尚待改善
2020/1/122013-12-02
DSGE
2
一、动态随机一般均衡模型
2020/1/122013-12-02
DSGE
3
动态随机一般均衡模型的特征
• 所谓“动态随机一般均衡模型”是指模型 具有三大特征:
– 动态 – 随机 – 一般均衡
increases in output gaps and in inflation result from increases in the natural rate of interest that are not offset by a corresponding tightening of monetary policy...or alternatively from loosenings of monetary policy that are not justified by declines in the natural rate of interests.

清华大学李稻葵中级微观经济学讲义

清华大学李稻葵中级微观经济学讲义
Chapter One
The Market --- Appreciating Economic Modeling
The Purpose of this Chapter
• To begin to understand the art of building an economic model • To begin to understand three basic elements of modeling in economics:
– apartments are close or distant, but otherwise identical – distant apartments rents are exo genous (外生变量) and known – many potential renters and landlords
– Purpose – Simplification through assumptions – Value judgment
The Purpose of an Economic Model
• The purpose of an economic model is to help provide precise insights (精确的 洞察力)on a specific economic phenomenon. • Thus:
– Different phenomena needs different model; – Simplification by assumption is necessary
An Illustration: Modeling the Apartment Market
• Purpose: How are apartment rents determined? Are rents “desirable”? • Simplifying assumptions:

Stata DSGE模型入门指南说明书

Stata DSGE模型入门指南说明书

Title Intro—Introduction to DSGE manualDescription Remarks and examples Also seeDescriptionDSGE stands for dynamic stochastic general equilibrium.DSGE models are multivariate time-series models that are used in economics,in particular,macroeconomics,for policy analysis and forecasting.These models are systems of equations that are typically derived from economic theory.As such, the parameters are often directly interpretable based on theory.DSGE models are unique in that equations in the system allow current values of variables to depend not only on past values but also on expectations of future values.The dsgenl command estimates parameters of nonlinear DSGE models.The dsge command estimates parameters of linear DSGE models.Remarks and examples We recommend that you read this manual beginning with[DSGE]Intro1and then continue with the remaining introductions.In these introductions,we will introduce DSGE models,show you how to use the dsgenl and dsge commands,walk you through worked examples of classic models,and present solutions to common stumbling blocks.[DSGE]Intro1and[DSGE]Intro2are essential reading.Read themfirst.Here you willfind an overview of DSGE models,descriptions of concepts used throughout the manual,discussion of assumptions,afirst worked example,and an introduction to the syntax.[DSGE]Intro1Introduction to DSGEs[DSGE]Intro2Learning the syntax[DSGE]Intro3focuses on classical DSGE models.It includes a series of examples that illustrate model solution,model estimation,and postestimation procedures for simple variants of common models.[DSGE]Intro3Classic DSGE examples[DSGE]Intro3a New Keynesian model[DSGE]Intro3b New Classical model[DSGE]Intro3c Financial frictions model[DSGE]Intro3d Nonlinear New Keynesian model[DSGE]Intro3e Nonlinear New Classical model[DSGE]Intro3f Stochastic growth model[DSGE]Intro4discusses some features commonly found in DSGE models and how to specify models with those features to dsge and dsgenl.The structural equations of the DSGE model must have a specific structure so that the model can be solved.Often,DSGE models are written using intuitive forms that do not have this structure.These intuitive forms can be rewritten in a logically equivalent form that has the structure required for solution.[DSGE]Intro4provides an overview of this topic and examples demonstrating solutions.12Intro—Introduction to DSGE manual[DSGE]Intro4Writing a DSGE in a solvable form[DSGE]Intro4a Specifying a shock on a control variable[DSGE]Intro4b Including a lag of a control variable[DSGE]Intro4c Including a lag of a state variable[DSGE]Intro4d Including an expectation dated by more than one periodahead[DSGE]Intro4e Including a second-order lag of a control[DSGE]Intro4f Including an observed exogenous variable[DSGE]Intro4g Correlated state variables[DSGE]Intro5–[DSGE]Intro8discuss technical issues.These introductions are essential reading, even though they are last.[DSGE]Intro5Stability conditions[DSGE]Intro6Identification[DSGE]Intro7Convergence problems[DSGE]Intro8Wald tests vary with nonlinear transforms[DSGE]Intro9,[DSGE]Intro9a,and[DSGE]Intro9b discuss Bayesian estimation.[DSGE]Intro9Bayesian estimation[DSGE]Intro9a Bayesian estimation of a New Keynesian model[DSGE]Intro9b Bayesian estimation of stochastic growth modelThe main command entries are references for syntax and implementation details.All the examples are in the introductions discussed above.[DSGE]dsge Linear dynamic stochastic general equilibrium models [DSGE]dsge postestimation Postestimation tools for dsge[DSGE]dsgenl Nonlinear dynamic stochastic general equilibrium models [DSGE]dsgenl postestimation Postestimation tools for dsgenl[DSGE]estat covariance Display estimated covariances of model variables[DSGE]estat policy Display policy matrix[DSGE]estat stable Check stability of system[DSGE]estat steady Display steady state of nonlinear DSGE model[DSGE]estat transition Display state transition matrix[BAYES]bayes:dsge Bayesian linear dynamic stochastic general equilibriummodels[BAYES]bayes:dsgenl Bayesian nonlinear dynamic stochastic general equilibriummodels[BAYES]bayes:dsge postestimation Postestimation tools for bayes:dsge and bayes:dsgenl [BAYES]bayesirf Bayesian IRFs,dynamic-multiplier functions,and FEVDsIntro—Introduction to DSGE manual3Also see[DSGE]Intro1—Introduction to DSGEsStata,Stata Press,and Mata are registered trademarks of StataCorp LLC.Stata andStata Press are registered trademarks with the World Intellectual Property Organization®of the United Nations.Other brand and product names are registered trademarks ortrademarks of their respective companies.Copyright c 1985–2023StataCorp LLC,College Station,TX,USA.All rights reserved.。

清华大学中级微观经济学讲义

清华大学中级微观经济学讲义
p y w 1 x 1 w 2 x ~ 2 . I.e. yw p 1x1p w 2x ~2.
.
Short-Run Iso-Profit Lines
y
Slopesw1 p
x1
.
Short-Run Profit-Maximization
y
y f(x 1 ,x ~ 2 )
.
Economic Profit
The economic profit generated by (x1,…,xm,y1,…,yn) is
p 1 y 1 p n y n w 1 x 1 w m x m .
Notes:

For the time being, we restrict to the case of a competitive firm, which is a tiny relative to the market size and takes prices p1,…,pn w1,…,wm as given constants;
.
Comparative Statics of Short-Run
Profit-Maximization
y
y f(x 1 ,x ~ 2 )
y* Slopesw1 p
x
* 1
x1
.
Comparative Statics of Short-Run
Profit-Maximization
y
equal. y*
M P1
w1 p
Slopesw1 p
a
t
(
x
* 1
,
x~
2
,
y*
)
x
* 1
x1

DSGE模型

DSGE模型

DSGE 模型在房产税影响分析的应用1.模型综述动态随机一般均衡模型(dynamic stochastic general equilibrium model ,即DSGE ),是以微观和宏观经济理论为基础,采用动态优化方法考察个行为主体(家庭、厂商等)的决策,即在家庭最大化其一生效用、厂商最大化其利润的假设下得到个行为主体的行为方程。

各行为主体在决策时必须考虑其行为的当期影响,以及未来的后续影响,同时,现实经济中存在诸多的不确定性,因此,DSGE 模型在引入各种外生随机冲击的情况下,研究各主体之间的相互作用和相互影响。

(Dynamic stochastic general equilibrium modeling (abbreviated DSGE or sometimes SDGE or DGE) is a branch of applied general equilibrium theory that is influential in contemporary macroeconomics. The DSGE methodology attempts to explain aggregate economic phenomena, such as economic growth, business cycles, and the effects of monetary and fiscal policy, on the basis of macroeconomic models derived from microeconomic principles.)其主要特征有:(1)动态“动态”指经济个体考虑的是跨期最优选择(Inter-temporal Optimal Choice )。

因此,模型得以探讨经济体系中各变量如何随时间变化而变化的动态性质。

(2)随机“随机”则指经济体系受到各种不同的外生随机冲击所影响。

清华大学中级微观经济学讲义(清华 李稻葵)11-16页精选文档

清华大学中级微观经济学讲义(清华 李稻葵)11-16页精选文档
to impatient people (borrowers) in exchange for a rate-of-return on the loaned funds. – both groups are better off.
Arbitrage
The price today of an asset is p0. Its price tomorrow will be p1. Should it be sold now?
The rate-of-return from holding the
asset is I.e.
R p1 p0 p0
( 1 R ) p 0 ( 1 r ) p 0 .
I.e. if the rate-or-return to holding the
asset Rr the interest rate, then
keep the asset.
And if Rr then ( 1 R ) p 0 ( 1 r lly asset values are uncertain. Incorporating uncertainty is difficult at this stage so we will instead study assets assuming that we can see the future with perfect certainty.
Assets with Consumption Returns
The example of house A=appreciation T=implicit rental rate P=initial investment h=(T+A)/P=total rate of return h=(T+A)/P=r
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Bayesian Estimation of Linearized DSGE ModelsDr.Tai-kuang HoAssociate Professor.Department of Quantitative Finance,National Tsing Hua University,No. 101,Section2,Kuang-Fu Road,Hsinchu,Taiwan30013,Tel:+886-3-571-5131,ext.62136,Fax: +886-3-562-1823,E-mail:tkho@.tw.1Posterior distributionChapter12of Tsay(2005)provides an elegant introduction to Markov Chain Monte Carlo Methods with applications.Greenberg(2008)provides a very good introduction to fundamentals of Bayesian inference and simulation.Geweke(2005)provides a more advanced treatment of Bayesian econometrics.Bayesian inference combines prior belief(knowledge)with empirical data to form posterior distribution,which is the basis for statistical inference.:the parameters of a DSGE modelY:the empirical dataP( ):prior distribution for the parametersThe prior distribution P( )incorporates the prior belief and knowledge of the parameters.f(Y j ):the likelihood function of the data for given parametersBy the de…nition of conditional probability:f( j Y)=f( ;Y)f(Y)=f(Y j )P( )f(Y)(1)The marginal distribution f(Y)is de…ned as:f(Y)=Z f(Y; )d =Z f(Y j )P( )d f( j Y)is called the posterior distribution of .It is the probability density function(PDF)of given the observed empirical data Y.Omit the scale factor and equation(1)can be expressed as:f( j Y)/f(Y j )P( )Bayes theoremposterior P DF/(likelihood function) (prior P DF)Expressed in logarithm:log(posterior P DF)/log(likelihood function)+log(prior P DF)2Markov Chain Monte Carlo(MCMC)methodsThis section draws from Chapter7of Greenberg(2008).An advanced textbook is Carlin and Louis(2009),Bayesian Methods for Data Analysis,CRC Press.The basis of an MCMC algorithm is the construction of a transition kernel, denoted by p(x;y),that has an invariant density equal to the target density.Given such a kernel,we can start the process at x0to yield a draw x1from p(x0;x1),x2from p(x1;x2),x3from p(x2;x3),...,and x g from p x g 1;x g .The distribution of x g is approximately equal to the target distribution after a transient period.Therefore,MCMC algorithms provide an approximation to the exact posterior distribution of a parameter.How to…nd a kernel that has the target density as its invariant distribution? Metropolis-Hasting algorithm provides a general principle to…nd such kernels. Gibbs sampler is a special case of the Metropolis-Hasting algorithm.2.1Gibbs algorithmThe Gibbs algorithm is applicable when it is possible to sample from each con-ditional distribution.Suppose we want to sample from the joint distribution f(x1;x2).Further suppose that we are able to sample from the two conditional distributions f(x1j x2)and f(x2j x1).Gibbs algorithm1.Choose x(0)2(you can also start from x(0)1)2.The…rst iterationdraw x(1)1from f x1j x(0)2draw x(1)2from f x2j x(1)1 3.The g-th iterationdraw x(g)from f x1j x(g 1)21draw x(g)from f x2j x(g)124.Draw until the desired number of iterations is obtained. We discard some portion of the initial sample.This portion is the transient or burn-in sample.Let n be the number of total iterations and m be the number of burn-in sample. The point estimate of x1(similarly for x2)and its variance are:^x1=1n mnX j=m+1x(j)1^ 21=1n m 1nX j=m+1 x(j)1 ^x1 2The invariant distribution of the Gibbs kernel is the target distribution. Proof:x=(x1;x2)y=(y1;y2)p(x;y):x!y,x1!y1;x2!y2The Gibbs kernel is:p(x;y)=f(y1j x2) f(y2j y1)f(y1j x2):draw x(g)1from f x1j x(g 1)2f(y2j y1):draw x(g)2from f x2j x(g)1 It follows that:Z p(x;y)f(x)dx=Z f(y1j x2) f(y2j y1)f(x1;x2)dx1dx2=f(y2j y1)Z f(y1j x2)f(x1;x2)dx1dx2=f(y2j y1)Z f(y1j x2)f(x2)dx2=f(y2j y1)f(y1)=f(y1;y2)=f(y)This proves that f(y)is the invariant distribution for the Gibbs kernel p(x;y).The invariant distribution of the Gibbs kernel is the target distribution is a nec-essary,but not a su¢cient condition for the kernel to converge to the target distribution.Please refer to Tierney(1994)for a further discussion of such conditions.The Gibbs sampler can be easily extended to more than two blocks.In practice,convergence of Gibbs sampler is an important issue.I will use Brooks and Gelman(1998)’s method for convergence check.2.2Metropolis-Hasting algorithmMetropolis-Hasting algorithm is more general than the Gibbs sampler because it does not require the availability of the full set of conditional distribution forsampling.Suppose that we want to draw a random sample from the distribution f(X). The distribution f(X)contains a complicated normalization constant so that a direct draw is either too time-consuming or infeasible.However,there exists an approximate distribution(jumping distribution,proposal distribution)for which random draws are easy to obtain.The Metropolis-Hasting algorithm generates a sequence of random draws from the approximate distribution whose distributions converge to f(X).MH algorithm1.Given x,draw Y from q(x;y).2.Draw U from U(0;1).3.Return Y if:U (x;Y)=min(f(Y)q(Y;x);1)f(x)q(x;Y)4.Otherwise,return x and go to step1.5.Draw until the desired number of iterations is obtained.q(x;y)is the proposal distribution.The normalization constant of f(X)is not needed because only a ratio is used in the computation.How to choose the proposal density q(x;y)?The proposal density should generate proposals that have a reasonably good probability of acceptance.The sampling should be able to explore a large part of the support.Two well-known proposal kernels are the random walk kernel and the independent kernel.A.Random walk kernel:y=x+uh(u)=h( u)!q(x;y)=q(y;x)! (x;y)=f(y)f(x) B.Independent kernel:q(x;y)=q(y)q(x;y)=q(y)! (x;y)=f(y)=q(y)f(x)=q(x)2.2.1Metropolis algorithmThe algorithm uses a symmetric proposal function,namely q(Y;x)=q(x;Y). Metropolis algorithm1.Given x,draw Y from q(x;y).2.Draw U from U(0;1).3.Return Y if:U (x;Y)=min(f(Y)f(x);1)4.Otherwise,return x and go to step1.5.Draw until the desired number of iterations is obtained.2.2.2Properties of MH algorithmThis part draws from Chib and Greenberg(1995),“Understanding the Metropolis-Hasting Algorithm,”The American Statistician,49(4),pp.327-335.A kernel q(x;y)is reversible if:f(x)q(x;y)=f(y)q(y;x)It can be shown that f is the invariant distribution for the reversible kernel q de…ned above.Now we begin with a kernel that is not reversible:f(x)q(x;y)>f(y)q(y;x)We make the irreversible kernel into a reversible kernel by multiplying both sides by a function .f(x) (x;y)q(x;y)|{z}|{z}=f(y) (y;x)q(y;x)p(x;y) (x;y)q(x;y)f(x)p(x;y)=f(y)p(y;x)This turns the irreversible kernel q(x;y)into the reversible kernel p(x;y). Now set (y;x)=1.f(x) (x;y)q(x;y)=f(y)q(y;x)(x;y)=f(y)q(y;x)f(x)q(x;y)<1By letting (x;y)< (y;x),we equalize the probability that the kernel goes from x to y with the probability that the kernel goes from y to x.Similar consideration for the general case implies that:;1)(x;y)=min(f(y)q(y;x)f(x)q(x;y)2.2.3Metropolis-Hasting algorithm with two blocksSuppose we are at the(g 1)-th iteration x=(x1;x2)and want to move to the g-th iteration y=(y1;y2).MH algorithm1.Draw Z1from q1(x1;Z j x2).2.Draw U1from U(0;1).3.Return y1=Z1if:U1 (x1;Z1j x2)=f(Z1;x2)q1(Z1;x1j x2)f(x1;x2)q1(x1;Z1j x2) 4.Otherwise,return y1=x1.5.Draw Z2from q2(x2;Z j y1).6.Draw U2from U(0;1).7.Return y2=Z2if:U2 (x2;Z2j y1)=f(y1;Z2)q(Z2;x2j y1)f(y1;x2)q(x2;Z2j y1) 8.Otherwise,return y2=x2.3Estimation algorithmKaragedikli et al.(2010)provide an overview of the Bayesian estimation of a simple RBC model.This paper provides internet linkages of several sources of useful computation code.The program appendix includes a whole set of DYNARE programs to estimate, simulate the simple RBC model by using the U.S.output data,as well as to diagnose the convergence of MCMC.The references include a rich and most updated literature on estimation of DSGE models.However,the paper is con…ned to Bayesian estimation,and it is not useful for researchers who want to understand the computational details and to build their own programs.An and Schorfheide(2007)review Bayesian estimation and evaluation techniques that have been developed in recent years for empirical work with DSGE models.Why using Bayesian method to estimate DSGE models?Bayesian estimation of DSGE models has3characteristics(An and Schorfheide, 2007).First,compared to GMM estimation,Bayesian estimation is system-based.(This is also true for maximum likelihood estimation)Second,the estimation is based on likelihood function generated by the DSGE model,rather than the discrepancy between model-implied impulse responses and VAR impulse responses.Third,prior distributions can be used to incorporate additional information into the parameter estimation.Counter-argument:Fukaµc and Pagan(2010)show that DSGE models should be not estimated and evaluated only with full information methods.If the assumption that the complete system of equations is speci…ed properly seems dubious,limited information estimation,which focuses on speci…c equa-tions,can provide useful complementary information about the adequacy of the model equations in matching the data.3.1Draw from the posterior by Random Walk Metropolis algo-rithmRemember that posterior is proportional to likelihood function times prior.f( j Y)/f(Y j )P( )How to compute posterior moments?Random Walk Metropolis(RWM)algorithm allows us to draw from the posterior f( j Y).RWM algorithm belongs to the more general class of Metropolis-Hasting algo-rithm.RWM algorithm1.Initialize the algorithm with an arbitrary value 0and set j=1.2.Draw j from j= j 1+" N j 1; " .3.Draw u from U(0;1).4.Return j= j ifu j 1; j 1 =min 8<:fY j j P j f Y j j 1 P j 1 ;19=;5.Otherwise,return j= j 1.6.If j N then j!j+1and go to step2.Kalman…lter is used to evaluate the above likelihood values f Y j j and f Y j j 1 .3.2Computational algorithmSchorfheide(2000)and An and Schorfheide(2007).e a numerical optimization routine to maximize log f(Y j )+log P( ).2.Denote the posterior model by~ .3.Denote by~ the inverse of the Hessian computed at the posterior mode~ .4.Specify an initial value for 0,or draw 0from N ~ ;c20 ~ .5.Set j=1and set the number of MCMC N.6.Evaluate f(Y j 0)and P( 0)A evaluate P( 0)for given 0B use Paul Klein’s method to solve the model for given 0C use Kalman…lter to evaluate f(Y j 0)7.Draw j from j= j 1+" N j 1;c2 ~ .8.Draw u from U(0;1).9.Evaluate f Y j j and P jA evaluate P j for given jB use Paul Klein’s method to solve the model for given jC use Kalman…lter to evaluate f Y j j10.Return j= j ifu j 1; j 1 =min 8<:fY j j P j f Y j j 1 P j 1 ;19=;11.Otherwise,return j= j 1.12.If j N then j!j+1and go to step7.13.Approximate the posterior expected value of a function h( )by:E[h( )j Y]=1N simN simX j=1h jN sim=N N burn inIt is recommended to adjust the scale factor c so that the acceptance rate is roughly25percent in WRM algorithm.4An example:business cycle accountingThis example illustrates Bayesian estimation of the wedges process in Chari, Kehoe and McGrattan(2007)’s business cycle accounting.The wedges process is s t= ^A t;^ lt;^ xt;^g t .s t+1=P s t+Q"t+1P=26664p11p12p13p14 p21p22p23p24p31p32p33p34p41p42p43p4437775Q=26664q11000 q21q2200q31q32q330q41q42q43q4437775"t+1 N(04 1;I4 4)We estimate the lower triangular matrix Q to ensure that the estimate of V= QQ0is positive semide…nite.The matrix Q has no structural interpretation.Given the wedges,which are functionally similar to shocks,the next step is to solve the log-linearized model.We use Paul Klein’s MATLAB code to solve the log-linearized model.The state variables of the model are: ^k t;s t = ^k t;^A t;^ lt;^ xt;^g tThe control variables of the model are: ^c t;^x t;^y t;^l t The observed variables of the model are: ^y t;^x t;^l t;^g t Here again the log-linearized model:~c ~y ^c t+~x~y^x t+~g~y^g t=^y t(1.c)^y t=^A t+ ^k t+(1 )^l t(2.c)^c t=^A t+ ^k t " +l(1 l)#^l t 1(1 l)^ lt(3.c)^ xt (1+ )+(1+ x)(1+ )E t^c t+1 (1+ x)(1+ )^c t(4.c)=E t ~y~k ^y t+1 ^k t+1 +(1 )^ xt+1(1+ n)(1+ )^k t+1=(1 )^k t+~x~k^x t(5.c)In Lecture4,I have shown the maximum likelihood estimation of the wedges process.Going from MLE to Bayesian estimation is straightforward.The…rst step is to set the priors.The choice of the priors follows Saijo,Hikaru(2008),"The Japanese Depres-sion in the Interwar Period:A General Equilibrium Analysis,"B.E.Journal of Macroeconomics.The prior for diagonal terms of matrix P is assumed to follow a beta distribution with mean0:7and standard deviation0:2.The prior for non-diagonal terms of matrix P is assumed to follow a normal distribution with mean0and standard deviation0:3.The prior for diagonal terms of matrix Q is assumed to follow an uniform distri-bution between0and0:5.The prior for non-diagonal terms of matrix Q is assumed to follow an uniform distribution between 0:5and0:5.The table below summarizes the priors.PriorName Domain Density Parameter1Parameter2 p11;p22;p33;p44[0;1)Beta0:0350:015p12;p13;p14R Normal00:3p21;p23;p24R Normal00:3p31;p32;p34R Normal00:3p41;p42;p43R Normal00:3q11;q22;q33;q44[0;0:5]Uniform00:5q21;q31;q32;q41;q42;q43[ 0:5;0:5]Uniform 0:50:5If the sequence obtained from MCMC were i.i.d.,we could use a central limit theorem to derive the standard error(known as the numerical standard error) associate with the estimate.Koop,Gary,Dale J.Poirier,and Justin L.Tobias(2007),Bayesian Econometric Methods,page119.E[ j y]=^ =1RR X r=1 (r)V ar( j y)=^ 2=1RRX r=1 (r) ^ 2p R ^ N 0;^ 2。

相关文档
最新文档