Solved – R statistics: Adjusted Chi-squared test for clustered binary / categorical data

I'm looking for some assistance in statistical analysis with R, but also some general stats advice.

I am analysing cardiac phenotype data by comparing 2 groups. The 2 groups are unmatched individuals, but within each group, they are clustered in family subgroups (of between 1 and ~6).

I want to report the difference in prevalence of a specific ECG appearance (binary – i.e. either present or absent in each individual) between the 2 groups.

For example:

Group 1 consists of 157 individuals comprised of 41 family clusters.
Group 2 consists of 463 individuals comprised of 163 family clusters.
Prevalence of x in Group 1 = 22.9% Prevalence of x in Group 2 = 24.6%.
Group 1 are cases and Group 2 controls (i.e. not randomized and defined by phenotype in an observational study).

What test is most appropriate in this circumstance, and which package in R provides the easiest way to account for the clustering of relatives within families?

Having looked around, I have found:

  • Ratio estimate chi-square test
  • Generalized estimating equation

But I have no experience of either of these techniques, and can't find any examples of their use in R.

Any advice on how best to proceed?

EDIT: See comment below for update.
I believe the Donner (1989) chi-square correction may be the most appropriate (provided by R function donner). Second opinions and correct use of R command appreciated. Thanks.

Prof Donner agrees the adjusted chi-square test is appropriate (conversation below).

My message:

I wonder whether you might be able to advise on whether your adjustment [ Donner (1989) ] is appropriate for analysis of my clustered binary data. My local statistician has recommended reporting prevalence by cluster and then applying the Mann-Whitney U test in the absence of experience of your correction.

I am investigating cardiac phenotypes in blood relatives (individuals) of sequential cases of premature sudden death. The cases of sudden death are categorised into 2 groups: 1. explained sudden death; 2. unexplained sudden death.

The groups are unmatched (sequential cases). Within each group, individuals are clustered in family subgroups / strata (of between 1 and 10 individuals).

All individuals / relatives are investigated for evidence of cardiac disease and categorised as "affected" or "unaffected."

I want to report the difference (or not) in proportion of blood relatives who are "affected" between the 2 groups.

For example: Group 1 consists of 157 individuals comprised of 41 family clusters Group 2 consists of 463 individuals comprised of 163 family clusters Proportion "affected" in Group 1 = 22.9% Proportion "affected" in Group 2 = 24.6% 

I believe that the Donner (1989) modification may be appropriate. I have found package(aod) in R which includes function donner(). e.g. donner(cbind(y,n-y) ~ group, data=matrix)

The data "matrix" will be 1 column per family / case with 4 columns: ID, group, n (number of relatives in family), y (number affected in family).

Reply from Prof Donner:

Yes, the adjusted chi-square test would in fact be quite appropriate for your data and likely more power than a nonparametric approach. However the 1989 paper is very limited in scope, so I am attaching another paper which discusses and illustrates the adjusted chi-square test in a more general setting.

My subsequent analysis (raw data below):

library(aod) donner(cbind(y,n-y) ~group, data = data_below) 

Hope this helps someone.

csv raw data (column headers as per message above):

FamilyId,Diagnosis,group,n,y 53,LQT,UNEXPLAINED,1,0 84,LQT,UNEXPLAINED,7,4 7,LQT,UNEXPLAINED,4,2 58,LQT,UNEXPLAINED,1,1 111,LQT,UNEXPLAINED,4,0 175,LQT,UNEXPLAINED,2,1 208,LQT,UNEXPLAINED,4,1 210,LQT,UNEXPLAINED,2,0 211,LQT,UNEXPLAINED,7,1 55,LQT,UNEXPLAINED,3,0 3,DCM,UNEXPLAINED,5,2 201,CPVT,UNEXPLAINED,1,1 121,BrS,UNEXPLAINED,1,1 164,BrS,UNEXPLAINED,4,2 169,BrS,UNEXPLAINED,1,1 170,BrS,UNEXPLAINED,6,2 173,BrS,UNEXPLAINED,6,1 190,BrS,UNEXPLAINED,2,2 196,BrS,UNEXPLAINED,4,1 209,BrS,UNEXPLAINED,1,1 222,BrS,UNEXPLAINED,3,1 227,BrS,UNEXPLAINED,4,2 5,BrS,UNEXPLAINED,7,2 15,BrS,UNEXPLAINED,6,1 27,BrS,UNEXPLAINED,4,2 32,BrS,UNEXPLAINED,4,1 33,BrS,UNEXPLAINED,6,2 39,BrS,UNEXPLAINED,3,1 40,BrS,UNEXPLAINED,3,2 57,BrS,UNEXPLAINED,6,2 65,BrS,UNEXPLAINED,10,5 69,BrS,UNEXPLAINED,4,1 71,BrS,UNEXPLAINED,4,3 74,BrS,UNEXPLAINED,1,0 78,BrS,UNEXPLAINED,1,1 83,BrS,UNEXPLAINED,2,1 88,BrS,UNEXPLAINED,1,1 93,BrS,UNEXPLAINED,4,1 102,BrS,UNEXPLAINED,3,1 109,BrS,UNEXPLAINED,4,1 112,BrS,UNEXPLAINED,6,4 115,BrS,UNEXPLAINED,4,1 116,BrS,UNEXPLAINED,3,2 125,BrS,UNEXPLAINED,5,2 131,BrS,UNEXPLAINED,1,1 138,BrS,UNEXPLAINED,3,1 140,BrS,UNEXPLAINED,8,3 145,BrS,UNEXPLAINED,3,1 146,BrS,UNEXPLAINED,2,1 154,BrS,UNEXPLAINED,3,2 156,BrS,UNEXPLAINED,2,2 157,BrS,UNEXPLAINED,8,6 161,BrS,UNEXPLAINED,2,2 166,BrS,UNEXPLAINED,4,1 134,LQT,UNEXPLAINED,4,1 212,LQT,UNEXPLAINED,1,1 75,LQT,UNEXPLAINED,3,1 20,"Familial AF",UNEXPLAINED,1,1 207,ARVC,UNEXPLAINED,1,1 203,BrS,UNEXPLAINED,1,1 213,BrS,UNEXPLAINED,3,0 97,BrS,UNEXPLAINED,5,2 47,BrS,UNEXPLAINED,2,1 259,BrS,UNEXPLAINED,2,1 260,BrS,UNEXPLAINED,5,2 389,BrS,UNEXPLAINED,1,1 329,BrS,UNEXPLAINED,4,1 40,LQT,UNEXPLAINED,4,1 85,LQT,UNEXPLAINED,1,1 87,LQT,UNEXPLAINED,4,1 89,LQT,UNEXPLAINED,3,1 112,LQT,UNEXPLAINED,7,3 122,LQT,UNEXPLAINED,6,1 131,LQT,UNEXPLAINED,4,1 134,LQT,UNEXPLAINED,4,3 223,ARVC,UNEXPLAINED,6,3 233,ARVC,UNEXPLAINED,1,1 6,None,UNEXPLAINED,3,0 12,None,UNEXPLAINED,1,0 16,None,UNEXPLAINED,3,0 17,None,UNEXPLAINED,2,0 21,None,UNEXPLAINED,2,0 22,None,UNEXPLAINED,7,0 23,None,UNEXPLAINED,1,0 28,None,UNEXPLAINED,1,0 31,None,UNEXPLAINED,5,0 34,None,UNEXPLAINED,3,0 35,None,UNEXPLAINED,2,0 36,None,UNEXPLAINED,1,0 37,None,UNEXPLAINED,3,0 43,None,UNEXPLAINED,1,0 45,None,UNEXPLAINED,1,0 51,None,UNEXPLAINED,3,0 54,None,UNEXPLAINED,2,0 56,None,UNEXPLAINED,6,0 61,None,UNEXPLAINED,1,0 62,None,UNEXPLAINED,5,0 63,None,UNEXPLAINED,7,0 64,None,UNEXPLAINED,4,0 66,None,UNEXPLAINED,1,0 70,None,UNEXPLAINED,2,0 73,None,UNEXPLAINED,1,0 76,None,UNEXPLAINED,3,0 87,None,UNEXPLAINED,1,0 90,None,UNEXPLAINED,3,0 92,None,UNEXPLAINED,6,0 94,None,UNEXPLAINED,4,0 118,None,UNEXPLAINED,2,0 119,None,UNEXPLAINED,1,0 123,None,UNEXPLAINED,2,0 129,None,UNEXPLAINED,2,0 135,None,UNEXPLAINED,1,0 136,None,UNEXPLAINED,1,0 137,None,UNEXPLAINED,3,0 143,None,UNEXPLAINED,3,0 147,None,UNEXPLAINED,1,0 149,None,UNEXPLAINED,2,0 153,None,UNEXPLAINED,2,0 165,None,UNEXPLAINED,1,0 171,None,UNEXPLAINED,1,0 174,None,UNEXPLAINED,2,0 177,None,UNEXPLAINED,1,0 179,None,UNEXPLAINED,1,0 184,None,UNEXPLAINED,3,0 185,None,UNEXPLAINED,4,0 187,None,UNEXPLAINED,3,0 191,None,UNEXPLAINED,2,0 193,None,UNEXPLAINED,1,0 195,None,UNEXPLAINED,3,0 206,None,UNEXPLAINED,3,0 214,None,UNEXPLAINED,2,0 216,None,UNEXPLAINED,1,0 218,None,UNEXPLAINED,2,0 219,None,UNEXPLAINED,1,0 223,None,UNEXPLAINED,2,0 224,None,UNEXPLAINED,1,0 225,None,UNEXPLAINED,1,0 226,None,UNEXPLAINED,4,0 228,None,UNEXPLAINED,1,0 229,None,UNEXPLAINED,1,0 230,None,UNEXPLAINED,1,0 231,None,UNEXPLAINED,3,0 232,None,UNEXPLAINED,1,0 377,None,UNEXPLAINED,1,0 134,None,UNEXPLAINED,4,0 201,None,UNEXPLAINED,3,0 203,None,UNEXPLAINED,4,0 206,None,UNEXPLAINED,3,0 207,None,UNEXPLAINED,4,0 208,None,UNEXPLAINED,1,0 215,None,UNEXPLAINED,2,0 219,None,UNEXPLAINED,1,0 223,None,UNEXPLAINED,1,0 233,None,UNEXPLAINED,1,0 317,None,UNEXPLAINED,1,0 328,None,UNEXPLAINED,1,0 333,None,UNEXPLAINED,2,0 340,None,UNEXPLAINED,1,0 352,None,UNEXPLAINED,1,0 358,None,UNEXPLAINED,1,0 367,None,UNEXPLAINED,4,0 370,None,UNEXPLAINED,1,0 376,None,UNEXPLAINED,2,0 1,0,EXPLAINED,2,0 39,BrS,EXPLAINED,2,1 40,BrS,EXPLAINED,2,1 41,0,EXPLAINED,3,0 42,0,EXPLAINED,3,0 43,0,EXPLAINED,1,0 44,0,EXPLAINED,2,0 45,0,EXPLAINED,6,0 46,BrS,EXPLAINED,4,2 41,LQT,EXPLAINED,2,1 40,DCM,EXPLAINED,5,2 41,0,EXPLAINED,3,0 42,BrS,EXPLAINED,13,5 43,0,EXPLAINED,2,0 44,BrS,EXPLAINED,3,2 45,0,EXPLAINED,5,0 38,BrS,EXPLAINED,3,1 39,BrS,EXPLAINED,9,2 40,BrS,EXPLAINED,6,1 41,0,EXPLAINED,5,0 1,0,EXPLAINED,7,0 2,0,EXPLAINED,4,0 37,BrS,EXPLAINED,3,1 38,0,EXPLAINED,3,0 39,0,EXPLAINED,2,0 40,HCM,EXPLAINED,3,1 41,0,EXPLAINED,4,0 42,BrS,EXPLAINED,4,4 43,BrS,EXPLAINED,3,1 44,0,EXPLAINED,2,0 45,CPVT,EXPLAINED,3,2 46,"LQT3 /BrS crossover",EXPLAINED,10,4 47,BrS,EXPLAINED,3,1 48,LQT,EXPLAINED,5,1 49,0,EXPLAINED,3,0 50,LQT,EXPLAINED,5,1 51,BrS,EXPLAINED,5,1 52,0,EXPLAINED,2,0 53,0,EXPLAINED,1,0 54,BrS,EXPLAINED,3,1 55,0,EXPLAINED,1,0 

Similar Posts:

Rate this post

Leave a Comment