ageBias(formula, data, ref.lab = tmp$Enames, nref.lab = tmp$Rname, method = stats::p.adjust.methods, sig.level = 0.05, min.n.CI = 3)
"summary"(object, what = c("table", "symmetry", "Bowker", "EvansHoenig", "McNemar", "bias", "diff.bias", "n"), flip.table = FALSE, zero.print = "-", digits = 3, cont.corr = c("none", "Yates", "Edwards"), ...)
"plot"(x, what = c("bias", "sunflower", "numbers"), difference = FALSE, xlab = x$ref.lab, ylab = x$nref.lab, show.n = TRUE, nYpos = 1.03, cex.n = 0.75, lwd = 1, show.pts = FALSE, pch.pts = 19, col.pts = grDevices::rgb(0, 0, 0, transparency), transparency = 1/10, pch.mean = 95, cex.mean = lwd, col.CI = "black", col.CIsig = "red", lwd.CI = lwd, sfrac = 0, show.range = FALSE, col.range = "gray", lwd.range = lwd, col.agree = "black", lwd.agree = lwd, lty.agree = 2, cex.numbers = 0.9, xlim = NULL, ylim = NULL, yaxt = graphics::par("yaxt"), xaxt = graphics::par("xaxt"), ...)
nrefvar~refvar
, where nrefvar
and refvar
generically represent the variables that contain the paired nonreference and reference age assignments, respectively. See details.formula
.?p.adjust.methods
.plot
is 100*(1-sig.level
).what="bias"
or what="diff.bias"
in summary
."none"
(default) then no continuity correction is used, if "Yates"
then 0.5 is used, and if "Edwards"
then 1 is used.ageBias
, usually a result from ageBias
.=TRUE
, default) or not (=FALSE
).show.n=TRUE
. For example, if nYpos=1.03
then the sample size values will be centered at 3 percent above the top end of the y-axis.lwd.CI
, lwd.range
).transparency
.col.pts
.pch.mean
.sfrac
in plotCI
of plotrix.what="numbers"
is used.?par
.ageBias
returns a list with the following items:
summary
returns the result if what=
contains one item, otherwise it returns nothing. Nothing is returned by plot
, but see details for a description of the plot that is produced.
compare2
in fishmethods, and all results using the AlewifeLH
data set from FSAdata against results from the online resource at http://www.nefsc.noaa.gov/fbp/age-prec/.The age-agreement table is constructed with what="table"
in summary
. The agreement table can be flipped (i.e., the rows in descending rather than ascending order) with flip.table=TRUE
. By default, the tables are shown with zeroes replaced by dashes. This behavior can be changed with zero.print
.
Three statistical tests of symmetry for the age-agreement table can be computed with what=
in summary
. The unpooled or Bowker test as described in Hoenig et al. (1995) is constructed with what="Bowker"
, the semi-pooled or Evans-Hoenig test as described in Evans and Hoenig (1998) is constructed with what="EvansHoenig"
, and the pooled or McNemar test as described in Evans and Hoenig (1998) is constructed with what="McNemar"
. All three tests are run simultaneously with what="symmetry"
.
An age-bias plot, as defined by Campana et al. (1995), is constructed with what="bias"
(the default) in plot
. The reference variable from the ageBias
call is plotted on the x-axis. Plotted confidence intervals are computed for the mean of the non-reference ages at each of the reference ages. The level of confidence is controlled by sig.level=
given in the original ageBias
call (i.e., confidence level is 100*(1-sig.level
)). Confidence intervals are only shown if the sample size is greater than the value in min.n.CI=
. Confidence intervals plotted in red do not contain the reference age (see discussion of t-tests below). Vertical lines that connect the minimum to the maximum observed value of the y-axis variable at each age of the x-axis variable are plotted in grey if show.range=TRUE
. Individual points are plotted if show.pts=TRUE
. The 1:1 (45 degree) agreement line is shown for comparative purposes. The sample sizes at each age of the x-axis variable are shown if show.n=TRUE
(the default). The position of the sample sizes is controlled with nYpos=
.
An age-bias plot, as defined by Muir et al. (2008), is constructed as defined above but by also including difference=TRUE
in plot
so that the y-axis is the difference in the paired reference and non-reference ages from the ageBias
call (specifically, nonreference-reference).
The frequency of observations at each unique (x,y) coordinate are shown by using what="numbers"
in plot
.
A sunflower plot, which contains a symbol for each unique (x,y) coordinate with as many petals as observations at that point, is constructed with what="sunflower"
in plot
. A sunflower plot with differences between the two structures can be constructed by also including difference=TRUE
.
Individual t-tests to determine if the mean age of the non-reference set at a particular age of the reference set is equal to the reference age (e.g., is the mean age of the non-reference set at age-3 of the reference set statistically equal to 3?) are shown with what="bias"
in summary
. The results provide a column that indicates whether the difference is significant or not as determined by adjusted p-values from the t-tests and using the signficance level provided in sig.level
(defaults to 0.05). Similar results for the difference in ages (e.g., is the mean row variable age minus column variable age at column variable age-3 equal to 0?) are constructed with what="diff.bias"
in summary
.
The sample size present in the age-agreement table is found with what="n"
.
Campana, S.E., M.C. Annand, and J.I. McMillan. 1995. Graphical and statistical methods for determining the consistency of age determinations. Transactions of the American Fisheries Society 124:131-138. [Was (is?) available from http://www.bio.gc.ca/otoliths/documents/Campana%20et%20al%201995%20TAFS.pdf.]
Evans, G.T. and J.M. Hoenig. 1998. Testing and viewing symmetry in contingency tables, with application to readers of fish ages. Biometrics 54:620-629.
Hoenig, J.M., M.J. Morgan, and C.A. Brown. 1995. Analysing differences between two age determination methods by tests of symmetry. Canadian Journal of Fisheries and Aquatic Sciences 52:364-368.
McBride, R.S. 2015. Diagnosis of paired age agreement: A simulation approach of accuracy and precision effects. ICES Journal of Marine Science 72:2149-2167.
Muir, A.M., M.P. Ebener, J.X. He, and J.E. Johnson. 2008. A comparison of the scale and otolith methods of age estimation for lake whitefish in Lake Huron. North American Journal of Fisheries Management 28:625-635. [Was (is?) available from http://www.tandfonline.com/doi/abs/10.1577/M06-160.1]
agePrecision
for measures of precision between pairs of age assignments. See compare2
in fishmethods for similar functionality.
data(WhitefishLC)
ab1 <- ageBias(scaleC~otolithC,data=WhitefishLC,ref.lab="Otolith Age",nref.lab="Scale Age")
summary(ab1)
summary(ab1,what="symmetry")
summary(ab1,what="Bowker")
summary(ab1,what="EvansHoenig")
summary(ab1,what="McNemar")
summary(ab1,what="McNemar",cont.corr="Yates")
summary(ab1,what="bias")
summary(ab1,what="diff.bias")
summary(ab1,what="n")
summary(ab1,what=c("n","symmetry","table"))
# show the zeroes (rather than dashes)
summary(ab1,what="table",zero.print="0")
# flip the table -- ease of comparison to age-bias plot
summary(ab1,what="table",flip.table=TRUE)
## default plot
plot(ab1)
## demonstrates squaring up the axes
plot(ab1,ylim=c(-1,23),xlim=c(-1,23))
## plot with the data points shown
plot(ab1,show.pts=TRUE,transparency=1/8)
## plot with the range shown
plot(ab1,show.range=TRUE)
## plot with no difference in significance bar colors
plot(ab1,col.CIsig="black")
## plot of differences (note could use same modifications as shown above)
plot(ab1,difference=TRUE)
## sunflower plot
plot(ab1,what="sunflower")
plot(ab1,what="sunflower",difference=TRUE)
## "Numbers" plot
plot(ab1,what="number",col.agree="gray50")
Run the code above in your browser using DataLab