smooth_hist: Histogram smoothing for whitestripe

View source: R/smooth_hist.R

smooth_histR Documentation

Histogram smoothing for whitestripe

Description

Uses a generalized additive model (GAM) to smooth a histogram for whitestripe

Usage

smooth_hist(
  x,
  y,
  deg = 4,
  k = floor(min(250, length(x)/2)),
  method = "REML",
  ...
)

Arguments

x

values of midpoints from hist

y

values of counts from hist

deg

degree of polynomials used

k

Number of knots

method

Method for smoothing for GAM

...

Arguments passed to gam

Value

List of objects: x and y coordinates of histogram, coefficients from GAM, fitted values from GAM, the GAM model, the knots fitted, and degrees of polynomials

See Also

gam

Examples

data(t2.voi.hist)
y = t2.voi.hist$counts
x = t2.voi.hist$mids
x = x[!is.na(y)];
y = y[!is.na(y)]
# 30 used for speed of example
s.hist = smooth_hist(x, y, k=30)
plot(t2.voi.hist, border="red")
lines(s.hist)

muschellij2/WhiteStripe documentation built on Aug. 31, 2022, 8:42 p.m.