-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathstats.bin.html
More file actions
102 lines (74 loc) · 2.44 KB
/
Copy pathstats.bin.html
File metadata and controls
102 lines (74 loc) · 2.44 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Bins data and finds some summary statistics.</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>
<table width="100%" summary="page for stats.bin {fields}"><tr><td>stats.bin {fields}</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>
Bins data and finds some summary statistics.
</h2>
<h3>Description</h3>
<p>Cuts up a numeric vector based on binning by a covariate and applies the
fields
stats function to each group
</p>
<h3>Usage</h3>
<pre>
stats.bin(x, y, N = 10, breaks = NULL)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
<p>Values to use to decide bin membership
</p>
</td></tr>
<tr valign="top"><td><code>y</code></td>
<td>
<p>A vector of data
</p>
</td></tr>
<tr valign="top"><td><code>N</code></td>
<td>
<p>Number of bins. If the breaks is missing there are N bins equally spaced
on the range of x.
</p>
</td></tr>
<tr valign="top"><td><code>breaks</code></td>
<td>
<p>The bin boundaries. If there are N+1 of these there will be N bins.
The bin widths can be unequal.
</p>
</td></tr>
</table>
<h3>Value</h3>
<p>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.
</p>
<h3>See Also</h3>
<p>bplot, stats
</p>
<h3>Examples</h3>
<pre>
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")
</pre>
<hr /><div style="text-align: center;">[Package <em>fields</em> version 9.9 <a href="00Index.html">Index</a>]</div>
</body></html>