format_data: Format data for 'TMB' calculations.

Description Usage Arguments Value

View source: R/utils.R

Description

Format data for TMB calculations.

Usage

1
format_data(y, X, id)

Arguments

y

Response vector for all subjects. A vector of length n.

X

Covariate matrix from all subjects. A matrix of size n x p.

id

Subject identifiers. A vector of length n consisting of nsub <= n distinct elements. If missing default to rep(1, n), i.e., only one subject.

Value

A list with the following elements:

y

The response vector y, reordered such that all observations for a given subject are consecutive, and converted to an n x 1 column matrix.

Xtr

The transpose of the covariate matrix, reordered the same way as y, having size p x n.

iStart

An integer vector of length nsub, specifying the starting index of the observations for each subject, using C++ indexing (i.e., starting at zero).

nObs

An integer vector of length nsub, specifying the number of observations per subject.


mlysy/losmix documentation built on Jan. 18, 2021, 5:56 a.m.