slm.methods: Methods for slm objects

Description Usage Arguments Value Author(s) References See Also Examples

Description

Summarize, print, and extract objects from slm objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## S3 method for class 'slm'
summary(object, correlation, ...)
## S3 method for class 'mslm'
summary(object, ...)
## S3 method for class 'slm'
print(x, digits, ...)
## S3 method for class 'summary.slm'
print(x, digits, symbolic.cor, signif.stars, ...)
## S3 method for class 'slm'
fitted(object, ...)
## S3 method for class 'slm'
residuals(object, ...)
## S3 method for class 'slm'
coef(object, ...)
## S3 method for class 'slm'
extractAIC(fit, scale = 0, k = 2, ...)
## S3 method for class 'slm'
deviance(object, ...)

Arguments

object,x,fit

object of class slm.

digits

minimum number of significant digits to be used for most numbers.

scale

optional numeric specifying the scale parameter of the model, see 'scale' in 'step'. Currently only used in the '"lm"' method, where 'scale' specifies the estimate of the error variance, and 'scale = 0' indicates that it is to be estimated by maximum likelihood.

k

numeric specifying the "weight" of the equivalent degrees of freedom ('edf') part in the AIC formula.

symbolic.cor

logical; if TRUE, the correlation of coefficients will be printed. The default is FALSE

signif.stars

logical; if TRUE, P-values are additionally encoded visually as “significance stars” in order to help scanning of long coefficient tables. It defaults to the ‘show.signif.stars’ slot of ‘options’.

correlation

logical; if TRUE, the correlation matrix of the estimated parameters is returned and printed.

...

additional arguments passed to methods.

Value

print.slm and print.summary.slm return invisibly. fitted.slm, residuals.slm, and coef.slm return the corresponding components of the slm object. extractAIC.slm and deviance.slm return the AIC and deviance values of the fitted object.

Author(s)

Roger Koenker

References

Koenker, R and Ng, P. (2002). SparseM: A Sparse Matrix Package for R,
http://www.econ.uiuc.edu/~roger/research/home.html

See Also

slm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(lsq)
X <- model.matrix(lsq) #extract the design matrix
y <- model.response(lsq) # extract the rhs
X1 <- as.matrix(X)
slm.time <- system.time(slm(y~X1-1) -> slm.o) # pretty fast
cat("slm time =",slm.time,"\n")
cat("slm Results: Reported Coefficients Truncated to 5  ","\n")
sum.slm <- summary(slm.o)
sum.slm$coef <- sum.slm$coef[1:5,]
sum.slm
fitted(slm.o)[1:10]
residuals(slm.o)[1:10]
coef(slm.o)[1:10]

Example output

Attaching package: 'SparseM'

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

    backsolve

slm time = 0.145 0.02 0.164 0 0 
slm Results: Reported Coefficients Truncated to 5   

Call:
slm(formula = y ~ X1 - 1)

Residuals:
       Min         1Q     Median         3Q        Max 
-1.952e-01 -1.400e-02  5.329e-15  1.442e-02  1.783e-01 

Coefficients:
     Estimate Std. Error t value Pr(>|t|)    
[1,] 823.3613     0.1274  6460.4   <2e-16 ***
[2,] 340.1156     0.1711  1987.3   <2e-16 ***
[3,] 472.9760     0.1379  3429.6   <2e-16 ***
[4,] 349.3175     0.1743  2004.0   <2e-16 ***
[5,] 187.5595     0.2100   893.3   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.03789 on 1138 degrees of freedom
Multiple R-Squared:     1,	Adjusted R-squared:     1 
F-statistic: 4.504e+07 on 712 and 1138 DF,	p-value:     0 

 [1] 64.040350  5.889029 64.069648  5.937578 76.388826 64.171021 76.414288
 [8] 64.196320 64.214065  7.658347
 [1]  0.027275686 -0.005630865 -0.041783949  0.020139128  0.022659984
 [6]  0.020583686 -0.037168247 -0.023604889 -0.012130877  0.023302606
 [1] 823.36129 340.11555 472.97601 349.31746 187.55954 159.05176 -54.88358
 [8] 497.65120 574.75533 584.40348

SparseM documentation built on Feb. 18, 2021, 5:06 p.m.