Announcement

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

  • KHB Error with "too few variables"

    [ATTACH=CONFIG]n1334709[/ATTACH] Dear all,

    Hi, my name is Jae and I'm trying khb method with Stata right now.

    One problem is that my attempts are failing due to the error called "too few variables".
    I understand that the program is requiring more variables than what I already specified,
    but I really do not know what more I need to add (I've put my model(ologit), DV, IV and my MV!).
    Please see the attached image and suggest any idea you have to overcome this problem.

    I did not have this error when I tried ologit with exact same variables WITHOUT khb.

    Any words will be appreciated!

    **Total number of cases in my data is 912. Could this be a reason to this problem?

  • #2
    I found the reason. It was the problem with the pipe symbols I used. After I put in the right symbols, it kinda worked but not worked right -- since my Stata version was too old.
    I use Stata 12 and it says khb method could only work in versions above 13.1 (see attached). Can anyone confirm this? No khb allowed in ver.12?

    Comment


    • #3
      khb is supposed to work in Stata 11. I long wanted to inform Uli Kohler (the author) that there was a problem with the latest version, but I did not find the time yet. Copy the code below into a do-file and do the complete file at once to fix the problem.

      Code:
      local cwd `"`c(pwd)'"'
      findfile lkhb.mata
      mata : pathsplit(st_global("r(fn)"), path = "", name = "")
      mata : st_local("path", path)
      cd `"`path'"'
      do lkhb.mata
      cd `"`cwd'"'
      Ah, by the way. Please do review the FAQ advice on posing questions, attachments etc.

      Best
      Daniel

      Edit: Just informed Uli Kohler about the problem.
      Last edited by daniel klein; 08 Apr 2016, 04:13.

      Comment


      • #4
        Dear Daniel,
        Thank you and I will try this for sure.
        And yes, I will review FAQ advices too.
        EDIT: Dofile worked. Thank you so much.
        EDIT2: I read the FAQ and I apologize for the mistakes I made in my last 2 posts. I will not post screenshots from now on and write more carefully. Thank you for your advice.
        Last edited by Jae Park; 08 Apr 2016, 04:53.

        Comment


        • #5
          -khb- in principal can run on Stata 11, but I, personally, cannot compile the Mata part for Stata 11, because I do not have Stata 11 on my computer. What I do is to offer the Mata source code of khb which allows you to compile khb yourself. You do that by running the file -lkhb.mata- (which ships with the khb package) as a Do-file and Daniels code is a very good way to do that.

          Alternatively I could set the version marker in -khb- to version 13, but in this case Stata 11/12 users could not compile the code themselves.

          If there is a better solution, let me know.


          Uli

          Comment


          • #6
            It would be nice if Mata had some sort of saveold function. Me, I have every version of Stata from 7 on. Stata is much easier to keep old versions around than most other programs are. Having access to the help files is handy plus I can make sure that I don't unnecessarily zap my own programs when I make a change.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            Stata Version: 17.0 MP (2 processor)

            EMAIL: [email protected]
            WWW: https://www3.nd.edu/~rwilliam

            Comment


            • #7
              It would be nice if Mata had some sort of saveold function.
              In many cases it would already help to be able to determine under which version a given function was compiled. That way, we could have several versions of a library, compiled under different versions of Stata and then call the appropriate one from with the ado file.

              Best
              Daniel

              Comment

              Working...
              X