makeSurvObj | R Documentation |
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.
makeSurvObj(dataf,Formula=surv~size+size2, coeff=NULL)
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 at t, and at t+1, respectively; these must take values of sequential integers, starting at ‘1’. |
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(size)^2), and
‘covariate’. Response should be 'surv' to match |
coeff |
numeric vector of required coefficients to be imposed if dataf is NULL; must be compatible with Formula |
An object of class survObj which is a S4 object which contains the slots:
fit |
an object of class |
Slots can be listed by using slotNames(survObj)
See manual for details on building case-specific survival objects.
C. Jessica E. Metcalf, Sean M. McMahon, Roberto Salguero-Gomez & Eelke Jongejans
picSurv
#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) #now specifying parameters and supplying no data sv1 <- makeSurvObj(Formula = surv ~ size + covariate,coeff=c(1,1,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.