All,
By George, I've got it! I reloaded -mlbeta- again, added two codes only
referring to the -nocons- options, and:
. mlbeta sqgovote conadmin labadmin sqgpchg sqbeldm weakgovt, robust nocons
initial: log pseudolikelihood = 58.897248
improve: log pseudolikelihood = 58.897248
alternative: log pseudolikelihood = 79.705106
rescale: log pseudolikelihood = 79.705106
rescale eq: log pseudolikelihood = 125.62044
initial: log pseudolikelihood = 125.62044
rescale: log pseudolikelihood = 152.77739
rescale eq: log pseudolikelihood = 182.60433
Iteration 0: log pseudolikelihood = 182.60433
Iteration 1: log pseudolikelihood = 213.70011
Iteration 2: log pseudolikelihood = 218.03775
Iteration 3: log pseudolikelihood = 218.16947
Iteration 4: log pseudolikelihood = 218.1697
Iteration 5: log pseudolikelihood = 218.1697
Number of obs = 118
Wald chi2(5) = 363.39
Log pseudolikelihood = 218.1697 Prob > chi2 = 0.0000
----------------------------------------------------------------------------
| Robust
sqgovote | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-----------+----------------------------------------------------------------
eq1 |
conadmin | -2.573098 .2641504 -9.74 0.000 -3.090823 -2.055373
labadmin | -2.49654 .2900482 -8.61 0.000 -3.065024 -1.928056
sqgpchg | .8231001 .136534 6.03 0.000 .5554985 1.090702
sqbeldm | -.9002064 .1771582 -5.08 0.000 -1.24743 -.5529827
weakgovt | .1150282 .1120976 1.03 0.305 -.104679 .3347354
-----------+----------------------------------------------------------------
eq2 |
_cons | 3.069133 .3693289 8.31 0.000 2.345261 3.793004
----------------------------------------------------------------------------
Mean squared error:.006385
So, what cracked it? Actually, both Scott and Richard were right in their
solutions in their own way:
program define mlbeta, rclass
version 8
syntax varlist [if][in] [,DIspersion(varlist)] [,Robust] [,svy] [,Nocons]
tokenize `varlist'
marksample touse
if "`svy'"!=""{
svymarkout `touse'
}
local lhs "`1'"
mac shift
local rhs "`*'"
ml model lf mlbeta_ll (`lhs'=`rhs', noconstant) (`dispersion') `if' `in',
`robust' `svy'
ml search
ml maximize
tempvar error
quietly {
predict `error' if e(sample)
replace `error' = exp(`error')/(1+exp(`error'))
replace `error' = (`lhs' - `error')^2
su `error', meanonly
}
display in green _n "Mean squared error:" in yellow `r(mean)'
end
In other words, leaving the -noconstant- option out of the dispersion part
of the code seemed to do the trick, since the dispersion part of the
equation _must_ have the constant present: I couldn't see the wood for the
trees clear enough to realise this.
The funny thing is, if I add the -nonconstant- option in the dispersion
bracket, as well as adding Richard's suggested add-on code to the -ml
model- line, nothing happens. At all. Perhaps this is just as well.
Thanks - yet again - to Richard, Scott and Nick for their selfless help in
finding the key to unlock the door.
CLIVE NICHOLAS |t: 0(044)7903 397793
Politics |e: [email protected]
Newcastle University |http://www.ncl.ac.uk/geps
*
* 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/