Announcement

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

  • Regression Coefficients - Maximum Decimals ?

    Hi everyone,

    I was wondering whether anyone knows what's the maximum number of coefficients' decimals Stata can compute and (store) from the OLS regressions?

    Specifically, after the regression, I need to extract the coefficients for other purposes (see code below as an example). Currently, the coefficients are up to 17 decimals in e(b). However, I'd like to have the coefficients as many as 64 decimals, if possible.

    Code:
        reg OccChoice ibn.MajorCategory OtherControls if OccChoiceSet == 1, noc robust 
        matrix list e(b)
        matrix b=e(b)'
        svmat double b, n(beta_1)
    I've tried to
    set type double, permanently
    , and it didn't help. set cformat [fmt] does not allow me to do something like
    set cformat %64.64g
    .

    Any background knowledge, ideas, and suggestions are highly appreciated! Thank you very much for your time and help!

    Best,
    Xiao



  • #2
    No, it is not possible. Stata's calculations are carried out using double-precision floating point numbers (8 bytes). With that amount of information, you can only have 16 significant figure accuracy in decimal notation. So, unless your coefficients are down in the range of 10-48 or smaller magnitude you cannot get 64 decimal places. If they are that small and you are trying to see the 49th to 64th decimal places after the 48 zeroes, then the solution is to rescale your outcome variable.

    And let me ask you, if it were possible to get calculations to 64 places, do you seriously think that either your model or your data itself are sufficiently accurate to make that meaningful? Read -help precision- to get a good sense of just how unrealistic that is. Even with just single-precision (float) numbers you have more accuracy than is needed for almost anything in the real world.

    Comment


    • #3
      Following up on Clyde's response, if it is indeed the case that you have values with lots of zeroes just to the right of the decimal point before getting to the non-zero digits, then if scaling doesn't work, try using scientific notation with an "exponential" format. (See the output of help format for details.)
      Code:
      . clear
      
      . set obs 1
      number of observations (_N) was 0, now 1
      
      . generate double x0 = 1/3
      
      . format x0 %25.18f 
      
      . generate double x2 = x0
      
      . format x2 %25.15e
      
      . generate double x3 = 1/30000000000000000000000000000000000
      
      . format x3 %25.15e
      
      . list, noobs
      
        +----------------------------------------------------------------------+
        |                   x0                      x2                      x3 |
        |----------------------------------------------------------------------|
        | 0.333333333333333315   3.333333333333333e-01   3.333333333333333e-35 |
        +----------------------------------------------------------------------+

      Comment


      • #4
        Thank you, both, for your prompt responses! I really appreciate it.

        For clarification (as a brief background):

        1. My dependent variable is an occupational choice (0, 1): e.g. if an individual's occupation = economist, choice ==1; otherwise 0.
        2. My independent variables are college major dummies, where the coefficients are of interest.
        3. The coefficients are used to construct a transition matrix which then is used as weights in a network structure. Note, the purpose of the regressions is not to infer causality.
        4. The decimals of the coefficients are important for the convergence rate that I am particularly struggling with. (FYI: the coefficients do not contain many zeros: e.g. 0.0027732675929)

        So it seems Stata regression cannot achieve such a purpose. Do any of you have experience and/or recommendation of other statistical packages that may help? Or any other advice?

        Thanks again for sharing your wisdom.

        Best,
        Xiao

        Comment

        Working...
        X