Announcement

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

  • Help to identify the difference

    input double count_ipd float(postpcv hic age15more) double(midyrpopn_ipd midyrpopn_ipdv) float st1
    2 1 0 0 28340 63536.88685493469 1
    . 0 0 0 . 48521.11314506531 1
    3 0 0 1 104137.0234375 63536.88685493469 1
    1 1 0 1 104137.0234375 48521.11314506531 1
    . 0 0 0 537071 63536.88685493469 1
    40 0 0 0 . 48521.11314506531 1
    9 0 0 0 . 63536.88685493469 1
    0 1 0 1 436567.28125 48521.11314506531 1
    63 1 0 0 3163531.076923077 63536.88685493469 1
    4 0 0 0 . 48521.11314506531 1
    2 1 0 0 5709087 63536.88685493469 1
    7 1 0 0 5730941 48521.11314506531 1
    6 1 1 0 56367 63536.88685493469 1
    39 1 0 0 5724636 48521.11314506531 1
    65 1 0 0 5490081 63536.88685493469 1
    1 1 0 0 302738 48521.11314506531 1
    74 0 1 0 9657827 63536.88685493469 1
    46 1 1 0 1024835 48521.11314506531 1
    6 1 1 0 56367 63536.88685493469 1
    5 0 0 0 146876 48521.11314506531 1
    13 0 0 0 . 63536.88685493469 1
    44 0 0 0 . 48521.11314506531 1
    3 0 0 0 . 63536.88685493469 1
    0 1 1 0 2098959 48521.11314506531 1
    3 1 1 0 9216875 63536.88685493469 1
    2 1 1 0 287383 48521.11314506531 1
    0 1 1 0 2097436 63536.88685493469 1
    530 1 1 0 8249981 48521.11314506531 1
    2 0 0 0 . 63536.88685493469 1
    47 1 0 0 5690495 48521.11314506531 1
    0 1 1 0 1241868.875 63536.88685493469 1
    1 1 0 0 28533.1796875 48521.11314506531 1
    8 0 0 0 5694000 63536.88685493469 1
    0 1 0 1 122456.6848564458 48521.11314506531 1
    2 1 0 0 49069.80078125 63536.88685493469 1
    4 0 0 0 49069.80078125 48521.11314506531 1
    4 1 0 0 790882.75 63536.88685493469 1
    93 0 0 0 377379 48521.11314506531 1
    13 0 0 0 . 63536.88685493469 1
    120 0 0 0 . 48521.11314506531 1
    0 1 1 0 2101390 63536.88685493469 1
    45 1 0 0 790882.75 48521.11314506531 1
    123 1 0 0 54369436 63536.88685493469 1
    0 1 0 0 43214.20273972602 48521.11314506531 1
    207 0 0 0 240000 63536.88685493469 1
    11 1 0 0 149040 48521.11314506531 1
    9 1 0 0 228565.109375 63536.88685493469 1
    6 0 0 0 44820 48521.11314506531 1
    42 0 0 0 . 63536.88685493469 1
    3 1 0 0 80503.23770491804 48521.11314506531 1
    0 1 0 0 28751.5 63536.88685493469 1
    0 1 0 0 42048.96721311475 48521.11314506531 1
    0 1 1 0 7549384 63536.88685493469 1
    . 0 0 0 . 48521.11314506531 1
    1 1 0 1 165423 63536.88685493469 1
    2 1 0 0 22708 48521.11314506531 1
    . 0 0 0 9800000 63536.88685493469 1
    1 0 0 0 75004 48521.11314506531 1
    2 1 1 0 53945855 63536.88685493469 1
    47 0 0 0 . 48521.11314506531 1
    0 1 1 0 549679.6875 63536.88685493469 1
    0 1 1 0 5618530 48521.11314506531 1
    9 0 0 0 41985 63536.88685493469 1
    39.0944 0 1 0 1563776 48521.11314506531 1
    15 0 0 0 181740 63536.88685493469 1
    4 0 0 1 99961.36986301371 48521.11314506531 1
    2 1 0 0 228565.109375 63536.88685493469 1
    0 1 0 0 40730.05464480874 48521.11314506531 1
    1 0 1 0 1243969 63536.88685493469 1
    . 0 0 0 . 48521.11314506531 1
    2 0 0 0 550297 63536.88685493469 1
    0 1 0 0 28533.1796875 48521.11314506531 1
    48 1 0 0 55203738 63536.88685493469 1
    24 1 1 1 8002335.5 48521.11314506531 1
    4 1 0 0 11042297 63536.88685493469 1
    2 0 0 0 . 48521.11314506531 1
    474 1 0 0 50337363 63536.88685493469 1
    32 1 1 0 9711572 48521.11314506531 1
    52 0 0 0 . 63536.88685493469 1
    4 1 0 0 90303 48521.11314506531 1
    1 1 0 1 145710 63536.88685493469 1
    207 0 0 0 240000 48521.11314506531 1
    5 0 0 0 46343 63536.88685493469 1
    99 1 0 0 9431487 48521.11314506531 1
    8 0 0 0 209647.9342465753 63536.88685493469 1
    3 1 0 0 181740 48521.11314506531 1
    . 0 0 0 9800000 63536.88685493469 1
    221 1 0 1 37272680 48521.11314506531 1
    0 1 1 0 2131247 63536.88685493469 1
    26 1 1 0 1104894 48521.11314506531 1
    77 1 0 0 9461123 63536.88685493469 1
    1 1 0 0 5614841 48521.11314506531 1
    48 1 1 0 445498.96875 63536.88685493469 1
    27 0 0 0 220855 48521.11314506531 1
    0 1 1 0 533673.4375 63536.88685493469 1
    1 1 0 0 49069.80078125 48521.11314506531 1
    103 1 1 1 7667467.5 63536.88685493469 1
    55 0 1 1 6493823.5 48521.11314506531 1
    17 0 1 0 955934.1875 63536.88685493469 1
    5 1 1 0 7973616 48521.11314506531 1
    end
    [/CODE]
    ------------------ copy up to and including the previous line ------------------

    Listed 100 out of 265 observations
    Use the count() option to list more
    Dear team attached is a data am trying to run betabin command on.PLease may someone tell why the code is running when I use the command ; betabin count_ipd postpcv hic age15more, n(midyrpopn_ipd) link(cloglog), if st1==1 i.e I use midyrpopn_ipd for n but fails when I use the command; betabin count_ipd postpcv hic age15more, n(midyrpopn_ipdv) link(cloglog), if st1==1 i.e use midyrpopn_ipdv as n.
    the error when I use midyrpopn_ipdv states that: N() must be a positive integer expression that is >= the outcome. midyrpopn_ipdv satisfies all the conditions except being a non-integer just like midyrpopn_ipd does so I don't understand

  • #2
    Realy requesting for advice on this

    Comment


    • #3
      Originally posted by Fredrick orwa View Post
      may someone tell why the code is running when I use . . . midyrpopn_ipd for n but fails when I use . . . midyrpopn_ipdv as n.
      . . . midyrpopn_ipdv satisfies all the conditions except being a non-integer just like midyrpopn_ipd does
      It's a bug in the user-written program.

      There is a section in betabin that tries to trap nonintegers etc. in the binomial denominator variable.
      Code:
              tempvar nvar
              gen `nvar' = `n'
              if floor(`nvar') != `nvar' | `nvar' < `dep' | `nvar' <= 0 {
                  noi di as err "N() must be a positive integer expression that is >= the outcome"
                  exit 199
              }
      But that use of if will test only the first observation. In the first observation, midyrpopn_ipd happens to be an integer and alas midyrpopn_ipdv (which, by the way, has only two distinct values) is not.

      Why do your n() variables have fractions, anyway?

      Comment


      • #4
        Thanks so much Joseph this is very clear for me now. We are trying to do some analysis where if the count of disease in the whole population is zero leading to zero proportion we use betabin to predict proportions and replace cases of zero with the prediction. So our n is population estimate(mid_year population) by sex since we are looking for the proportion of disease by sex.We used some proportion to estimate population by sex which led to the decimals. I think I should roundoff midyear population estimate then.

        Comment


        • #5
          Originally posted by Fredrick orwa View Post
          I think I should roundoff midyear population estimate then.
          Yeah.

          I also urge you to
          Code:
          set type double
          before using this estimation command. The reason? Look at the code quoted above. It makes a copy of your n() variable for use in all further calculations and computations. And it makes it (like a lot of Stata users do without thinking) a float, i.e, a single-precision floating-point variable.

          According to the help file for precision, "Integer values, however, can be stored exactly, at least up to 16,777,215 in the case of float precision."

          Now, take a look at your midyrpopn_ipd.
          Code:
          summarize midyrpopn_ipd
          display r(max)
          reveals that its maximum value is 55,203,738, which exceeds the limit of precision for float. Without
          Code:
          set type double
          beforehand, you're begging for trouble.

          I know others disagree, but in my opinion all Stata users ought to
          Code:
          set type double, permanently
          immediately after installing the software. I doubt that there's a fortnight that goes by without someone on the list who's flummoxed by some screwy result because Stata insists on remaining the last holdout among contemporary statistical and data-management software products to use single-precision floating point as the default. /Soapbox

          Comment


          • #6
            Wah I did not know this.Thi means have done alot of mistakes in previous analyses

            Comment

            Working...
            X