动态计量ppt课件

上传人:ni****g 文档编号:586714523 上传时间:2024-09-05 格式:PPT 页数:47 大小:146KB
返回 下载 相关 举报
动态计量ppt课件_第1页
第1页 / 共47页
动态计量ppt课件_第2页
第2页 / 共47页
动态计量ppt课件_第3页
第3页 / 共47页
动态计量ppt课件_第4页
第4页 / 共47页
动态计量ppt课件_第5页
第5页 / 共47页
点击查看更多>>
资源描述

《动态计量ppt课件》由会员分享,可在线阅读,更多相关《动态计量ppt课件(47页珍藏版)》请在金锄头文库上搜索。

1、动态经济计量模型与时间序列模型罗 凯2019.11.22Noticen为防止丧失,上机作业一致交至助教 黄国华师兄 信箱nhuangguohuagsm.pku.edu动态经济计量模型n时间n静态模型同期影响n分布滞后模型继续影响分布滞后模型n无约束有限分布滞后模型n n困难:n时间序列期数有限,q会过多占用自在度;net自相关会很严重;n多重共线性分布滞后模型n滞后期长度nAdjusted RsquarenAIC准那么:分布滞后模型n例如:两期滞后模型nReg yt xt xtlag1 xtlag2n看Adjusted Rsquaren进展序贯F 检验分布滞后模型方法1n多项式分布滞后模型 n

2、步骤:n1.先定义新的解释变量:nZt0=xt+xtlag1+xtlag2+xtlagq分布滞后模型nZt1= xtlag1+2xtlag2+qxtlagqnZt2= xtlag1+4xtlag2+q2xtlagqnZt3= xtlag1+8xtlag2+q3xtlagqn2.run OLSnreg yt zt0-zt3n3. 根据下式,回求分布滞后模型方法2ncnsreg - Constrained linear regressionn cnsreg depvar indepvars if in weight , constraints(constraints)n optionsn opti

3、ons descriptionn -n Modeln * constraints(constraints) apply specified linear constraintsn noconstant suppress constant termn SE/Robustn vce(vcetype) vcetype may be bootstrap or jackknife分布滞后模型方法2n Reportingn level(#) set confidence level; default is level(95)n -n * constraints(constraints) is requir

4、ed.n depvar and indepvars may contain time-series operators; see tsvarlist.n bootstrap, by, jackknife, rolling, statsby, and xi are allowed; see n prefix.n aweights and fweights are allowed; see weight.n See cnsreg postestimation for features available after estimation.nDescriptionn cnsreg fits cons

5、trained linear regression models. cnsreg typed withoutn arguments redisplays the previous cnsreg results.分布滞后模型方法2nOptionsn +-+n -+ Model +-n constraints(constraints), noconstant; see estimation options.n +-+n -+ SE/Robust +-n vce(vcetype); see vce_option.n +-+n -+ Reporting +-n level(#); see estima

6、tion options.分布滞后模型方法2nExamplesn . constraint define 1 price = weightn . cnsreg mpg price weight, constraints(1)n . constraint def 1 price = weightn . constraint def 2 displ = weightn . constraint def 3 gear_ratio = -foreignn . cnsreg mpg price weight displ gear_ratio foreign length, c(1-3)n . predi

7、ct mpghat if e(sample)n . constraint define 99 _cons = 0n . cnsreg mpg price weight displ gear_ratio foreign length, c(1-3,99)分布滞后模型方法2n假设原模型有q个滞后,那么约束的个数为qp个。接上例,进一步设滞后5期,因p3,因此,有2个约束。n依次为:几何滞后模型 自回归方式n方法一:nvar - Vector autoregression modelsnvar depvarlist if in , optionsnVar yt xt ylagn方法二:nprais

8、depvar indepvars if in , optionsn此外,还是可以试着run一下:FGLS,xtivreg几何滞后模型 挪动平均方式n主要方法:n非线性最小二乘法Stata 语句例如nNLS语句nnl fcn depvar varlist weightif expin range ,level(#) init() lnlsq(#) leave eps(#) nolog trace iterate(#) delta(#) fcn_optionsnnlinit # parameter_list.(给参数赋初值).npredictnl yhat =将参数最终估计值带入的回归方程式;St

9、ata 常用的函数(系统已内设) Exponential regression with one asymptote: nl exp3 Y = b0 + b1*b2X nl exp2 Y = b1*b2X nl exp2a Y = b1*(1-b2X) Logistic function (symmetric sigmoid shape)(*): nl log4 Y = b0 + b1/(1 + exp(-b2*(X-b3) nl log3 Y = b1/(1 + exp(-b2*(X-b3) Gompertz function (asymmetric sigmoid shape): nl g

10、om4 Y = b0 + b1*exp(-exp(-b2*(X-b3) nl gom3 Y = b1*exp(-exp(-b2*(X-b3)函数编程例如program nlfcn version 8.0 if 1=? global S_1 parameter names (initialize parameters) exit replace 1= . end 留意:详细函数称号前面的nl与函数称号中间无空格,且不可去掉.以后可以直接调用,留意语句格式:nl fcn depvar indepvars动态回归模型nARMAX方法n或:(差分法)动态回归模型narima - ARIMA, ARMA

11、X, and other dynamic regression modelsnBasic syntax for a regression model with ARMA disturbancesn arima depvar indepvars, ar(numlist) ma(numlist)n Basic syntax for an ARIMA(p,d,q) modeln arima depvar, arima(#p,#d,#q)n Basic syntax for a multiplicative seasonal ARIMA(p,d,q)*(P,D,Q)s modeln arima dep

12、var, arima(#p,#d,#q) sarima(#P,#D,#Q,#s)n Full syntaxn arima depvar indepvars if in weight , options动态回归模型n options descriptionn -n Modeln noconstant suppress constant termn arima(#p,#d,#q) specify ARIMA(p,d,q) model for dependentn variablen ar(numlist) autoregressive terms of the structural modeln

13、disturbancen ma(numlist) moving-average terms of the structural modeln disturbancen Model 2n constraints(constraints) apply specified linear constraintsn sarima(#P,#D,#Q,#s) specify period-#s multiplicative seasonaln ARIMA termn mar(numlist, #s) multiplicative seasonal autoregressiven terms; may be

14、repeatedn mma(numlist, #s) multiplicative seasonal moving-averagen terms; may be repeated动态回归模型n Model 3n condition use conditional MLE instead of full MLEn savespace conserve memory during estimationn diffuse use diffuse prior for starting Kalman filtern recursionsn state(#|matname) use alternate s

15、tate vector for startingn Kalman filter recursionsn p0(#|matname) use alternate prior for starting Kalmann recursions; seldom usedn SE/Robustn vce(vcetype) vcetype may be opg, robust, or oimn robust synonym for vce(robust)n Reportingn level(#) set confidence level; default is level(95)n detail repor

16、t list of gaps in time seriesn Max options动态回归模型n maximize_options control the maximization process; seldomn usedn -n You must tsset your data before using arima; see tsset.n depvar and indepvars may contain time-series operators; see tsvarlist.n by, rolling, statsby, and xi may be used with arima;

17、see prefix.n iweights are allowed; see weights.n See arima postestimation for features available after estimation.nDescriptionn arima fits univariate models with time-dependent disturbances. arima fitsn a model of depvar on indepvars where the disturbances are allowed ton follow a linear autoregress

18、ive moving-average (ARMA) specification. Then dependent and independent variables may be differenced or seasonallyn differenced to any degree. When independent variables are included in then specification, such models are frequently called ARMAX models; and whenn independent variables are not specif

19、ied, they reduce to Box-Jenkinsn autoregressive integrated moving-average (ARIMA) models in the dependent动态回归模型n variable. Multiplicative seasonal ARIMA and ARMAX models can also ben fitted. Missing data are allowed and are handled using the Kalman filtern and methods outlined in TS arima.n In the f

20、ull syntax, depvar is the variable being modeled, and then structural or regression part of the model is specified in indepvars.n ar() and ma() specify the lags of autoregressive and moving-average terms,n respectively; and mar() and mma() specify the multiplicative seasonaln autoregressive and movi

21、ng-average terms, respectively.n arima allows time-series operators in the dependent variable andn independent variable lists, and it is often convenient to make extensiven use of these operators; see dates for an extended discussion ofn time-series operators.n arima typed without arguments redispla

22、ys the previous estimates.nOptions动态回归模型n +-+n -+ Model +-n noconstant; see estimation options.n arima(#p,#d,#q) is an alternative, shorthand notation for specifyingn models with ARMA disturbances. The dependent variable and anyn independent variables are differenced #d times, 1 through #p lags ofn

23、autocorrelations and 1 through #q lags of moving averages are includedn in the model. For example, the specificationn . arima D.y, ar(1/2) ma(1/3)n is equivalent ton . arima y, arima(2,1,3)n The latter is easier to write for simple ARMAX and ARIMA models, butn if gaps in the AR or MA lags are to be

24、modeled, of if differentn operators are to be applied to independent variables, the first syntax动态回归模型n is required.n ar(numlist) specifies the autoregressive terms of the structural modeln disturbance to be included in the model. For example, ar(1/3)n specifies that lags of 1, 2, and 3 of the struc

25、tural disturbance ben included in the model; and ar(1 4) specifies that lags 1 and 4 ben included, perhaps to account for additive quarterly effects.n If the model does not contain regressors, these terms can also ben considered autoregressive terms for the dependent variable.n ma(numlist) specifies

26、 the moving-average terms to be included in then model. These are the terms for the lagged innovations (white-noisen disturbances).n constraints(constraints); see estimation options for details.n If constraints are placed between structural model parameters and ARMAn terms, the first few iterations

27、may attempt steps into nonstationaryn areas. This can be ignored if the final solution is well within the动态回归模型n bounds of stationary solutions.n +-+n -+ Model 2 +-n sarima(#P,#D,#Q,#s) is an alternative, shorthand notation for specifyingn the multiplicative seasonal components of models with ARMAn

28、disturbances. The dependent variable and any independent variablesn are lag-#s seasonally differenced #D times, and 1 through #P seasonaln lags of autoregressive terms and 1 through #Q seasonal lags ofn moving-average terms are included in the model. For example, then specificationn . arima DS12.y,

29、ar(1/2) mar(1/2,12) mma(1/2,12)n is equivalent ton . arima y, arima(2,1,3) sarima(2,1,2,12)n mar(numlist,#s) specifies the lag-#s multiplicative seasonaln autoregressive terms. For example, mar(1/2,12) requests that the动态回归模型n first two lag-12 multiplicative seasonal autoregressive terms ben include

30、d in the model.n mma(numlist,#s) specifies the lag-#s multiplicative seasonaln moving-average terms. For example, mma(1 3,12) requests that then first and third (but not the second) lag-12 multiplicative seasonaln moving-average terms be included in the model.n +-+n -+ Model 3 +-n condition specifie

31、s that conditional, rather than full, maximum likelihoodn estimates be produced. This estimation method is not appropriate forn nonstationary series but may be preferable for long series or forn models that have one or more long AR or MA lags. diffuse, p0(), andn state0() may not be specified with c

32、ondition. See TS arima forn details.n savespace specifies that memory use be conserved by retaining only thosen variables required for estimation. The original dataset is restored动态回归模型n after estimation. This option is rarely used and should be used onlyn if there is insufficient space to fit a mod

33、el without the option.n Note, however, that arima requires considerably more temporary storagen diffuse specifies that a diffuse prior be used as a starting point for then during estimation than most estimation commands in Stata.n Kalman filter recursions. Using diffuse, nonstationary models may ben

34、 fitted with arima (see option p0() below; diffuse is equivalent ton specifying p0(1e9). See TS arima for details.n state0(#|matname) is a rarely used option that specifies an alternaten initial state vector for starting the Kalman filter recursions. If #n is specified, all elements of the vector ar

35、e taken to be #. Then default initial state vector is state0(0).n p0(#|matname) is a rarely specified option that can be used forn nonstationary series or when an alternate prior for starting then Kalman recursions is desired; see TS arima for details.n +-+动态回归模型n -+ SE/Robust +-n vce(vcetype); see

36、vce_option.n robust; see estimation options.n For state-space models in general and ARMAX and ARIMA models inn particular, the robust or quasi-maximum likelihood estimates (QMLE) ofn variance are robust to symmetric non-normality in the disturbances,n including, as a special case, heteroskedasticity

37、. The robust variancn estimates are not generally robust to functional misspecification ofn the structural or ARMA components of the model.n +-+n -+ Reporting +-n level(#); see estimation options.n detail specifies that a detailed list of any gaps in the series ben reported, including gaps due to mi

38、ssing observations or missing data动态回归模型n for the dependent variable or independent variables.n +-+n -+ Max options +-n maximize_options: difficult, technique(algorithm_spec), iterate(#),n nolog, trace, gradient, showstep, hessian, shownrtolerance,n tolerance(#), ltolerance(#), gtolerance(#), nrtole

39、rance(#),n nonrtolerance(#), from(init_specs); see maximize.n These options are sometimes more important for ARIMA models than mostn maximum likelihood models because of potential convergence problemsn with ARIMA models, particularly if the specified model and the samplen data imply a nonstationary

40、model.n Several alternate optimization methods, such asn Berndt-Hall-Hall-Hausman (BHHH) and Broyden-Fletcher-Goldfarb-Shannon (BFGS), are provided for arima models. Although arima models are notn as difficult to optimize as ARCH models, their likelihoods aren nevertheless generally not quadratic an

41、d often pose optimization动态回归模型n difficulties; this is particularly true if a model is nonstationary orn nearly nonstationary. Since each method approaches optimizationn differently, some problems can be successfully optimized by ann alternate method when one method fails.n The following options are

42、 all related to maximization and aren particularly important in fitting ARIMA models.n technique(algorithm_spec) specifies the optimization technique to usen to maximize the likelihood function.n technique(bhhh) specifies the Berndt-Hall-Hall-Hausman (BHHH)n algorithm.n technique(dfp) specifies the

43、Davidon-Fletcher-Powell (DFP)n algorithm.n technique(bfgs) specifies the Broyden-Fletcher-Goldfarb-Shannon (BFGS) algorithm.动态回归模型n technique(nr) specifies that Statas modified Newton-Raphson (NR)n algorithm.n You can specify multiple optimization methods. For example,n technique(bhhh 10 nr 20)n req

44、uests that the optimizer perform 10 BHHH iterations, switch ton Newton-Raphson for 20 iterations, switch back to BHHH for 10 moren iterations, and so on.n The default for arima is technique(bhhh 5 bfgs).n gtolerance(#) is a rarely used option that specifies a threshold forn the relative size of the

45、gradient; see maximize. The defaultn gradient tolerance for arima is gtolerance(.05).n gtolerance(999) effectively disables the gradient criterion whenn convergence is difficult to achieve. If the optimizer becomesn stuck with repeated (backed up) messages, the gradient probably动态回归模型n still contain

46、s substantial values, but an uphill direction cannotn be found for the likelihood. Using gtolerance(999) will oftenn obtain results but it may be unclear whether the global maximumn likelihood has been found. It is usually better to set then maximum number of iterations (see maximize) to the point w

47、here then optimizer appears to be stuck and then inspect the estimationn results.n from(init_specs) specifies the starting values of the modeln coefficients; see maximize for a general discussion and syntaxn options.n The standard syntax for from() accepts a matrix, a list of values,n or coefficient

48、 name value pairs; see maximize. In addition, ariman accepts from(armab0), which sets the starting value for all ARMAn paramters in the model to 0 prior to optimization.n ARIMA models may be sensitive to initial conditions and may haven coefficent values that correspond to local maxima. The defaultn

49、 starting values for arima are generally very good, particularly in动态回归模型n large samples for stationary series.nExamplesn . arima wpi, arima(1,1,1)n . arima D.wpi, ar(1) ma(1) (same as above)n . arima D.wpi, ar(1) ma(1 4) (add quarterly MA effect)n . arima wpi, arima(3,2,4) (ARIMA - p=3, d=2, q=4)n

50、. arima D2.wpi, ar(1/3) ma(1/4) (same as above)n . arima lnair, arima(0,1,1) sarima(0,1,1,12) (Multiplicative seasonaln ARIMA)n . arima DS12.lnair, ma(1) mma(1, 12) (same as above)n . arima consump m2 if tin( , 1981q4), ar(1) ma(1) robust时间序列模型n单位根检验 n dfgls DF-GLS unit-root testn dfuller Augmented

51、Dickey-Fuller unit-root testn pperron Phillips-Perron unit-roots testn dwstat Durbin-Watson d statisticn durbina Durbins alternative test for serial correlationn bgodfrey Breusch-Godfrey test for higher-order serialn correlation时间序列模型narchlm Engles LM test for the presence of autoregressiven conditi

52、onal heteroskedasticitynwntestb Bartletts periodogram-based test for white noisenwntestq Portmanteau (Q) test for white noisen例:nUse c:a.dtantsset yearndfuller gdp (or: dfgls gdp 根据情况选)时间序列模型nDickey-Fuller test for unit root Number of obs = 20n - Interpolated Dickey-Fuller -n Test 1% Critical 5% Cri

53、tical 10% Criticaln Statistic Value Value Valuen-n Z(t) 6.995 -3.750 -3.000 -2.630n-nMacKinnon approximate p-value for Z(t) = 1.0000n发散。n不遵照平稳的AR(1)过程:I(0),其差分也不是平稳的AR(1)过程:I(1)。时间序列模型n协整和误差修正模型n步骤:n 1.run OLS reg y x (t)n 2.predict abc, ren 3.ge dabc=abc-abclagn 4.dfuller dabc(or: dfgls dabc 根据情况选)

54、其他备用语句n TS vecrank - Estimate the cointegrating rank using Johansens frameworknSyntaxn vecrank depvar if in , optionsn options descriptionn -n Modeln lags(#) use # for the maximum lag in underlying VARn modeln trend(constant) include an unrestricted constant in model; then defaultn trend(rconstant)

55、include an restricted constant in modeln trend(trend) include a linear trend in the cointegratingn equations and a quadratic trend in then undifferenced datan trend(rtrend) include a restricted trend in modeln trend(none) do not include a trend or a constant modeln Adv. modeln sindicators(varlist_si

56、) include normalized seasonal indicatorn variables varlist_sin noreduce do not perform checks and corrections forn collinearity among lags of dependentn variablesn Reportingn notrace do not report of the trace statisticn max report maximum-eigenvalue statisticn ic report information criterian level9

57、9 report 1% critical values instead of 5%n critical valuesn levela report both 1% and 5% critical valuesn -n You must tsset your data before using vecrank.n depvar may contain time-series operators; see tsvarlist.n by and rolling may be used with vecrank; see prefix.n vecrank does not allow gaps in

58、the data.nDescriptionn vecrank produces statistics used to determine the number of cointegratingn equations in a vector error-correction model (VECM).nOptionsn +-+n -+ Model +-n lags(#) specifies the number of lags in the VAR representation of then model. The VECM will include one fewer lag of the f

59、irst-differences.n The number of lags must be greater than zero but small enough so thatn the degrees of freedom used up by the model are less than the numbern of observations.n trend(trend_spec) specifies one of five trend specifications to include inn the model. See vec intro and vec for descripti

60、ons. The default isn trend(constant).n +-+n -+ Adv. model +-n sindicators(varlist_si) specifies normalized seasonal indicator variablesn to be included in the model. The indicator variables specified inn this option must be normalized. If the indicators are not properlyn normalized, the likelihood-r

61、atio-based tests for the number ofn cointegrating equations do not converge to the asymptoticn distributions derived by Johansen. For details, see Methods andn Formulas of TS vec. sindicators() cannot be specified withn trend(none) or trend(rconstant).n noreduce causes vecrank to skip the checks and

62、 corrections forn collinearity among the lags of the dependent variables. By default,n vecrank checks if the current lag specification causes some of then regressions performed by vecrank to contain perfectly collinearn variables and reduces the maximum lag until the perfect collinearityn is removed

63、. See Collinearity in TS vec for more information.n +-+n -+ Reporting +-n notrace requests that the output for the trace statistic not be displayed.n The default is to display the trace statistic.n max requests that the output for the maximum-eigenvalue statistic ben displayed. The default is to not

64、 display this output.n ic causes the output for the information criteria to be displayed. Then default is to not display this output.n level99 causes the 1% critical values to be displayed instead of then default 5% critical values.n levela causes both the 1% and the 5% critical values to be displayed.nExamplesn . vecrank y i c, lags(5)n . vecrank y i c, lags(5) level99n . vecrank y i c, lags(5) max levela notracen . vecrank y i c, lags(5) ic notrace

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 资格认证/考试 > 自考

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号