create.grid {gplm}R Documentation

Create a grid for kernel estimation

Description

Helps to define a grid for kernel denity or regression estimates (univariate or multivariate).

Usage

create.grid(grid.list, sort=TRUE)

Arguments

grid.list

list of 1-dimensional vectors containing the grid values for each dimension

sort

sort the vectors (can be set to FALSE if vectors are already sorted in ascending order)

Details

This function allows easily to define grids for the "gplm" package. If the data are d-dimensional and the grid vector lengths are n1, ... nd, then the output is a (n1*...*nd) x d matrix with each row corresponding to one d-dimensional data point at which the function estimate is to be calculated.

Value

m x d grid matrix

Author(s)

Marlene Mueller

See Also

expand.grid, kde, kreg

Examples

  v1 <- 1:5
  v2 <- 3:1
  grid <- create.grid(list(v1,v2))

  x <- matrix(rnorm(60),30,2)
  v1 <- seq(min(x[,1]),max(x[,1]),length=10)
  v2 <- seq(min(x[,2]),max(x[,2]),length=5)
  grid <- create.grid(list(v1,v2))

[Package gplm version 0.7-4 Index]