anova.nltm {nltm} | R Documentation |
Analysis of deviance table for NLT models
Description
If a single model is specified, gives a sequential analysis of deviance table for that fit.
Each row of the table represents a model, the first corresponds to the NULL model and the following rows correspond to models in which variables have been added sequentially. If a model has both, long term and short term covariates, long term covariates are added first. The last row corresponds to the input model (object).
Each row of the table gives the likelihood ratio test for comparing the model corresponding to that row and the one without the indicated covariate (Deviance) and its degrees of freedom (Df). It also gives -2 times the loglikelihood for the model (Resid. Dev) and its degrees of freedom (Resid. Df). Optionally it gives the p-value for the likelihood ratio test.
If more than one object is specified, the table has a row for each model. It specifies -2 times the loglikelihood for the model (Resid. Dev) and its degrees of freedom (Resid. Df). It also gives the likelihood ratio test for comparing the model corresponding to the given row with that of the previous row. (This only makes statistical sense if the models are nested.) Optionally it gives the p-value for the likelihood ratio test.
Usage
## S3 method for class 'nltm'
anova(object, ..., test=FALSE)
Arguments
object |
An object of class |
... |
Further |
test |
If TRUE the p-value for the likelihood ratio test is computed. Default is FALSE. |
Value
An object of class "anova"
inheriting from class
"data.frame"
with the information given in the description.
Warning
The comparison between two or more models by anova
will only be
valid if they are fitted to the same dataset. This may be a problem if
there are missing values.
See Also
nltm
, anova
.
Examples
data(melanoma, package="nltm")
fit1 <- nltm(formula1=Surv(time,status) ~ size + stage,
formula2=Surv(time,status) ~ size, data=melanoma, nlt.model="PH")
anova(fit1)
anova(fit1,test=TRUE)
fit2 <- nltm(formula1=Surv(time,status) ~ size + stage + age,
formula2=Surv(time,status) ~ size + age, data=melanoma, nlt.model="PH")
anova(fit1,fit2,test=TRUE)