Description Usage Arguments Details Value References Examples
View source: R/proptestclust.R
prop.test.clust
can be used for testing the null that the marginal proportion
(probability of success) is equal to certain given values in clustered data with potentially informative
cluster size.
1 2 3 4 5 6 7 8 | prop.test.clust(
x,
id,
p = NULL,
alternative = c("two.sided", "less", "greater"),
variance = c("sand.null", "sand.est", "emp", "MoM"),
conf.level = 0.95
)
|
x |
a vector of binary indicators denoting success/failure of each observation, or a two-dimensional table (or matrix) with 2 columns giving the aggregate counts of failures and successes (respectively) across clusters. |
id |
a vector which identifies the clusters; ignored if |
p |
the null hypothesized value of the marginal proportion. Must be a single number greater than 0 and less than 1. |
alternative |
a character string specifying the alternative hypothesis. Must be one of " |
variance |
character string specifying the method of variance estimation. Must be one of " |
conf.level |
confidence level of the returned confidence interval. Must be a single number between 0 and 1. |
If p
is not given, the null tested is that the underlying marginal probablity of
success is .5.
The variance
argument allows the user to specify the method of variance estimation, selecting from
the sandwich estimate evaluated at the null hypothesis (sand.null
), the sandwich estimate evaluated at the
cluster-weighted proportion (sand.est
), the emperical estimate (emp
), or the method of moments
estimate (MoM
).
A list with class "htest
" containing the following compoments:
statistic |
the value of the test statistic. |
p.value |
the p-value of the test. |
estimate |
the estimated marginal proportion. |
null.value |
the value of |
conf.int |
a confidence interval for the true marginal proportion. |
alternative |
a character string describing the alternative hypothesis. |
method |
a character string indicating the test performed and method of construction. |
data.name |
a character string giving the name of the data and the total number of clusters. |
m |
the number of clusters. |
Gregg, M., Datta, S., Lorenz, D. (2020) Variance Estimation in Tests of Clustered Categorical Data with Informative Cluster Size. Submitted, xx, xx–xx.
1 2 3 | data(icsdat)
prop.test.clust(icsdat$cat1, icsdat$id)
prop.test.clust(table(icsdat$id, icsdat$cat1), variance="emp")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.