You can subscribe to this list here.
2001 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}

_{Jun}

_{Jul}
(10) 
_{Aug}
(5) 
_{Sep}
(3) 
_{Oct}
(41) 
_{Nov}
(41) 
_{Dec}
(33) 

2002 
_{Jan}
(75) 
_{Feb}
(10) 
_{Mar}
(170) 
_{Apr}
(174) 
_{May}
(66) 
_{Jun}
(11) 
_{Jul}
(10) 
_{Aug}
(44) 
_{Sep}
(73) 
_{Oct}
(28) 
_{Nov}
(139) 
_{Dec}
(52) 
2003 
_{Jan}
(35) 
_{Feb}
(93) 
_{Mar}
(62) 
_{Apr}
(10) 
_{May}
(55) 
_{Jun}
(70) 
_{Jul}
(37) 
_{Aug}
(16) 
_{Sep}
(56) 
_{Oct}
(31) 
_{Nov}
(57) 
_{Dec}
(83) 
2004 
_{Jan}
(85) 
_{Feb}
(67) 
_{Mar}
(27) 
_{Apr}
(37) 
_{May}
(75) 
_{Jun}
(85) 
_{Jul}
(160) 
_{Aug}
(68) 
_{Sep}
(104) 
_{Oct}
(25) 
_{Nov}
(39) 
_{Dec}
(23) 
2005 
_{Jan}
(10) 
_{Feb}
(45) 
_{Mar}
(43) 
_{Apr}
(19) 
_{May}
(108) 
_{Jun}
(31) 
_{Jul}
(41) 
_{Aug}
(23) 
_{Sep}
(65) 
_{Oct}
(58) 
_{Nov}
(44) 
_{Dec}
(54) 
2006 
_{Jan}
(96) 
_{Feb}
(27) 
_{Mar}
(69) 
_{Apr}
(59) 
_{May}
(67) 
_{Jun}
(35) 
_{Jul}
(13) 
_{Aug}
(461) 
_{Sep}
(160) 
_{Oct}
(399) 
_{Nov}
(32) 
_{Dec}
(72) 
2007 
_{Jan}
(316) 
_{Feb}
(305) 
_{Mar}
(318) 
_{Apr}
(54) 
_{May}
(194) 
_{Jun}
(173) 
_{Jul}
(282) 
_{Aug}
(91) 
_{Sep}
(227) 
_{Oct}
(365) 
_{Nov}
(168) 
_{Dec}
(18) 
2008 
_{Jan}
(71) 
_{Feb}
(111) 
_{Mar}
(155) 
_{Apr}
(173) 
_{May}
(70) 
_{Jun}
(67) 
_{Jul}
(55) 
_{Aug}
(83) 
_{Sep}
(32) 
_{Oct}
(68) 
_{Nov}
(80) 
_{Dec}
(29) 
2009 
_{Jan}
(46) 
_{Feb}
(18) 
_{Mar}
(95) 
_{Apr}
(76) 
_{May}
(140) 
_{Jun}
(98) 
_{Jul}
(84) 
_{Aug}
(123) 
_{Sep}
(94) 
_{Oct}
(131) 
_{Nov}
(142) 
_{Dec}
(125) 
2010 
_{Jan}
(128) 
_{Feb}
(158) 
_{Mar}
(172) 
_{Apr}
(134) 
_{May}
(94) 
_{Jun}
(84) 
_{Jul}
(32) 
_{Aug}
(127) 
_{Sep}
(167) 
_{Oct}
(109) 
_{Nov}
(69) 
_{Dec}
(78) 
2011 
_{Jan}
(39) 
_{Feb}
(58) 
_{Mar}
(52) 
_{Apr}
(47) 
_{May}
(56) 
_{Jun}
(76) 
_{Jul}
(55) 
_{Aug}
(54) 
_{Sep}
(165) 
_{Oct}
(255) 
_{Nov}
(328) 
_{Dec}
(263) 
2012 
_{Jan}
(82) 
_{Feb}
(147) 
_{Mar}
(400) 
_{Apr}
(216) 
_{May}
(209) 
_{Jun}
(160) 
_{Jul}
(86) 
_{Aug}
(141) 
_{Sep}
(156) 
_{Oct}
(6) 
_{Nov}

_{Dec}

2015 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}

_{Jun}

_{Jul}
(1) 
_{Aug}

_{Sep}
(1) 
_{Oct}

_{Nov}
(1) 
_{Dec}
(2) 
2016 
_{Jan}

_{Feb}
(2) 
_{Mar}
(2) 
_{Apr}
(1) 
_{May}
(1) 
_{Jun}
(2) 
_{Jul}
(1) 
_{Aug}
(1) 
_{Sep}

_{Oct}

_{Nov}
(1) 
_{Dec}

S  M  T  W  T  F  S 






1
(2) 
2

3
(2) 
4

5

6

7
(3) 
8
(1) 
9

10

11
(1) 
12
(1) 
13
(1) 
14

15
(4) 
16

17

18

19

20
(5) 
21
(1) 
22

23

24

25

26
(1) 
27
(2) 
28
(1) 
29

30

31







From: Michael Creel <mcreel@us...>  20041020 10:31:47

Update of /cvsroot/octave/octaveforge/main/econometrics In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv15337/main/econometrics Added Files: average_moments.m gmm_estimate.m gmm_example.m gmm_obj.m gmm_results.m gmm_variance_inefficient.m gmm_variance.m Log Message: initial commit of gmm functions  NEW FILE: gmm_results.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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. function [theta, V, obj_value] = gmm_results(theta, data, weight, moments, momentargs, names, title, unscale, control) if nargin < 9 [theta, obj_value, convergence] = gmm_estimate(theta, data, weight, moments, momentargs); else [theta, obj_value, convergence] = gmm_estimate(theta, data, weight, moments, momentargs, control); endif m = feval(moments, theta, data, momentargs); # find out how many obsns. we have n = rows(m); if convergence == 1 convergence="Normal convergence"; else convergence="No convergence"; endif V = gmm_variance(theta, data, weight, moments, momentargs); # unscale results if argument has been passed # this puts coefficients into scale corresponding to the original data if nargin > 7 if iscell(unscale) [theta, V] = unscale_parameters(theta, V, unscale); endif endif [theta, V] = delta_method("Parameterize", theta, {data, moments, momentargs}, V); n = rows(data); k = rows(theta); se = sqrt(diag(V)); printf("\n\n******************************************************\n"); disp(title); printf("\nGMM Estimation Results\n"); printf("BFGS convergence: %s\n", convergence); printf("\nObjective function value: %f\n", obj_value); printf("Observations: %d\n", n); junk = "X^2 test"; df = rows(weight)  rows(theta); if df > 0 clabels = str2mat("Value","df","pvalue"); a = [n*obj_value, df, 1  chisquare_cdf(n*obj_value, df)]; printf("\n"); prettyprint(a, junk, clabels); else disp("\nExactly identified, no spec. test"); end; # results for parameters a =[theta, se, theta./se, 2  2*normal_cdf(abs(theta ./ se))]; clabels = str2mat("estimate", "st. err", "tstat", "pvalue"); printf("\n"); prettyprint(a, names, clabels); printf("******************************************************\n"); endfunction  NEW FILE: gmm_example.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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. # GMM example file, shows initial consistent estimator, # estimation of efficient weight, and second round # efficient estimator # This also shows how do use data scaling  WHICH YOU SHOULD DO! 1; # the form a userwritten moment function should take function m = mymoments(theta, data, momentargs) k = momentargs{1}; # use this so that data can hold dep, indeps, and instr y = data(:,1); x = data(:,2:k+1); w = data(:, k+2:columns(data)); lambda = exp(x*theta); e = y ./ lambda  1; m = dmult(e, w); endfunction n = 1000; k = 5; x = [ones(n,1) rand(n,k1)]; w = [x, rand(n,1)]; theta = ones(k,1); lambda = exp(x*theta); y = randp(lambda); [xs, scalecoef] = scale_data(x); # The arguments for gmm_estimate theta = zeros(k,1); data = [y xs w]; weight = eye(columns(w)); moments = "mymoments"; momentargs = {k}; # needed to know where x ends and w starts # additional args for gmm_results names = str2mat("theta1", "theta2", "theta3", "theta4", "theta5"); title = "Poisson GMM trial"; control = {100,0,1,1}; # initial consistent estimate: only used to get efficient weight matrix, no screen output [theta, obj_value, convergence] = gmm_estimate(theta, data, weight, moments, momentargs); # efficient weight matrix # this method is valid when moments are not autocorrelated # the user is reponsible to properly estimate the efficient weight m = feval(moments, theta, data, momentargs); weight = inverse(cov(m)); # second round efficient estimator gmm_results(theta, data, weight, moments, momentargs, names, title, scalecoef, control);  NEW FILE: gmm_variance.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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. # GMM variance, which assumes weights are optimal function V = gmm_variance(theta, data, weight, moments, momentargs) D = numgradient("average_moments", {theta, data, moments, momentargs}); D = D'; m = feval(moments, theta, data, momentargs); # find out how many obsns. we have n = rows(m); V = (1/n)*inv(D*weight*D'); endfunction  NEW FILE: gmm_obj.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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. # The GMM objective function # This is scaled so that it converges to a # finite number. To get the chisquare specification # test you need to multiply by n (the sample size) function obj_value = gmm_obj(theta, data, weight, moments, momentargs) m = average_moments(theta, data, moments, momentargs); obj_value = m' * weight *m; if (((abs(obj_value) == Inf))  (isnan(obj_value))) obj_value = realmax; endif endfunction  NEW FILE: gmm_variance_inefficient.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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. # GMM variance, which assumes weights are not optimal function V = gmm_variance_inefficient(theta, data, weight, omega, moments, momentargs) D = NumGradient("average_moments", {theta, data, moments, momentargs}); D = D'; m = feval(moments, theta, data, momentargs); # find out how many obsns. we have n = rows(m); J = D*weight*D'; J = inv(J); I = D*weight*omega*weight*D'; V = (1/n)*J*I*J; endfunction  NEW FILE: gmm_estimate.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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. # performs the minimization function [theta, obj_value, convergence] = gmm_estimate(theta, data, weight, moments, momentargs, control) gmmargs = {theta, data, weight, moments, momentargs}; if nargin < 6 [theta, obj_value, convergence] = bfgsmin("gmm_obj", gmmargs); else [theta, obj_value, convergence] = bfgsmin("gmm_obj", gmmargs, control); endif endfunction  NEW FILE: average_moments.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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. # average moments (separate function so it can be differentiated) function m = average_moments(theta, data, moments, momentargs) m = feval(moments, theta, data, momentargs); m = mean(m)'; # returns Gx1 moment vector endfunction 
From: Michael Creel <mcreel@us...>  20041020 09:14:48

Update of /cvsroot/octave/octaveforge/main/econometrics In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv30780/main/econometrics Modified Files: mle_example.m Log Message: indicate it's a script, with a "1;" Index: mle_example.m =================================================================== RCS file: /cvsroot/octave/octaveforge/main/econometrics/mle_example.m,v retrieving revision 1.1 retrieving revision 1.2 diff u d r1.1 r1.2  mle_example.m 20 Oct 2004 09:12:30 0000 1.1 +++ mle_example.m 20 Oct 2004 09:14:36 0000 1.2 @@ 51,6 +51,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA + +1; # Example to show how to use MLE functions # Example likelihood function, no score 
From: Michael Creel <mcreel@us...>  20041020 09:12:50

Update of /cvsroot/octave/octaveforge/main/econometrics In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv30326/main/econometrics Added Files: delta_method.m mle_estimate.m mle_example.m mle_obj.m mle_results.m mle_variance.m parameterize.m prettyprint_c.m prettyprint.m scale_data.m unscale_parameters.m Log Message: initial commit of econometrics functions  NEW FILE: scale_data.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Standardizes and normalizes data matrix, # primarily for use by BFGS function [zz, scalecoefs] = scale_data(z); n = rows(z); k = columns(z); # Scale data s = std(z)'; test = s != 0; s = s + (1  test); # don't scale if column is a constant (avoid div by zero) A = diag(1 ./ s); # Demean all variables except constant, if a constant is present test = std(z(:,1)) != 0; if test warning("ScaleData: no constant present  only scale  no demean"); bb = zeros(n,k); b = zeros(k,1); else b = mean(z)'; test = std(z)' != 0; # don't take out mean if the column is a constant, to preserve identification b = b .* test; b = A*b; bb = dmult(b, ones(k,n))'; endif zz = z*A + bb; scalecoefs = {A,b}; endfunction  NEW FILE: prettyprint.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # this prints matrices with row and column labels function prettyprint(mat, rlabels, clabels) # left pad the column labels a = columns(rlabels); for i = 1:a printf(" "); endfor printf(" "); # print the column labels clabels = [" ";clabels]; # pad to 8 characters wide clabels = strjust(clabels,"right"); k = columns(mat); for i = 1:k printf("%s ",clabels(i+1,:)); endfor # now print the row labels and rows printf("\n"); k = rows(mat); for i = 1:k if isstr(rlabels(i,:)) printf(rlabels(i,:)); else printf("%i", rlabels(i,:)); endif printf(" %10.3f", mat(i,:)); printf("\n"); endfor endfunction  NEW FILE: mle_example.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Example to show how to use MLE functions # Example likelihood function, no score function [log_density, score] = poisson_no_score(theta, data, otherargs) y = data(:,1); x = data(:,2:columns(data)); lambda = exp(x*theta); log_density = lambda + y .* (x*theta)  lgamma(y+1); score = "na"; endfunction # Example likelihood function, with score function [log_density, score] = poisson_with_score(theta, data, otherargs) y = data(:,1); x = data(:,2:columns(data)); lambda = exp(x*theta); log_density = lambda + y .* (x*theta)  lgamma(y+1); score = dmult(y  lambda,x); endfunction # Generate data n = 1000; # how many observations? # the explanatory variables: note that they have unequal scales x = [ones(n,1) rand(n,1) randn(n,1)]; theta = 1:3; # true coefficients are 1,2,3 theta = theta'; lambda = exp(x*theta); y = randp(lambda); # generate the dependent variable #################################### # define arguments for mle_results # #################################### # starting values theta = zeros(3,1); # data data = [y, x]; # name of model to estimate model = "poisson_with_score"; # placeholder, poisson model has no additional args modelargs = {}; # parameter names names = str2mat("beta1", "beta2", "beta3"); title = "Poisson MLE trial"; # title for the run # controls for bfgsmin: 30 iterations is not always enough for convergence control = {30,0,1,1}; # This displays the results printf("\n\nanalytic score, unscaled data\n"); [theta, V, obj_value, infocrit] = mle_results(theta, data, model, modelargs, names, title, 0, control); # This just calculates the results, no screen display printf("\n\nanalytic score, unscaled data, no screen display\n"); theta = zeros(3,1); [theta, obj_value, convergence] = mle_estimate(theta, data, model, modelargs, control); printf("obj_value = %f, to confirm it worked\n", obj_value); # This show how to scale data during estimation, but get results # for data in original units (recommended to avoid conditioning problems) # This usually converges faster, depending upon the data printf("\n\nanalytic score, scaled data\n"); [scaled_x, unscale] = scale_data(x); data = [y, scaled_x]; theta = zeros(3,1); [theta, V, obj_value, infocrit] = mle_results(theta, data, model, modelargs, names, title, unscale, control); # Example using numeric score printf("\n\nnumeric score, scaled data\n"); theta = zeros(3,1); model = "poisson_no_score"; [theta, V, obj_value, infocrit] = mle_results(theta, data, model, modelargs, names, title, unscale, control);  NEW FILE: mle_results.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # report results function [theta, V, obj_value, infocrit] = mle_results(theta, data, model, modelargs, names, title, unscale, control) if nargin < 8 [theta, obj_value, convergence] = mle_estimate(theta, data, model, modelargs); else [theta, obj_value, convergence] = mle_estimate(theta, data, model, modelargs, control); endif V = mle_variance(theta, data, model, modelargs); # unscale results if argument has been passed # this puts coefficients into scale corresponding to the original modelargs if (nargin > 5) if iscell(unscale) # don't try it if unscale is simply a placeholder [theta, V] = unscale_parameters(theta, V, unscale); endif endif [theta, V] = delta_method("parameterize", theta, {data, model, modelargs}, V); n = rows(data); k = rows(V); se = sqrt(diag(V)); if convergence == 1 convergence="Normal convergence"; elseif convergence == 2 convergence="No convergence"; elseif convergence == 1 convergence = "Max. iters. exceeded"; endif printf("\n\n******************************************************\n"); disp(title); printf("\nMLE Estimation Results\n"); printf("BFGS convergence: %s\n\n", convergence); printf("Average LogL: %f\n", obj_value); printf("Observations: %d\n", n); a =[theta, se, theta./se, 2  2*normal_cdf(abs(theta ./ se))]; clabels = str2mat("estimate", "st. err", "tstat", "pvalue"); printf("\n"); if names !=0 prettyprint(a, names, clabels); else prettyprint_c(a, clabels); endif printf("\nInformation Criteria \n"); caic = 2*n*obj_value + rows(theta)*(log(n)+1); bic = 2*n*obj_value + rows(theta)*log(n); aic = 2*n*obj_value + 2*rows(theta); infocrit = [caic, bic, aic]; printf("CAIC : %8.4f Avg. CAIC: %8.4f\n", caic, caic/n); printf(" BIC : %8.4f Avg. BIC: %8.4f\n", bic, bic/n); printf(" AIC : %8.4f Avg. AIC: %8.4f\n", aic, aic/n); printf("******************************************************\n"); endfunction  NEW FILE: delta_method.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Computes Delta method mean and covariance of a nonlinear # transformation defined by "func" function [theta_transf, vartheta] = delta_method(func, theta, otherargs, vartheta) theta_transf = feval(func, theta, otherargs); D = numgradient(func, {theta, otherargs}); var_transf = D * vartheta * D'; endfunction  NEW FILE: unscale_parameters.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Unscales parameters that were estimated using scaled data # primarily for use by BFGS function [theta_us, vartheta_us] = unscale_parameters(theta, vartheta, scalecoefs); k = rows(theta); A = nth(scalecoefs, 1); b = nth(scalecoefs, 2); kk = rows(b); B = zeros(kk1,kk); B = [b'; B]; C = A + B; # allow for parameters that aren't associated with x if (k > kk) D = zeros(kk, k  kk); C = [C, D; D', eye(k  kk)]; endif; theta_us = C*theta; vartheta_us = C * vartheta * C'; endfunction  NEW FILE: mle_obj.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # this takes a general model and calculates average log likelihood function [obj_value, score] = mle_obj(theta, data, model, modelargs) [obj_value, score] = feval(model, theta, data, modelargs); obj_value =  mean(obj_value); # let's bulletproof this in case the model goes nuts if (((abs(obj_value) == Inf))  (isnan(obj_value))) obj_value = realmax; endif if isnumeric(score) score =  mean(score)'; endif endfunction  NEW FILE: parameterize.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # # This is an empty function, provided so that # delta_method will work as is. Replace it with # the parameter transformations your models use. # Note: you can let "otherargs" contain the model # name so that this function can do parameterizations # for a variety of models function theta = parameterize(theta, otherargs) endfunction  NEW FILE: mle_estimate.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # call the minimizing routine function [theta, obj_value, convergence] = mle_estimate(theta, data, model, modelargs, control) if nargin == 3 [theta, obj_value, convergence] = bfgsmin("mle_obj", {theta, data, model, modelargs}); else [theta, obj_value, convergence] = bfgsmin("mle_obj", {theta, data, model, modelargs}, control); endif obj_value =  obj_value; # recover from minimization rather than maximization endfunction  NEW FILE: prettyprint_c.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # this prints matrices with column labels but no row labels function prettyprint_c(mat, clabels) printf(" "); # print the column labels clabels = [" ";clabels]; # pad to 8 characters wide clabels = strjust(clabels,"right"); k = columns(mat); for i = 1:k printf("%s ",clabels(i+1,:)); endfor # now print the row labels and rows printf("\n"); k = rows(mat); for i = 1:k printf(" %8.3f", mat(i,:)); printf("\n"); endfor endfunction  NEW FILE: mle_variance.m  # Copyright (C) 2003,2004 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # Copyright (C) 2003 Michael Creel michael.creel@... # under the terms of the GNU General Public License. # The GPL license is in the file COPYING # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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 this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021111307 USA # sandwich form of varcov matrix function [V,scorecontribs,J_inv] = mle_variance(theta, data, model, modelargs) scorecontribs = numgradient(model, {theta, data, modelargs}); n = rows(scorecontribs); I = scorecontribs'*scorecontribs / n; J = numhessian("mle_obj", {theta, data, model, modelargs}); J_inv = inverse(J); V = J_inv*I*J_inv/n; endfunction 
From: Michael Creel <mcreel@us...>  20041020 09:11:06

Update of /cvsroot/octave/octaveforge/main/econometrics In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv29962/main/econometrics Log Message: Directory /cvsroot/octave/octaveforge/main/econometrics added to the repository 
From: David Bateman <adb014@us...>  20041020 09:06:55

Update of /cvsroot/octave/octaveforge/main/miscellaneous In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv29227 Modified Files: dispatch.cc Log Message: Constructor should set has_alias to false (For Gernot Hueber) Index: dispatch.cc =================================================================== RCS file: /cvsroot/octave/octaveforge/main/miscellaneous/dispatch.cc,v retrieving revision 1.17 retrieving revision 1.18 diff u d r1.17 r1.18  dispatch.cc 11 Aug 2004 03:06:12 0000 1.17 +++ dispatch.cc 20 Oct 2004 09:06:45 0000 1.18 @@ 123,7 +123,8 @@ #endif octave_dispatch::octave_dispatch (const std::string &name)  : octave_function (name, "Overloaded function"), tab (), base(name) + : octave_function (name, "Overloaded function"), tab (), base(name), + has_alias (false) { } void 