getDeaths: Matrix of imputed death times

Description Usage Arguments Details Value Examples

View source: R/getDeaths.R

Description

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

Usage

1
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

1
getDeaths(deathyr, medProb = TRUE)

robschick/tangled documentation built on Dec. 17, 2018, 10:12 a.m.