equalTheta | R Documentation |
Estimates parameters π for each table under the contraint that theta is equal for all tables.
equalTheta(data, theta, epsilon=10^(-4), trace=TRUE, initPi, maxit=1000)
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 |
trace |
Logical. TRUE: print estimates while iterating. |
initPi |
Initial values for each pi vector (one of each table). |
maxit |
Maximum number of iterations. |
Returns a list similar to the output of dirmult
.
dirmult
## Not run: 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]] ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.