當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


R lm.summaries 訪問線性模型擬合

R語言 lm.summaries 位於 stats 包(package)。

說明

所有這些函數都是 methods 類的 "lm" 對象。

用法

## S3 method for class 'lm'
family(object, ...)

## S3 method for class 'lm'
formula(x, ...)

## S3 method for class 'lm'
residuals(object,
          type = c("working", "response", "deviance", "pearson",
                   "partial"),
          ...)

## S3 method for class 'lm'
labels(object, ...)

參數

object, x

從類 lm 繼承的對象,通常是調用 lmaov 的結果。

...

傳入或傳出其他方法的進一步參數。

type

應返回的殘差類型。可以縮寫。

細節

通用訪問器函數 coefeffectsfittedresiduals 可用於提取 lm 返回值的各種有用特征。

工作殘差和響應殘差是“觀察-擬合”的。偏差和皮爾遜殘差是加權殘差,按擬合中使用的權重的平方根縮放。部分殘差是一個矩陣,每列都是通過從模型中省略一項而形成的。在所有這些中,零權重情況永遠不會被忽略(與標準化的 rstudent 殘差和 weighted.residuals 相反)。

residuals 如何處理原始擬合中缺失值的情況由該擬合的 na.action 參數確定。如果 na.action = na.omit 省略的情況將不會出現在殘差中,而如果 na.action = na.exclude 則它們將出現,並具有殘差值 NA 。另請參閱naresid

泛型 labels"lm" 方法返回可估計項的項標簽,即具有至少一個可估計係數的項的名稱。

例子


##-- Continuing the  lm(.) example:
coef(lm.D90) # the bare coefficients

## The 2 basic regression diagnostic plots [plot.lm(.) is preferred]
plot(resid(lm.D90), fitted(lm.D90)) # Tukey-Anscombe's
abline(h = 0, lty = 2, col = "gray")

qqnorm(residuals(lm.D90))

參考

Chambers, J. M. (1992) Linear models. Chapter 4 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.

也可以看看

模型擬合函數lmanova.lm

coefdeviancedf.residualeffectsfittedglm 用於廣義線性模型,influence (該頁麵上的等)用於回歸診斷。 weighted.residualsresidualsresiduals.glmsummary.lmweights

influence.measures 用於刪除診斷,包括標準化 ( rstandard ) 和學生化 ( rstudent ) 殘差。

相關用法


注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Accessing Linear Model Fits。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。