rolling_test_dist {tectonicr} | R Documentation |
Apply Rolling Functions using Circular Statistics
Description
A generic function for applying a function to rolling margins of an array along an additional value.
Usage
distroll_circstats(
x,
distance,
FUN,
width = NULL,
min_n = 2,
align = c("right", "center", "left"),
w = NULL,
sort = TRUE,
...
)
distroll_confidence(
x,
distance,
w = NULL,
width = NULL,
min_n = 2,
align = c("right", "center", "left"),
sort = TRUE,
...
)
distroll_dispersion(
x,
y,
w = NULL,
w.y = NULL,
distance,
width = NULL,
min_n = 2,
align = c("right", "center", "left"),
sort = TRUE,
...
)
distroll_dispersion_sde(
x,
y,
w = NULL,
w.y = NULL,
distance,
width = NULL,
min_n = 2,
align = c("right", "center", "left"),
sort = TRUE,
...
)
Arguments
x , y |
vectors of numeric values in degrees. |
distance |
numeric. the independent variable along the values in |
FUN |
the function to be applied |
width |
numeric. the range across |
min_n |
integer. The minimum values that should be considered in |
align |
specifies whether the index of the result should be left- or right-aligned or centered (default) compared to the rolling window of observations. This argument is only used if width represents widths. |
w |
numeric. the weighting for |
sort |
logical. Should the values be sorted after |
... |
optional arguments to |
w.y |
numeric. the weighting for |
Value
two-column vectors of (sorted) x
and the rolled statistics along
distance
.
Examples
data("plates")
plate_boundary <- subset(plates, plates$pair == "na-pa")
data("san_andreas")
PoR <- subset(nuvel1, nuvel1$plate.rot == "na")
san_andreas$distance <- distance_from_pb(
x = san_andreas,
PoR = PoR,
pb = plate_boundary,
tangential = TRUE
)
dat <- san_andreas |> cbind(PoR_shmax(san_andreas, PoR, "right"))
distroll_circstats(dat$azi.PoR, distance = dat$distance, w = 1 / dat$unc, FUN = circular_mean)
distroll_confidence(dat$azi.PoR, distance = dat$distance, w = 1 / dat$unc)
distroll_dispersion(dat$azi.PoR, y = 135, distance = dat$distance, w = 1 / dat$unc)
distroll_dispersion_sde(dat$azi.PoR, y = 135, distance = dat$distance, w = 1 / dat$unc, R = 100)