找回密码
 注册
查看: 477|回复: 0

R语言 robustbase包 nlrob()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 22:11:51 | 显示全部楼层 |阅读模式
nlrob(robustbase)
nlrob()所属R语言包:robustbase

                                        Robust Fitting of Nonlinear Regression Models
                                         强大的非线性回归模型的拟合

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

nlrob fits a nonlinear regression model by robust M-estimators, using iterated reweighted least squares (IWLS).
nlrob适合一个强劲的M-估计的非线性回归模型,采用迭代加权最小的平方(IWLS)。


用法----------Usage----------


nlrob(formula, data, start, weights = NULL, na.action = na.fail,
      psi = psi.huber, test.vec = c("resid", "coef", "w"), maxit = 20,
      acc = 1e-06, algorithm = "default", control = nls.control(),
      trace = FALSE, ...)

## S3 method for class 'nlrob'
fitted(object, ...)
## S3 method for class 'nlrob'
residuals(object, type = , ...)
## S3 method for class 'nlrob'
predict(object, newdata, ...)



参数----------Arguments----------

参数:formula
a nonlinear formula including variables and parameters of the model, such as y ~ f(x, theta) (cf. nls). (For some checks: if f(.) is linear, then we need parentheses, e.g., y ~ (a + b * x).)  Do not use w as variable or parameter name!  
的非线性formula,包括变量和参数的模型,如y ~ f(x, theta)(参见nls)。 (对于一些检查:如果f(.)是线性的,那么我们需要括号,例如,y ~ (a + b * x)。)不要使用w变量或参数的名称!


参数:data
an optional data frame containing the variables in the model.  If not found in data, the variables are taken from environment(formula), typically the environment from which nlrob is called.
一个可选的数据框包含在模型中的变量。如果没有找到data,变量environment(formula),通常是nlrob被称为环境。


参数:start
a named numeric vector of starting parameters estimates.
一个名为“数字矢量的初始参数估计。


参数:weights
an optional vector of weights to be used in the fitting process (for intrinsic weights, not the weights w used in the iterative (robust) fit). I.e., sum(w * e^2) is minimized with e = residuals, e[i] = y[i] - f(xreg[i], theta), where f(x, theta) is the nonlinear function, and w are the robust weights from resid * weights.
可选在嵌合过程中使用的权重向量(固有的权重,而不是权重w用于在迭代(鲁棒)配合)。 ,sum(w * e^2)最小化,e=残差,e[i] = y[i] - f(xreg[i], theta),其中f(x, theta)是非线性函数,w是resid * weights强劲的权重。


参数:na.action
a function which indicates what should happen when the data contain NAs.  The default action is for the procedure to fail.  If NAs are present, use na.exclude to have residuals with length == nrow(data) == length(w), where w are the weights used in the iterative robust loop.  This is better if the explanatory variables in formula are time series (and so the NA location is important). For this reason, na.omit, which leads to omission of cases with missing values on any required variable, is not suitable here since the residuals length is different from nrow(data) == length(w).  
一个函数,它表示当数据包含NA的,应该发生什么。默认的操作是失败的程序。如果使用NAS,使用na.exclude有残留物,“length == nrow(data) == length(w),其中w权重在迭代强大的循环使用。这是更好,如果解释变量formula的时间序列(和NA的位置是很重要的)。出于这个原因,na.omit,这导致遗漏任何所需的变量的遗漏值的情况下,是不适合这里,因为残差的长度是不同nrow(data) == length(w)。


参数:psi
a function (possibly by name) of the form g(x, 'tuning       constant(s)', deriv) that for deriv=0 returns psi(x)/x and for deriv=1 returns psi'(x).  Tuning constants will be passed in via one or several arguments, depending on the psi function. (See also rlm).
一个函数(可能的名称)的形式g(x, 'tuning       constant(s)', deriv),deriv=0返回psi(x)/x和deriv=1回报psi'(x)。调谐常数将被传递通过一个或几个参数,取决于psi的功能。 (见rlm)。


参数:test.vec
character string specifying the convergence criterion. The relative change is tested for residuals with a value of "resid" (the default), for coefficients with "coef", and for weights with "w".
字符串指定收敛标准。测试"resid"(默认值)值的残差的相对变化,"coef",重量与"w"系数。


参数:maxit
maximum number of iterations in the robust loop.
强劲的循环中的迭代的最大数量。


参数:acc
convergence tolerance for the robust fit.
收敛公差的强劲配合。


参数:algorithm
character string specifying the algorithm to use for nls, see there. The default algorithm is a Gauss-Newton algorithm.
字符串指定要使用的算法为nls,请参阅。默认的算法是Gauss-Newton算法。


参数:control
an optional list of control settings for nls. See nls.control for the names of the settable control values and their effect.
的可选列表控制设置nls。见nls.control的名称,可设定的控制值和它们的影响。


参数:trace
logical value indicating if a &ldquo;trace&rdquo; of the nls iteration progress should be printed.  Default is FALSE. <br> If TRUE, in each robust iteration, the residual sum-of-squares and the parameter values are printed at the conclusion of each nls iteration. When the "plinear" algorithm is used, the conditional estimates of the linear parameters are printed after the nonlinear parameters.
逻辑值,指示是否应印有“跟踪”nls迭代进步。默认是FALSE。 <br>如果TRUE,在每个鲁棒迭代的残差的平方和的参数值的打印在每个nls迭代的结论。当"plinear"算法被使用时,打印后的非线性参数条件估计的线性参数。


参数:...
optional arguments (tuning constants) to be passed to the psi function (see psi above).
可选参数(整定参数)传递给PSI的功能(见psi以上)。


参数:object
an R object of class "nlrob", typically resulting from nlrob(..).
的R对象类"nlrob",通常从nlrob(..)。


参数:type
a string specifying the type of residuals desired. Currently, "response" and "working" are supported.   
一个字符串,指定类型的残差所需。目前,"response"和"working"支持。


参数:newdata
a data frame (or list) with the same names as the original data, see e.g., predict.nls.
一个数据框(或列表)使用相同的名称作为原始的data,例如,predict.nls。


值----------Value----------

nlrob() returns an object of S3 class "nlrob", also inheriting from class "nls", (see nls).
nlrob()的S3类"nlrob"返回一个对象,也继承类"nls"(nls“)。

It is a list with components
这是一个与组件列表


参数:FIXME
???


There are methods (at least) for the generic accessor functions summary, coefficients, fitted.values and residuals.
有一般的访问功能的方法(至少)summary,coefficients,fitted.values和residuals。

residuals(.), by default type = "response", returns the residuals e_i, defined above as e[i] = Y[i] - f(x[i],theta). These differ from the standardized or weighted residuals which, e.g., are assumed to be normally distributed, and a version of which is returned in working.residuals component.
residuals(.),默认情况下,type = "response",返回残差e_i,定义为e[i] = Y[i] - f(x[i],theta)。这些不同,例如,被假定为正态分布的标准化或加权残差,和其中的一个版本中返回working.residuals组件。


注意----------Note----------

This function used to be named rnls and has been in package sfsmisc, but will be deprecated and dropped there, eventually.
使用此功能rnls一直在包sfsmisc,反而会下降,最终被抛弃,被命名为。


(作者)----------Author(s)----------



Andreas Ruckstuhl (inspired by <code><a href="../../MASS/html/rlm.html">rlm</a></code>() and
<code><a href="../../stats/html/nls.html">nls</a></code>()), in July 1994 for S-plus.<br>
Christian Sangiorgio did the update to <font face="Courier New,Courier" color="#666666"><b>R</b></font> and corrected some errors,
from June 2002 to January 2005, and Andreas contributed slight changes
and the first methods in August 2005.<br>
Help page, testing, more cleanup, methods: Martin Maechler.




参见----------See Also----------

nls, rlm.
nls,rlm。


实例----------Examples----------


DNase1 <- DNase[ DNase$Run == 1, ]

## note that selfstarting models don't work yet % &lt;&lt;&lt; FIXME !!![#注意,selfstarting模型不工作尚未%<<< FIXME!!]

##--- without conditional linearity ---[#---没有条件的线性---]

## classical[#经典]
fmNase1 <- nls( density ~ Asym/(1 + exp(( xmid - log(conc) )/scal ) ),
                data = DNase1,
                start = list( Asym = 3, xmid = 0, scal = 1 ),
                trace = TRUE )
summary( fmNase1 )

## robust[#强劲]
RmN1  <- nlrob( density ~ Asym/(1 + exp(( xmid - log(conc) )/scal ) ),
                data = DNase1, trace = TRUE,
                start = list( Asym = 3, xmid = 0, scal = 1 ))
summary( RmN1 )

##--- using conditional linearity ---[#---使用条件的线性度---]

## classical[#经典]
fm2DNase1 <- nls( density ~ 1/(1 + exp(( xmid - log(conc) )/scal ) ),
                  data = DNase1,
                  start = c( xmid = 0, scal = 1 ),
                  alg = "plinear", trace = TRUE )
summary( fm2DNase1 )

## robust[#强劲]
if(FALSE) { # currently fails %% FIXME error in nls's nlsModel.plinear()[目前失败%%的FIXME错误的免入息审查贷款计划的nlsModel.plinear()]
frm2DNase1 <- nlrob(density ~ 1/(1 + exp(( xmid - log(conc) )/scal ) ),
                  data = DNase1, start = c( xmid = 0, scal = 1 ),
                  alg = "plinear", trace = TRUE )
summary( frm2DNase1 )
} # not yet[未]

### -- new examples -- "moderate outlier":[## - 新的例子 - “温和的异常值”:]
DN2 <- DNase1
DN2[10,"density"] <- 2*DN2[10,"density"]

fm3DN2 <- nls(density ~  Asym/(1 + exp(( xmid - log(conc) )/scal ) ),
              data = DN2, trace = TRUE,
              start = list( Asym = 3, xmid = 0, scal = 1 ))

## robust[#强劲]
Rm3DN2 <- nlrob(density ~  Asym/(1 + exp(( xmid - log(conc) )/scal ) ),
                data = DN2, trace = TRUE,
                start = list( Asym = 3, xmid = 0, scal = 1 ))
Rm3DN2
summary(Rm3DN2)

## utility function sfsmisc::lseq() :[#实用工具美国功能sfsmisc :: lseq():]
lseq <- function (from, to, length)
  2^seq(log2(from), log2(to), length.out = length)
## predict() {and plot}:[预测(){和图}:]
h.x <- lseq(min(DN2$conc), max(DN2$conc), length = 100)
nDat <- data.frame(conc = h.x)

h.p  &lt;- predict(fm3DN2, newdata = nDat)# classical[经典]
h.rp &lt;- predict(Rm3DN2, newdata = nDat)# robust[健壮]

plot(density ~ conc, data=DN2, log="x",
     main = format(formula(Rm3DN2)))
lines(h.x, h.p,  col="blue")
lines(h.x, h.rp, col="magenta")
legend("topleft", c("classical nls()", "robust nlrob()"),
       lwd = 1, col= c("blue", "magenta"), inset = 0.05)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-25 09:47 , Processed in 0.029959 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表