Announcement

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

  • Error: factors variables not allowed with cmp command (Stata 12)

    Hi,

    I tried to use the cmp command for 3 equations: the first one is a linear regression of loan granted amount, the second is the Heckman selection equation with "Octroi" being the dummy variable to be selected, and the third one is a linear regression of loan requested amount, as it must be endogenous for the two other equations.

    Here is the command:
    cmp (montantacc=Genre montantdem besoin superficie age EDUC taillemen Inactif proprietaire Creation Cofinancement Investissement Relance Campagricole Apport clientmen actifmen Autrecred Garantiesalaire depenses revenutotal nbemployes nbemployessaison genreagent ageagent EDUCagent nbcreditparan expeagent i.gouv || Branch (selectvar Octroi= Genre montantdem besoin age EDUC taillemen Divorced Widowed Married Inactif proprietaire i.gouv Agri Prod Commerce Services Creation Cofinancement Educlogement Investissement Relance Campagricole Apport clientmen actifmen Autrecred genreagent ageagent EDUCagent nbcreditparan expeagent) (montantdem=Genre Montantdem13 besoin age EDUC taillemen Single Divorced Widowed Married Inactif proprietaire Agri Prod Commerce Services Conditionsdevie Creation Cofinancement Educlogement Investissement Relance Campagricole Apport clientmen actifmen Autrecred || Branch, ind(selectvar*$cmp_cont $cmp_cont)

    I have an error message:
    factor variables not allowed
    r(101);

    Is this a syntax issue ? of course I have both factor and continuous variables in the equations. Maybe it's the last part of the command which is not correctly specified ?
    It's my first time with cmp.

    Thank you !



  • #2
    cmp (SJ, SSC, as you are asked to explain) is written for version 10. Factor variables were introduced in version 11.

    David Roodman, the author, tends to catch questions on it here. He will be able to comment. Meanwhile I imagine that using xi: would work.

    Comment


    • #3
      Expanding on Nick's comment, David Roodman updates -cmp- frequently. In fact, although much of its code is version-controlled back to 10, currently -cmp- does support factor variables. Perhaps you don't have the latest version of cmp, which is 6.9.5 (29 November 2015). If that's not what you have, run -adoupdate cmp, update-.

      Comment


      • #4
        Clyde: Well spotted.

        Comment


        • #5
          Ok, I checked and my version of cmp is updated. I tried with xi: at the very beginning (before cmp) and I have another error message this time: "| invalid name" (error 198). The only " | " sign I have is the double " ||" for random effects. Do you see any syntax error in the command I wrote above ? especially, is the last part (after "ind") is correct ?

          Thank you very much for your help !

          Comment


          • #6
            Well, it looks to me like the first equation (montantacc=... never gets a closed parenthesis. Neither does the last one, (montantdem=... Those would be problems. For example, the first occurrence of | occurs just after i.gouv, where I would expect the first closed parenthesis to be. The parser not finding the closed parenthesis might think it is still reading variables in the montantacc equation, and, of course | is not a valid character in a variable name. So I think the unbalanced parentheses probably account for your problem.

            Also, in your post, the name Branch is always followed by a smiley-face. When I copy it into a text editor it shows up as some kind of non-printing character. I don't know what it is; it may or may not be a problem. I would start by getting all the parentheses balanced and see if that solves the problem.

            I would not use xi:--it's just complicating matters by creating new variable names that are potentially problems themselves here. With the current version of -cmp-, you definitely have support for factor variables. If you are getting an error message about factor variables not being allowed, it is because something in the command is confusing the parser and it is finding what looks to it like a factor variable in a part of the command where they shouldn't be. Again, unbalanced parentheses could be responsible for a problem like that.

            Comment


            • #7
              Hi again, actually I found the problem: I corrected the syntax, but the problem is that I use Stata 12, and the cmp command on Stata 12 does not seem to support hierarchical models. However I only have access to Stata 12. Is there any way to solve this problem ? another command to estimate system of multiple equations with hierarchical model maybe ?

              Comment


              • #8
                "does not seem to support hierarchical models": evidence please.

                Comment


                • #9
                  Hi again, I finally found the technical problem, it was an old version of cmp which did not recognize " ||" but I managed to update it and now it works.

                  Comment

                  Working...
                  X