Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Slight Bug in Margins when using -fvset- ?

    I think I'm hitting a small bug when I use -fvset- with -margins-. I assume this is similar to "Slight Bug in Margins after Fixed Effects Estimation" (https://www.statalist.org/forums/for...s-estimation)? Example:

    Code:
    sysuse auto, clear
    est clear
    
    /* make an outcome */
    gen y = (price>5000)
    
    /* generate a categorical variable x1 */                    
    gen x_str_temp = substr(make,1,1)
    encode x_str_temp, gen(x1)
    bys x1: drop if _N<5            /* drop some obs to avoid having few obs per cell */
    ta x1, m
    keep y foreign x1
    
    qui {
    * no problem here
    probit y foreign     i.x1
    noi eststo fvsetNO:                     margins, dydx(*) post atmeans
    
    * now foreign "not estimable" because of -fvset-
    fvset base 1 x1
    probit y foreign     i.x1
    noi eststo fvsetYES:                     margins, dydx(*) post atmeans
    
    * -noestimcheck- option can solve this problem, it seems
    probit y foreign     i.x1
    noi eststo fvsetYES_and_noestimcheck:     margins, dydx(*) post atmeans         noestimcheck
    
    * show results side-by-side
    noi estout *, cells(    b(fmt(a4) star) se(fmt(a4) )     )     modelwidth(30)     
    }
    exit

Working...
X