smooth

smooth, function

def pure smooth(r: ranvar): ranvar

Returns a smoothed variant of the ranvar r, intended to reduce overfitting from sparse observations.

Example

table T = with
  [| as Obs |]
  [| 1 |]
  [| 0 |]
  [| 0 |]
  [| 2 |]

r = ranvar(T.Obs)
s = smooth(r)

show summary "Smooth" with
  mean(r) as "MeanR"
  mean(s) as "MeanS"
  dispersion(r) as "DispR"
  dispersion(s) as "DispS"

This outputs the following summary:

MeanR MeanS DispR DispS
0.75 0.7498437 0.9166667 1.915443

Remarks

The smoothing replaces each bucket with a Poisson distribution whose mean is the bucket index and whose weight is the bucket weight. Negative indices are reflected.

User Contributed Notes
0 notes + add a note