apsrtableSummary: Custom summary functions for output tables

Description Usage Arguments Details Value Author(s) Examples

Description

Provide alternative model summaries specifically for use with apsrtable

Usage

1
2
3
4
## S3 method for class 'gee'
apsrtableSummary(x)
## S3 method for class 'lrm'
apsrtableSummary(x) 

Arguments

x

A model object to be summarized in a format suitable for apsrtable output.

Details

When preparing model objects for output, apsrtable uses primarily the representation of the model provided by its summary method. However, some packages return summaries with information that can be confusing to apsrtable.

In such an event, you have two options: provide a custom apsrtableSummary method, or work with the package maintainers to produce a suitable summary object. Ideally, the former is a stopgap for the latter.

Value

A summary representation of a model object, probably derived from the object's own summary method.

Author(s)

Michael Malecki <malecki at wustl.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
### summary.gee produces z scores but not Pr(z). This converts the relevant columns
### to Pr(z) so that apsrstars() works on it, and places the vector of robust se's in 
### an $se position which apsrtable expects.

apsrtableSummary.gee <- function(x) {
  s <- summary(x)
  newCoef <- coef(s)
  ## which columns have z scores? (two of them in robust case)
  zcols <- grep("z",colnames(newCoef))
  newCoef[,zcols] <- pnorm(abs(newCoef[,zcols]), lower.tail=FALSE)
  colnames(newCoef)[zcols] <- "Pr(z)"
  s$coefficients <- newCoef
  ## put the robust se in $se so that notefunction works automatically
  ## the se checker will overwrite [,4] with pt, but this doesn't matter
  ## because the last column Pr(z) is used by apsrstars() anyway
  ## and the se are pulled from $se.
  if( class(x) == "gee.robust") {
    s$se <- coef(s)[,4]
  }
  return(s)
}

apsrtable documentation built on May 2, 2019, 5:20 a.m.