In R, Warning messages: 1: In sum(mhtable[, 1, i]) * sum(mhtable[1, , i]) : NAs produced by integer overflow

17 Views Asked by At

I'm trying to do a Cochran-Mantel-Haenzel test to see if sex modifies the relationship between cases (whether someone has a condition) and grandmal (outcome = having grand mal status). head gm

# A tibble: 6 × 3
  cases SEX   grandmal
  <dbl> <chr>    <dbl>
1     1 M            0
2     1 F            0
3     1 M            0
4     1 M            0
5     1 F            0
6     1 F            0

table<-xtabs(~grandmal+cases+SEX, data=gm) ftable(table)

               SEX      F      M
grandmal cases                  
0        0         259471 143343
         1          85749  44601
1        0            587    419
         1            202    122

with(gm, mhor(grandmal, cases, SEX))

Stratified analysis by  SEX 
                OR lower lim. upper lim. P value
SEX F        1.041      0.883       1.22   0.621
SEX M        0.936      0.758       1.15   0.544
M-H combined 0.999      0.881       1.13      NA

M-H Chi2(1) = NA , P value = NA 
Homogeneity test, chi-squared 1 d.f. = 0.66 , P value = 0.416 

Warning messages:
1: In sum(mhtable[, 1, i]) * sum(mhtable[1, , i]) :
  NAs produced by integer overflow
2: In sum(mhtable[, 1, i]) * sum(mhtable[1, , i]) :
  NAs produced by integer overflow

Using the mantelhaen.test results in an error mantelhaen.test(table)

Error in if (correct && (abs(DELTA) >= 0.5)) 0.5 else 0 : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In s.x[1, ] * s.y[1, ] : NAs produced by integer overflow`

tried using base mantelhaens.test and epiDisplay, but there is some problem with integer overflow. I tried changing sex to female==1 and male==0 and make them all numeric, but it still returns the same error.

I also removed all NAs

any(is.na(gm))

[1] FALSE
0

There are 0 best solutions below