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

R语言:stepAIC()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 21:01:39 | 显示全部楼层 |阅读模式
stepAIC(MASS)
stepAIC()所属R语言包:MASS

                                         Choose a model by AIC in a Stepwise Algorithm
                                         选择模型,由工商行政管理机关在逐步算法

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

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

Performs stepwise model selection by AIC.
执行逐步由AIC模型选择。


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


stepAIC(object, scope, scale = 0,
        direction = c("both", "backward", "forward"),
        trace = 1, keep = NULL, steps = 1000, use.start = FALSE,
        k = 2, ...)



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

参数:object
an object representing a model of an appropriate class. This is used as the initial model in the stepwise search.  
一个对象代表了一个合适的类模型。这是用来作为初始模型中逐步搜索。


参数:scope
defines the range of models examined in the stepwise search. This should be either a single formula, or a list containing components upper and lower, both formulae.  See the details for how to specify the formulae and how they are used.  
定义的范围在逐步搜索研究模型。这应该是一个单一的公式,或一个列表,其中包含组件upper和lower,两个公式。请参阅如何指定公式和如何使用它们的详细信息。


参数:scale
used in the definition of the AIC statistic for selecting the models, currently only for lm and aov models (see extractAIC for details).  
AIC的统计定义用于选择的模式,目前只对lm和aov模型(见extractAIC细节)。


参数:direction
the mode of stepwise search, can be one of "both", "backward", or "forward", with a default of "both". If the scope argument is missing the default for direction is "backward".  
逐步搜索模式,可以是一个"both","backward"或"forward",与"both"的默认。如果scope参数缺少direction的默认是"backward"。


参数:trace
if positive, information is printed during the running of stepAIC. Larger values may give more information on the fitting process.  
如果阳性,信息打印在stepAIC运行。较大的值可能会在装修过程中的更多信息。


参数:keep
a filter function whose input is a fitted model object and the associated AIC statistic, and whose output is arbitrary. Typically keep will select a subset of the components of the object and return them. The default is not to keep anything.  
一个过滤器的功能,其输入是拟合模型对象和相关AIC统计,其输出是任意的。通常keep将选择对象的组件的一个子集,并返回它们。默认情况下是不保留任何东西。


参数:steps
the maximum number of steps to be considered.  The default is 1000 (essentially as many as required).  It is typically used to stop the process early.  
要考虑的最大数量的步骤。默认值是1000(基本上许多)。它通常用于早期停止进程。


参数:use.start
if true the updated fits are done starting at the linear predictor for the currently selected model. This may speed up the iterative calculations for glm (and other fits), but it can also slow them down. Not used in R.  
如果属实,在当前选定的模型的线性预测开始进行更新千篇一律。这可能会加快迭代计算glm(和其他配合),但它也可以慢下来。不使用在R


参数:k
the multiple of the number of degrees of freedom used for the penalty. Only k = 2 gives the genuine AIC: k = log(n) is sometimes referred to as BIC or SBC.  
多用于罚款的自由度数。只k = 2给人真正的工商行政管理机关:k = log(n)有时被称为BIC或单板。


参数:...
any additional arguments to extractAIC. (None are currently used.)  </table>
extractAIC任何额外的参数。 (没有正在使用。)</ TABLE>


Details

详情----------Details----------

The set of models searched is determined by the scope argument. The right-hand-side of its lower component is always included in the model, and right-hand-side of the model is included in the upper component.  If scope is a single formula, it specifies the upper component, and the lower model is empty.  If scope is missing, the initial model is used as the upper model.
scope参数确定的搜索模型。 lower组件的右手端始终包含在模型中,模型的右手端包含在upper组件。 scope如果是一个公式,它指定upper组件,lower模型是空的。 scope如果丢失,被用作初始模型upper模型。

Models specified by scope can be templates to update object as used by update.formula.
scope指定型号可以是模板更新objectupdate.formula的使用的。

There is a potential problem in using glm fits with a variable scale, as in that case the deviance is not simply related to the maximized log-likelihood. The glm method for extractAIC makes the appropriate adjustment for a gaussian family, but may need to be amended for other cases. (The binomial and poisson families have fixed scale by default and do not correspond to a particular maximum-likelihood problem for variable scale.)
有一个潜在的问题,在使用glm适合用变量scale,在这种情况下,偏差不只是关系到最大化的日志的可能性。 glm方法extractAICgaussian家庭的适当调整,但其他情况下可能需要修订。 (binomial和poisson家庭有固定的scale默认情况下,不符合变量scale到一个特定的可能性最大问题。)

Where a conventional deviance exists (e.g. for lm, aov and glm fits) this is quoted in the analysis of variance table: it is the unscaled deviance.
在传统的偏差存在(例如lm,aov和glm适合),这是引述方差分析表:它是未缩放的越轨行为。


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

the stepwise-selected model is returned, with up to two additional components.  There is an "anova" component corresponding to the steps taken in the search, as well as a "keep" component if the keep= argument was supplied in the call. The "Resid. Dev" column of the analysis of deviance table refers to a constant minus twice the maximized log likelihood: it will be a deviance only in cases where a saturated model is well-defined (thus excluding lm, aov and survreg fits, for example).
逐步所选模型返回,最多两个附加组件。如果在呼叫提供"anova"参数,有"keep"在搜索中所采取的措施相应组件,以及一个keep=组件。 "Resid. Dev"的越轨表分析列指的是一个常数减去两次最大化日志的可能性:这将是一个只有在饱和模型定义的情况下的越轨行为(从而排除lm, aov和survreg适合的例子)。


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

The model fitting must apply the models to the same dataset.  This may be a problem if there are missing values and an na.action other than na.fail is used (as is the default in R). We suggest you remove the missing values first.
模型拟合必须适用相同的数据集模型。这可能是一个问题,如果有遗漏值和na.action除na.fail(是在R默认)用于其他。我们建议您先删除遗漏值。


参考文献----------References----------

Modern Applied Statistics with S. Fourth edition.  Springer.

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

addterm, dropterm, step
addterm,dropterm,step


举例----------Examples----------


quine.hi <- aov(log(Days + 2.5) ~ .^4, quine)
quine.nxt <- update(quine.hi, . ~ . - Eth:Sex:Agern)
quine.stp <- stepAIC(quine.nxt,
    scope = list(upper = ~Eth*Sex*Age*Lrn, lower = ~1),
    trace = FALSE)
quine.stp$anova

cpus1 <- cpus
attach(cpus)
for(v in names(cpus)[2:7])
  cpus1[[v]] <- cut(cpus[[v]], unique(quantile(cpus[[v]])),
                    include.lowest = TRUE)
detach()
cpus0 &lt;- cpus1[, 2:8]  # excludes names, authors' predictions[不包括名称,作者预测]
cpus.samp <- sample(1:209, 100)
cpus.lm <- lm(log10(perf) ~ ., data = cpus1[cpus.samp,2:8])
cpus.lm2 <- stepAIC(cpus.lm, trace = FALSE)
cpus.lm2$anova

example(birthwt)
birthwt.glm <- glm(low ~ ., family = binomial, data = bwt)
birthwt.step <- stepAIC(birthwt.glm, trace = FALSE)
birthwt.step$anova
birthwt.step2 <- stepAIC(birthwt.glm, ~ .^2 + I(scale(age)^2)
    + I(scale(lwt)^2), trace = FALSE)
birthwt.step2$anova

quine.nb <- glm.nb(Days ~ .^4, data = quine)
quine.nb2 <- stepAIC(quine.nb)
quine.nb2$anova

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-3 04:50 , Processed in 0.023320 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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