vfstats: Statistical analyses for visual fields data

vfaggregateR Documentation

Statistical analyses for visual fields data

Description

  • vfaggregate computes summary statistics of visual field data

  • vfmean computes the mean statistics of visual field data. It is a wrapper for vfaggregate but only to compute means

  • vfretestdist 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 date, that is by id, eye, and date (default) or by eye, that is by id and eye

fun

a function to compute the summary statistics which can be applied to all data subsets. The default is 'mean'

...

arguments to be passed to or from methods. A useful one to try is type of quantile calculation 'type' use in quantile

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 0.1

Details

  • vfaggregate this is a restricted version of aggregate that only allows to use part of the key hierarchically, and operates on all data frames of the VisualField 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 by eye and the function, then the date 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 in x. It is a list with as many entries as x

  • n number of retest values conditional to each value in x. It is a list with as many entries as x

  • ymed median for each value in x. It is a list with as many entries as x

  • ylow quantile value for significance 1 - alpha / 2 for each value in x. It is a list with as many entries as x

  • yup quantile value for significance alpha / 2 for each value in x. It is a list with as many entries as x

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)

visualFields documentation built on March 18, 2022, 7:14 p.m.