extractIndlPeriod: This function takes as input a matrix M and two vectors,...

View source: R/extractIndlPeriod.R

extractIndlPeriodR Documentation

This function takes as input a matrix M and two vectors, vecIndls and vecPeriods It returns the vector whose i-th line is given by M[vecIndls[i], vecPeriods[i]].

Description

Instead of vectors, vecIndls and vecPeriods can also be matrices, in which case the (i, j)-th element of the output is M[vecIndls[i, j], vecPeriods[i, j]].

Usage

extractIndlPeriod(M, vecPeriods, vecIndls = NULL)

Arguments

M

n x T matrix from which we want to extract elements.

vecPeriods

vector corresponding to the column numbers of the elements we want to extract. Can also be a constant, it will then be constant for all elements of vecIndls. NAs are passed on to the output.

vecIndls

vector corresponding to the row numbers of the elements we want to extract. Can also be a constant, it will then be constant for all elements of vecPeriods. Default is all rows, once, in order (the vector 1:n).

Details

If one is a vector and the other a matrix, the vector is interpreted as column vector standing for a matrix constant on each row (for vecIndls) or as a row vector standing for a matrix constant for each column (for vecPeriods).

Value

If vecPeriods and vecIndls are vectors, returns the vector whose i-th line is given by M[vecIndls[i], vecPeriods[i]]. If either is a matrix, returns the matrix whose (i, j)-th element of the output is M[vecIndls[i, j], vecPeriods[i, j]].


cgaillac/MarginalFElogit documentation built on Dec. 24, 2024, 3:23 p.m.