getvalidrows {bmstdr}R Documentation

Returns a vector of row numbers for validation.

Description

Returns a vector of row numbers for validation.

Usage

getvalidrows(sn, tn, valids, validt = NULL, allt = FALSE)

Arguments

sn

The total number of spatial locations.

tn

The total number of time points in each location.

valids

A vector of site numbers in (1:sn) to be used for validation.

validt

A vector of time points in (1:tn) to be used for validation.

allt

Whether all the time points should be used for validation.

Value

Integer vector providing the row numbers of the data frame for validation. Output of this function is suitable as the argument validrows for the bmstdr model fitting functions Bsptime, Bcartime.

Examples

{
# To validate at site numbers 1, 5, and 10 at 31 randomly selected
# time points for the nysptime data set we issue the following commands
set.seed(44)
vt <- sample(62, 31)
vrows <- getvalidrows(sn=28, tn=62, valids=c(1, 5, 10), validt=vt)
# To validate at sites 1 and 2 at all time points
vrows <- getvalidrows(sn=28, tn=62, valids=c(1, 2), allt=TRUE)
}

[Package bmstdr version 0.7.9 Index]