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

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

[复制链接]
发表于 2012-9-27 19:12:40 | 显示全部楼层 |阅读模式
pentrace(rms)
pentrace()所属R语言包:rms

                                         Trace AIC and BIC vs. Penalty
                                         跟踪AIC和BIC与罚款

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

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

For an ordinary unpenalized fit from lrm or ols and for a vector or list of penalties,  fits a series of logistic or linear models using penalized maximum likelihood estimation, and saves the effective degrees of freedom, Akaike Information Criterion (AIC), Schwarz Bayesian Information Criterion (BIC), and Hurvich and Tsai's corrected AIC (AIC_c).  Optionally pentrace can  use the nlminb function to solve for the optimum penalty factor or combination of factors penalizing different kinds of terms in the model. The effective.df function prints the original and effective degrees of freedom for a penalized fit or for an unpenalized fit and the best penalization determined from a previous invocation of pentrace if method="grid" (the default). The effective d.f. is computed separately for each class of terms in the model (e.g., interaction, nonlinear). A plot method exists to plot the results, and a print method exists to print the most pertinent components.  Both AIC and BIC may be plotted if  there is only one penalty factor type specified in penalty.  Otherwise, the first two types of penalty factors are plotted, showing only the AIC.
对于一个普通的unpenalized适合lrm或ols和一个向量或列表的惩罚,适合一系列MF或使用惩罚最大似然估计的线性模型,并保存有效自由度,赤池信息标准(AIC),施瓦茨贝叶斯信息标准(BIC),和Hurvich蔡纠正AIC(AIC_c)。 (可选)pentrace可以使用nlminb函数的最佳惩罚因子或惩罚模型中的不同的因素组合的解决。 effective.df函数打印的原件和有效自由度的处罚适合或从上一次调用确定为一个unpenalized的的配合和最好的惩罚pentrace如果method="grid"(默认值)。有效D.F.分别计算每类模型中的(例如,交互性,非线性)。 Aplot方法存在绘制的结果,并打印最相关的部分,存在一个print方法。这两个AIC和BIC可以被绘制,如果只有一个惩罚因子类型指定的penalty。否则,前两种类型的惩罚因子的策划,只显示AIC。


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


pentrace(fit, penalty, penalty.matrix,
         method=c('grid','optimize'),
         which=c('aic.c','aic','bic'), target.df,
         fitter, pr=FALSE, tol=1e-7,
         keep.coef=FALSE, complex.more=TRUE, verbose=FALSE, maxit=12, subset)

effective.df(fit, object)

## S3 method for class 'pentrace'
print(x, ...)

## S3 method for class 'pentrace'
plot(x, method=c('points','image'),
     which=c('effective.df','aic','aic.c','bic'), pch=2, add=FALSE,
     ylim, ...)



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

参数:fit
a result from lrm or ols with x=TRUE, y=TRUE and without using penalty or penalty.matrix (or optionally using penalization in the case of effective.df)  
结果lrm或olsx=TRUE, y=TRUE不使用penalty或penalty.matrix(或选择性地使用惩罚的情况effective.df)


参数:penalty
can be a vector or a list.  If it is a vector, all types of terms in the model will be penalized by the same amount, specified by elements in penalty, with a penalty of zero automatically added.  penalty can also be a list in the format documented in the lrm function, except that elements of the list can be vectors.  The expand.grid function is invoked by pentrace to generate all possible combinations of penalties.  For example, specifying  penalty=list(simple=1:2, nonlinear=1:3) will generate 6 combinations to try, so that the analyst can attempt to determine whether penalizing more complex terms in the model more than the linear or categorical variable terms will be beneficial.  If complex.more=TRUE, it is assumed that the variables given in penalty are listed in order from less complex to more complex.  With method="optimize" penalty specifies an initial guess for the penalty or penalties.  If all term types are to be equally penalized, penalty should be a single number, otherwise it should be a list containing single numbers as elements, e.g., penalty=list(simple=1, nonlinear=2).  Experience has shown that the optimization algorithm is more likely to find a reasonable solution when the starting value specified in penalty is too large rather than too small.  
向量可以是一个或一个列表。如果它是一个矢量,模型中的所有类型的将被处以同样的数量,指定元素的penalty,自动添加的零的罚款。 penalty还可以是一个列表中的格式记录在lrm函数,除非该元素的列表可以是向量。 expand.grid函数被调用pentrace来生成所有可能的组合处罚。例如,指定penalty=list(simple=1:2, nonlinear=1:3)将产生6种组合的尝试,使分析师可以尝试,以确定是否惩罚更复杂的模型中的多线性或分类变量条款,将有利于。如果complex.more=TRUE,它是假定给定的变量中penalty的顺序列出,从不太复杂到更复杂的。 method="optimize"penalty指定一个初始猜测的罚款或处罚。如果所有的词的类型被同样处罚,penalty应该是一个单一的数字,否则它应该是一个列表,其中包含单个数字的元素,例如,penalty=list(simple=1, nonlinear=2)。经验表明,优化算法更容易找到一个合理的解决方案时,指定的起始值在penalty过大,而不是太小。


参数:object
an object returned by pentrace.  For effective.df, object can be omitted if the fit was penalized.  
返回的对象pentrace。对于effective.df,object可以省略,如果fit被处罚。


参数:penalty.matrix
see lrm  
看到lrm


参数:method
The default is method="grid" to print various indexes for all combinations of penalty parameters given by the user.  Specify method="optimize" to have pentrace use nlminb to solve for the combination of penalty parameters that gives the maximum value of the objective named in which, or, if target.df is given, to find the combination that yields target.df effective total degrees of freedom for the model.  When target.df is specified, method is set to "optimize" automatically. For plot.pentrace this parameter applies only if more than one penalty term-type was used.  The default is to use open triangles whose sizes are proportional to the ranks of the AICs, plotting the first two penalty factors respectively on the x and y  axes.  Use method="image" to plot an image plot.   
默认为method="grid"打印的惩罚参数的组合,由用户的各项指标。指定method="optimize"pentrace使用nlminb解决的惩罚参数的组合能够提供最大价值的目标命名which,或者,如果target.df ,找到的组合,产生target.df有效的总自由度的模型。当target.df指定,method设置为"optimize"自动。对于plot.pentrace此参数只适用于一个以上的惩罚型。默认情况下是使用开放三角形的大小是成正比的工商行政管理部门的行列,绘制分别在x轴和y轴的前两个点球的因素。使用method="image"绘制图像图。


参数:which
the objective to maximize for either method.  Default is "aic.c" (corrected AIC). For plot.pentrace, which is a vector of names of criteria to show; default is to plot all 4 types, with effective d.f. in its own separate plot  
的目标,最大限度地发挥为是method。默认是"aic.c"(更正AIC)。 plot.pentrace,which是一个向量,标准的名称显示,默认情况下是有效的DF绘制所有4种类型,在其自己单独的图


参数:target.df
applies only to method="optimize".  See method.  target.df makes sense mainly when a single type of penalty factor is specified.  
只适用于method="optimize"。见method。 target.df有意义的,主要是当指定一个单一类型的惩罚因子。


参数:fitter
a fitting function.  Default is lrm.fit (lm.pfit is always used for ols).  
拟合函数。默认是lrm.fit(lm.pfit总是用于ols)。


参数:pr
set to TRUE to print intermediate results  
设置为TRUE打印中间结果


参数:tol
tolerance for declaring a matrix singular (see lrm.fit, solvet)  
宽容声明矩阵的奇异(见lrm.fit, solvet)


参数:keep.coef
set to TRUE to store matrix of regression  coefficients for all the fits (corresponding to increasing values of penalty) in object Coefficients in the returned list.  Rows correspond to penalties, columns to regression parameters.  
设置为TRUE来存储所有的配合(增加值penalty)的目的Coefficients在返回的列表对应的回归系数矩阵。行相应处罚,列的回归参数。


参数:complex.more
By default if penalty is a list, combinations of penalties for which complex terms are penalized less than less complex terms will be dropped after expand.grid is invoked.  Set complex.more=FALSE to allow more complex terms to be penalized less.  Currently this option is ignored for method="optimize".  
默认情况下,如果penalty是一个列表,复杂的术语被处罚的处罚小于不太复杂的组合将被丢弃后expand.grid调用。设置complex.more=FALSE允许更复杂的条款受到惩罚。目前,该选项被忽略method="optimize"。


参数:verbose
set to TRUE to print number of intercepts and sum of effective degrees of freedom
设置为TRUE打印截获的数量和金额的有效自由度


参数:maxit
maximum number of iterations to allow in a model fit (default=12). This is passed to the appropriate fitter function with the correct argument name.  Increase maxit if you had to when fitting the original unpenalized model.  
最大迭代次数,允许在一个模型拟合(默认值= 12)。这是传递给适当的钳工用正确的参数名称的功能。增加maxit如果你不得不,装修时原unpenalized模型。


参数:subset
a logical or integer vector specifying rows of the design and response matrices to subset in fitting models.  This is most useful for bootstrapping pentrace to see if the best penalty can be estimated with little error so that variation due to selecting the optimal penalty can be safely ignored when bootstrapping standard errors of regression coefficients and measures of predictive accuracy.  See an example below.  
一个逻辑或整数向量指定行的设计和响应矩阵拟合模型的子集。为引导pentrace,看看最好的惩罚,这样的变化,由于选择最合适的刑罚时,可以忽略不计引导的回归系数的标准误差和措施的预测精度误差小,可以估算,这是最有用的。请参阅下面的例子。


参数:x
a result from pentrace
因此,从pentrace


参数:pch
used for method="points"
用于method="points"


参数:add
set to TRUE to add to an existing plot.  In that case, the effective d.f. plot is not re-drawn, but the AIC/BIC plot is added to.  
设置为TRUE添加到现有的图。在这种情况下,有效的D.F.图重新绘制的,但AIC / BIC图的加入。


参数:ylim
2-vector of y-axis limits for plots other than effective d.f.  
2-y轴限制图有效df的以外的向量的


参数:...
other arguments passed to plot, lines, or image  </table>
其他参数传递给plot,lines或image</表>


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

a list of class "pentrace" with elements penalty, df, objective, fit, var.adj, diag, results.all, and optionally Coefficients. The first 6 elements correspond to the fit that had the best objective as named in the which argument, from the sequence of fits tried. Here fit is the fit object from fitter which was a penalized fit, diag is the diagonal of the matrix used to compute the effective d.f., and var.adj is Gray (1992) Equation 2.9, which is an improved covariance matrix for the penalized beta. results.all is a data frame whose first few variables are the components of penalty and whose other columns are df, aic, bic, aic.c.  results.all thus contains a summary of results for all fits attempted.  When method="optimize", only two components are returned: penalty and objective, and the object does not have a class.
一类"pentrace"的元素penalty, df, objective, fit, var.adj, diag, results.all,并选择性地Coefficients列表。第6元素相对应的配合,有最好的目标命名which参数,适合尝试的顺序。这是fit是合适的对象fitter“”这是一个合适的惩罚,“diag是对角线所使用的矩阵来计算有效自由度,var.adj是灰色(1992年)公式2.9,这是一种改进的协方差矩阵为惩罚项测试。 results.all是一个数据框的前几个变量的组成部分penalty而另一列是df, aic, bic, aic.c。 results.all包含所有适合尝试的结果的总结。当method="optimize",只有两个组件返回:penalty和objective,并且该对象不具有一类。


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



Frank Harrell<br>
Department of Biostatistics<br>
Vanderbilt University<br>
f.harrell@vanderbilt.edu




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

with applications to breast cancer prognosis.  JASA 87:942&ndash;951, 1992.
samples.  Biometrika 76:297&ndash;307, 1989.

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

lrm, ols, solvet, rmsMisc, image
lrm,ols,solvet,rmsMisc,image


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


n &lt;- 1000    # define sample size[确定样本量]
set.seed(17) # so can reproduce the results[所以可以重现的结果]
age            <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol    <- rnorm(n, 200, 25)
sex            <- factor(sample(c('female','male'), n,TRUE))
# Specify population model for log odds that Y=1[指定的log几率的人口模型Y = 1]
L <- .4*(sex=='male') + .045*(age-50) +
  (log(cholesterol - 10)-5.2)*(-2*(sex=='female') + 2*(sex=='male'))
# Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)][模拟二进制y以有PROB(y = 1时)= 1 / [1 +(-L)]]
y <- ifelse(runif(n) < plogis(L), 1, 0)


f <- lrm(y ~ blood.pressure + sex * (age + rcs(cholesterol,4)),
         x=TRUE, y=TRUE)
p <- pentrace(f, seq(.2,1,by=.05))
plot(p)
p$diag      # may learn something about fractional effective d.f. [可以学习一些关于分数有效的DF]
            # for each original parameter[为每个原始参数]
pentrace(f, list(simple=c(0,.2,.4), nonlinear=c(0,.2,.4,.8,1)))


# Bootstrap pentrace 5 times, making a plot of corrected AIC plot with 5 reps[引导pentrace 5倍,5代表与修正AIC图的图]
n <- nrow(f$x)
plot(pentrace(f, seq(.2,1,by=.05)), which='aic.c',
     col=1, ylim=c(30,120)) #original in black[原来在黑]
for(j in 1:5)
  plot(pentrace(f, seq(.2,1,by=.05), subset=sample(n,n,TRUE)),
       which='aic.c', col=j+1, add=TRUE)


# Find penalty giving optimum corrected AIC.  Initial guess is 1.0[查找提供最佳校正AIC处罚。初步猜测是1.0]
# Not implemented yet[尚未实现]
# pentrace(f, 1, method='optimize')[pentrace方法(F,1,=优化)]


# Find penalty reducing total regression d.f. effectively to 5[处罚降低总回归D.F.有效,以5]
# pentrace(f, 1, target.df=5)[pentrace(F,1,target.df = 5)]


# Re-fit with penalty giving best aic.c without differential penalization[再配合带罚得到最佳的aic.c不差处罚]
f <- update(f, penalty=p$penalty)
effective.df(f)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 13:44 , Processed in 0.023707 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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