Announcement

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

  • Regsave logistic regression

    Hello, using the wonderful regsave (https://ideas.repec.org/c/boc/bocode/s456964.html) to store results from regression models, it seems as if it still stores logit coefficients and CIs (as opposed to odds ratios) when using the -logistic- command.

    Based on this: https://julianreif.com/regsave/ it seems like it has something to do with how Stata saves things in e(). Is there a way to transform that (and the CIs) within Stata before using regsave, perhaps?

  • #2
    Hi Anne, why do you need to store the odds ratios? Can't you just derive them later when you open the Stata dataset?

    Comment


    • #3
      [Deleted because of accidental double post]
      Last edited by Anne Todd; 23 Feb 2023, 18:01.

      Comment


      • #4
        Sure, I could just write a function to derive them in Python/R later, but I was thinking if there's an easy way to do this in the process of saving with -regsave- that it would be simpler that way.

        Comment


        • #5
          Since the odds ratio = eβ you won't need to write a function to transform the coefficient estimates and confidence interval into odds ratios and confidence intervals.

          Alternatively, the rtable option will solve your problem.
          Code:
          sysuse auto, clear
          logit foreign mpg, or
          regsave, ci
          list
          
          sysuse auto, clear
          logit foreign mpg, or
          regsave, rtable ci
          list
          Code:
          . list, clean noobs
          
                        var        coef     stderr    ci_lower    ci_upper    N  
                foreign:mpg    .1597621   .0525876    .0566922     .262832   74  
              foreign:_cons   -4.378866   1.211295   -6.752961   -2.004771   74
          Code:
          . list, clean noobs
          
                        var       coef     stderr   ci_lower   ci_upper    N  
                foreign:mpg   1.173232   .0616975    1.05833   1.300608   74  
              foreign:_cons   .0125396   .0151891   .0011674   .1346911   74

          Comment

          Working...
          X