grid1 {mclust} | R Documentation

## Generate grid points

### Description

Generate grid points in one or two dimensions.

### Usage

    grid1(n, range = c(0, 1), edge = TRUE)
    grid2(x, y)

### Arguments

`n` | Number of grid points.
`range` | Range of grid points.
`edge` | Logical: include edges or not?
`x, y` | Vectors.

### Value

The value returned is simple: `grid1` generates a vector; `grid2` generates a matrix.

### Author(s)

C. Fraley

### See Also

`lansing`, `dens`

### Examples

    data(lansing)
    maples <- lansing[as.character(lansing[,"species"]) == "maple", -3]
    maplesBIC <- EMclust(maples)
    maplesModel <- summary(maplesBIC, maples)
    x <- grid1(100, range=c(0,1))
    y <- x
    xyDens <- do.call("dens", c(list(data=grid2(x, y)), maplesModel))
    xyDens <- matrix(xyDens, ncol=100)
    contour(xyDens)
    points(maples, cex=.2, col="red")

    image(xyDens)
    points(maples, cex=.5)

[Package Contents]