楼主: songtao07
11124 19

[问答] 哪位高手用R自己编写过广义矩估计的程序吗? [推广有奖]

11
epoh 发表于 2011-10-31 17:47:57
GVAR_Toolbox1.1
User Guide page 37/138, PERFORMING THE GVAR ANALYSIS
***********************
>> gvar
***************************************************************************                                                                          
                               GVAR Toolbox 1.1                           
                                  July 2011                                                                                                                                                                           
Alessandro Galesi, CEMFI Madrid & L.Vanessa Smith, University of Cambridge
***************************************************************************
>>> Type the interface filename (WITHOUT the .xls extension) that you would like to
    use and press enter. If you wish to use one of the demo interface files provided
    with the installation program, type gvarBriefDemo or gvarFullDemo, accordingly.
    Alternatively, type the name of your own interface file.
    Note that MatLab is case sensitive.

===============================================================================
Note:
1. After typing the interface filename, the program will start running and it will make
   a number of pauses, unless the "Running the program with pauses option" is disabled.
   (This is the case for the gvarBriefDemo, for which no pauses will be performed).
2. At each pause, you will be called upon to supply settings and/or check intermediate
   results in the MAIN worksheet of the interface file that will open automatically each
   time. Once this file has opened, always refer back to the MatLab command window for
   instructions and information.
3. Additional guidance is also available by clicking on many of the headings and field
   names within the MAIN worksheet.

-----------------------------------------------------------------------------------
  After every pause, once the required settings have been supplied and/or the inter-
  mediate results have been checked, you must save and close the interface file. In
  fact, it is recommended that you close excel completely, each time.
-----------------------------------------------------------------------------------

USING THE FULL DEMO INTERFACE FILE
If you are using the full demo interface file most of the required settings and
intermediate results are already provided. However, there are occassions where the
user is required to intervene. Once again, consult the MatLab command window for
instructions referring SPECIFICALLY to the use of the full demo interface file.
If no such instructions are given, just save and close the interface file whenever
it opens in order to proceed.
======================================================================================

gvarBriefDemo

The program is now running (do not press any key)

1) IMPORTING DATA
********************************************************************
1.1) Importing country and region names
1.2) Importing weights for aggregation (used for regional analysis)
1.3) Importing the country specific datasets

>>> Pause and go to gvarBriefDemo.xls. Define the GVAR settings for the:

- Output folder name
- Frequency of pauses in the program
- Plotting of impulse responses
- Estimation window
- Type of weights
- Unit root tests
- Model selection
- Overidentifying restrictions test
- Weak exogeneity test
- Structural stability tests
- GVAR forecasts

  Once the above settings are defined (or if these are already defined),
  press enter.

======================================================================================
When defining the settings for the program in the MAIN worksheet of the interface file:
1. White cells require you to fill in data, and blue cells contain information for you
   generated by the program.                                                      
2. Dropdown menus are found in many of the fields. They are not apparent until you
   click within the field. Completing these fields is compulsory. For dropdown menus
   with the options 1 or 0: 1 means enable that function, and 0 disable that function.
3. If you choose to disable a function the program will ignore any other information
   relating to that function. This applies throughout the MAIN worksheet.
4. If you select one type of weights, it does not matter whether you leave the boxes
   related to alternative choices blank, as the program will ignore them by default.
   This applies throughout the MAIN worksheet of the interface file.                 
======================================================================================

>>> Make sure you have saved and closed the gvarBriefDemo.xls file. If so, press enter again.

The program is now running (do not press any key)  

1.4) Importing critical values for maximum eigenvalue and trace statistics

2) PREPARING DATA
********************************************************************
2.1) Creating domestic variables for each country
2.1b) Creating regions
2.2) Weight matrix
- Retrieving flows data
- Fixed weight matrix will be computed, as selected
- Building the weight matrix
- Updating weight matrix taking into account possible regions
- Writing to output.xls: (fixed) weight matrix

3) COUNTRY MODELS
********************************************************************
3.1) Model specification
3.2) Creating foreign-specific variables
- Adding to output.xls: Descriptive statistics of domestic, foreign-specific and global variables
3.4) Building country models
- Writing to countrydata.xls: Data for domestic and foreign variables of each country
3.5) Determining the lag orders of each country model
- Adding to output.xls: VARX lag orders
3.6) Determining the number of cointegrating relations for each country
- Adding to output.xls: Cointegrating ranks
3.7) Estimating individual VECMX models
- Adding to output.xls: VECMX estimates
- Adding to output.xls: VECMX statistics
- Adding to output.xls: VECMX cointegrating vectors
- Adding to output.xls: VECMX single-equation statistics
- Adding to output.xls: Descriptive statistics and normality test of VECMX residuals
- Adding to output.xls: F statistics for the test of serial correlation of the VECMX residuals
3.8) Testing weak exogeneity  
- Adding to output.xls: Weak exogeneity test results
3.9) Contemporaneous effects of foreign variables on their domestic counterparts
- Adding to output.xls: Contemporaneous coefficients
3.10) Average pairwise cross-section correlations: Variables and residuals
- Adding to output.xls: Average pairwise cross-section correlations

4) SOLVING THE GVAR MODEL
********************************************************************
4.1) Creating the link matrices W_i
4.2) Retrieving the parameters of the VARX models from the VECMX estimates
4.3) Constructing and solving the GVAR model
- Adding to output.xls: Eigenvalues of the GVAR

End of the GVAR model estimation.

5) IMPULSE RESPONSE ANALYSIS
********************************************************************
5.1) Settings, shock selection and (optional) region definition for regional GIRFs and GFEVDs
5.2) Computing the covariance matrices
5.3) Calculation of country and regional PPP-GDP weights
- Adding to output.xls: Country weights
- Adding to output.xls: Regional weights
5.4) Point estimates
- Computing the dynamic multipliers
- Computing the persistence profiles
- Adding to output.xls: Persistence profiles
- GIRFs and GFEVDs
- Shock simulation no.1: Writing results to output folder
- Creating the output file girfs.xls
- Plotting GIRFs
creating graphs REAL GDP.xls
creating graphs INFLATION.xls
creating graphs REAL EQUITY PRICES.xls
creating graphs REAL EXCHANGE RATE.xls
creating graphs NOMINAL S RATE.xls
creating graphs NOMINAL L RATE.xls
creating graphs OIL PRICE.xls
- Creating the output file gfevds.xls
- Creating the output file rgirfs.xls
creating rgraphs REAL GDP.xls
creating rgraphs INFLATION.xls
creating rgraphs REAL EQUITY PRICES.xls
creating rgraphs REAL EXCHANGE RATE.xls
creating rgraphs NOMINAL S RATE.xls
creating rgraphs NOMINAL L RATE.xls
creating rgraphs OIL PRICE.xls
- Creating the output file rgfevds.xls
- Shock simulation no.2: Writing results to output folder
- Creating the output file girfs.xls
- Plotting GIRFs
creating graphs REAL GDP.xls
creating graphs INFLATION.xls
creating graphs REAL EQUITY PRICES.xls
creating graphs REAL EXCHANGE RATE.xls
creating graphs NOMINAL S RATE.xls
creating graphs NOMINAL L RATE.xls
creating graphs OIL PRICE.xls
- Creating the output file gfevds.xls
- Creating the output file rgirfs.xls
creating rgraphs REAL GDP.xls
creating rgraphs INFLATION.xls
creating rgraphs REAL EQUITY PRICES.xls
creating rgraphs REAL EXCHANGE RATE.xls
creating rgraphs NOMINAL S RATE.xls
creating rgraphs NOMINAL L RATE.xls
creating rgraphs OIL PRICE.xls
- Creating the output file rgfevds.xls
--- End of the dynamic analysis ---
--- End of the program ---
   Output Brief Demo.rar (1.11 MB)
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhangtao + 5 + 5 + 5 精彩帖子

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

12
zhangtao 发表于 2011-11-1 08:27:07
非常感谢epoh老师,我再仔细看看。
数学好就是要天天学

13
songtao07 发表于 2012-4-14 23:10:42
都没有R的。

14
843978571 发表于 2014-4-6 22:49:40
epoh 发表于 2011-10-31 17:47
GVAR_Toolbox1.1
User Guide page 37/138, PERFORMING THE GVAR ANALYSIS
***********************
老师您好! 我运行了好几次GVAR 1.1工具箱,每次都在3.7这里出现错误提示:
- Adding to output.xls: Cointegrating ranks
3.7) Estimating individual VECMX models
- Adding to output.xls: VECMX estimates
- Adding to output.xls: VECMX statistics
- Adding to output.xls: VECMX cointegrating vectors
- Adding to output.xls: VECMX single-equation statistics
- Adding to output.xls: Descriptive statistics and normality test of VECMX residuals
??? Error using ==> gammainc
Inputs must be real, full, and double or single.

Error in ==> gamm_cdf at 25
cdf = gammainc(x,a);

Error in ==> chis_cdf at 28
F = gamm_cdf(x/2,a*0.5);

Error in ==> jarquebera at 32
chi2_pval=1-chis_cdf(W,2);

Error in ==> print_ECMS_resstats at 23
        [W chi2_pval] = jarquebera(res);

Error in ==> gvar at 1219
  print_ECMS_resstats(cnum,cnames,cnames_long,endoglist,epsilon,outdir);


这个是怎么回事啊,是我前面的设定有问题吗? 我用的是gvarExperiment 这个里面的设定数据。

15
843978571 发表于 2014-4-8 19:50:03
epoh 发表于 2011-10-31 17:47
GVAR_Toolbox1.1
User Guide page 37/138, PERFORMING THE GVAR ANALYSIS
***********************
老师您好。 之前的问题解决了。 但是如果我现在想自己修改GVAR, 变成自己的程序,发现好难。我首选尝试着只用作者例子中的2个国家建立GVAR 。但是在3.1) Model specification这里就会出现错误。
??? Error using ==> rmfield at 40
A field named 'china' doesn't exist.

Error in ==> gvar at 688
            dv.(vnames{j}) = rmfield(dv.(vnames{j}),cnames{i});
这个是怎么回事啊?

16
冲刺流星ll 发表于 2015-1-20 17:04:42
843978571 发表于 2014-4-6 22:49
老师您好! 我运行了好几次GVAR 1.1工具箱,每次都在3.7这里出现错误提示:
- Adding to output.xls: Co ...
请问你这个问题是怎么解决的,我也遇到了相同的问题,非常感谢啦~~~

17
843978571 发表于 2015-1-20 17:51:59
冲刺流星ll 发表于 2015-1-20 17:04
请问你这个问题是怎么解决的,我也遇到了相同的问题,非常感谢啦~~~
额,这个老早了。。。我都记不得了,那个程序调整自己的始终出不来结果,会卡到3.几过不去。。我的建议是,如果你自己用他的数据来先跑着运行的话,关键是有些地方要修改下,因为你存储数据的文件夹和一些程序的调用文件夹和作者的目录名字肯定不一样。所以你只能对着程序仔细检查,我记得我都检查到第400多行了,才发现好几处不一样的地方。

18
冲刺流星ll 发表于 2015-1-24 10:50:45
843978571 发表于 2015-1-20 17:51
额,这个老早了。。。我都记不得了,那个程序调整自己的始终出不来结果,会卡到3.几过不去。。我的建议是 ...
恩恩,非常感谢啦!!

19
继继 发表于 2015-9-11 18:05:46
冲刺流星ll 发表于 2015-1-20 17:04
请问你这个问题是怎么解决的,我也遇到了相同的问题,非常感谢啦~~~
请问,你解决了没有哦,我也是遇到这个问题。真是奇怪。。。。

20
继继 发表于 2015-9-11 18:06:50
843978571 发表于 2015-1-20 17:51
额,这个老早了。。。我都记不得了,那个程序调整自己的始终出不来结果,会卡到3.几过不去。。我的建议是 ...
这个问题是什么情况,是怎么解决的?这个命令运行的结果是说我们输入的数据不是实数。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 12:38