Description Usage Arguments Value See Also Examples

Cuts up a numeric vector based on binning by a covariate and applies the fields stats function to each group

1 |

`x` |
Values to use to decide bin membership |

`y` |
A vector of data |

`N` |
Number of bins. If the breaks is missing there are N bins equally spaced on the range of x. |

`breaks` |
The bin boundaries. If there are N+1 of these there will be N bins. The bin widths can be unequal. |

A list with several components. stats is a matrix with columns indexing the bins and rows being summary statistics found by the stats function. These are: number of obs, mean, sd, min, quartiles, max and number of NA's. (If there is no data for a given bin, NA's are filled in. ) breaks are the breaks passed to the function and centers are the bin centers.

bplot, stats

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
u<- rnorm( 2000)
v<- rnorm( 2000)
x<- u
y<- .7*u + sqrt(1-.7**2)*v
look<- stats.bin( x,y)
look$stats["Std.Dev.",]
data( ozone2)
# make up a variogram day 16 of Midwest daily ozone ...
look<- vgram( ozone2$lon.lat, c(ozone2$y[16,]), lon.lat=TRUE)
# break points
brk<- seq( 0, 250,,40)
out<-stats.bin( look$d, look$vgram, breaks=brk)
# plot bin means, and some quantiles Q1, median, Q3
matplot( out$centers, t(out$stats[ c("mean", "median","Q1", "Q3"),]),
type="l",lty=c(1,2,2,2), col=c(3,4,3,4), ylab="ozone PPB")
``` |

```
Loading required package: spam
Loading required package: dotCall64
Loading required package: grid
Spam version 2.1-1 (2017-07-02) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
Attaching package: 'spam'
The following objects are masked from 'package:base':
backsolve, forwardsolve
Loading required package: maps
1 2 3 4 5 6 7 8
1.9344308 0.4234618 0.6903594 0.6987889 0.7305328 0.7314753 0.6945809 0.7595942
9 10 11 12 13 14
0.6971363 0.7209923 0.6731544 0.6143412 0.7060829 0.4739856
```

fields documentation built on Jan. 30, 2018, 1:07 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.