Differentiate x and y and compute change amplitude via an algorithm proposed by Nyström and Holmqvist (2010) doi:10.3758/BRM.42.1.188
Source:R/diff_nh.R
diff_nh.Rd
Differentiate x and y and compute change amplitude via an algorithm proposed by Nyström
and Holmqvist (2010) doi:10.3758/BRM.42.1.188
. Note that both components and the amplitude are smoothed
independently via a Savitzky-Golay filter, so the components may not (probably won't) add up to
the amplitude. Note that filtering is sensitive to the presence of NA
.
Arguments
- x
vector with x coordinates in degrees of visual angle
- y
vector with y coordinates in degrees of visual angle
- trial
vector with trial index
- sample_rate
sample rate in Hz
- options
List with method specific options, see Details.
Details
Method options, please refer to Nyström and Holmqvist (2010) for details on parameters and the rationale for default values.
nh_sg_filter_order
Order of Savitzky-Golay filter. Defaults to2
.
Examples
diff_nh(rnorm(1000), rnorm(1000), rep(1, 1000), 250, list("nh_sg_filter_order" = 2))
#> # A tibble: 1,000 × 3
#> x y amp
#> <dbl> <dbl> <dbl>
#> 1 NA NA NA
#> 2 NA NA NA
#> 3 NA NA NA
#> 4 NA NA NA
#> 5 NA NA NA
#> 6 NA NA NA
#> 7 NA NA NA
#> 8 -34.5 -31.0 674.
#> 9 -140. 147. 364.
#> 10 89.5 -298. 207.
#> # … with 990 more rows