cortestClust | R Documentation |

Test for marginal association between paired samples in clustered data with potentially informative cluster size.

cortestClust(x, ...) ## Default S3 method: cortestClust( x, y, id, method = c("pearson", "kendall", "spearman"), alternative = c("two.sided", "less", "greater"), conf.level = 0.95, ... ) ## S3 method for class 'formula' cortestClust(formula, id, data, subset, na.action, ...)

`x, y` |
numeric vectors of data values. |

`...` |
further arguments to be passed to or from methods. |

`id` |
a vector or factor object which identifies the clusters. The length of |

`method` |
a character string indicating which correlation coefficient is to be used for the test.
One of " |

`alternative` |
indicates the alternative hypothesis and must be one of " |

`conf.level` |
confidence level for the returned confidence interval. |

`formula` |
a formula of the form ~ u + v, where each of |

`data` |
an optional matrix or data frame containing variables in the formula |

`subset` |
an optional vector specifying a subset of observations to be used. |

`na.action` |
a function which indicates what should happen when data contain |

The three methods each estimate the marginal association between paired observations from clustered data and compute a test of the value being zero.

If `method`

is "`pearson`

" ("`kendall`

"), the test statistic is based on the
Pearson product-moment (Kendall concordance coefficient) analog of Lorenz *et al.* (2011).

If `method`

is "`spearman`

", the test statistic
is based on the Spearman coefficient analog of Lorenz *et al.* (2018) modified for paired data.

A list with class "`htest`

" containing the following components:

`statistic` |
the value of the test statistic. |

`p.value` |
the p-value of the test. |

`estimate` |
the estimated measure of marginal association, with name " |

`null.value` |
the value of the association measure under the null hypothesis, always 0. |

`conf.int` |
a confidence interval for the measure of association. |

`alternative` |
a character string describing the alternative hypothesis. |

`method` |
a character string indicating how the association was measured. |

`data.name` |
a character string giving the name(s) of the data and the total number of clusters. |

`M` |
the number of clusters. |

Lorenz, D., Datta, S., Harkema, S. (2011) Marginal association measures for clustered data.
*Statistics in Medicine*, **30**, 3181–3191.

Lorenz, D., Levy, S., Datta, S. (2018) Inferring marginal association with paired and unpaired
clustered data. *Stat. Methods Med. Res.*, **27**, 1806–1817.

data(screen8) ## test if math and reading scores are marginally correlated using vectors cortestClust(screen8$read, screen8$math, screen8$sch.id) ## formula interface cortestClust(~ math + read, sch.id, data=screen8, method="kendall")

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.