Learn R Programming

dirmult (version 0.1.1)

equalTheta: Test whether theta is equal for several tables

Description

Estimates parameters $\pi$ for each table under the contraint that $\theta$ is equal for all tables.

Usage

equalTheta(data, theta, epsilon=10^(-4), trace=TRUE, initPi, maxit=1000)

Arguments

data
A list of matrix or table with counts. Rows in the tables represent subpopulations and columns the different categories of the data. Zero columns are automaticly removed.
theta
Initial value of the commen theta paramter.
epsilon
Tolerance of the convergence, see dirmult.
trace
Logical. TRUE: print estimates while iterating.
initPi
Initial values for each pi vector (one of each table).
maxit
Maximum number of iterations.

Value

  • Returns a list similar to the output of dirmult.

concept

  • Genetics
  • Overdispersion
  • Dirichlet-multinomial

See Also

dirmult

Examples

Run this code
data(us)
fit <- lapply(us[1:2],dirmult,epsilon=10^(-12),trace=FALSE)
thetas <- unlist(lapply(fit,function(x) x$theta))
logliks <- unlist(lapply(fit,function(x) x$loglik))
fit1 <- equalTheta(us[c(1:2)],theta=mean(thetas),epsilon=10^(-12))
lr <- -2*(fit1$loglik-sum(logliks))
1-pchisq(lr,df=1)
fit1$theta[[1]]

Run the code above in your browser using DataLab