Announcement

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

  • bounced from running a legit with higher order & interaction terms by r(452)

    I am running a legit with squared & interaction terms that I've added to my original model which did not have anyany error, but now when I attempt to run this:
    . logit completr1dum ibn.zip ibn.fedcode ibn.gender ibn.econ agemon2 stla16 ftla17 ferncesch ferncenat fswrdsncesch fswrdsncenat fw
    > segncesch fwsegncenat fsentncesch fsentncenat fnonsncesch fnonsncenat c.stla16#c.stla16 c.ftla17#c.ftla17 c.stla16#ibn.zip c.fsen
    > tncenat#ibn.zip c.fsentncesch#ibn.zip ferncesch#ibn.fedcode fswrdsncesch#ibn.fedcode fwsegncesch#ibn.fedcode fwsegncenat#ibn.fedc
    > ode fsentncesch#ibn.fedcode c.stla16#ibn.gender fwsegncesch#ibn.gender fsentncesch#ibn.gender c.stla16#ibn.econ c.fwsegncenat#ibn
    > .econ c.ftla17#c.agemon2 c.ferncesch#c.agemon2 c.fswrdsncesch#c.agemon2 c.fsentncesch#c.agemon
    fswrdsncesch: factor variables may not contain noninteger values
    r(452);

    but my variable, fswrdsncesch does not have any nonifnteger values. It is a NCE score, all positive. I had no problems when I ran the original model. The is the variables beginning with completr1dum and ending with fnonsncenat. I've added the higher order and interaction terms begining with c.stla16#stla16. I am trying to identify a model to generate propensity scores

    What can I do?

  • #2
    Jack:
    usually query posed in this way are unlike to receive helpful replies.
    We do not know your data and what we read is a long and difficult to follow Stata code with an error at its end.
    You would help other helping yourself by posting what you typed (as you did but not between CODE delimiters) and what Stata gave you back, both via CODE delimiters, please.
    In the meantime: have you imported -fswrdsncesch- from, say, a spreadsheet?
    Kind regards,
    Carlo
    (Stata 15.1 SE)

    Comment


    • #3
      Following Carlo's excellent advice, which is similar to what Nick Cox advised on your previous topic, you should take the time to review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question. The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

      With that said, you assert without any demonstration to support it that fswrdsncesch contains only integer values. I suggest you show us the results of running
      Code:
      codebook fswrdsncesch
      You will note that the output includes "units" which is Stata's best guess at the granularity of your variable. I hazard a guess that the result for your variable will be something fractional. As Carlo suggests, depending on how your data was imported, it's possible that what was represented to the viewer as an integer in Excel was actually a rounded representation of a non-integer. For that matter, the same could be true in Stata, if the format for fswrdsncesch is something like %9.0f.

      Comment


      • #4
        I should note that I m using Stata 12.1 SE. I've used such squared and interaction terms previously in both logit, probit, and pscore and psmatch. And with these same variables. I created all the NCE scores from percentiles in the assessment files I used to create my work files:

        . use "/Users/johnwillis/Documents/jstatdata/2016-17 Projects-statdata/reading/rr study/main rr analysis/updated 2017data dump rewo
        > rked2 common zips.dta"

        . describe

        Contains data from /Users/johnwillis/Documents/jstatdata/2016-17 Projects-statdata/reading/rr study/main rr analysis/updated 2017da
        > ta dump reworked2 common zips.dta
        obs: 5,715
        vars: 113 14 Nov 2017 09:37
        size: 3,823,335
        -----------------------------------------------------------------------------------------------------------------------------------
        storage display value
        variable name type format label variable label
        -----------------------------------------------------------------------------------------------------------------------------------
        cid long %12.0g
        rr17treat byte %8.0g
        rr17sch byte %8.0g
        lastname str20 %20s
        firstname str19 %19s
        schcode int %8.0g
        schname str36 %36s
        hroom str10 %10s
        rr17teacher str13 %13s
        rr17excepted str1 %1s
        rr17disability str30 %30s
        rr17round byte %10.0g
        rr17dispo byte %10.0g
        rr17discon byte %10.0g
        rr17numbweeks byte %10.0g
        rr17numblessons int %10.0g
        fgrlevel str1 %1s
        ftla17 byte %10.0g
        f17tlamerge str1 %1s
        wgrlevel17 byte %8.0g
        wschcode17 int %8.0g
        wschname17 str36 %36s
        whroom17 str10 %10s
        wtlaletter17 str5 %5s
        wtlascore17 byte %8.0g
        wtla17 byte %8.0g
        w17tlamerge byte %8.0g
        s16lname str15 %15s
        s16fname str15 %15s
        s16schcode int %8.0g
        s16schname str49 %49s
        s16hroom str8 %8s
        s15grlevel byte %8.0g
        stla16 byte %8.0g
        ks16merge byte %8.0g
        Assessment str5 %5s
        ferfname str19 %19s
        ferlname str21 %21s
        fercomposite int %8.0g
        fer_ilesch byte %8.0g
        fer_ilenat byte %8.0g
        ferncesch byte %8.0g
        ferncenat byte %8.0g
        ferrisklev str9 %9s
        fletso_ilesch byte %8.0g
        fletso_ilenat byte %8.0g
        fletsorisklev str9 %9s
        fnons_ilesch byte %8.0g
        fnons_ilenat byte %8.0g
        fnonsrisklev str9 %9s
        fsent_ilesch byte %8.0g
        fsent_ilenat byte %8.0g
        fsentrisklev str9 %9s
        fswrds_ilesch byte %8.0g
        fswrds_ilenat byte %8.0g
        fswrdsrisklev str9 %9s
        fwseg_ilesch byte %8.0g
        fwseg_ilenat byte %8.0g
        fwsegrisklev str9 %9s
        meno int %8.0g
        gr byte %8.0g
        ereadfallmerge byte %8.0g
        wcbmr_ilesch byte %8.0g
        wcbmr_ilenat byte %8.0g
        wcbmrrisklev str9 %9s
        wcbmrmerge byte %8.0g
        meno2 int %8.0g
        stno int %8.0g
        grdyr byte %8.0g
        lname str21 %21s
        fname str19 %19s
        mname str25 %25s
        dob long %tdD_m_Y
        race str1 %1s
        ed byte %8.0g
        sped byte %8.0g
        po byte %8.0g
        ell byte %8.0g
        lep byte %8.0g
        lep2 byte %8.0g
        nelb1 byte %8.0g
        nelb2 byte %8.0g
        homePrimaryLa~e str30 %30s
        country str20 %20s
        zip long %12.0g
        actmerge byte %8.0g
        fedcode byte %8.0g
        demomerge byte %8.0g
        wcbmrncesch float %9.0g
        wcbmrncenat float %9.0g
        fwsegncesch float %9.0g
        fwsegncenat float %9.0g
        fswrdsncenat float %9.0g
        fswrdsncesch float %9.0g
        fsentncesch float %9.0g
        fsentncenat float %9.0g
        fnonsncenat float %9.0g
        fnonsncesch float %9.0g
        fletsoncesch float %9.0g
        fletsoncenat float %9.0g
        agemon float %9.0g
        racenum float %9.0g
        sex str1 %1s
        edstart str10 %10s
        edend str10 %10s
        EDmerge byte %23.0g _merge
        gender float %9.0g
        econ float %9.0g
        lastmerge byte %23.0g _merge
        agemon2 float %9.0g
        completdum float %9.0g
        discondum float %9.0g
        completr1dum float %9.0g
        -----------------------------------------------------------------------------------------------------------------------------------
        Sorted by: zip

        Comment


        • #5
          And here's a tab1 of the variable:
          . tab1 fsentncenat

          -> tabulation of fsentncenat

          fsentncenat | Freq. Percent Cum.
          ------------+-----------------------------------
          1 | 558 10.14 10.14
          10.4 | 152 2.76 12.90
          17.3 | 144 2.62 15.52
          20.4 | 140 2.54 18.06
          24.2 | 141 2.56 20.62
          27.2 | 140 2.54 23.16
          30.7 | 156 2.83 26.00
          33.7 | 183 3.32 29.32
          36.5 | 210 3.82 33.14
          39 | 169 3.07 36.21
          41.3 | 191 3.47 39.68
          43 | 185 3.36 43.04
          45.2 | 165 3.00 46.04
          46.8 | 143 2.60 48.64
          48.4 | 148 2.69 51.33
          49.5 | 131 2.38 53.71
          51.1 | 88 1.60 55.31
          52.1 | 86 1.56 56.87
          52.6 | 68 1.24 58.10
          53.7 | 64 1.16 59.27
          54.8 | 62 1.13 60.39
          55.3 | 54 0.98 61.37
          55.9 | 63 1.14 62.52
          57 | 65 1.18 63.70
          57.5 | 47 0.85 64.55
          58.1 | 58 1.05 65.61
          58.7 | 42 0.76 66.37
          59.3 | 40 0.73 67.10
          59.9 | 70 1.27 68.37
          60.4 | 30 0.55 68.91
          61 | 29 0.53 69.44
          61.7 | 44 0.80 70.24
          62.3 | 59 1.07 71.31
          62.9 | 38 0.69 72.00
          63.5 | 71 1.29 73.29
          64.2 | 35 0.64 73.93
          64.9 | 36 0.65 74.58
          65.6 | 69 1.25 75.84
          66.3 | 36 0.65 76.49
          67 | 45 0.82 77.31
          67.7 | 44 0.80 78.11
          68.5 | 49 0.89 79.00
          69.3 | 53 0.96 79.96
          70.1 | 53 0.96 80.92
          70.9 | 32 0.58 81.50
          71.8 | 52 0.94 82.45
          72.8 | 54 0.98 83.43
          73.7 | 63 1.14 84.57
          74.7 | 28 0.51 85.08
          75.8 | 54 0.98 86.06
          77 | 65 1.18 87.25
          78.2 | 45 0.82 88.06
          79.6 | 25 0.45 88.52
          81.1 | 76 1.38 89.90
          82.7 | 38 0.69 90.59
          84.6 | 28 0.51 91.10
          86.9 | 98 1.78 92.88
          89.6 | 60 1.09 93.97
          93.3 | 23 0.42 94.39
          99 | 309 5.61 100.00
          ------------+-----------------------------------
          Total | 5,504 100.00

          Comment


          • #6
            Thanks for all your replies. Never run into anything like this before

            Comment


            • #7
              Are we to interpret what you posted as confirmation that fsentncenat contains noninteger values in the dataset to which your logit command was applied? And that your problem is now resolved? It's not at all clear what you mean when you conclude "Never run into anything like this before" - are you suggesting there remains an unexplained problem, or are you commenting on your disbelief when Stata having told you precisely what was wrong with your data?

              Do please take the time to review the Statalist FAQ.

              Comment


              • #8
                As others have said, code tags would make your output much easier to read. See pt 12 of the faq.

                i think you are confusing noninteger with nonnegative. It looks to me like your variable has many noninteger values, e.g. 10.4, 17.3, etc.
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                Stata Version: 15MP (2 processor)

                EMAIL: rwilliam@ND.Edu
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Richard and all. Ah. That may be it. When decimals are combined with a factorial such as zip codes or the federal codes for race and ethnicity it may create many more categories. the help to r(452): "You specified a variable that does not meet the factor-variable restrictions. Factor variables are assumed to take on only nonnegative integer values." I was led by the no negative numbers rather than thinking thru the integer and the decimals in the ice scores. thanks

                  Comment

                  Working...
                  X