Skip to contents

A loess regression is fit to the surface measurements and residuals are calculated. The most extreme 0.25% of residuals are filtered from further consideration. The result is called the raw signature of the bullet land. Adapted from fit_loess in bulletr

Usage

cc_fit_loess(ccdata, span = 0.75)

Arguments

ccdata

The crosscut as returned from x3p_to_df, grooves need to be removed ahead of time

span

The span to use for the loess regression

Value

a list of a data frame of the original bullet measurements extended by loess fit, residuals, and standard errors and two plots: a plot of the fit, and a plot of the bullet's land signature.

Examples

library(dplyr)
ccdata <- data_frame(
  x = seq(0, 6, .001),
  value = 10 - (3 - x)^2 + rnorm(length(x), sd = .25)
)
cc_fit_loess(ccdata = ccdata)
#> # A tibble: 6,001 × 7
#>        x value fitted  raw_sig     se abs_resid chop 
#>    <dbl> <dbl>  <dbl>    <dbl>  <dbl>     <dbl> <lgl>
#>  1 0     0.462   1.01 -0.549   0.0123   0.549   FALSE
#>  2 0.001 0.788   1.02 -0.228   0.0123   0.228   FALSE
#>  3 0.002 0.997   1.02 -0.0259  0.0123   0.0259  FALSE
#>  4 0.003 0.567   1.03 -0.462   0.0123   0.462   FALSE
#>  5 0.004 1.30    1.03  0.270   0.0122   0.270   FALSE
#>  6 0.005 0.764   1.04 -0.277   0.0122   0.277   FALSE
#>  7 0.006 0.824   1.05 -0.222   0.0122   0.222   FALSE
#>  8 0.007 0.842   1.05 -0.211   0.0122   0.211   FALSE
#>  9 0.008 1.06    1.06 -0.00254 0.0122   0.00254 FALSE
#> 10 0.009 0.733   1.06 -0.331   0.0122   0.331   FALSE
#> # ℹ 5,991 more rows