jointprobs: Estimate joint event probabilities for multinomial data

Description Usage Arguments Value See Also Examples

View source: R/ExchMultinomial.R

Description

An exchangeable multinomial distribution with K+1 categories O_1,…,O_{K+1}, can be parameterized by the joint probabilities of events

tau_{r_1,..,r_K|n} = P[X_1=...=X_{r_1}=O_1,..., X_{sum_{i=1}^{K-1}r_i+1} =...=X_{sum_{i=1}^{K}r_i}=O_K]

where r_i ≥q 0 and r_1+\cdots +r_K≤q n. The jointprobs function estimates these probabilities under various settings. Note that when some of the r_i's equal zero, then no restriction on the number of outcomes of the corresponding type are imposed, so the resulting probabilities are marginal.

Usage

1
jointprobs(cmdata, type = c("averaged", "cluster", "mc"))

Arguments

cmdata

a CMData object

type

character string describing the desired type of estimate:

  • "averaged" - averaged over the observed cluster-size distribution within each treatment

  • "cluster" - separately for each cluster size within each treatment

  • "mc" - assuming marginal compatibility, ie that τ does not depend on the cluster-size

Value

a list with an array of estimates for each treatment. For a multinomial distribution with K+1 categories the arrays will have either K+1 or K dimensions, depending on whether cluster-size specific estimates (type="cluster") or pooled estimates (type="averaged" or type="mc") are requested. For the cluster-size specific estimates the first dimension is the cluster-size. Each additional dimension is a possible outcome.

See Also

mc.est for estimating the distribution under marginal compatibility, uniprobs and multi.corr for extracting the univariate marginal event probabilities, and the within-multinomial correlations from the joint probabilities.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(dehp)
# averaged over cluster-sizes
tau.ave <- jointprobs(dehp, type="ave")
# averaged P(X1=X2=O1, X3=O2) in the 1500 dose group
tau.ave[["1500"]]["2","1"]  # there are two type-1, and one type-2 outcome

#plot P(X1=O1) - the marginal probability of a type-1 event over cluster-sizes
tau <- jointprobs(dehp, type="cluster")
ests <- as.data.frame(lapply(tau, function(x)x[,"1","0"]))
matplot(ests, type="b")

Example output

[1] 0.03172957

CorrBin documentation built on May 2, 2019, 4:46 p.m.