[R] bootstraping lm
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Thu Jan 16 16:04:04 CET 2003
That's not a problem in boot, but a problem in your usage of it.
On 16 Jan 2003, Ernesto Jardim wrote:
> Hi
>
> I found the problem (I hope:).
>
> In "boot" a data.frame with the expected results from "statistic" is
> created, "t.star", wich has dim[[1]]=sum(R), the number of replicates,
> and dim[[2]]=lt0, the length of the output of statistic using the
> original data.
>
> t0 <- statistic(data, original, ...)
> lt0 <- length(t0)
> t.star <- matrix(NA, sum(R), lt0)
>
> However when fitting the "lm" with different sets of data, it might
> happen that the result of "statistic" is not of the same length has with
> the original data. That's when
>
> for (r in 1:sum(R)) t.star[r, ] <- statistic(data, i[r,], ...)
>
> fails, because its not able to replace the complete row of t.star.
>
> So "statistic" shall guarantee that all the outputs are of the same
> length.
>
> Something you might want to had to "boot" documentation.
It's already there:
statistic: A function which when applied to data returns a vector
containing the statistic(s) of interest.
t: A matrix with `R' rows each of which is a bootstrap replicate
of `statistic'.
Where does it say that the statistic(s) of interest can change by
replicate?
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list