Announcement

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

  • #31
    With which version of violinplot are you working? With your dataset and the code it works smoothly with version 1.1.2 from March 2023.
    Anyway, in your data example paddy is always 0... even changing paddy in the last 50 cases to 1 does not make a difference...

    Comment


    • #32
      Hi Marc. I have the latest version 1.1.5. installed. And the variable paddy is 0 only in the example dataset as the actual dataset has about 27000 observations. A tabulation of paddy:
      paddy Freq. Percent Cum.
      0 12,834 47.54 47.54
      1 14,161 52.46 100.00
      Total 26,995 100.00

      Comment


      • #33
        Thank you for your inputs Nick Cox, I also tried the stripplots. But for this case, the kind of representation provided by the violin plots is what I need. Not only for values itself but also because of the distribution and shape of the density plots. I would like to have suggestions from Ben Jann before trying something else.
        Thank you very much for your helpful inputs!

        Comment


        • #34
          #33 Thanks for the thanks!

          It's your graph, but it would be interesting to see what supervisors, mentors, examiners, reviewers think too (depending on who lies downstream of your work).

          As I said in #28 a density function estimate from 7 data points is a bit of a stretch. That was deliberate understatement.

          Comment


          • #35
            #25 #27 #33

            I assume you specified something like dscale(0.01). By default, a small offset is added to the position of the bar, rag, etc. if option split() is applied. The size of the default offset does not depend on dscale(). In your case, you squeeze the density estimates so much that the default offset is huge compared to the scaling of the density estimate. To get rid of the offset add option offset(0). Example:

            Code:
            violinplot Difference_CH2tau1, split(MMRStatus) noline ///
                fill(fintensity(30)) mean(type(m) m(o) mc(white)) box(type(bar)) med(type(l)) ///
                rag(spread(30) msymbol(o) mcolor(%60) mlc(%0)) ///
                dscale(.01) offset(0)
            Or set a very small value for the offset:

            Code:
            violinplot Difference_CH2tau1, split(MMRStatus) noline ///
                fill(fintensity(30)) mean(type(m) m(o) mc(white)) box(type(bar)) med(type(l)) ///
                rag(spread(30) msymbol(o) mcolor(%60) mlc(%0)) ///
                dscale(.01) offset(0.0001)
            The last command will, in fact, produce the exact same graph as

            Code:
            violinplot Difference_CH2tau1, split(MMRStatus) noline ///
                fill(fintensity(30)) mean(type(m) m(o) mc(white)) box(type(bar)) med(type(l)) ///
                rag(spread(30) msymbol(o) mcolor(%60) mlc(%0))
            (as long as set seed is the same), so I am asking myself why you want to apply dscale() in the first place...
            ben

            Comment


            • #36
              #29 #31 #32

              Cannot reproduce the problem either (note, the latest version of violinplot is 1.1.2, not 1.1.5). You indicated that you had the same problem also when using the nlsw88 dataset (sysuse nlsw88). Can you show me an example in which the problem occurs with that dataset?

              ben

              Comment


              • #37
                Hi Ben, thanks for your response. My bad - it is indeed 1.1.2 installed on my system. Yes, I am facing the same issue with nlsw88 dataset as well, with the exact same error response as I showed in #29 if I run the following code:

                Code:
                 violinplot wage, pdf(ll(0)) noline fill(fcolor(%50) lcolor(%100)) over(union)
                The code works fine if I remove the over() option. The same happens in my own dataset as well.

                Comment


                • #38
                  Kuber Bathla have you properly installed and updated all dependencies of -violinplot-?
                  I run
                  Code:
                  sysuse nlsw88
                  violinplot wage, pdf(ll(0)) noline fill(fcolor(%50) lcolor(%100)) over(union)
                  without any poroblems with Stata 18.

                  Comment


                  • #39
                    Marc Kaulisch Yes, I had installed them. I upgraded to Stata 18 today and it works perfectly on it. But as I had mentioned previously, I was using Stata 15, and the issue still persists there if I try the same code. It could have something to do with my system. Might be worth looking into for Ben Jann if other Stata 15 users are also facing the same issue. Nevertheless, thank you all for your time.
                    Last edited by Kuber Bathla; 07 Feb 2024, 05:48.

                    Comment


                    • #40
                      The example runs fine on my copy of Stata 15. Don't know why it did not on yours.
                      ben

                      Comment

                      Working...
                      X