*!  version 0.2.0 2005-02-03 jsl
    * pe2 to pe

//  simply check if last command was valid for spost

capture program drop _pecmdcheck
program define _pecmdcheck, rclass
    version 8
    args spostcmd
    local io ""
    if "`e(cmd)'"=="cloglog"  {
        local io "typical binary"
    }
    if "`e(cmd)'"=="cnreg"    {
        local io "typical tobit"
    }
    if "`e(cmd)'"=="fit"      {
        local io "typical regress"
    }
    if "`e(cmd)'"=="gologit"  {
        local io "typical ordered"
    }
    if "`e(cmd)'"=="intreg"   {
        local io "typical tobit"
    }
    if "`e(cmd)'"=="logistic" {
        local io "typical binary"
    }
    if "`e(cmd)'"=="logit"    {
        local io "typical binary"
    }
    if "`e(cmd)'"=="mlogit"   {
        local io "typical nominal"
    }
    if "`e(cmd)'"=="nbreg"    {
        local io "typical count"
    }
    if "`e(cmd)'"=="ologit"   {
        local io "typical ordered"
    }
    if "`e(cmd)'"=="oprobit"  {
        local io "typical ordered"
    }
    if "`e(cmd)'"=="poisson"  {
        local io "typical count"
    }
    if "`e(cmd)'"=="probit"   {
        local io "typical binary"
    }
    if "`e(cmd)'"=="regress"  {
        local io "typical regress"
    }
    if "`e(cmd)'"=="tobit"    {
        local io "typical tobit"
    }
    if "`e(cmd)'"=="zinb"     {
        local io "twoeq count"
    }
    if "`e(cmd)'"=="zip"      {
        local io "twoeq count"
    }
    if "`io'"=="" {
        di as error _new ///
            "`spostcmd' does not work for the last type of model estimated."
    }
    return local io = "`io'"

end