 
    


epoh 发表于 2011-8-6 14:08
data=xlsread('iotablecoe.xls','B2:K11');size(data) % 10 10 %你的数据有 10rows,10 columns%你 ...



Error using ==> dlmread
The file 'C:\Users\Jason\Desktop\Medicare\HHsampnodum.csv'
could not be opened because: No such file or directory
已经很明显告诉你找不到HHsampnodum.csv
因为在你的电脑根本没有路径
C:\Users\Jason\Desktop\Medicare\......
你必须自行更改路径
dlmread
Read ASCII-delimited file of numeric data into matrix
dlmread只读取ASCII file
所以 HHsampnodum.csv必须改存 HHsampnodum.txt
才能读到文件
PartDHH4BS.m 有用到function randint()
这在 Communications System Toolbox
我没安装Communications System Toolbox
所以抱歉无法继续
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
parameters,errors,p,q,k,k2,t这些参数如何设定?
你的思惟需要改变
重点在fmincon()及likelihood.m
likelihood.m 是fmincon()的objective function
而fmincon() 的主要目的是求解garch model的parameters
既然parameters都已求出
事后你又把这些parameters,errors,p,q,k,k2,..
带进likelihood function,意义何在
%%%%%%%%%%%%%%%%%%%%%%%%%%%
a=x.boot$std.error^2这一行有什么错误?
x=c(5,4,9,6,21,17,11,20,7,10,21,15,13,16,8)
x.boot=boot(data = x, statistic = function(x, i) var(x), R = 999)
x.boot
names(x.boot)
# [1] "t0" "t" "R" "data" "seed" "statistic"
# [7] "sim" "call" "stype" "strata" "weights"
没std.error,如何取出?
请注意std.error是每次不同的
Bootstrap Statistics :
original bias std. error
t1* 34.31429 -2.465542 7.545234
####################################
Bootstrap Statistics :
original bias std. error
t1* 34.31429 -2.098413 7.791326
####################################
Bootstrap Statistics :
original bias std. error
t1* 34.31429 -2.266037 7.826279
std.error=sqrt(var(x.boot$t))
[,1]
[1,] 7.826279






EM.R
少定义nc,ni.nt
请自行补上.
另两个问题,ywh兄所言甚是.
### Example 3 SEM algorithm
#First, run EM using the code in the basic EM algorithm given in Example 1.
#Then we run SEM as follows.
n.obs<-c(85,196,341)
nc<-n.obs[1]
ni<-n.obs[2]
nt<-n.obs[3]
#Starting values for SEM

epoh 发表于 2011-8-9 10:34
EM.R少定义nc,ni.nt请自行补上.另两个问题,ywh兄所言甚是.### Example 3 SEM algorithm #First, run EM usi ...
1\Simulatione.m
simulation
s =
1
??? Undefined function or variable "np".
Error in ==> simulatione at 41
year=zeros(np*TS,1);
>>
2\solvee.m
Warning: Input arguments must be scalar.
> In transzx at 3
In solvee at 8
Warning: Size vector should be a row vector with integer elements.
> In transzx at 3
In solvee at 8
Warning: Input arguments must be scalar.
> In transzx at 3
In solvee at 8
Warning: Size vector should be a row vector with integer elements.
> In transzx at 3
In solvee at 8
??? Undefined function or variable "Tx11".
Error in ==> transzx at 10
Tzx11=Tz.*Tx11;
Error in ==> solvee at 8
transzx;
>>
3\xprobit.m
??? Undefined function or variable "nkgrid".
Error in ==> xprofit at 5
pix=zeros(ngrid,nkgrid);
>>
Dprobit.m
??? Undefined function or variable "nkgrid".
Error in ==> dprofit at 6
pid=zeros(ngrid,nkgrid);
>>
Parameters.m
运行没有任何反应?

很久没用fortran了
由于mcmc.f90要用到IMSL.mod,numerical_libraries.mod
PROGRAM mcmc
!=======================
!Use these modules
!=======================
USE IMSL
USE numerical_libraries
USE parameterse
单独抓IMSL.mod,numerical_libraries.mod都失败
最后使用内含IMSL Fortran Library的
Compaq Visual Fortran 6.6 Pro
才顺利Build mcmc.exe
mcmc_fortran.rar
double click mcmc.exe
执行时会自动产生2个文件
accept.txt,
param.txt,

zhangtao兄
Rdexp_summary内的readme
已经说明执行function是main.m
依序执行load_data,parameters,.....
如此才不会产生错误.
%LOAD DATA
load_data;
%DEFINE PARAMETERS GIVEN
parameters;
%DEFINE GRIDS OF CAPITAL AND PRODUCTIVITY (X)
gridkx;
......
......




Q2:tsDyn包载入splus中运行,有困难?困难在什么地方?
你是否还记得package"pkgutils"
s-plus就是用pkgutils,
建构供s-plus使用的package
目前R与S-plus语法已经相差很多
要用pkgutils建构符合s-plus用的
tsDyn package 肯定会出错.




model部份,
初看有下列3点错
可能还有,请再仔细检查.
1.
l^(1+kappa) = (1/(ul*(1+tauc))*((c-h*c(-1))^(-gam))*(1-taul)*(1-alp)*y;
漏掉 " ) "
我先改成这样:
l^(1+kappa) = (1/(ul*(1+tauc)))*((c-h*c(-1))^(-gam))*(1-taul)*(1-alp)*y;
%%%%%%
2.
w = (1-alp)* ? /l;
%%%%%%
3.
zhat : Unknown symbol


哈哈!"美"的冒泡
问题出在这里,有点麻烦.
方便的话你把修改过的
model代码,放在我的短信息.
(有变更的部分)
我来实际跑程序,
这样好跟你的结果一致.
%%%%%%%
要不你就跟底下这篇文献一样
不要用fs2000_steadystate试试
Stochastic simulation of a DSGE model for Brazil.pdf
Brazilmodel_v4.mod
data33.mat


solve_algo = 0
solve_algo = 1
solve_algo = 2
solve_algo = 3
我都试了,Residuals都很大
要麻烦你检查一下
1.你手算的 initial values 对不对?
2.每条输入的equation对不对?
**********
governinv_dynamic.m
% Model equations
%
residual = zeros(47, 1);
.....
.....
lhs =T15;
rhs =T25*T29/(1+params(8));
residual(1)= lhs-rhs;
lhs =y(36)^(1+params(5));
rhs =T48*y(37);
residual(2)= lhs-rhs;
lhs =y(37);
rhs =y(44)*y(45)*y(2)+y(36)*y(50);
residual(3)= lhs-rhs;
.....
.....
lhs =y(79);
rhs =y(32);
residual(46)= lhs-rhs;
lhs =y(80);
rhs =y(33);
residual(47)= lhs-rhs;


put resid(1) before the steady command.
就是:
initval;
v = 1;
rk = 0.042;
.....
.....
e_tk = 0;
e_tc = 0;
e_gc = 0;
end;
resid(1);
/*
steady;
check;
estimated_params;
alp, beta_pdf, 0.4, 0.02;
.....
.....
estimation(datafile=gidat_simul,.....);
*/
%%%%%%%%%%%%%%%%
dynare governinv
Substitution of endo lags >= 2: added 19 auxiliary variables and equations.???
Found 47 equation(s).
Residuals of the static equations:
Equation number 1 : 0
Equation number 2 : -1.2211
Equation number 3 : 0.15673
Equation number 4 : 0
Equation number 5 : 0.06635
Equation number 6 : 0.49994
Equation number 7 : 0.033175
Equation number 8 : 0.065673
Equation number 9 : -0.31346
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : -0.09375
Equation number 15 : 0
Equation number 16 : -0.00114
Equation number 17 : 0.05896
Equation number 18 : 0.06886
Equation number 19 : -0.05
Equation number 20 : 0
Equation number 21 : 0.5
Equation number 22 : 0.5
Equation number 23 : 0.5
Equation number 24 : 0
Equation number 25 : 0
Equation number 26 : 0
Equation number 27 : 0.075
Equation number 28 : 0
%%%%%%%%%%%
dynare Brazilmodel_v4
Starting Dynare (version 4.2.2).
Starting preprocessing of the model file ...
Found 25 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.
Residuals of the static equations:
Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : 0
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0
Equation number 15 : 0
Equation number 16 : 0
Equation number 17 : 0
Equation number 18 : 0
Equation number 19 : 0
Equation number 20 : 0
Equation number 21 : 0
Equation number 22 : 0
Equation number 23 : 0
Equation number 24 : 0
Equation number 25 : 0 
%%%%%%%%%
你的是啥模型?
Dynare v4 - User Guide
page 35/106
For complicated models,finding suitable initial values for 
the endogenous variables is the trickiest part of finding the 
equilibrium of that model. Often,it is better to 
start with a smaller model and add new variables one by one.

 扫码加好友,拉您进群
扫码加好友,拉您进群 
    
 
     













