mapindex: Index in one vector mapped to treatment and observation index

Description Usage Arguments Value Examples

View source: R/functions.R

Description

Function mapindex() maps the 1-d index r=1,...,N to 2-d index i=1, ...a, j=1, ..., ni. Generally the covariate values from all treatments are stored together in one vector and r=1,...,N enumerates the values. For any integer between 1 and N, mapindex tells which treatment the rth value belongs to, and which observation in the identified treatment.

Usage

1
mapindex(r, n)

Arguments

r

an integer between 1 and sum(n).

n

a vector of the sample sizes.

Value

the 2-d index, where the first gives which treatment the value belongs to and the second gives which observation in that treatment.

Examples

1
2
3
r=5; n=c(7, 8); mapindex(r, n)
r=7; n=c(7, 8); mapindex(r, n)
r=9; n=c(7, 8); mapindex(r, n)

PSSIM documentation built on Sept. 13, 2020, 5:18 p.m.

Related to mapindex in PSSIM...