Skip to contents

A function that will convolve over the one dimensional vector of raw impressions over time and apply the adstock weights.

Usage

adstock_w(x, w, l)

Arguments

x

vector

w

weights

l

maximum adstock length

Value

a numeric vector of length(x) with adstock transformed media impressions.

Examples

data(mmm_imps)
x <- mmm_imps$mi_banners
w <- geometric_adstock_weights()
l <- length(w)
a <- adstock_w(x, w, l)

x[1:12]
#>  [1]    0.000 3731.596 2217.981    0.000 4274.270 2801.566 3329.304 2652.199
#>  [9] 3066.319 2415.696    0.000    0.000
a[1:12]
#>  [1] 1432.5600 2865.1200 1997.7330 1777.7585 3556.3257 2838.0783 2874.8193
#>  [8] 2420.2907 2188.6512 1311.0397  206.7044  414.1895