vecr2matr {bayesSurv} | R Documentation |
Transform single component indeces to double component indeces
Description
Components of a bivariate G-spline can be indexed in several
ways. Suppose that the knots in the first dimension are
and the knots in the second dimension
I.e. we have
knots in the first dimension and
knots in the second dimension. Each G-spline
component can have a double index
assigned which means that it corresponds to the knot
or alternatively the same G-spline component can have a~single index
assigned where takes values from
. Single indexing is used
for example by files
r.sim
and r_2.sim
generated by
functions bayesHistogram
, bayesBisurvreg
,
bayessurvreg2
to save some space.
This function serves to translate single indeces to double indeces using the relationship
The function can be used also in one dimensional case when a~simple relationship holds
Usage
vecr2matr(vec.r, KK)
Arguments
vec.r |
a~vector of single indeces |
KK |
a~vector with numbers of knots on each side of the central
knot for each dimension of the G-spline. The length of |
Value
In bivariate case: a~matrix with two columns and as many rows as the
length of vec.r
.
In univariate case: a~vector with as ,amy components as the length of vec.r
.
Author(s)
Arnošt Komárek arnost.komarek@mff.cuni.cz
Examples
### Bivariate G-spline
### with 31 knots in each dimension
KK <- c(15, 15)
### First observation in component (-15, -15),
### second observation in component (15, 15),
### third observation in component (0, 0)
vec.r <- c(1, 961, 481)
vecr2matr(vec.r, KK)