dtomogplot {MCMCpack} | R Documentation |
dtomogplot is used to produce a tomography plot (see King, 1997) for a series of temporally ordered, partially observed 2 x 2 contingency tables.
dtomogplot(r0, r1, c0, c1, time.vec=NA, delay=0, xlab="fraction of r0 in c0 (p0)", ylab="fraction of r1 in c0 (p1)", color.palette=heat.colors, bgcol="black", ...)
r0 |
An (ntables * 1) vector of row sums from row 0. |
r1 |
An (ntables * 1) vector of row sums from row 1. |
c0 |
An (ntables * 1) vector of column sums from column 0. |
c1 |
An (ntables * 1) vector of column sums from column 1. |
time.vec |
Vector of time periods that correspond to the elements of r0, r1, c0, and c1. |
delay |
Time delay in seconds between the plotting of the tomography lines. Setting a positive delay is useful for visualizing temporal dependence. |
xlab |
The x axis label for the plot. |
ylab |
The y axis label for the plot. |
color.palette |
Color palette to be used to encode temporal patterns. |
bgcol |
The background color for the plot. |
... |
further arguments to be passed |
Consider the following partially observed 2 by 2 contingency table:
| Y=0 | | Y=1 | | | |
- - - - - | - - - - - | - - - - - | - - - - - |
X=0 | | Y0 | | | | r0 |
- - - - - | - - - - - | - - - - - | - - - - - |
X=1 | | Y1 | | | | r1 |
- - - - - | - - - - - | - - - - - | - - - - - |
| c0 | | c1 | | N |
where r0, r1, c0, c1, and N are non-negative integers that are observed. The interior cell entries are not observed. It is assumed that Y0|r0 ~ Binomial(r0, p0) and Y1|r1 ~ Binomial(r1,p1).
This function plots the bounds on the maximum likelihood estimates for (p0, p1) and color codes them by the elements of time.vec.
Gary King, 1997. A Solution to the Ecological Inference Problem. Princeton: Princeton University Press.
Jonathan Wakefield. 2001. ``Ecological Inference for 2 x 2 Tables,'' Center for Statistics and the Social Sciences Working Paper no. 12. University of Washington.
Kevin M. Quinn. 2002. ``Ecological Inference in the Presence of Temporal Dependence.'' Paper prepared for Ecological Inference Conference, Harvard University, June 17-18, 2002.
MCMChierEI
,
MCMCdynamicEI
,tomogplot
## Not run: ## simulated data example 1 set.seed(3920) n <- 100 r0 <- rpois(n, 2000) r1 <- round(runif(n, 100, 4000)) p0.true <- pnorm(-1.5 + 1:n/(n/2)) p1.true <- pnorm(1.0 - 1:n/(n/4)) y0 <- rbinom(n, r0, p0.true) y1 <- rbinom(n, r1, p1.true) c0 <- y0 + y1 c1 <- (r0+r1) - c0 ## plot data dtomogplot(r0, r1, c0, c1, delay=0.1) ## simulated data example 2 set.seed(8722) n <- 100 r0 <- rpois(n, 2000) r1 <- round(runif(n, 100, 4000)) p0.true <- pnorm(-1.0 + sin(1:n/(n/4))) p1.true <- pnorm(0.0 - 2*cos(1:n/(n/9))) y0 <- rbinom(n, r0, p0.true) y1 <- rbinom(n, r1, p1.true) c0 <- y0 + y1 c1 <- (r0+r1) - c0 ## plot data dtomogplot(r0, r1, c0, c1, delay=0.1) ## End(Not run)