Announcement

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

  • Taylor Series linearization

    Just want to make sure I'm not asking the authors of this ado file a dumb question. The survey I'm analyzing uses Taylor series linearization to compute variances. I'm using the apc_ie (http://econpapers.repec.org/software...de/s456754.htm) module to crunch the data withe Stata 13.1/Windows 7. If I try to svyset my data with the weight, psu and stratum information and prefix apc_ie with svy, I get an error:

    apc_ie is not supported by svy with vce(linearized); see help svy estimation for a list of Stata estimation commands that are supported by
    svy
    r(322);
    Since the module is based on glm, there doesn't seem to be a lot of options for computing the variance (the vce option is not allowed with the svy prefix when using glm). Can anyone think of a way of incorporating the sample design information? Weights are allowed, but I can't see how to get the psu and stratum included.

  • #2
    I'm not sure I follow. You can use Taylor linearization with glm


    Code:
    . use http://www.stata-press.com/data/r13/nhanes2.dta
    Code:
    . svyset
    
          pweight: finalwgt
              VCE: linearized
      Single unit: missing
         Strata 1: strata
             SU 1: psu
            FPC 1: <zero>
    
    . glm highbp age, family(binomial)
    
    Iteration 0:   log likelihood = -6324.2046  
    Iteration 1:   log likelihood = -6319.5859  
    Iteration 2:   log likelihood = -6319.5836  
    Iteration 3:   log likelihood = -6319.5836  
    
    Generalized linear models                          No. of obs      =     10351
    Optimization     : ML                              Residual df     =     10349
                                                       Scale parameter =         1
    Deviance         =  12639.16718                    (1/df) Deviance =  1.221294
    Pearson          =  10315.89661                    (1/df) Pearson  =  .9968013
    
    Variance function: V(u) = u*(1-u)                  [Bernoulli]
    Link function    : g(u) = ln(u/(1-u))              [Logit]
    
                                                       AIC             =  1.221444
    Log likelihood   = -6319.583591                    BIC             = -83035.67
    
    ------------------------------------------------------------------------------
                 |                 OIM
          highbp |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .0472671   .0013188    35.84   0.000     .0446824    .0498519
           _cons |  -2.615888   .0693205   -37.74   0.000    -2.751754   -2.480023
    ------------------------------------------------------------------------------
    Richard T. Campbell
    Emeritus Professor of Biostatistics and Sociology
    University of Illinois at Chicago

    Comment


    • #3
      Ok. So maybe I'm misinterpreting this. The vce option is not allowed with glm. However, it seems that one still cannot svyset data and run apc_ie. At least that's what the message above seems to be saying. Any way around this?

      Comment


      • #4
        An ado programmer has to specify which of the various Stata prefix options are available to the program. I don't know enough about apc_ie to know why its authors decided not to make svy available. It does add some complexity to the program but I would think it could be done if the core of the program is gl But I guess you will have to ask the authors unless you want to attempt to modify their code, which is usually not a good idea.

        I copied the wrong output into my previous response. Here is an example of svy with glm,

        Code:
        . svyset
        
              pweight: finalwgt
                  VCE: linearized
          Single unit: missing
             Strata 1: strata
                 SU 1: psu
                FPC 1: <zero>
        
        . svy: glm highbp age, family(binomial)
        (running glm on estimation sample)
        
        Survey: Generalized linear models
        
        Number of strata   =        31                 Number of obs      =      10351
        Number of PSUs     =        62                 Population size    =  117157513
                                                       Design df          =         31
        
        ------------------------------------------------------------------------------
                     |             Linearized
              highbp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 age |   .0494915   .0015693    31.54   0.000     .0462909     .052692
               _cons |  -2.696099   .0992494   -27.16   0.000    -2.898519   -2.493678
        ------------------------------------------------------------------------------
        .
        Richard T. Campbell
        Emeritus Professor of Biostatistics and Sociology
        University of Illinois at Chicago

        Comment


        • #5
          Just to complicate matters for those interested in following this, the apc package cited here as being on SSC (and is) can't be downloaded in the usually recommended way. The problem appears to be that there is package called apc that already exists (also for estimating age-period-cohort effects, albeit differently), and associated with an article published in the Stata Journal. findit apc points to the SJ article package, not to the package cited here. Look at the following:
          Code:
           
          . ssc desc apc
            --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          package apc from http://fmwww.bc.edu/repec/bocode/a
          --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            TITLE
                'APC': module for estimating age-period-cohort effects
            DESCRIPTION/AUTHOR(S)
               
                apc is a Stata package for estimating age-period-cohort models.
                apc_cglim estimates generalized linear models in which a single
                equality  constraint on the coefficients is used to solve the
                age-period-cohort  identification problem. apc_ie estimates
                generalized linear models with age, period and cohort  effects
                using the intrinsic estimator (IE) described by Yang, Fu and Land
                 (Sociological Methodology, 2004). The IE employs a special
                principal components regression that removes the influence of
                the null (column) space of the design matrix on  the estimator.
                Both commands are implemented as wrappers for Stata's glm
                command.
               
                KW: APC
                KW: age-period-cohort models
                KW: CGLIM
                KW: intrinsic estimator
               
                Requires: Stata version 9.2
               
                Distribution-Date: 20060804
               
                Author: Sam Schulhofer-Wohl , University of Chicago
                Support: email [email protected]
               
                Author: Yang Yang, University of Chicago
                Support: email [email protected]
               
            INSTALLATION FILES                                  (type net install apc)
                apc_cglim.ado
                apc_cglim.hlp
                apc_ie.ado
                apc_ie.hlp
            ANCILLARY FILES                                     (type net get apc)
                apc_example.do
                apc_example_data.dta
          --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          (type -ssc install apc- to install)
            . findit apc
            . net install apc
          file http://www.stata-journal.com/software/sj10-4/apc.pkg not found
          server says file temporarily redirected to http://www.stata-journal.com/error/404.html
          could not load apc.pkg from http://www.stata-journal.com/software/sj10-4/
          r(601);

          Comment


          • #6
            Definitely using the package apc_ie by Schulhofer-Wohl & Yang. And I'm not into modifying other people's ado files-agree that's probably not a good idea. Just want to make sure I'm not doing anything stupid. Just kind of strange that it seemingly cannot incorporate full sample design information.

            Comment


            • #7
              Confirmed with the apc_ie author that sample design information cannot be included, at least through svyset. However, I came across this article: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4109063/ that talks about some kind of stratum adjustment in the last line of the methods section:

              "...data from each survey were assigned unique strata numbers to adjust standard errors for design effects (Korn and Graubard, 1999).

              I'm familiar with Korn and Graubard, but I can't quite visualize what the authors of this paper are doing. Can anyone explain?

              Comment


              • #8
                I'm not sure if you are unclear about the stratum issue or about how they got apc_ie to run with survey design information. With regard to strata, suppose you have two annual surveys, each of which have strata numbered 1 to 30. If you pool them and just declare the stratum number variable in the svyset you have lost the between survey design effect because, for example, stratum 1 is lodged in two different years. Instead, each stratum/year combo has to have a unique value e.g. 1 .. 60.You probably are familiar with this notion, so what must not be clear is how the authors managed to finesse apc_ie to get it to estimate survey design effects.

                You said "Confirmed with the apc_ie author that sample design information cannot be included, at least through svyset." but I don't know if that means that there is some inherent aspect of the method that rules out specifying a survey design or just that the author didn't include that functionality. I would ask the authors of the paper how they did it.
                Richard T. Campbell
                Emeritus Professor of Biostatistics and Sociology
                University of Illinois at Chicago

                Comment

                Working...
                X