convol: Kernel convolution

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Calculates the convolution of data with a kernel function.

Usage

1
2
convol(x, h = 1, grid = NULL, y = 1, w = 1, p = 2, q = 2,
       product = TRUE, sort = TRUE)

Arguments

x

n x d matrix, data

h

scalar or 1 x d, bandwidth(s)

grid

m x d matrix, where to calculate the convolution (default = x)

y

n x c matrix, optional responses

w

scalar or n x 1 or 1 x m or n x m, optional weights

p

integer or text, see kernel.function

q

integer, see kernel.function

product

(if d>1) product or spherical kernel

sort

logical, TRUE if data need to be sorted

Details

The kernel convolution which is calculated is ∑_i K_h(x_i - grid_{j})\,y_i\,w_{ij} for i=1,...,n and j=1,...,m. The kernel function is determined by the kernel parameters p and q, see kernel.function. The default kernel is the biweight (quartic) kernel function. Note that the DLL requires the data matrix to be sorted by its first column.

Value

m x c matrix

Author(s)

Marlene Mueller

See Also

kernel.function, kde, kreg

Examples

1
2
3
  n <- 100
  x <- rnorm(n)
  convol(x,h=0.8,grid=-3:3)/n  ## estimates density of x at points -3:3

Example output

Loading required package: AER
Loading required package: car
Loading required package: lmtest
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: sandwich
Loading required package: survival
            [,1]
[1,] 0.019463990
[2,] 0.093564823
[3,] 0.340329127
[4,] 0.301122730
[5,] 0.219292581
[6,] 0.038365277
[7,] 0.005806487

gplm documentation built on May 2, 2019, 2:10 a.m.