Compute all the single terms in the scope argument that can be added to or dropped from the model, fit those models and compute a table of the changes in fit.

# S3 method for class 'logistf'
add1(object, scope, data, test = "PLR", ...)

Arguments

object

A fitted logistf, flic or flac object

scope

The scope of variables considered for adding or dropping. Should be a vector of variable names. Can be left missing; the method will then use all variables in the object's data slot which are not identified as the response variable.

data

The data frame used to fit the object.

test

The type of test statistic. Currently, only the PLR test (penalized likelihood ratio test) is allowed for logistf fits.

...

Further arguments passed to or from other methods.

Value

A matrix with nvar rows and 3 columns (Chisquared, degrees of freedom, p-value).

Details

drop1 and add1 generate a table where for each variable the penalized likelihood ratio chi-squared, the degrees of freedom, and the p-value for dropping/adding this variable are given.

Examples

data(sex2) 
fit<-logistf(data=sex2, case~1, pl=FALSE) 
add1(fit, scope=c("dia", "age"), data=sex2)
#>        ChiSq df    P-value
#> dia 6.359199  1 0.01167743
#> age 5.537045  1 0.01861799
 
fit2<-logistf(data=sex2, case~age+oc+dia+vic+vicl+vis) 
drop1(fit2, data=sex2)
#>            ChiSq df      P-value
#> age   7.50773092  1 6.143472e-03
#> oc    0.02467044  1 8.751911e-01
#> dia   7.89693139  1 4.951873e-03
#> vic  22.93139022  1 1.678877e-06
#> vicl 19.10407252  1 1.237805e-05
#> vis   3.69740975  1 5.449701e-02