v4 matlab:
* fixed various copyright headers * added URL pointer to C. Sims' original files * removed obsolete dgamma.m git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2018 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
b4c04a27cc
commit
0c23ac2b06
|
@ -4,6 +4,9 @@ function H = bfgsi(H0,dg,dx)
|
||||||
% 6/8/93 version that updates inverse hessian instead of hessian
|
% 6/8/93 version that updates inverse hessian instead of hessian
|
||||||
% itself.
|
% itself.
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/optimize/mfiles/bfgsi.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
|
|
|
@ -61,6 +61,9 @@ function w = matrictint(S, df, XXi)
|
||||||
%
|
%
|
||||||
% (where k is the dimension of XXi and ny is the dimension of S and
|
% (where k is the dimension of XXi and ny is the dimension of S and
|
||||||
% Sigma)
|
% Sigma)
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/VARtools/matlab/matrictint.m
|
||||||
|
|
||||||
k=size(XXi,1);
|
k=size(XXi,1);
|
||||||
ny=size(S,1);
|
ny=size(S,1);
|
||||||
|
|
|
@ -181,7 +181,9 @@ function [ydum,xdum,breaks]=varprior(nv,nx,lags,mnprior,vprior)
|
||||||
% prior mean generates larger prior variances for own than for cross-effects even in
|
% prior mean generates larger prior variances for own than for cross-effects even in
|
||||||
% this formulation, but here there is no way to shrink toward a set of unconstrained
|
% this formulation, but here there is no way to shrink toward a set of unconstrained
|
||||||
% univariate AR's.
|
% univariate AR's.
|
||||||
% Author: C. Sims
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/VARtools/matlab/varprior.m
|
||||||
|
|
||||||
if ~isempty(mnprior)
|
if ~isempty(mnprior)
|
||||||
xdum = zeros(lags+1,nx,lags,nv);
|
xdum = zeros(lags+1,nx,lags,nv);
|
||||||
|
@ -247,7 +249,10 @@ function var=rfvar3(ydata,lags,xdata,breaks,lambda,mu)
|
||||||
% repeating the initial xdata(lags+1,:) row or copying xdata(lags+1:2*lags,:) into
|
% repeating the initial xdata(lags+1,:) row or copying xdata(lags+1:2*lags,:) into
|
||||||
% xdata(1:lags,:) are reasonable subsititutes. These values are used in forming the
|
% xdata(1:lags,:) are reasonable subsititutes. These values are used in forming the
|
||||||
% persistence priors.
|
% persistence priors.
|
||||||
% Code written by Christopher Sims. This version 6/15/03.
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/VARtools/matlab/rfvar3.m
|
||||||
|
|
||||||
[T,nvar] = size(ydata);
|
[T,nvar] = size(ydata);
|
||||||
nox = isempty(xdata);
|
nox = isempty(xdata);
|
||||||
if ~nox
|
if ~nox
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
function result = check
|
function result = check
|
||||||
|
|
||||||
|
|
||||||
% function result = check
|
% function result = check
|
||||||
% checks determinacy conditions by computing the eigenvalues
|
% checks determinacy conditions by computing the eigenvalues
|
||||||
%
|
%
|
||||||
|
@ -13,7 +11,7 @@ function result = check
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2001-2007 Dynare Team
|
% Copyright (C) 2001-2008 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -16,7 +16,11 @@ function [fhat,xhat,fcount,retcode] = csminit(fcn,x0,f0,g0,badg,H0,varargin)
|
||||||
% Fixed 7/19/93 to flip eigenvalues of H to get better performance when
|
% Fixed 7/19/93 to flip eigenvalues of H to get better performance when
|
||||||
% it's not psd.
|
% it's not psd.
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/optimize/mfiles/csminit.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
|
% Copyright (C) 2008 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -19,7 +19,11 @@ function [fh,xh,gh,H,itct,fcount,retcodeh] = csminwel(fcn,x0,H0,grad,crit,nit,me
|
||||||
% write g2.mat and g3.mat as well. If all were written at about the same time, any of them
|
% write g2.mat and g3.mat as well. If all were written at about the same time, any of them
|
||||||
% may be a decent starting point. One can also start from the one with best function value.)
|
% may be a decent starting point. One can also start from the one with best function value.)
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/optimize/mfiles/csminwel.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
|
% Copyright (C) 2006-2008 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -18,7 +18,11 @@ function [x,rc] = csolve(FUN,x,gradfun,crit,itmax,varargin)
|
||||||
% in step length (very likely a numerical problem, or a discontinuity). 4 means itmax
|
% in step length (very likely a numerical problem, or a discontinuity). 4 means itmax
|
||||||
% termination.
|
% termination.
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/optimize/mfiles/csolve.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
|
% Copyright (C) 2007 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
function f = dgamma(x,a,b)
|
|
||||||
%DGAMMA The gamma density function
|
|
||||||
%
|
|
||||||
% f = dgamma(x,a)
|
|
||||||
|
|
||||||
% Anders Holtsberg, 18-11-93
|
|
||||||
% Copyright (c) Anders Holtsberg
|
|
||||||
|
|
||||||
if any(any(a<=0))
|
|
||||||
error('Parameter a is wrong')
|
|
||||||
end
|
|
||||||
|
|
||||||
f = (x./b) .^ (a-1) .* exp(-x./b) ./ (b.*gamma(a));
|
|
||||||
I0 = find(x<0);
|
|
||||||
f(I0) = zeros(size(I0));
|
|
|
@ -1,4 +1,23 @@
|
||||||
function [dr,info,M_,options_,oo_] = dr11_sparse(dr,task,M_,options_,oo_, jacobia_, hessian)
|
function [dr,info,M_,options_,oo_] = dr11_sparse(dr,task,M_,options_,oo_, jacobia_, hessian)
|
||||||
|
%function [dr,info,M_,options_,oo_] = dr11_sparse(dr,task,M_,options_,oo_, jacobia_, hessian)
|
||||||
|
|
||||||
|
% Copyright (C) 2008 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare is free software: you can redistribute it and/or modify
|
||||||
|
% it under the terms of the GNU General Public License as published by
|
||||||
|
% the Free Software Foundation, either version 3 of the License, or
|
||||||
|
% (at your option) any later version.
|
||||||
|
%
|
||||||
|
% Dynare is distributed in the hope that it will be useful,
|
||||||
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
% GNU General Public License for more details.
|
||||||
|
%
|
||||||
|
% You should have received a copy of the GNU General Public License
|
||||||
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
info = 0;
|
info = 0;
|
||||||
klen = M_.maximum_endo_lag + M_.maximum_endo_lead + 1;
|
klen = M_.maximum_endo_lag + M_.maximum_endo_lead + 1;
|
||||||
kstate = dr.kstate;
|
kstate = dr.kstate;
|
||||||
|
|
|
@ -17,9 +17,24 @@ function independent_metropolis_hastings(TargetFun,ProposalFun,xparam1,vv,mh_bou
|
||||||
%
|
%
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% None.
|
% None.
|
||||||
%
|
|
||||||
% part of DYNARE, copyright Dynare Team (2006-2008)
|
% Copyright (C) 2006-2008 Dynare Team
|
||||||
% Gnu Public License.
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare is free software: you can redistribute it and/or modify
|
||||||
|
% it under the terms of the GNU General Public License as published by
|
||||||
|
% the Free Software Foundation, either version 3 of the License, or
|
||||||
|
% (at your option) any later version.
|
||||||
|
%
|
||||||
|
% Dynare is distributed in the hope that it will be useful,
|
||||||
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
% GNU General Public License for more details.
|
||||||
|
%
|
||||||
|
% You should have received a copy of the GNU General Public License
|
||||||
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
global M_ options_ bayestopt_
|
global M_ options_ bayestopt_
|
||||||
%%%%
|
%%%%
|
||||||
%%%% Initialization of the independent metropolis-hastings chains.
|
%%%% Initialization of the independent metropolis-hastings chains.
|
||||||
|
|
|
@ -1,4 +1,23 @@
|
||||||
function model_info;
|
function model_info;
|
||||||
|
%function model_info;
|
||||||
|
|
||||||
|
% Copyright (C) 2008 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare is free software: you can redistribute it and/or modify
|
||||||
|
% it under the terms of the GNU General Public License as published by
|
||||||
|
% the Free Software Foundation, either version 3 of the License, or
|
||||||
|
% (at your option) any later version.
|
||||||
|
%
|
||||||
|
% Dynare is distributed in the hope that it will be useful,
|
||||||
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
% GNU General Public License for more details.
|
||||||
|
%
|
||||||
|
% You should have received a copy of the GNU General Public License
|
||||||
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
global M_;
|
global M_;
|
||||||
fprintf(' Informations about %s\n',M_.fname);
|
fprintf(' Informations about %s\n',M_.fname);
|
||||||
fprintf(strcat(' ===================',char(ones(1,length(M_.fname))*'='),'\n\n'));
|
fprintf(strcat(' ===================',char(ones(1,length(M_.fname))*'='),'\n\n'));
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
function [g, badg] = numgrad(fcn,x,varargin)
|
function [g, badg] = numgrad(fcn,x,varargin)
|
||||||
% function [g badg] = numgrad(fcn,xvarargin)
|
% function [g badg] = numgrad(fcn,xvarargin)
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/optimize/mfiles/numgrad.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
|
% Copyright (C) 2008 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -7,6 +7,9 @@ function [g, badg, f0, f1, f2] = numgrad3(fcn,x,varargin)
|
||||||
% See section 25.3.4 in Abramovitz and Stegun (1972, Tenth Printing, December) Handbook of Mathematical Functions.
|
% See section 25.3.4 in Abramovitz and Stegun (1972, Tenth Printing, December) Handbook of Mathematical Functions.
|
||||||
% http://www.math.sfu.ca/~cbm/aands/
|
% http://www.math.sfu.ca/~cbm/aands/
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/optimize/mfiles/numgrad.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
% Copyright (C) 2008 Dynare Team
|
% Copyright (C) 2008 Dynare Team
|
||||||
%
|
%
|
||||||
|
|
|
@ -9,6 +9,9 @@ function [g, badg, f0, f1, f2, f3, f4] = numgrad5(fcn,x,varargin)
|
||||||
%
|
%
|
||||||
% TODO Try Four points formula when cost_flag3=0 or cost_flag4=0.
|
% TODO Try Four points formula when cost_flag3=0 or cost_flag4=0.
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/optimize/mfiles/numgrad.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
% Copyright (C) 2008 Dynare Team
|
% Copyright (C) 2008 Dynare Team
|
||||||
%
|
%
|
||||||
|
|
|
@ -6,6 +6,9 @@ function [A,B,Q,Z] = qzdiv(stake,A,B,Q,Z)
|
||||||
% corner, while preserving U.T. and orthonormal properties and Q'AZ' and
|
% corner, while preserving U.T. and orthonormal properties and Q'AZ' and
|
||||||
% Q'BZ'.
|
% Q'BZ'.
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/gensys/mfiles/qzdiv.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
|
|
|
@ -10,6 +10,9 @@ function [A,B,Q,Z] = qzswitch(i,A,B,Q,Z)
|
||||||
% the qz transformation is not unique and it is not possible simply to switch
|
% the qz transformation is not unique and it is not possible simply to switch
|
||||||
% the positions of the diagonal elements of both A and B.
|
% the positions of the diagonal elements of both A and B.
|
||||||
|
|
||||||
|
% Original file downloaded from:
|
||||||
|
% http://sims.princeton.edu/yftp/gensys/mfiles/qzswitch.m
|
||||||
|
|
||||||
% Copyright (C) 1993-2007 Christopher Sims
|
% Copyright (C) 1993-2007 Christopher Sims
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
function [dr,info]=resol(ys,check_flag)
|
function [dr,info]=resol(ys,check_flag)
|
||||||
|
|
||||||
% function [dr,info]=resol(ys,check_flag)
|
% function [dr,info]=resol(ys,check_flag)
|
||||||
% Computes first and second order approximations
|
% Computes first and second order approximations
|
||||||
%
|
%
|
||||||
|
@ -22,7 +21,7 @@ function [dr,info]=resol(ys,check_flag)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2001-2007 Dynare Team
|
% Copyright (C) 2001-2008 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -14,9 +14,8 @@ function sim1
|
||||||
%
|
%
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% None.
|
% None.
|
||||||
%
|
|
||||||
|
|
||||||
% Copyright (C) 1996-2007 Dynare Team
|
% Copyright (C) 1996-2008 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -11,7 +11,7 @@ function steady()
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2001-2007 Dynare Team
|
% Copyright (C) 2001-2008 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
function [A,B] = transition_matrix(dr, varargin)
|
function [A,B] = transition_matrix(dr, varargin)
|
||||||
|
|
||||||
% function [A,B] = transition_matrix(dr, varargin)
|
% function [A,B] = transition_matrix(dr, varargin)
|
||||||
% Makes transition matrices out of ghx and ghu
|
% Makes transition matrices out of ghx and ghu
|
||||||
%
|
%
|
||||||
|
@ -14,7 +13,7 @@ function [A,B] = transition_matrix(dr, varargin)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2003-2007 Dynare Team
|
% Copyright (C) 2003-2008 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
|
Loading…
Reference in New Issue