Skip to content

Commit

Permalink
A general 'getSummary_expcoef()' default method is now provided
Browse files Browse the repository at this point in the history
  • Loading branch information
melff committed Aug 12, 2020
1 parent c09980f commit eeb9731
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/DESCRIPTION
Expand Up @@ -2,7 +2,7 @@ Package: memisc
Type: Package
Title: Management of Survey Data and Presentation of Analysis Results
Version: 0.99.26.3
Date: 2020-08-10
Date: 2020-08-12
Author: Martin Elff (with contributions from Christopher N. Lawrence, Dave Atkins, Jason W. Morgan, Achim Zeileis)
Maintainer: Martin Elff <memisc@elff.eu>
Description: An infrastructure for the management of survey data including
Expand Down
4 changes: 2 additions & 2 deletions pkg/NAMESPACE
Expand Up @@ -34,7 +34,7 @@ export(
getSummary.weibreg,
getSummary.merMod,
getSummary_expcoef,
getSummary_expcoef.glm,
getSummary_expcoef.default,
getSummary.ivreg,
getSummary.tobit,
getSummary.hurdle,
Expand Down Expand Up @@ -142,7 +142,7 @@ S3method(getSummary,simex)
S3method(getSummary,survreg)
S3method(getSummary,tobit)
S3method(getSummary,weibreg)
S3method(getSummary_expcoef,glm)
S3method(getSummary_expcoef,default)
S3method(getSummary,clm)
S3method(getSummary,clmm)
S3method(sort,data.frame)
Expand Down
2 changes: 2 additions & 0 deletions pkg/R/yy-mtable-ext-DaveAtkins.R
Expand Up @@ -7,6 +7,8 @@

getSummary_expcoef <- function(obj, alpha = 0.05, ...) UseMethod("getSummary_expcoef")

### This function is no longer exported, because there is a more general
### default method available now.
getSummary_expcoef.glm <- function (obj, alpha = 0.05, ...)
{
smry <- summary(obj)
Expand Down
12 changes: 12 additions & 0 deletions pkg/R/yz-getSummary_expcoef.R
@@ -0,0 +1,12 @@
getSummary_expcoef.default <- function (obj, alpha = 0.05, ...){
res <- getSummary(obj=obj, alpha=alpha, ...)
coef <- res$coef
exp_coef <- coef
exp_coef[,1,] <- exp(coef[,1,])
# Based on the delta-method
exp_coef[,2,] <- exp_coef[,1,]*coef[,2,]
if(ncol(coef) ==6)
exp_coef[,5:6,] <- exp(coef[,5:6,])
res$coef <- exp_coef
return(res)
}
5 changes: 4 additions & 1 deletion pkg/inst/ChangeLog
@@ -1,5 +1,8 @@
2020-08-12:
- Some 'setOldClass()' calls are now conditional on the absence of certain packages.
- Some 'setOldClass()' calls are now conditional on the absence of certain
packages.
- A general 'getSummary_expcoef()' default method is now provided,
which is widely applicable as it builds on 'getSummary()'.

2020-08-10:
- Minor fix in documentation for 'collect()'.
Expand Down
20 changes: 10 additions & 10 deletions pkg/man/getSummary.Rd
Expand Up @@ -6,7 +6,7 @@
\alias{getSummary.clm}
\alias{getSummary.polr}
\alias{getSummary.simex}
\alias{getSummary_expcoef.glm}
\alias{getSummary_expcoef.default}
\alias{getSummary.aftreg}
\alias{getSummary.coxph}
\alias{getSummary.phreg}
Expand All @@ -31,31 +31,31 @@
\method{getSummary}{glm}(obj, alpha=.05,\dots)
\method{getSummary}{merMod}(obj, alpha=.05, \dots)

# These are contributed by Christopher N. Lawrence
# These are contributed by Christopher N. Lawrence
\method{getSummary}{clm}(obj, alpha=.05,\dots)
\method{getSummary}{polr}(obj, alpha=.05,\dots)
\method{getSummary}{simex}(obj, alpha=.05,\dots)

# These are contributed by Jason W. Morgan
# These are contributed by Jason W. Morgan
\method{getSummary}{aftreg}(obj, alpha=.05,\dots)
\method{getSummary}{coxph}(obj, alpha=.05,\dots)
\method{getSummary}{phreg}(obj, alpha=.05,\dots)
\method{getSummary}{survreg}(obj, alpha=.05,\dots)
\method{getSummary}{weibreg}(obj, alpha=.05,\dots)

# These are contributed by Achim Zeileis
# These are contributed by Achim Zeileis
\method{getSummary}{ivreg}(obj, alpha=.05,\dots)
\method{getSummary}{tobit}(obj, alpha=.05,\dots)
\method{getSummary}{hurdle}(obj, alpha=.05,\dots)
\method{getSummary}{zeroinfl}(obj, alpha=.05,\dots)
\method{getSummary}{betareg}(obj, alpha=.05,\dots)
\method{getSummary}{multinom}(obj, alpha=.05,\dots)

# These are contributed by Dave Atkins
# Method for 'glm' objects - to report
# exponentiated coefficients.
getSummary_expcoef(obj, alpha=.05,\dots)
\method{getSummary_expcoef}{glm}(obj, alpha=.05,\dots)
# A variant that reports exponentiated coefficients.
# The default method calls 'getSummary()' internally and should
# be applicable to all classes for which 'getSummary()' methods exist.
getSummary_expcoef(obj, alpha=.05,\dots)
\method{getSummary_expcoef}{default}(obj, alpha=.05,\dots)
}
\arguments{
\item{obj}{a model object, e.g. of class \code{lm} or \code{glm}}
Expand Down Expand Up @@ -97,4 +97,4 @@


\keyword{misc}
\keyword{utilities}
\keyword{utilities}

0 comments on commit eeb9731

Please sign in to comment.