Announcement

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

  • A note on anovaplot (and anova)

    The last version of Nick Cox's -anovaplot- command dates back to 2004. With the introduction of factor notation in Stata 11 (July 2009) and changes to the anova syntax, some examples in the anovaplot help file require version control or appropriate modification; otherwise the graphs it generates may be misleading.
    In Stata 11 and newer versions, the options category(), class(), and continuous() are no longer used in anova command, and you should use c.varname to indicate continuous. Check the difference:
    Code:
    sysuse auto
    decode foreign, gen(Foreign)
    gen F = substr(Foreign,1,1)
    
    version 10: anova price weight foreign, cont(weight)
    anovaplot, scatter(ms(i) mla(F) mlabpos(0))
    
    version 11: anova price c.weight foreign
    anovaplot, scatter(ms(i) mla(F) mlabpos(0))
    
    version 11: anova price weight foreign
    anovaplot, scatter(ms(i) mla(F) mlabpos(0))

  • #2
    Chen Samulsion Thanks for your interest in this command, but it's not correct that the latest version of anovaplot goes back to 2004.

    I think this error arises because you're assuming that the latest versions of community-contributed commands (or at least those I write) are always to be found on SSC. I am not that systematic, although I try to document where my stuff is, within the njc_stuff package (which is on SSC). Recently I discovered a package on SSC I had forgotten about....

    In general search is your friend to find where command files are lurking. The latest version of the modeldiag package was published through the Stata Journal in 2023.

    More important is whether the command is in any case out of date given changes in anova syntax. You may be right on that and I will look at the matter soon.

    Although the modeldiag package contains some commands I use often and think well of, that doesn't really include anovaplot. I never now apply anova directly without changing my mind and using regress instead. That's because I never use the method in a form that doesn't lend itself to the switch.

    I encourage you to write your own command to do what you prefer to see.

    Comment


    • #3
      I do know some packages distributed by and only by SJ. That's why I am a bit disappointed of Stata not to 'buy' SSC. (They can do whatever they like, I don't care.) I point something need to be handled, not only for me, but for all (that may be interested in this). As to the author, if they are not interested, We will write our own command, there is no doubt about that.

      Comment


      • #4
        You seem puzzled that I make my own decisions about my work (and my time and effort), which is unfortunate.

        Your remarks on SSC are simply bizarre, but perhaps those who weren't active in Stata when it was set up don't know the history and/or need an explanation. SSC was set up as a convenience for authors to post their code files easily and simply. Posting there was always a choice to be made freely. In fact long ago StataCorp's guess was that authors would prefer the total control of posting Stata packages on their own websites, and it was a surprise to many that Kit Baum's proposal became popular. Some users still do post independently. and some now prefer an arrangement like that GitHub provides. SSC was always (and so far as I can imagine, will foreseeably be) essentially independent of StataCorp and the Stata Journal. There is no question of StataCorp taking it over, any more than any other comparable language or software wants to take charge of all the community-contributed commands in its domain. What is unusual, but seems to have worked quite well, is that StataCorp itself supports a convenience command ssc to make use of what is there. The ssc command as itself originally community-contributed), but that is, I guess, where the matter both begins and ends.

        Comment


        • #5
          The last few sentences got slightly mangled. Sorry about that.

          Replacement text:

          What is unusual, but seems to have worked quite well, is that StataCorp itself supports a convenience command ssc to make use of what is there. The ssc command was itself originally community-contributed. But that is, I guess, where the matter both begins and ends.

          Comment


          • #6
            Going back to #2: I promised to look at the most recent version of anovaplot, which as explained was published in 2023.

            The help file carries this signal:

            Examples here use syntax introduced for anova in Stata 11. If you are using an earlier Stata, details may differ for
            your version.
            so my stance is that trying to combine syntax from Stata 10 or earlier with this command is the user's responsibility.

            I've not heard or seen anyone disappointed or inconvenienced by that.

            Chen's stance in #1 appears to be the reverse: that the version written in 2004 didn't foresee or couldn't support anova syntax introduced later, which is correct, but already dealt with my updates in 2023 (or indeed earlier in 2010).

            Comment


            • #7
              Thanks, Chen and Nick. I tried the three examples with the 2023 release. The cont(weight) and c.weight specifications gave identical plots. With c. omitted, anova treated the distinct weights as factor levels, and the model degrees of freedom rose from 2 to 64.

              For anyone adapting older examples, use c. before a covariate you intend to model as continuous. In this example, foreign is a factor and weight is a continuous covariate.
              Click image for larger version

Name:	anovaplot_v11_category.png
Views:	1
Size:	105.4 KB
ID:	1788221
              Click image for larger version

Name:	anovaplot_v11_cont.png
Views:	1
Size:	79.2 KB
ID:	1788222

              Code:
              sysuse auto, clear
              anova price c.weight i.foreign
              anovaplot
              If your installed help or output differs, which anovaplot shows which copy Stata runs. search anovaplot helps locate the Stata Journal release.

              Stata anova manual | 2023 Stata Journal software update

              Comment


              • #8
                I don't think #7 contradicts anything I have said. The fact that the first graph in #7 looks a mess isn't an indictment of anovaplot. It doesn't make either scientific or statistical sense to treat weight as categorical.

                Comment

                Working...
                X