vfaggregate {visualFields} | R Documentation |
Statistical analyses for visual fields data
Description
vfaggregate
computes summary statistics of visual field datavfmean
computes the mean statistics of visual field data. It is a wrapper for vfaggregate but only to compute meansvfretestdist
computes the conditional distribution from test-retest data
Usage
vfaggregate(vf, by = "date", fun = mean, ...)
vfmean(vf, by = "date", ...)
vfretestdist(vf, nbase = 1, nfollow = 1, alpha = 0.1, ...)
Arguments
vf |
a table with visual fields data. Data is rounded, which leaves sensitivity data unchanged, but it is necessary for the nature of the algorithm if the data passed are TD or PD values or summary stats such as averages. Beware of the locations in the blind spot, which very likely need to be removed |
by |
aggregate by |
fun |
a function to compute the summary statistics which can be applied to
all data subsets. The default is ' |
... |
arguments to be passed to or from methods. A useful one to try
is type of quantile calculation ' |
nbase |
number of visual fields to be used as baseline |
nfollow |
number of visual fields to be used as follow up |
alpha |
significance level to derive the conditional retest intervals.
Default value is |
Details
vfaggregate
this is a restricted version ofaggregate
that only allows to use part of the key hierarchically, and operates on all data frames of theVisualField
object. The restriction is that only aggregates that are allowed are 'newkey = c("id", "eye")
' and 'newkey = c("id", "eye", "date")
'. It returns the aggregated value for all numeric columns grouped and ordered by the new key (id and eye, or id, eye, and date). If the aggregate grouping is byeye
and the function, then thedate
returned is the average.
Value
vfaggregate
and vfmean
return a vf data frame with aggregate values
vfretestdist
returns a list with the following elements:
x
with all the test values (x-axis)y
the distribution of retest dB values conditional to each test value inx
. It is a list with as many entries asx
n
number of retest values conditional to each value inx
. It is a list with as many entries asx
ymed
median for each value inx
. It is a list with as many entries asx
ylow
quantile value for significance1 - alpha / 2
for each value inx
. It is a list with as many entries asx
yup
quantile value for significancealpha / 2
for each value inx
. It is a list with as many entries asx
Together ylow
and yup
represent the lower and upper limit of the
(1 - alpha)%
confidence intervals at each value x
.
Examples
# aggregate by date
vfaggregate(vfpwgRetest24d2, by = "date") # compute the mean
vfaggregate(vfpwgRetest24d2, by = "date", fun = sd) # compute standard deviation
# aggregate by eye
vfaggregate(vfpwgRetest24d2, by = "eye") # compute the mean
vfaggregate(vfpwgRetest24d2, by = "eye", fun = sd) # compute standard deviation
# mean by date
vfmean(vfpwgRetest24d2, by = "date")
# mean by eye
vfmean(vfpwgRetest24d2, by = "eye")
# get the retest sensitivity data after removing the blind spot
retest <- vfretestdist(vfpwgRetest24d2, nbase = 1, nfollow = 1)
plot(0, 0, typ = "n", xlim = c(0, 40), ylim = c(0,40),
xlab = "test in dB", ylab = "retest in dB", asp = 1)
for(i in 1:length(retest$x)) {
points(rep(retest$x[i], length(retest$y[[i]])), retest$y[[i]],
pch = 20, col = "lightgray", cex = 0.75)
}
lines(c(0,40), c(0,40), col = "black")
lines(retest$x, retest$ymed, col = "red")
lines(retest$x, retest$ylow, col = "red", lty = 2)
lines(retest$x, retest$yup, col = "red", lty = 2)