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.