# Copyright (C) 2003,2004 Michael Creel address@hidden
# 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 02111-1307 USA
# Copyright (C) 2003 Michael Creel address@hidden
# 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 02111-1307 USA
# Copyright (C) 2003 Michael Creel address@hidden
# 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 02111-1307 USA
# Example to show how to use MLE functions
n = 1000; # how many observations?
control = {30,0,1,1}; # controls for bfgsmin
# create random data, true coefficients are 1,2,3
x = [ones(n,1) rand(n,2)];
theta = 1:3;
theta = theta';
lambda = exp(x*theta);
y = poisson_rnd(lambda);
theta = zeros(3,1);
model = "Poisson";
data = {y, x};
names = str2mat("beta1", "beta2", "beta3", "alpha", "sp", "sp2");
title = "Poisson MLE trial";
# This displays the results
[theta, V, obj_value, infocrit] = mle_results(theta, model, data, names, title, 0, control);
obj_value
# # This just calculates the results, no screen display
# [theta, obj_value, convergence] = mle_estimate(theta, model, data, control);
# # verify that it works
# disp(theta);
# disp(obj_value);
# disp(convergence);