Announcement

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

  • 95% BCa confidence interval for Cramers V with negative values - why?

    Hello,

    I tried to get a 95%-CI for Cramer´s V I calculated using the tabulate-command. I used bootstrapping, the CI got calculated but it entailed negative values which are not possibe for V. So my questions are:
    1. Why does Stata calculate negative values for the CI of V? Might there be something wrong with my data?
    2. Is there another way to calculate the CI for V besides bootstrapping?

    Thanks in advance
    Laura
    Last edited by Laura Bartz; 22 Aug 2019, 04:56.

  • #2
    The bootstrap software doesn't know what limits should bite with that method. The bottom line here is evidently a very weak relationship and/or a sample size too small to report it without substantial uncertainty.

    Assuming that V is not zero (or indeed one), then bootstrapping logit(V) and backtransforming should be a way to keep the interval entirely positive. I would just be tempted to use percentile bootstrap myself.

    Note the spelling https://en.wikipedia.org/wiki/Harald_Cram%C3%A9r to get points for your write-up (or not lose them if you have to argue your way past someone as picky or pickier than I am). As I recall the original symbol was Greek nu, but there you go.

    Comment


    • #3
      Dear Nick,
      thank you very much for your answer! Unfortunately, I have no actual idea of how to do what you suggested in order to keep my interval positive as I am a Stata-Beginner. I´d be really happy if you could show me some code for that if you don´t mind.
      Thanks for the spelling advice, I am going to include it in the fine tuning of my thesis as soon as I am done with the basic stuff.
      Cheers
      Laura

      Comment


      • #4
        That's fine, as is this advice: being new should mean that you study the FAQ Advice really carefully, but there is here no data example or specific code you used.

        Here's a sample of code.

        Code:
        sysuse auto, clear 
        
        capture program drop mystat 
        
        program mystat, rclass  
             tab foreign rep78 , V 
             return scalar stat = logit(r(CramersV))
        end 
        
        set seed 280352 
        bootstrap r(stat), bca nodots reps(1000) : mystat 
        
        mat results = r(table)
        
        mata
        results = st_matrix("results")
        invlogit(results[(1,5,6), 1])
        end 
        
            +---------------+
          1 |  .6285935651  |
          2 |  .4440280877  |
          3 |   .781973763  |
            +---------------+
        If you wanted to do this repeatedly, you'd need more general code.

        Comment


        • #5
          One variation on Nick's illustrative example is to do the transformation within the bootstrap command (as Stata allows some manipulation of the returned quantities).

          Code:
          bootstrap x=logit(r(CramersV)), bca nodots reps(1000) : tab foreign rep78 , V
          This line can replace the -bootstrap- line in #4, and no longer needs the -program- block. Of course, there's no harm in producing your own program, especially if you wanted to make use of -esample()-.

          Comment


          • #6

            Thank you both very much. I managed to run the code you provided and it was really helpful.
            Nick, thanks for your advice again. I didn´t provide my code as I thought it was trivial. I will next time.
            Last edited by Laura Bartz; 22 Aug 2019, 07:25.

            Comment


            • #7
              Leonardo Guizzetti gave a better method.

              Comment


              • #8
                Yes, I used the combination of your codes Leonardo Guizzetti suggested!
                Thanks again very much for your quick and helpful responses!

                Comment

                Working...
                X