Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: MLE of a function with complex coefficients

From   "Pete Aling" <>
To   <>
Subject   st: MLE of a function with complex coefficients
Date   Fri, 31 Mar 2006 11:01:20 +0200

Hi all,

I'm using STATA to do MLE and I'm using the lf method.

I have only 1 variable, interest rate and it is explained only as a function of its previous value. The coefficients however are complex and non-linear thus I need to hard code the lag into the likelihood function. I'm not sure whether I've done this correctly since I get the following result when I run my do file.

initial:       log likelihood =     -<inf>  (could not be evaluated)

could not find feasible values

The process that the interest rate follows is this

tbrate = exp(beta)*L.tbrate + (alpha/beta)*(exp(beta)-1) + e

where e is an error term. The likelihood function is in the paper and is based on the form of tbrate and the properties of the error term.

Here is a copy of my code. If anyone has more experience with this and might be able to help I'd appreciate it.
tbrate is the interest rate variable and ltbrate is its lagged values.

capture program drop myest
program define myest
	version 6
	args lnf theta1 theta2 theta3 theta4
	tempvar a b c d e
	quietly gen double `a'= `theta3'/(2*`theta2')
	quietly gen double `b'= exp(2*`theta2') - 1
	quietly gen double `c'=	2*`theta4'
	quietly gen double `d'= exp(`theta2')
	quietly gen double `e'= `theta1'/`theta2'
	quietly replace `lnf' = (ln(`a'*`b'*(ltbrate)^`c')) + (($ml_y1-`d'*ltbrate-`e'*(`d'-1))^2)/(`a'*`b'*(ltbrate)^`c')
ml model lf myest (tbrate) /alpha /beta /sigma2 /gamma
ml maximize

Peter Aling

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/295 - Release Date: 2006/03/28

*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index