View source: R/partitioned-GLS.R
sample_partitions | R Documentation |
Create a matrix whose columns contain indices of non-overlapping random samples.
sample_partitions(
npix,
npart = 10,
partsize = NA,
pixels = NA,
verbose = FALSE
)
npix |
number of pixels in full dataset |
npart |
number of partitions to create |
partsize |
size of each partition |
pixels |
vector of pixel indexes to sample from |
verbose |
logical: TRUE prints additional info |
If both npart
and partsize
is specified, a partition matrix with
these dimensions is returned. If only npart
, is specified,
partsize
is selected as the largest integer possible that creates
equal sized partitions. Similarly, if only npart = NA
, then npart
is selected to obtain as many partitions as possible.
sample_partitions
returns a matrix with partsize
rows and npart
columns. Columns contain random, non-overlapping samples
from 1:npix
Other partitionedGLS:
MC_GLSpart()
,
crosspart_GLS()
# dummy data with 100 pixels and 20 time points
dat.M <- matrix(rnorm(100*20), ncol = 20)
# 4 partitions (exhaustive)
sample_partitions(npix = nrow(dat.M), npart = 4)
# partitions with 10 pixels each (exhaustive)
sample_partitions(npix = nrow(dat.M), partsize = 10)
# 4 partitions each with 10 pixels (non-exhaustive, produces warning)
sample_partitions(npix = nrow(dat.M), npart = 4, partsize = 10)
# index of 50 pixels to use as subset
sub.indx <- c(1:10, 21:25, 30:62, 70:71)
# 5 partitions (exhaustive) from only the specified pixel subset
sample_partitions(npix = nrow(dat.M), npart = 5, pixels = sub.indx)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.