Announcement

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

  • class member function not found - error when producing graph

    Using Stata 13, trying to run a graph of predicted probabilities after an ordered probit with a heckman correction (heckoprobit)

    I ran the predicted probabilities successfully using:
    predict xbheckoprobit...which returns the following comment: (option pmargin assumed; predicted marginal probability)

    I followed this up with the following comments to attempt to create the graph:
    graph xbheckoprobit pmargin x1, ylab xlab yline(0,1,2)...this returns:

    'xbheckoprobitgraph_g.new pmargin x1, ylab xlab yline(0,1,2): class member function not found'

    No idea how to address this problem as looking at the notes on class got my head spinning. Any idea how to address this problem?

    Thank you in advance for your help.

  • #2
    graph SOMETYPEOFGRAPHHERE ....

    xbheckoprobit is not a graph. Perhaps you mean scatter, line, bar, or something else.

    Check your notes again.

    Comment


    • #3
      The error message admittedly doesn't tell what's really happening, but what you typed is some graph syntax for Stata 7 [NB!] and earlier. Stata is trying to interpret your syntax as referring to current graph syntax by looking at the second item typed.

      You can use the old syntax if you like by merely changing graph to graph7, but my wild guess is that you are referring to some old book or paper for guidance, which is here leading you astray.

      Code:
       
      scatter xbheckoprobit pmargin x1, yline(0 1 2)
      would be a translation (as best as I can recall across 6 Stata versions) of what you typed to current syntax.

      Comment


      • #4
        thanks for your reply. Thanks, I understand that xbheckoprobit is not a type of graph. I checked the notes I found online (psfaculty.ucdavis.edu/bsjjones/logitprobit.doc), and the notes I am reading from are at the top of page 7 of the link I have included.

        The author uses gr xbprobit, so I rationally figured I would replace this with xbheckoprobit...evidently this was wrong. Essentially I want to produce a similar graph to the one below the commands at the top of page 7
        Last edited by chris lalley; 28 Feb 2015, 09:53.

        Comment


        • #5
          From your post it seems, as I guessed, that you are using as role model a document which is several versions out of date in terms of graph syntax. You need a more up-to-date role model or to learn the basic modern syntax you need.

          Please note also advice in the FAQ Advice about referring to MS Word or Excel files. Many members here cannot or will not read them.
          Last edited by Nick Cox; 28 Feb 2015, 10:52.

          Comment


          • #6
            Originally posted by Nick Cox View Post
            The error message admittedly doesn't tell what's really happening, but what you typed is some graph syntax for Stata 7 [NB!] and earlier. Stata is trying to interpret your syntax as referring to current graph syntax by looking at the second item typed.

            You can use the old syntax if you like by merely changing graph to graph7, but my wild guess is that you are referring to some old book or paper for guidance, which is here leading you astray.

            Code:
            scatter xbheckoprobit pmargin x1, yline(0 1 2)
            would be a translation (as best as I can recall across 6 Stata versions) of what you typed to current syntax.
            Thanks for your help nick. I tried running the code you sent an managed to produce a graph. but it doesn't resemble the sigmoid curve I am attempting to produce, similar to the one I include in the link in my previous post. The syntax you sent only allows me to plot on the Y and lower X axis. Is there a way to include an additional variable on the upper Y axis (for lack of a better word)? This was the reason for the inclusion of the 'ylab xlab yline' component of the original syntax I used.

            Comment


            • #7
              yline(0 1 2) in fact worked similarly in Stata 7 to how it works in Stata 13 and did not and does not connect data points. The option call draws horizontal lines at y = 0, 1, 2.

              My advice remains what it was. Expecting people to translate ancient graph syntax has a low probability of success as

              1. Most users here started using Stata long after Stata 7.

              2. The exceptions have mostly forgotten what they used a decade or more ago.

              3. The problem seems self-inflicted.

              but as a one-off wild guess you may need something like

              Code:
               
              scatter xbheckoprobit x1 || mspline margin x1

              Comment


              • #8
                thanks again for your assistance. I appreciate the difficulty in being able to comment on antiquated code, though regrettably this was as good as I could find at this time, having attempted to source more modern examples. Apologies for posting the link. I will continue to look for more modern examples of code, but in the meantime if anyone can assist me in replicating the diagram below then that would be greatly appreciated

                Click image for larger version

Name:	Sigmoid Curve1.jpg
Views:	1
Size:	25.5 KB
ID:	931320

                Comment


                • #9
                  But I think you already have all the hints you need. The data at y = 0, 1 can be plotted with scatter; the points defining the prediction with mspline and the horizontal lines with a yli() call. Five minutes looking at the help for graph in Stata 13 will get you further than outdated code. Or use graph7 not graph.

                  Comment

                  Working...
                  X