getDeaths: Matrix of imputed death times

View source: R/getDeaths.R

getDeathsR Documentation

Matrix of imputed death times

Description

getDeaths returns a matrix of all of the estimated death times for each animal in the model

Usage

getDeaths(deathyr, medProb = TRUE)

Arguments

deathyr

A matrix where each row contains the estimated death times for each animal. Times are in the columns from 1:bnt, which allows for the animal to be alive at the time modelling end.

medProb

logical indicating whether you want to sample from the deaths using a multinomial, or just extract the median death month (default)

Details

This is a function that will build an object to be used in the construction of the Kaplan-Meier survival curves for right whales. The idea behind this is to loop over the deathyr matrix and sample a death time for each animal. The sampling is done with a call to rmultinom based on the estimates of death. These estimates are normalised, and then we choose a candidate month.

Value

The output will be a vector of sampled death times. Each column will represent an individual animal's sampled times.

Examples

getDeaths(deathyr, medProb = TRUE)

robschick/tangled documentation built on May 9, 2022, 4:07 p.m.