lmrob..M..fit(robustbase)
lmrob..M..fit()所属R语言包:robustbase
Compute M-estimators of regression
计算M-估计的回归
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function performs RWLS iterations to find an M-estimator of regression. When started from an S-estimated beta.initial, this results in an MM-estimator.
此功能进行RWLS的迭代找到一个M-估计的回归。启动时从S-估计beta.initial,在MM估计这个结果。
用法----------Usage----------
lmrob..M..fit(x, y, beta.initial, scale, control, obj)
参数----------Arguments----------
参数:x
design matrix (n x p) typically including a column of 1s for the intercept.
设计矩阵(n x p)通常包括用于拦截一列1的。
参数:y
numeric response vector (of length n).
数字响应向量(长度n)。
参数:beta.initial
numeric vector (of length p) of initial estimate. Usually the result of an S-regression estimator.
数字矢量(长度p)的初步估计。通常情况下,S-回归估计的结果。
参数:scale
robust residual scale estimate. Usually an S-scale estimator.
强大的剩余规模估计。通常,一个S-级的估计。
参数:control
list of control parameters, as returned by lmrob.control. Currently, only the components c("max.it", "rel.tol","trace.lev", "psi", "tuning.psi", "method") are accessed.
列表控制参数,返回的lmrob.control。目前,只有组件c("max.it", "rel.tol","trace.lev", "psi", "tuning.psi", "method")访问的。
参数:obj
an optional lmrob-object. If specified, this is used to set values for the other arguments.
一个可选的lmrob对象。如果指定了,这是用来设置其他参数的值。
Details
详细信息----------Details----------
This function is used by lmrob.fit and typically not to be used on its own.
使用此功能lmrob.fit,通常不使用自己的。
值----------Value----------
A list with the following elements:
列表包含下列元素:
参数:coef
the M-estimator (or MM-estim.) of regression
回归M-估计(或MM估算)。
参数:control
the control list input used
control列表输入
参数:scale
The residual scale estimate
剩余规模估计
参数:seed
The random number generator seed
的随机数发生器的种子
参数:converged
TRUE if the RWLS iterations converged, FALSE otherwise
TRUE,如果RWLS迭代融合,FALSE否则
(作者)----------Author(s)----------
Matias Salibian-Barrera and Martin Maechler
参考文献----------References----------
参见----------See Also----------
lmrob.fit, lmrob; rlm from package MASS.
lmrob.fit,lmrob; rlm包MASS。
实例----------Examples----------
data(stackloss)
X <- model.matrix(stack.loss ~ . , data = stackloss)
y <- stack.loss
## Compute manual MM-estimate:[#计算手动MM估计:]
## 1) initial LTS:[#1)初始LTS:]
m0 <- ltsReg(X[,-1], y)
## 2) M-estimate started from LTS:[#2)开始从LTS M-估计:]
m1 <- lmrob..M..fit(X, y, beta.initial = coef(m0), scale = m0$scale,
control = lmrob.control(tuning.psi = 1.6,
psi = 'bisquare'))
cbind(m0$coef, m1$coef)
## the scale is kept fixed:[#规模保持不变:]
stopifnot(identical(unname(m0$scale), m1$scale))
## robustness weights: are[#鲁棒性重量:]
r.s <- with(m1, residuals/scale) # scaled residuals[规模残差]
m1.wts <- robustbase:::tukeyPsi1(r.s, cc = 1.6) / r.s
summarizeRobWeights(m1.wts)
##--> outliers 1,3,4,13,21[# - >离群值1,3,4,13,21]
which(m0$lts.wt == 0) # 1,3,4,21 but not 13[1,3,4,21,但不是13]
## Add M-step to SMD-estimate[#M-步骤,SMD估计]
m2 <- lmrob(stack.loss ~ ., data = stackloss, method = 'SMD')
m3 <- lmrob..M..fit(obj = m2)
## Simple function that allows custom initial estimates[#简单的功能,允许自定义的初步估计]
## (Deprecated use init argument to lmrob() instead.)[#(已过时利用初始化参数来lmrob的()来代替。)]
lmrob.custom <- function(x, y, beta.initial, scale, terms) {
## initialize object[#初始化对象]
obj <- list(control = lmrob.control("KS2011"),
terms = terms) ## terms is needed for summary()[#条款是必要的摘要()]
## M-step[#M步]
obj <- lmrob..M..fit(x, y, beta.initial, scale, obj = obj)
## D-step[#D的步骤]
obj <- lmrob..D..fit(obj, x)
## Add some missing elements[#添加一些缺少的元素。]
obj$cov <- TRUE ## enables calculation of cov matrix[#使覆盖矩阵的计算]
obj$p <- obj$qr$rank
obj$degree.freedom <- length(y) - obj$p
## M-step[#M步]
obj <- lmrob..M..fit(x, y, obj=obj)
obj$control$method <- ".MDM"
obj
}
m4 <- lmrob.custom(X, y, m2$init$init.S$coef,
m2$init$scale,m2$terms)
stopifnot(all.equal(m4$coef, m3$coef))
## Start from ltsReg:[#启动从ltsReg:]
m5 <- ltsReg(stack.loss ~ ., data = stackloss)
m6 <- lmrob.custom(m5$X, m5$Y, coef(m5), m5$scale, m5$terms)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|