expWeight: This function computes the smooth windowing weights

Description Usage Arguments Value Author(s) See Also Examples

View source: R/auxFuncs.R

Description

This function computes the exponential weights (smooth windowing function) for different shapes (k) and bandwidth (l) and provides some plots

Usage

1
  expWeight(t, k, l, m = 0, plot = FALSE, ...)

Arguments

t

Vector. a vector of positive continuous values

k

A single value for sharpness

l

A single value for bandwidth

m

Vector. The location of the modes on t (modes are the peak of the windows)

plot

Logical flag. Set to true shows a plot of the weights.

...

The parameters that can be passed to the plot() function

Value

A vector of weights

Author(s)

Hamed Haselimashhadi <[email protected]>

See Also

SmoothWin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  par(mfrow = c(3, 1))
  # Example 1 - no merging in windows
  weight = expWeight(
    t = 1:100                                       ,
    k = 5                                           ,
    l = 10                                          ,
    m = c(25, 50, 75)                               ,
    plot = TRUE                                     ,
    ### Passed parameters to the plot function
    type = 'l'                                      ,
    lty = 2                                         ,
    lwd = 3                                         ,
    main = 'If windows do not intersect, then wont merge!'
  )
  # Example 2 - merging in windows
  weight = expWeight(
    t = 1:100                                       ,
    k = 5                                           ,
    l = 15                                          ,
    m = c(25, 50, 75)                               ,
    plot = TRUE                                     ,
    ### Passed parameters to the plot function
    type = 'l'                                      ,
    lty = 2                                         ,
    lwd = 3                                         ,
    main = 'If windows intersect, then merge!'
  )
  # Example 3 - partial merging in windows
  weight = expWeight(
    t = 1:100                                       ,
    k = 1                                           ,
    l = 12                                          ,
    m = c(25, 50, 75)                               ,
    plot = TRUE                                     ,
    ### Passed parameters to the plot function
    type = 'l'                                      ,
    lty = 2                                         ,
    lwd = 3                                         ,
    main = 'If windows intersect with small k, then partially merge!'
  )

SmoothWin documentation built on July 19, 2018, 9:07 a.m.