I am trying to fit the reparametized model to my data, but stata 13.0 keeps returning error message "+age* invalid name".
In my data IGG.dta, there are only two variables, igg and age.
Could someone please point out where went wrong in my code? Thanks a lot!
Below is my code:
*================================================= ================
cap prog drop ll
prog define ll
args lnf a b c d e f
tempvar b t k
qui gen `b'=exp(`c'+age*`d')
qui gen `t'=exp(`a'+age*`b')
qui gen `k'=exp(`e'+age*`f')
qui replace `lnf' = log(`b')-`k'*`b'*log(`t')-lngamma(`k')+ (`k'*`b'-1)*log(igg)-(igg/`t')^`b'
end
use IGG, clear
ml model lf ll (=age)
ml maximize
*================================================= ================
After typing in "ml check", below is the response Stata returned:
*================================================= ================
. ml check
Test 1: Calling ll to check if it computes log likelihood and
does not alter coefficient vector...
FAILED; ll returned error 198.
Here is a trace of its execution:
------------------------------------------------------------------------------
-> ll __000008 __000009
- `begin'
= capture noisily version 13.1: ll __000008 __000009
---------------------------------------------------------------------------- begin ll ---
- args lnf a b c d e f
- tempvar b t k
- qui gen `b'=exp(`c'+age*`d')
= qui gen __00000A=exp(+age*)
+age* invalid name
------------------------------------------------------------------------------ end ll ---
- `end'
= set trace off
------------------------------------------------------------------------------
Fix ll.
r(198);
*================================================= ================
Linda
In my data IGG.dta, there are only two variables, igg and age.
Could someone please point out where went wrong in my code? Thanks a lot!
Below is my code:
*================================================= ================
cap prog drop ll
prog define ll
args lnf a b c d e f
tempvar b t k
qui gen `b'=exp(`c'+age*`d')
qui gen `t'=exp(`a'+age*`b')
qui gen `k'=exp(`e'+age*`f')
qui replace `lnf' = log(`b')-`k'*`b'*log(`t')-lngamma(`k')+ (`k'*`b'-1)*log(igg)-(igg/`t')^`b'
end
use IGG, clear
ml model lf ll (=age)
ml maximize
*================================================= ================
After typing in "ml check", below is the response Stata returned:
*================================================= ================
. ml check
Test 1: Calling ll to check if it computes log likelihood and
does not alter coefficient vector...
FAILED; ll returned error 198.
Here is a trace of its execution:
------------------------------------------------------------------------------
-> ll __000008 __000009
- `begin'
= capture noisily version 13.1: ll __000008 __000009
---------------------------------------------------------------------------- begin ll ---
- args lnf a b c d e f
- tempvar b t k
- qui gen `b'=exp(`c'+age*`d')
= qui gen __00000A=exp(+age*)
+age* invalid name
------------------------------------------------------------------------------ end ll ---
- `end'
= set trace off
------------------------------------------------------------------------------
Fix ll.
r(198);
*================================================= ================
Linda
Comment