Statalist


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

SV: st: RE: unexisting errors


From   "Mikkel Barslund" <Mikkel.Barslund@econ.ku.dk>
To   <statalist@hsphsun2.harvard.edu>
Subject   SV: st: RE: unexisting errors
Date   Wed, 25 Jul 2007 15:20:00 +0200

Geraldo, you don't define r12 (/r12) in your model call.

Think you might get there if you try:

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

In that order.

Hope this helps,
Mikkel


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'*`r
14'*`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'*`r
24'*`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'*`r1
3')/(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'*`r2
3')/(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



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index