Diff of /gmm_results.m [6da49b] .. [0e3aae] Maximize Restore

  Switch to side-by-side view

--- a/gmm_results.m
+++ b/gmm_results.m
@@ -1,4 +1,4 @@
-# Copyright (C) 2003,2004  Michael Creel michael.creel@uab.es
+# Copyright (C) 2003,2004,2005  Michael Creel michael.creel@uab.es
 # 
 # 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
@@ -14,12 +14,37 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-function [theta, V, obj_value] = gmm_results(theta, data, weight, moments, momentargs, names, title, unscale, control)
+# usage: [theta, V, obj_value] = 
+#  gmm_results(theta, data, weight, moments, momentargs, names, title, unscale, control, nslaves)
+#
+# inputs:
+# theta: column vector initial parameters
+# data: data matrix
+# weight: the GMM weight matrix
+# moments: name of function computes the moments (should return nXg matrix of contributions)
+# momentargs: (cell) additional inputs needed to compute moments. May be empty ("")
+# names: vector of parameter names, e.g., use names = str2mat("param1", "param2");
+# title: string, describes model estimated
+# unscale: (optional) cell that holds means and std. dev. of data (see scale_data) 
+# control: (optional) BFGS or SA controls (see bfgsmin and samin). May be empty (""). 
+# nslaves: (optional) number of slaves if executed in parallel (requires MPITB)
+#
+# outputs:
+# theta: GMM estimated parameters
+# V: estimate of covariance of parameters. Assumes the weight matrix is optimal 
+# obj_value: the value of the GMM objective function
+#
+# Please see gmm_example for information on how to use this
+ 
+
+function [theta, V, obj_value] = gmm_results(theta, data, weight, moments, momentargs, names, title, unscale, control, nslaves)
+	
+  if nargin < 10 nslaves = 0; endif # serial by default
 	
 	if nargin < 9
-		[theta, obj_value, convergence] = gmm_estimate(theta, data, weight, moments, momentargs);
+		[theta, obj_value, convergence] = gmm_estimate(theta, data, weight, moments, momentargs, "", nslaves);
 	else
-		[theta, obj_value, convergence] = gmm_estimate(theta, data, weight, moments, momentargs, control);
+		[theta, obj_value, convergence] = gmm_estimate(theta, data, weight, moments, momentargs, control, nslaves);
 	endif