On Sat, 2006-05-20 at 15:44 +0200, Dimitrios Rizopoulos wrote:
> as an alternative, you can have a look inside cut.default and use the
> part that produces the breaks, i.e.,
>
> breaks <- 10
> groups <- cut(x, breaks = breaks)
> max.bias <- as.vector(tapply(error, groups, mean))
>
> # from cut.d
Actually here is one further simplification. Here we add
the simplify = TRUE to strapply producing an interv
which is the transpose of the prior interv and so
we modify arrows accordingly. Also suggest you
use set.seed when using the random generator
so that the example is exactly reproducible.
One can simplify this slightly using strapply from the gsubfn package.
Given groups, this will create interv. strapply applies the indicated
function, as.numeric, to each matched pattern, i.e. to each string
that represents a number, producing a list of vectors. Then we rbind
those vectors togeth
as an alternative, you can have a look inside cut.default and use the
part that produces the breaks, i.e.,
breaks <- 10
groups <- cut(x, breaks = breaks)
max.bias <- as.vector(tapply(error, groups, mean))
# from cut.default()
nb <- as.integer(breaks + 1)
dx <- diff(rx <- range(x, na.rm = TRUE))
On Sat, 2006-05-20 at 17:39 +0800, Berwin A Turlach wrote:
> G'day Gavin,
>
> > "GS" == Gavin Simpson <[EMAIL PROTECTED]> writes:
>
> GS> The problem is getting the range/interval for each group from
> GS> (4,4.3], so I can automate this.
> Most likely there is an easier way, but this
G'day Gavin,
> "GS" == Gavin Simpson <[EMAIL PROTECTED]> writes:
GS> The problem is getting the range/interval for each group from
GS> (4,4.3], so I can automate this.
Most likely there is an easier way, but this seems to work:
## get the levels of groups:
> tmp <- levels(groups)
##
Hi,
Given some example data:
dat <- seq(4, 7, by = 0.05)
x <- sample(dat, 30)
y <- sample(dat, 30)
error <- x - y
I have broken the rage of x into 10 groups and I can calculate the bias
(mean(error)) for each of these 10 groups:
groups <- cut(x, breaks = 10)
max.bias <- aggregate(error, list(gr