The function checks whether interval-censored data with two repeated measurements meet the normality assumption for subjects' means. This is a prerequisite for the random effects model used in ICC calculation.

1 | ```
ntest.means(r1, r2, predefined.classes=FALSE, classes, c.limits, optim.method=1, bins=10)
``` |

`r1` |
argument passed to |

`r2` |
argument passed to |

`predefined.classes` |
argument passed to |

`classes` |
argument passed to |

`c.limits` |
argument passed to |

`optim.method` |
argument passed to |

`bins` |
number of categories in chi-square test; see details below (default is 10). |

For ICC estimation the random effects data model

*Y_{ij} = μ + b_i + e_{ij},*

is used, where *b_i* and *e_{ij}* are normally distributed with means 0 and variances *σ^2_b* and *σ^2*, respectively.
This function assesses the assumption that the subjects' means *0.5 (Y_{i1}+Y_{i2})* are normally distributed with mean *μ* and variance *σ^2_b + 0.5 σ^2*, as is expected under the specified model.

To test normality, chi-square goodness-of-fit test with `bins`

subsequent data categories is used (call to `chisq.test`

from package `stats`

).
The categories (bins) are determined using the equidistant quantiles of expected normal distribution, with corresponding maximum likelihood
parameters. Maximum likelihood estimates for parameters *μ*, *σ^2_b* and *σ^2* are obtained by calling the function `intervalICC`

.
The probability corresponding to each bin is `1/bins`

(expected relative frequencies; this corresponds to `p = rep(1/bins,bins)`

in `chisq.test`

function).
Since means are interval-censored and censoring intervals overlap, the observed relative frequencies are calculated in the following way. If one of the original intervals representing subjects mean
spans multiple bins, each bin receives a share of votes from the original interval. This share is calculated using the
expected normal density function and it is proportional to the probability of data falling within the intersection of the
original interval and bin.

An object of class "ntestMeans". The object is a list with the components:

`statistic ` |
value of chi-squared statistic; |

`parameter ` |
number of degrees of freedom for chi-squared distribution; |

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

`data ` |
character string with value "means" |

`mu ` |
mean of the expected normal distribution for subjects' means; equal to maximum likelihood estimate for |

`var ` |
variance of the expected normal distribution for subjects' means; equal to maximum likelihood estimate for |

`bins ` |
number of categories in chi-square test |

This function was designed as a help in assessing goodness of model fit. However, it has not been tested in simulations nor in any other way.
It is the responsibility of the user to provide appropriate number of bins; the function checks only if `bins`

is a positive integer.
Testing normality with low number of bins is unreliable. On the other hand, if the number of bins is too large, `chisq.test`

will complain since the expected frequencies will be too low.

Jelena Kovacic jkovacic@imi.hr

Kovacic J, Varnai VM. Reproducibility of grouped data assessed by intraclass correlation coefficient. Accepted for publication in *Epidemiology*.

`summary.ntestMeans`

, `intervalICC`

, `chisq.test`

1 2 3 4 5 6 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.