neonate.survival: neonate.survival

View source: R/neonate.survival.R

neonate.survivalR Documentation

neonate.survival

Description

Convert capture data of neonates into the proper format for conducting survival analysis. This function will return 2 columns of data: survival time of each in whatever units desired (days, weeks, months, etc.) and an indicator column of whether the event (i.e., mortality) occurred in binary format. Further, this function allows the option to use a cutoff age for modeling survival. For instance, in many cases survival of neonatal ungulates is modeled to 140 days.

Usage

neonate.survival(dbpath, startdate, enddate, units, cuts, cutoff, fatecol,
  censors, model)

Arguments

dbpath

path to neonate database

startdate

name of column where birth date or capture date is stored

enddate

name of column where mortality date is stored

units

Units desired for modeling survival (e.g. days, weeks, etc)

cuts

Logical. TRUE/FALSE. Whether you desire to use a cutoff date for survival

cutoff

days from birth to use as cutoff (e.g. 140 days, indicate 140)

fatecol

name of column where fate/cause of death is stored

censors

Vector of causes in your data.frame in which events should be censored (i.e. CollarFailure)

model

Logical. TRUE/FALSE. Whether model of survival (stratified by year) should be done

Value

Returns a list that includes original dataframe with time alive, and indicator of event as well as the model of survival (if model == TRUE)

Examples

neo.survival<-neonate.survival(dbpath = yourpath, units = "days", cuts = TRUE, cutoff = 140, censors = "collar_failure", model = TRUE)


khuggler/Ovis documentation built on Nov. 30, 2023, 7:41 p.m.