Statalist


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

Re: st: RE: unexisting errors


From   "Geraldo Cerqueiro" <[email protected]>
To   [email protected]
Subject   Re: st: RE: unexisting errors
Date   Wed, 25 Jul 2007 13:52:29 +0200

You are right, Maarten.
Below you can find the code and the error message (ml check). The
program is not recognizing the argument r34.


capture program drop experim_lf
program experim_lf

args lnf xb1 xb2 xb3 xb4 s3 s4 r12 r13 r14 r23 r24 r34
tempvar u3 u4 cum1 cum2 r
quietly {

		
local r12 0
gen double `u3'=$ML_y3-`xb3'
gen double `u4'=$ML_y4-`xb4'

gen double `cum1'=(-`xb1'-`u3'*((`r13'-`r34'*`r14')/(`s3'*(1-`r34'^2)))-`u4'*((`r14'-`r34'*`r13')/(`s4'*(1-`r34'^2))))/(sqrt(1-((`r13'^2+`r14'^2-2*`r34'*`r14'*`r13')/(1-`r34'^2))))
gen double `cum2'=(-`xb2'-`u3'*((`r23'-`r34'*`r24')/(`s3'*(1-`r34'^2)))-`u4'*((`r24'-`r34'*`r23')/(`s4'*(1-`r34'^2))))/(sqrt(1-((`r23'^2+`r24'^2-2*`r34'*`r24'*`r23')/(1-`r34'^2))))

gen double `r'=(`r12'-((`r13'*`r23'-`r13'*`r24'*`r34'-`r14'*`r23'*`r34'+`r14'*`r24')/(1-`r34'^2)))

replace `lnf'=ln(normal(-`xb1')) if $ML_y1==0		
replace `lnf'=ln(binormal(`xb1',-`xb2',-`r12')) if $ML_y1==1&$ML_y2==0	
replace `lnf'=ln(1-normal(`cum1')-normal(`cum2')+binormal(`cum1',`cum2',`r'))+ln(normalden($ML_y3,`xb3',`s3'))+ln(normalden($ML_y4,`xb4',`s4'))
if $ML_y1==1&$ML_y2==1
}
end


clear
use "E:\Stata\NSSBF 1993.dta"

foreach var of varlist _all {
quietly replace `var'=0 if `var'==.
}


local xapplied "late_tc_payments tc_denied concentrated ln_assets
debt_assets debt_owner "
local xaccepted "relat_lending concentrated corporation ln_assets
debt_assets intangibles_assets clean_record"
local xloanrate "floating prime_rate relat_lending concentrated clean_record"
local xamount "prime_rate ln_assets concentrated clean_record relat_lending"
reg loanrate `xloanrate' if accepted==1
reg ln_amount `xamount' if accepted==1


quietly {
probit applied `xapplied'
mat b_p1=e(b)
predict z1d1,xb
gen mills1=normden(z1d1)/normal(z1d1)
probit accepted `xaccepted' if applied==1
mat b_p2=e(b)
predict z2d2,xb
gen mills2=normden(z2d2)/normal(z2d2)
reg loanrate `xloanrate' if accepted==1
mat b_y3=e(b)
reg ln_amount `xamount' if accepted==1
mat b_y4=e(b)
}

ml model lf experim_lf (applied=`xapplied') (accepted=`xaccepted')
(loanrate=`xloanrate') (ln_amount=`xamount') /r34 /s3 /s4 /r13 /r23
/r24 /r14
ml check

ml init b_p1 b_p2 b_y3 b_y4 2 1.5 0 -0.1 0.8 0.11 -0.2,copy
ml maximize,difficult




Test 1:  Calling experim_lf to check if it computes log likelihood and
        does not alter coefficient vector...
        FAILED; experim_lf returned error 198.

Here is a trace of its execution:
------------------------------------------------------------------------------
-> experim_lf __00000Y __00000N __00000O __00000P __00000Q __00000R
__00000S __00000T __00000U __00000V __00
000W __00000X
             - `begin'
             = capture noisily version 9.1: experim_lf __00000Y
__00000N __00000O __00000P __00000Q __00000
R __00000S __00000T __00000U __00000V __00000W __00000X
-----------------------------------------------------------------------
begin experim_lf ---
               - args lnf xb1 xb2 xb3 xb4 s3 s4 r12 r13 r14 r23 r24 r34
               - tempvar u3 u4 cum1 cum2 r
               - quietly {
               - local r12 0
               - gen double `u3'=$ML_y3-`xb3'
               = gen double __00000Z=loanrate-__00000P
               - gen double `u4'=$ML_y4-`xb4'
               = gen double __000010=ln_amount-__00000Q
               - gen double
`cum1'=(-`xb1'-`u3'*((`r13'-`r34'*`r14')/(`s3'*(1-`r34'^2)))-`u4'*((`r14'-`r34'
*`r13')/(`s4'*(1-`r34'^2))))/(sqrt(1-((`r13'^2+`r14'^2-2*`r34'*`r14'*`r13')/(1-`r34'^2))))
               = gen double
__000011=(-__00000N-__00000Z*((__00000U-*__00000V)/(__00000R*(1-^2)))-__000010*
((__00000V-*__00000U)/(__00000S*(1-^2))))/(sqrt(1-((__00000U^2+__00000V^2-2**__00000V*__00000U)/(1-^2))))
*__00000V invalid name
                 gen double
`cum2'=(-`xb2'-`u3'*((`r23'-`r34'*`r24')/(`s3'*(1-`r34'^2)))-`u4'*((`r24'-`r34'
*`r23')/(`s4'*(1-`r34'^2))))/(sqrt(1-((`r23'^2+`r24'^2-2*`r34'*`r24'*`r23')/(1-`r34'^2))))
                 gen double
`r'=(`r12'-((`r13'*`r23'-`r13'*`r24'*`r34'-`r14'*`r23'*`r34'+`r14'*`r24')/(1-`r
34'^2)))
                 replace `lnf'=ln(normal(-`xb1')) if $ML_y1==0
                 replace `lnf'=ln(binormal(`xb1',-`xb2',-`r12')) if
$ML_y1==1&$ML_y2==0
                 replace
`lnf'=ln(1-normal(`cum1')-normal(`cum2')+binormal(`cum1',`cum2',`r'))+ln(normalden
($ML_y3,`xb3',`s3'))+ln(normalden($ML_y4,`xb4',`s4')) if $ML_y1==1&$ML_y2==1
                 }

-------------------------------------------------------------------------
end experim_lf ---
             - `end'
             = set trace off
------------------------------------------------------------------------------
Fix experim_lf.
r(198);

end of do-file



Thanks,

Geraldo


On 7/25/07, Maarten Buis <[email protected]> wrote:
--- Geraldo Cerqueiro wrote:
> I don't know if I'm the only one experiencing this but Stata sometimes
> complaints about inexistent errors, for instance, reading arguments or
> local macros (in ML check). I also found my self running two identical
> programs (I checked character by character) and they would run in
> totally different ways (one would converge and the other not).
> But the question that I'm really interested in is: Is this stata's
> problem or my problem?

Remember that we know nothing about your Stata set up, the kind of
model you are trying to estimate, the data you are using, the error
messages you get, unless you tell us. How can you expect us to be
able to give you any sensible advise based on the information you
have given us? I am not trying to be nasty, I am just trying to
explain to you that we need information to diagnose your problem.
If you do not give it we cannot help you, not because of some petty
adherence to the Statalist FAQ, but because of a lack of telepathic
or extrasensory ability.

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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