[R] ranking predictive features in logsitic regression

David Firth d.firth at warwick.ac.uk
Fri Jul 1 17:36:14 CEST 2005


On 30 Jun, 2005, at 21:20, Stephen Choularton wrote:

> Hi
>
> Is there some function R that multiplies each coefficient by the
> standard deviation of the corresponding variable and produces a 
> ranking?
>
>

Possibly you meant un-signed coefficients?  In which case something like

   function(model) rank(abs(coef(model)) * apply(model.matrix(model), 2, 
sd))

should do what you asked about.

The "relimp" package provides approximate inference for comparisons of 
this kind.

I should say that I don't think that such a ranking will often be very 
useful, though.  Some coefficients will be determined with greater 
precision than others, and there may be correlations to worry about, or 
variables may only make sense when considered in groups (eg factor 
effects, or interactions with corresponding main effects, etc.)

David




More information about the R-help mailing list