I see nothing here to do with the 'bootstrap', which is sampling with replacement.

Do you know what you mean exactly by 'randomly sample'? In general the way to so this is to sample randomly (uniformly, whatever) and reject samples that do not meet your restriction. For some restrictions there are more efficient algorithms, but I don't understand yours. (What are the 'rows'? Do you want to sample rows in space or xy locations? How come 'dist' is not symmetric?) For some restrictions, an MCMC sampling scheme is needed, the hard-core spatial point process being a related example.

On Wed, 3 Sep 2008, Grant Gillis wrote:

Hello List,

I am not sure that I have the correct terminology here (restricted
bootstrap) which may be hampering my archive searches.  I have quite a large
spatially autocorrelated data set.  I have xy coordinates and the
corresponding pairwise distance matrix (metres) for each row.  I would like
to randomly sample some number of rows but restricting samples such that the
distance between them is larger than the threshold of autocorrelation.  I
have been been unsuccessfully trying to link the 'sample' function to values
in the distance matrix.

My end goal is to randomly sample M thousand rows of data N thousand times
calculating linear regression coefficients for each sample but am stuck on
taking the initial sample. I believe I can figure out the rest.


Example Question

I would like to radomly sample 3 rows further but withe the restriction that
they are greater than 100m apart

example data:
main data:

y<- c(1, 2, 9, 5, 6)
x<-c( 1, 3, 5, 7, 9)
z<-c(2, 4, 6, 8, 10)
a<-c(3, 9, 6, 4 ,4)

maindata<-cbind(y, x, z, a)

    y x x a
[1,] 1 1 1 3
[2,] 2 3 3 9
[3,] 9 5 5 6
[4,] 5 7 7 4
[5,] 6 9 9 4

distance matrix:
row1<-c(0, 123, 567, 89)
row2<-c(98, 0, 345, 543)
row3<-c(765, 90, 0, 987)
row4<-c(654, 8, 99, 0)

dist<-rbind(row1, row2, row3, row4)

    [,1] [,2] [,3] [,4]
row1    0  123  567   89
row2   98    0  345  543
row3  765   90    0  987
row4  654    8   99    0

Thanks for all of the help in the past and now

Cheers
Grant

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Brian D. Ripley,                  [EMAIL PROTECTED]
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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to