Announcement

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

  • Issue producing geometric means with svy commands in Stata 15

    I am working on a project using Stata 14.2 using survey data with a complex design, that also involves analyzing biochemical data from participants. For an upcoming project, I would like to re-work my existing code that was used in Stata 14.2 and run the analysis in Stata 15 (due to other features in the most recent version of the package).

    I am running into an issue adapting the code from 14.2 for use in 15. For instance, previously I could obtain an estimated geometric mean using the following syntax:

    svy: mean <variable>
    ereturn display, eform (geo_mean).

    This code works just fine in 14.2, however when I run the command in Stata 15, the "ereturn display" command simply returns the same value I get with the original svy command. I cannot find any information on whether or not the syntax has changed, or if this is a software related problem. Alternatively, I would like to seek another way to get this information.

    Any assistance anyone could offer would be appreciated.

    Thanks,
    Danielle Smith

  • #2
    This seems to be a bug. I can replicate your problem, Stata version 15.1 MP2, 64 bit, updated 8 Mar 2018, Windows 7.

    Meanwhile you can get your geometric mean as follows:

    Code:
    mean variable
    nlcom exp(_b[variable])
    (Works with -svy:- prefix on -mean- as well.)

    Added: To be clear, to actually get a geometric mean, the "variable" referred to in this code should be the natural logarithm of the actual variable whose geometric mean is sought.

    Comment


    • #3
      Perfect - thank you so much!

      Comment

      Working...
      X