gsummary {gfunctions}R Documentation

The gsummary() function

Description

The gsummary() function provides an alternative to the summary() function by returning different information. The prefix g is a reminder of who to blame if things do not work properly.

Usage

## generic:
gsummary(object, ...)
## Default S3 method:
gsummary(object, ...)
## S3 method for class 'data.frame'
gsummary(object, ...)
## S3 method for class 'lm'
gsummary(object, vcov.type = c("ordinary", "robust", "hac"), confint.level = 0.95, ...)
## S3 method for class 'glm'
gsummary(object, confint.level = 0.95, ...)

Arguments

object

an object of suitable class, for example data.frame, lm or glm.

vcov.type

a character string that determines the variance-vcovariance estimator. If "ordinary" (default), then the ordinary estimator is used (vcov.lm()). If "robust", then the heteroscedasticity robust estimator of White (1980) (vcovHC() with type = "HC") is used. If "hac", then the heteroscedasticity and autocorrelation robust estimator of Newey and West (1987) (NeweyWest()) is used.

confint.level

a number between 0 and 1 (the default is 0.95), or NULL. If a number, then confidence intervals are printed (the default is 95 percent). If NULL, then confidence intervals are not printed.

...

additional arguments

Value

No value is returned, the function only prints. The content of the print depends on the class of its main argument object.

Author(s)

Genaro Sucarrat, http://www.sucarrat.net/

References

Halbert White (1980): 'A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity', Econometrica 48, pp. 817-838. Whitney K. Newey and Kenned D. West (1987): 'A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix', Econometrica 55, pp. 703-708.

See Also

summary()

Examples

##simulate some data:
set.seed(123)
y <- rnorm(20); x <- rnorm(20); z <- rnorm(20)

##illustrate gsummary.data.frame():
mydataframe <- as.data.frame(cbind(y,x,z))
gsummary(mydataframe)

##illustrate gsummary.lm():
mymodel <- lm(y ~ x + z)
gsummary(mymodel)
gsummary(mymodel, vcov.type="robust")
gsummary(mymodel, vcov.type="hac")
gsummary(mymodel, confint.level=0.90)
gsummary(mymodel, confint.level=0.99)
gsummary(mymodel, confint.level=NULL)

##illustrate gsummary.glm():
y <- as.numeric( y > 0 )
mymodel <- glm(y ~ x + z, family=binomial)
gsummary(mymodel)


[Package gfunctions version 1.0 Index]