Glm: rms Version of glm

Description Usage Arguments Value See Also Examples

View source: R/Glm.s

Description

This function saves rms attributes with the fit object so that anova.rms, Predict, etc. can be used just as with ols and other fits. No validate or calibrate methods exist for Glm though.

For the print method, format of output is controlled by the user previously running options(prType="lang") where lang is "plain" (the default), "latex", or "html".

Usage

1
2
3
4
5
6
7
8
Glm(formula, family = gaussian, data = list(), weights = NULL, subset =
NULL, na.action = na.delete, start = NULL, offset = NULL, control =
glm.control(...), model = TRUE, method = "glm.fit", x = FALSE, y = TRUE,
contrasts = NULL, ...)

## S3 method for class 'Glm'
print(x, digits=4, coefs=TRUE,
title='General Linear Model', ...)

Arguments

formula,family,data,weights,subset,na.action,start,offset,control,model,method,x,y,contrasts

see glm; for print, x is the result of Glm

...

ignored

digits

number of significant digits to print

coefs

specify coefs=FALSE to suppress printing the table of model coefficients, standard errors, etc. Specify coefs=n to print only the first n regression coefficients in the model.

title

a character string title to be passed to prModFit

Value

a fit object like that produced by glm but with rms attributes and a class of "rms", "Glm", "glm", and "lm". The g element of the fit object is the g-index.

See Also

glm,rms,GiniMd, prModFit,residuals.glm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
f <- glm(counts ~ outcome + treatment, family=poisson())
f
anova(f)
summary(f)
f <- Glm(counts ~ outcome + treatment, family=poisson())
# could have had rcs( ) etc. if there were continuous predictors
f
anova(f)
summary(f, outcome=c('1','2','3'), treatment=c('1','2','3'))

Example output

Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve


Call:  glm(formula = counts ~ outcome + treatment, family = poisson())

Coefficients:
(Intercept)     outcome2     outcome3   treatment2   treatment3  
  3.045e+00   -4.543e-01   -2.930e-01    1.189e-15    8.438e-16  

Degrees of Freedom: 8 Total (i.e. Null);  4 Residual
Null Deviance:	    10.58 
Residual Deviance: 5.129 	AIC: 56.76
Analysis of Deviance Table

Model: poisson, link: log

Response: counts

Terms added sequentially (first to last)


          Df Deviance Resid. Df Resid. Dev
NULL                          8    10.5814
outcome    2   5.4523         6     5.1291
treatment  2   0.0000         4     5.1291

Call:
glm(formula = counts ~ outcome + treatment, family = poisson())

Deviance Residuals: 
       1         2         3         4         5         6         7         8  
-0.67125   0.96272  -0.16965  -0.21999  -0.95552   1.04939   0.84715  -0.09167  
       9  
-0.96656  

Coefficients:
              Estimate Std. Error z value Pr(>|z|)    
(Intercept)  3.045e+00  1.709e-01  17.815   <2e-16 ***
outcome2    -4.543e-01  2.022e-01  -2.247   0.0246 *  
outcome3    -2.930e-01  1.927e-01  -1.520   0.1285    
treatment2   1.189e-15  2.000e-01   0.000   1.0000    
treatment3   8.438e-16  2.000e-01   0.000   1.0000    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 10.5814  on 8  degrees of freedom
Residual deviance:  5.1291  on 4  degrees of freedom
AIC: 56.761

Number of Fisher Scoring iterations: 4

General Linear Model
 
 Glm(formula = counts ~ outcome + treatment, family = poisson())
 
                   Model Likelihood     
                      Ratio Test        
 Obs       9       LR chi2      5.45    
 Residual d.f.4    d.f.            4    
 g 0.2271276       Pr(> chi2) 0.2440    
 
             Coef    S.E.   Wald Z Pr(>|Z|)
 Intercept    3.0445 0.1709 17.81  <0.0001 
 outcome=2   -0.4543 0.2022 -2.25  0.0246  
 outcome=3   -0.2930 0.1927 -1.52  0.1285  
 treatment=2  0.0000 0.2000  0.00  1.0000  
 treatment=3  0.0000 0.2000  0.00  1.0000  
 
                Wald Statistics          Response: counts 

 Factor     Chi-Square d.f. P     
 outcome    5.49       2    0.0643
 treatment  0.00       2    1.0000
 TOTAL      5.49       4    0.2409
             Effects              Response : counts 

 Factor          Low High Diff. Effect      S.E.    Lower 0.95 Upper 0.95
 outcome - 1:2   2   1    NA     4.5426e-01 0.20217 -0.10706   1.01560   
 outcome - 3:2   2   3    NA     1.6127e-01 0.21512 -0.43600   0.75854   
 treatment - 1:2 2   1    NA    -1.1887e-15 0.20000 -0.55529   0.55529   
 treatment - 3:2 2   3    NA    -3.4490e-16 0.20000 -0.55529   0.55529   

rms documentation built on Jan. 8, 2018, 1:11 a.m.

Related to Glm in rms...