Learn R Programming

logistf (version 1.20)

anova.logistf: Analysis of penalized deviance for logistf models

Description

This method compares hierarchical and non-hierarchical logistf models using penalized likelhood ratio tests. It replaces the function logistftest of former versions of logistf.

Usage

## S3 method for class 'logistf':
anova(object, fit2, formula, method = "nested", ...)

Arguments

object
a fitted logistf model object
fit2
another fitted logistf model object, to be compared with object
formula
alternatively to fit2, a formula which specifies terms to omit from the object model fit.
method
One of c("nested","PLR"). nested is the default for hierarchically nested models, and will compare the penalized likelihood ratio statistics (minus twice the difference between maximized penalized log likelihood and null penaliz
...
Further arguments passed to the method.

Value

  • An object of class anova.logistf with items
  • chisqthe chisquared statistic for the model comparison
  • dfthe degrees of freedom
  • pvalthe p-value
  • callthe function call
  • methodthe method of comparison (input)
  • model1the first model
  • model2the second model which was compared to the first model
  • PLR1the PLR statistic of the first model
  • PLR2the PLR statistic of the second model; for the nested method, this will be the drop in chi-squared due to setting the coefficients to zero

Details

Comparing models fitted by penalized methods, one must consider that the penalized likelihoods are not directly comparable, since a penalty is involved. Or in other words, inserting zero for some regression coefficients will not lead to the same penalized likelihood as if the corresponding variables are simply "unknown" to a model. The anova method takes care that the same penalty is used for two hierarchically nested models, and if the models are not hierarchically nested, it will first relate each penalized likelihood to its null penalized likelihood, and only compare the resulting penalized likelihod ratio statistics. The chi-squared approximation for this latter method (PLR) is considered less accurate than that of the nested method. Nevertheless, it is the only way to go for comparison of non-nested models.

Examples

Run this code
data(sex2)
fit<-logistf(data=sex2, case~age+oc+dia+vic+vicl+vis)

#simultaneous test of variables vic, vicl, vis:
anova(fit, formula=~vic+vicl+vis)

#test versus a simpler model
fit2<-logistf(data=sex2, case~age+oc+dia)
# or: fit2<-update(fit, case~age+oc+dia)
anova(fit,fit2)


# comparison of non-nested models (with different df):
fit3<-logistf(data=sex2, case~age+vic+vicl+vis)
anova(fit2,fit3, method="PLR")

Run the code above in your browser using DataLab