Hi Statalist users,
I am running an ml estimation iteratively; in each iteration an ml estimation is performed, and such estimation varies significantly (due to random changes in its parameters). As a result, sometimes a particular iteration may come up with values that lead to flat or discontinous region in the ml estimation. However, I do not want to bann these particular values from showing up, but rather simply to command stata to skip/ignore/restart an iteration automatically when the ml estimation finds a flat/discontinous region (instead of throwing an error and stopping the program from running). Does anyone knows how can I do this? The ML program I am using is a very simple one:
program define mixturemodel
version 1.0
args lnf s
tempvar PAa PBa
quietly {
gen double `PAa'=$ML_y1
gen double `PBa'=$ML_y2
replace `lnf'=ln((exp(`s')/(1+exp(`s')))*`PAa'+(1/(1+exp(`s')))*`PBa')
sum `lnf' `s'
}
end
Thank you for your help!
I am running an ml estimation iteratively; in each iteration an ml estimation is performed, and such estimation varies significantly (due to random changes in its parameters). As a result, sometimes a particular iteration may come up with values that lead to flat or discontinous region in the ml estimation. However, I do not want to bann these particular values from showing up, but rather simply to command stata to skip/ignore/restart an iteration automatically when the ml estimation finds a flat/discontinous region (instead of throwing an error and stopping the program from running). Does anyone knows how can I do this? The ML program I am using is a very simple one:
program define mixturemodel
version 1.0
args lnf s
tempvar PAa PBa
quietly {
gen double `PAa'=$ML_y1
gen double `PBa'=$ML_y2
replace `lnf'=ln((exp(`s')/(1+exp(`s')))*`PAa'+(1/(1+exp(`s')))*`PBa')
sum `lnf' `s'
}
end
Thank you for your help!
Comment