vcdExtra icon indicating copy to clipboard operation
vcdExtra copied to clipboard

CMHTest type="cor" supresses p-value and df

Open bill-raynor opened this issue 7 years ago • 4 comments

When I run CMHtest(as.formula(fStr), data=dm, types = c("cor"), overall = T) the $ALL element lacks a p-value and a d.f. Any particular reason why?

Example: CMHtest(Freq~right+left|gender, data=VisualAcuity, overall=T, type="cor", details=T) lacks a p-value but CMHtest(Freq~right+left|gender, data=VisualAcuity, overall=T, type="cor", details=T) doesn't.

bill-raynor avatar Jun 11 '18 19:06 bill-raynor

Your two examples are identical, as far as I can see.

Pedantic: you should use types="cor" not type="cor" or types=c("cor"), and =TRUE, not =T.

If you omit the types=arg, the function does give the df`` and Prob` column in the result. I don't have an immediate explanation for this.

friendly avatar Jun 11 '18 20:06 friendly

That's primarily because I didn't proof the post carefully. My apologies. The types= version CMHtest(Freq~right+left|gender, data=VisualAcuity, types=c("cor"), overall=TRUE) produces

    ....
    $ALL
     Cochran-Mantel-Haenszel Statistics for right by left 
	  Overall tests, controlling for all strata 

             AltHypothesis  Chisq Df Prob
    cor Nonzero correlation 5193.2 NA   NA

while the call CMHtest(Freq~right+left|gender, data=VisualAcuity, overall=TRUE) produces

    ...
       $ALL
        Cochran-Mantel-Haenszel Statistics for right by left 
    	    Overall tests, controlling for all strata 

                    AltHypothesis  Chisq Df Prob
    cor        Nonzero correlation 5193.2  1    0
    rmeans  Row mean scores differ 5213.4  3    0
    cmeans  Col mean scores differ 5219.4  3    0
    general    General association  11316  9    0

WRT the types and T, point taken. I thought R permitted partial matches.

bill-raynor avatar Jun 12 '18 00:06 bill-raynor

Hi @bill-raynor,

I am facing a similar output in a recent analysis. So in your second output just above, Does Prob 0 effectively means that comparison is statistically significant?

I am just finding the output a bit distinct from other R packages, where I see something like P < 0.05, for example.

Thank you

lf-araujo avatar Jun 13 '19 20:06 lf-araujo

Good evening, It’s been awhile, but you can check it by running it once with and without type=“cor.” I went diving through the code but have forgotten how I handled it.

Bill

On Jun 13, 2019, at 3:04 PM, lf_araujo [email protected] wrote:

Hi @bill-raynor https://github.com/bill-raynor,

I am facing a similar output in a recent analysis. So in your second output just above, Does Prob 0 effectively means that comparison is statistically significant?

I am just finding the output a bit distinct from other R packages, where I see something like P < 0.05, for example.

Thank you

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/friendly/vcdExtra/issues/2?email_source=notifications&email_token=AAP4D7QA3O34GIKUCAAUCNDP2KR4PA5CNFSM4FENFEJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXU4CRI#issuecomment-501858629, or mute the thread https://github.com/notifications/unsubscribe-auth/AAP4D7Q33KXVQN3PLHKYI4TP2KR4PANCNFSM4FENFEJA.

bill-raynor avatar Jun 14 '19 02:06 bill-raynor