Learn R Programming

IPMpack (version 1.6)

makeSurvObj: Functions to build survival objects

Description

A function to fit logistic regressions defining survival following user defined formulas (e.g., size+size^2, etc) to build survival objects for which methods to build an IPM object are defined.

Usage

makeSurvObj(dataf,Formula=surv~size+size2)

Arguments

dataf
a dataframe with columns `size' and `surv'(`size' is size at t, `surv' is 0 for death of the individual and 1 for survival); facultatively, dataf may include `covariate' and `covariatel' for a single discrete covariate, indicating values a
Formula
a formula describing the desired explanatory variables (interactions, etc) in classical R style, i.e. separated by `+', `*', `:'. Possible covariates include `size', 'size2' (size^2), `size3' (size^3),`logsize' (log(size)), `logsize2' (log(siz

Value

  • An object of class survObj which is a S4 object which contains the slots:
  • fitan object of class lm or glm that can be used with predict in the survival methods

See Also

picSurv

Examples

Run this code
#generate data
dff <- generateData()
#make simple logistic regression survival object relating survival to size at t
sv1 <- makeSurvObj(dff, Formula=surv~size)
#assess fit for model with discrete environmental classes fitted
sv1 <- makeSurvObj(dff, Formula=surv~size+covariate)

Run the code above in your browser using DataLab