Hi,
I'd like to estimate Ordered Logit and create discrete predicted values
(inside a sample). Simple script:
<hansl>
set verbose off
open wtp.gdt
list X = 1 2 9 10 11
yvalues = values(depvar)
logit depvar 0 X
cuts = $coeff[$model["nx"]+1:end]
YHAT = ($yhat .<= cuts[1]) * yvalues[1]
loop i=2..nelem(cuts) --quiet
YHAT += (($yhat .> cuts[i-1]) && ($yhat .<= cuts[i])) * yvalues[i]
endloop
YHAT += ($yhat .> cuts[end]) * yvalues[end]
series yhat = YHAT
printf "\ncorrectly predicted: (model) %d vs. (manual) %d\n",
$model["correct"], sum(depvar == yhat)
</hansl>
What am I doing wrong?
--
Marcin Błażejowski