R language Access Menu

Title Text Both  

Logistic and ordinal regression using rms package

Code:

> bwdf = mybwdf()

> str(bwdf)
'data.frame':   189 obs. of  9 variables:
 $ low  : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
 $ age  : int  19 33 20 21 18 21 22 17 29 26 ...
 $ lwt  : int  182 155 105 108 107 124 118 103 123 113 ...
 $ race : Factor w/ 3 levels "1","2","3": 2 3 1 1 1 3 1 3 1 1 ...
 $ smoke: Factor w/ 2 levels "0","1": 1 1 2 2 2 1 1 1 2 2 ...
 $ ptl  : int  0 0 0 0 0 0 0 0 0 0 ...
 $ ht   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
 $ ui   : Factor w/ 2 levels "0","1": 2 1 1 2 2 1 1 1 1 1 ...
 $ ftv  : int  0 3 1 2 0 0 1 1 1 0 …

> library(rms)
> mod = lrm(low~age+lwt+race+smoke+ptl+ht+ui+ftv, data=bwdf)
> mod

Logistic Regression Model

lrm(formula = low ~ age + lwt + race + smoke + ptl + ht + ui + 
    ftv, data = bwdf)

                      Model Likelihood     Discrimination    Rank Discrim.    
                         Ratio Test            Indexes          Indexes       
Obs            189    LR chi2     33.39    R2       0.228    C       0.746    
 0             130    d.f.            9    g        1.180    Dxy     0.492    
 1              59    Pr(> chi2) 0.0001    gr       3.254    gamma   0.493    
max |deriv| 0.0002                         gp       0.214    tau-a   0.212    
                                           Brier    0.179                     

          Coef    S.E.   Wald Z Pr(>|Z|)
Intercept  0.4806 1.1969  0.40  0.6880  
age       -0.0295 0.0370 -0.80  0.4249  
lwt       -0.0154 0.0069 -2.23  0.0258  
race=2     1.2723 0.5274  2.41  0.0158  
race=3     0.8805 0.4408  2.00  0.0458  
smoke=1    0.9388 0.4022  2.33  0.0196  
ptl        0.5433 0.3454  1.57  0.1157  
ht=1       1.8633 0.6975  2.67  0.0076  
ui=1       0.7676 0.4593  1.67  0.0947  
ftv        0.0653 0.1724  0.38  0.7048  


References:

Frank E Harrell Jr (2015). rms: Regression Modeling Strategies. R package version 4.3-1.
http://CRAN.R-project.org/package=rms


    Comments & Feedback