Learn R Programming

astsa (version 2.3)

ttable: t-table summary for an lm object

Description

Works like summary for an lm object but adds AIC, AICc, and BIC to the output with the option to display VIFs.

Usage

ttable(obj, digits = 4, vif = FALSE, ...)

Value

Prints a typical t-table with additional information as mentioned in the details. The p-values are two-sided. Also silently returns the same values as described in summary.lm.

Arguments

obj

an object of class "lm" as a result of a call to lm.

digits

the (approximate) number of significant digits to use when printing.

vif

if TRUE, variance inflation factors are printed if applicable; default is FALSE.

...

further arguments passed to or from other methods.

Author

D.S. Stoffer

Details

Produces a t-table for an lm object much like print.summary.lm with added information including AIC, AICc, BIC, and VIF (if requested and if applicable), to the output. The output is rounded and there are no significance stars. In fact, there are no stars at all.

TO REPEAT THE WARNING ON USING 'lm' FOR TIME SERIES: Considerable care must be taken:

  • Include na.action = NULL in the lm call to avoid stripping the time series attributes from the variables before the regression is done.

  • If any lagged or differenced variables are used in 'lm', the series must be lined up first. In this case, prepare a data frame using ts.intersect(..., dframe = TRUE); e.g.,

    
    mydata = ts.intersect(M = cmort, P4 = lag(part,-4), dframe=TRUE)
    fit    = lm(M ~ P4, na.action=NULL, data=mydata)
    ttable(fit)
    

References

You can find demonstrations of astsa capabilities at FUN WITH ASTSA.

The most recent version of the package can be found at https://github.com/nickpoison/astsa/.

In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/blob/master/NEWS.md.

The webpages for the texts and some help on using R for time series analysis can be found at https://nickpoison.github.io/.

See Also

Examples

Run this code

fit1 = lm(cmort~ time(cmort) + tempr + I(tempr^2))
ttable(fit1, vif=TRUE)
# if you center `tempr`, the squared term doesn't change
temp = tempr - mean(tempr)
fit2 = lm(cmort~ time(cmort) + temp + I(temp^2)) 
ttable(fit2, vif=TRUE)

Run the code above in your browser using DataLab