Announcement

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

  • Accessing ado code for svy: total to identify variance estimation method

    Hello,
    I'm needing to estimate standard errors in an Excel file, for a complex survey. It is a two stage stratified sample.
    In testing, I've almost been able to match the standard error in Excel, to what Stata generates. I'm looking at the total of a variable. I've been using the formula (2) on page 200 of the svy manual.
    I have tried to manually use Stata to generate the standard error myself...where I get the same estimate as Excel!
    So that I can identify what I'm missing in Excel, where do I look at the relevant Stata ado code? I can't see the relevant code in the svy ado file.
    Alternatively, has someone generated code that does this estimate the long way?
    Any assistance will be gratefully received.
    Regards,
    Andrew
    Last edited by Andrew Wade; 29 May 2019, 07:42.

  • #2
    Code:
    viewsource _svy_summarize.ado
    Now, StataCorp's ado-files often call other ado-files, so what you are looking for may or may not be in this file. You may have to root around to look for the source code for some other ado mentioned therein.

    I'm needing to estimate standard errors in an Excel file, for a complex survey. It is a two stage stratified sample.
    Why on earth would you want to do that? Excel is not a statistical package, and whatever you do in it leaves no audit trail, so nobody with sense will trust anything you do in it. Excel is fine for shipping data around among people who use different statistical packages, or for certain types of visual displays of data. But why would you try to do any serious statistics in Excel?
    Last edited by Clyde Schechter; 29 May 2019, 12:42.

    Comment


    • #3
      Hi,
      Thanks. I will look at this syntax. I think your response was cut off.
      In response to your question...I've generated a financial model for a client that uses complex survey data. They need to be able to change model assumptions. Point estimates are easy. But I want them to understand the potential error.
      Alas, I don't know how to tell Excel to use Stata for certain analysis. Can this be done?
      And I would say that Excel leaves an audit trail, albeit complex, via formula auditor and VBA. Many multi-billion dollar decisions are made on the basis of Excel models.
      Regards,

      Andrew

      Comment


      • #4
        I've generated a financial model for a client that uses complex survey data. They need to be able to change model assumptions. Point estimates are easy. But I want them to understand the potential error.
        I'm sorry, I wasn't questioning wanting to have error estimates. That's best practice. I meant, why are you doing this in Excel?

        Alas, I don't know how to tell Excel to use Stata for certain analysis. Can this be done?
        Stata has an -import excel- command: you can bring the data into Stata and work with it there. Your do-file and log files become an exact audit trail. If, at the end, you want to put the results back in an Excel file, there is an -export excel- command that does that.

        And I would say that Excel leaves an audit trail, albeit complex, via formula auditor and VBA.
        Sort of. But there is no way of telling the order in which these various things were done. And tracing out the path of calculations through formulas in the cells is nearly impossible in any but the simplest situations.

        Many multi-billion dollar decisions are made on the basis of Excel models.
        That is one of the most frightening things I have heard in my life! Seriously, I would never knowingly do any kind of important business with anyone based on an Excel model, and I'm genuinely appalled to hear this.

        Comment


        • #5
          One more thing, the mathematical equations for what is calculated is given in the relevant section of the -svy- manual included with your Stata installation. This should save you ample time rather that rooting around in source ado files.

          Comment

          Working...
          X