compare_PSMdist: Compare Different Distributions for Parametric Survival...

Description Usage Arguments Details Value See Also Examples

Description

Choosing the best distribution for parametric survivial models is not trivial. One possibility is to select of all plausible distributions the one with which the resulting models' AIC is minimal. Therefore, several models have to be fitted and compared. compare_PSMdist fits the models for all distributions that come into consideration by calling survreg. The fitting of the models is parallelised via snowfall.

Usage

1
2
3
compare_PSMdist(Formula, Data, Distributions = c("weibull", "exponential",
  "lognormal", "loglogistic"), parallel = TRUE, cpus = NULL,
  type = "SOCK", level = 0.95, ...)

Arguments

Formula

A formula expression as for other regression models passed to survreg. The response has to be a survival object as returned by the Surv function.

Data

A data frame where the variables in formula are found.

Distributions

A character vector. The names of the distributions to be used. See survreg for the possible distributions.

parallel

Logical determinating parallel or sequential execution, passed to sfInit.

cpus

Passed to sfInit.

type

Passed to sfInit.

level

Passed to sfInit.

...

Further arguments passed to sfInit, confint, and survreg.

Details

If parallel = TRUE (the default) and cpus is not specified, on Unix systems all but one CPU will be used by sfInit. Other systems will use cpus = 2.

Value

A list consiting of:

Formula

The formula used for the fitting call.

Distribution

A character vector naming the distributions used for the models. It defines the order for the following list elements.

Fit

A logical vector: if FALSE the corresponding model could not be fitted without problems and a Message is returned.

Message

A character vector: NA if the corresponding model was fitted without problems, otherwise the error message.

AIC

A numeric vector with the AIC of the models. NA if the fitting of the corresponding model caused problems.

Effects

A numeric array: the levels of the model effects define the rows, three columns (estimated coefficient, lower and upper confidence limits at 95%-level as default), and separate layers for each distribution. NA if the fitting of the corresponding model caused problems.

logScale

A numeric matrix with one row for each distribution, and three columns (estimated coefficient, lower and upper confidence limits at 95%-level as default). NA if the fitting of the corresponding model caused problems.

FrailtyVar

A numeric vector with the estimated variance of the frailty effect (if one is included.). NA if the fitting of the corresponding model caused problems.

See Also

show_comparison produces a print- and readable table of the comparison.

Examples

1
2
3
4
5
6
intS2 <- with(MIC, create_int2Surv(concentration, inhibition))
compare_PSMdist(as.formula("intS2 ~ region"), Data = cbind(intS2, MIC))
compare_PSMdist(as.formula("intS2 ~ region + frailty(herd, sparse = FALSE)"),
 Data = cbind(intS2, MIC), cpus = 2, control = survreg.control(maxiter = 100))
compare_PSMdist(as.formula("intS2 ~ 1 + frailty(herd, sparse = FALSE)"),
 Data = cbind(intS2, MIC), cpus = 2, control = survreg.control(maxiter = 100))

VZoche-Golob/AFTtools documentation built on May 9, 2019, 9:42 p.m.