survwrapper {Survomatic}  R Documentation 
Takes one or two vectors of event times (numeric format) and optionally corresponding vectors of indicator variables to designate rightcensored events. Fits several mortality models, selects the best fitting one/s, and if two vectors were given, tests hypotheses about the model parameters.
survwrapper(x, y = NULL, models = c("g", "gm", "l", "lm"), cx = rep(1, length(x)), cy = rep(1, length(y)), ext = F, n = length(c(x, y)), AIC = F, BIC = F, breakties = "AIC", compare.matrix = NULL, constraint.matrix = NULL, thresh = 0.05, smooth = 7)
x 
A numeric vector of event times. For example, number of days an individual has survived. 
y 
An optional second numeric vector of event times, in the same units as

models 
A character vector of model names: 
cx 
A vector of 0 and 1 the same length as 
cy 
A vector of 0 and 1 the same length as 
ext 
Not implemented. 
n 
Total sample size. Should normally be left for the script to automatically calculate, but can be specified when survwrapper is called from another script repeatedly in order to speed up runtimes. 
AIC 
Whether to calculate the AIC (Akaike Information Criterion) for each candidate model. 
BIC 
Whether to calculate the BIC (Bayes Information Criterion) for each candidate model. 
breakties 
What criterion to use for choosing a model if more than one is justified by the comparisons. 
compare.matrix 
A matrix for specifying a customized comparison algorithm. 
constraint.matrix 
A matrix of 1's and 0's for specifying a customized set of parameter constraints to test. 
thresh 
Significance cutoff. 
smooth 
Not yet supported. 
In progress.
x.m 

y.m 

xy.sm 

par.differences 

x 

y 

cx 

cy 

x.d 

y.d 

suggested.models 

nx 

ny 
Uses NelderMead algorithm to find maximum likelihood estimates of model parameters.
Alex F. Bokov (bokov@uthscsa.edu), Jon A. Gelfond
Pletcher,S.D., Khazaeli,A.A., and Curtsinger,J.W. (2000). Why do life spans differ? Partitioning mean longevity differences in terms of agespecific mortality parameters. Journals of Gerontology Series ABiological Sciences and Medical Sciences 55, B381B389
## Generate two sets of survival times. population1 < simsurv(629,type='g',p=c(7.33e4,0.1227,0,0)); population2 < simsurv(574,type='lm',p=c(5.4818e5,0.1543,0.0023,0.6018)); ## Fit models to the populations and compare the parameters. models1vs2 < survwrapper(population1,population2);