Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: FW: ML for logit/ologit
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
RE: st: FW: ML for logit/ologit
Date
Wed, 16 Nov 2011 11:35:40 +0000
You need to supply the right number of arguments too. Here it looks as if rho is undefined because you are not feeding the program with enough arguments.
Nick
[email protected]
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Thomas Murray (Department of Economics)
Sent: 16 November 2011 11:18
To: [email protected]
Subject: RE: st: FW: ML for logit/ologit
Right yes - apologies for that - I was experimenting with different arguments and emailed a faulty program.
What I type is:
program drop logittest
program define logittest
version 12.0
args lnf b1 x rho
tempvar lng
qui {
gen double `lng' = ln(invlogit(`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==1
replace `lng' = ln(invlogit(-`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==0
replace `lnf' = `lng'
}
end
ml model lf logittest (happy =)
ml max
The trace returns:
- version 12.0
- args lnf b1 x rho
- tempvar lng
- qui {
- gen double `lng' = ln(invlogit(`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==1
= gen double __000007 = ln(invlogit(__000006*((^(1-)-1)/(1-)))) if happy==1
unknown function ^()
replace `lng' = ln(invlogit(-`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==0
replace `lnf' = `lng'
This is Brendan's comment from a bit earlier:
You have "((^(1-)" in there, so the ^ doesn't apply to a variable, and therefore isn't recognised as an operator.
I think this is because your `x' expands to "".
Could ^ be failing to pick up `rho' inside the bracket?
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: 16 November 2011 11:03
To: '[email protected]'
Subject: RE: st: FW: ML for logit/ologit
That is not clear at all. The explanation is different. You are invoking a local rho, which you never define. Your earlier statement defines mu.
It now also seems that your earlier "along the lines of" means that you were not showing us the code that was buggy, which does help to explain why we couldn't see the bug.
Please do "Say exactly what you typed and exactly what Stata typed (or did) in response."
Nick
[email protected]
Thomas Murray (Department of Economics)
I have run the set trace and it is clear there is a problem with the including an argument within the squared term (I've pasted the relevant part below). I am sure this is the bug but I do not know why Stata doesn't like it.
I am confident all the quotations are correct in the program.
Many Thanks,
Tom
- mata: Mopt_search()
------------------------------------------------------------------------------------------------ begin logittest ---
- version 12.0
- args lnf b1 b2 x mu
- tempvar lng
- qui {
- gen double `lng' = ln(invlogit(`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==1
= gen double __000007 = ln(invlogit(__000006*((^(1-)-1)/(1-)))) if educ1==1 unknown function ^()
replace `lng' = ln(invlogit(-`b1'*((`x'^(1-`rho')-1)/(1-`rho')))) if $ML_y1==0
replace `lnf' = `lng'
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/