ageBias(formula, data, ref.lab = tmp$Enames, nref.lab = tmp$Rname,
method = stats::p.adjust.methods, sig.level = 0.05, min.n.CI = 3)
## S3 method for class 'ageBias':
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"),
...)
## S3 method for class 'ageBias':
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 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 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 AlewifeLH
data set from what="table"
in summary
. The agreement table can be 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 what="Bowker"
, the what="EvansHoenig"
, and the 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 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"
.agePrecision
for measures of precision between pairs of age assignments. See compare2
in 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