help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: request for help with fmins or fminbnd


From: Michael Creel
Subject: Re: request for help with fmins or fminbnd
Date: Fri, 31 Aug 2007 11:05:45 +0200



On 8/31/07, Tracy Feldman <address@hidden> wrote:
To whom it may concern:
 
I am trying to convert a program that had worked well in Matlab, so that I can use an equivalent program in Octave (I no longer have access to Matlab).  The program calculates the maximum likelihood estimate and the best-fit parameters for a function (finding poisson confidence limits, in this case, or in other cases, fitting a logistic function with binomial error).  I have run into difficulties with the fmins function (which I have used in Octave to replace "fminsearch" in Matlab).  I am trying to call my likelihood function as follows:
 
[maxparam, maxlike] = fmins(@Likelihood_pois1, initparammax, [], [], pir, boundslowmax, boundsupmax);
 
where
maxparam is a vector of two values of the maximized function
Likelihood_pois1 is the likelihood function (which I could send if it would help)
initparammax is a vector of two initial parameter values
the two [] sets are for Options and GRAD, respectively
pir is a response variable (the data)
boundslowmax is a vector of two lower bounds of the parameter values
boundsupmax is a vector of two upper bound of the parameter values
 
It is received by the Likelihood function as follows:
 
function neglogL = Likelihood_pois1(pp, initparammax, pir, boundslowmax, boundsupmax);
 
I am not sure what would be the correct syntax, but whatever order I choose for the variables in parentheses (or if I get rid of one or both of the empty brackets)  I get an error message saying invalid vector index = 4 (or some other #), and that fmins cannot perform any of several binary operations.
 
I have also tried converting to syntax for fminbnd, hoping it would be better, but this will not work for me either.  Is this more than a simple syntax issue?
 
I would appreciate any suggestions you might have (or if you would like more code from me and/or the program files, I can send more--or original files that worked in Matlab).
 
I really appreciate your time and help.  I am not currently subscribed to the list, so if you can, please respond to me directly at  address@hidden.
Sincerely,
 
Tracy S. Feldman
 
Postdoctoral Associate
The Samuel Roberts Noble Foundation
Ardmore, OK 73401
 


Got a little couch potato?
Check out fun summer activities for kids.


_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave


If you get the econometrics and optim packages from Octave Forge (http://octave.sourceforge.net/packages.html) you can do maximum likelihood estimation using "mle_estimate" or "mle_results". There is an mle_example script that in fact does MLE of a Poisson model:

octave:1> mle_example


analytic score, unscaled data


******************************************************
Poisson MLE trial

MLE Estimation Results
BFGS convergence: Normal convergence

Average Log-L: -1.540433
Observations: 1000

         estimate     st. err      t-stat     p-value
beta1       1.023       0.015      67.892       0.000
beta2       2.036       0.011     180.661       0.000
beta3       2.993       0.006     531.754       0.000

Information Criteria
CAIC : 3104.5897      Avg. CAIC:   3.1046
 BIC : 3101.5897       Avg. BIC:   3.1016
 AIC : 3086.8664       Avg. AIC:   3.0869
******************************************************

Michael


reply via email to

[Prev in Thread] Current Thread [Next in Thread]